Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

contracts: Lazy contract removal #6594

Closed
athei opened this issue Jul 7, 2020 · 0 comments · Fixed by #7740
Closed

contracts: Lazy contract removal #6594

athei opened this issue Jul 7, 2020 · 0 comments · Fixed by #7740
Labels
I2-security The client fails to follow expected, security-sensitive, behaviour.

Comments

@athei
Copy link
Member

athei commented Jul 7, 2020

With O(1) child trie removal not happening anytime soon ( see discussion in #5280 ) we need to cope with the fact that contract removal takes linear time depending on how much storage a contract accumulated. This can be a problem because the removal can take longer than a single block and makes the chain subject to DoS because no-one is there to pay for the removal of an evicted contract.

For that reason we should move to a model where contracts are removed lazily. When the removal of a contract is decided through one of the various entry points (discussed later), we immediately remove the contract itself (ContractInfo) and schedule the actual storage removal to happen asynchronously possibly over multiple blocks. This operation is bounded and not DoSable because every storage item scheduled for removal is subject to rent payment making it expensive to accumulate huge amounts of storage.

The following entry points can trigger the removal of a contract and must transfer to an asynchronous model:

  • ext_terminate: Contract triggers the removal of an contract
  • claim_surchargedispatchable: Some external caller triggers the eviction of a contract that did not pay rent

Depends on: #7671

@athei athei added the I2-security The client fails to follow expected, security-sensitive, behaviour. label Jul 7, 2020
@athei athei changed the title seal: Lazy contract removal contracts: Lazy contract removal Nov 12, 2020
@athei athei added J0-enhancement An additional feature request. and removed I2-security The client fails to follow expected, security-sensitive, behaviour. labels Nov 12, 2020
@xlc xlc mentioned this issue Dec 7, 2020
@athei athei added I2-security The client fails to follow expected, security-sensitive, behaviour. and removed J0-enhancement An additional feature request. labels Dec 7, 2020
@ghost ghost closed this as completed in #7740 Jan 4, 2021
@athei athei moved this to Done in Smart Contracts Jul 27, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I2-security The client fails to follow expected, security-sensitive, behaviour.
Projects
Status: No status
1 participant