This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
pallet-contracts: Rent projection RPC #4754
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NikVolf
reviewed
Jan 29, 2020
tomusdrw
reviewed
Jan 29, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! The code is really nice and readable, however I didn't carefully check if the logic has not been altered, but it makes sense to me in it's current form.
294c7c4
to
2997990
Compare
Merge it with subsistence_treshold.
tomusdrw
approved these changes
Jan 31, 2020
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change adds a new RPC endpoint which allows a user to query the current state of a given contract.
State rent is enacted lazy. That is, if a contract runs out of funds it becomes inaccessible, but it is not removed from the chain storage right away. Instead, it will be removed on the first access: a call or e.g. or poking with
claim_surcharge
.This however poses a problem from an external users of the chain. If an external user wants to know if a given contract is usable or not, the user will have to do the calculations by themselves.
While it might be possible to work around this issue by piggybacking on some other call, we introduce a new RPC call here:
contracts_rentProjection
. This call doesn't can tell the status of the given contract, it will also return the projected block number of eviction. Such functionality might be useful in creation of crawlers that would callclaim_surcharge
for the nearly expiring contracts.