-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPC: add actual_amount
into account/
rpc call
#1974
Conversation
Codecov Report
@@ Coverage Diff @@
## staging #1974 +/- ##
===========================================
+ Coverage 86.6% 87.34% +0.74%
===========================================
Files 167 169 +2
Lines 31752 33415 +1663
===========================================
+ Hits 27498 29187 +1689
+ Misses 4254 4228 -26
Continue to review full report at Codecov.
|
@@ -186,7 +186,14 @@ impl User for RuntimeUser { | |||
let state_update = self.client.read().expect(POISONED_LOCK_ERR).get_state_update(); | |||
self.trie_viewer | |||
.view_account(&state_update, account_id) | |||
.map(|account| account.into()) | |||
.map(|account| AccountView { |
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.
Should it be clone()
?
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.
could you elaborate, please?
Co-Authored-By: Maksym Zavershynskyi <[email protected]>
core/primitives/src/account.rs
Outdated
account_length_baseline_cost_per_block, | ||
storage_cost_byte_per_block, | ||
); | ||
let actual_charge = std::cmp::min(account.amount, charge); |
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.
We should probably expose the full unpaid rent here and handle overflow in other places.
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.
wait
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.
Do you mind removing:
let actual_charge = std::cmp::min(account.amount, charge);
And move it into the apply_rent
?
Btw, if we do: let rent = calculate_rent(
account_id,
account,
block_index,
runtime_config.account_length_baseline_cost_per_block,
runtime_config.storage_cost_byte_per_block,
);
let actual_charge = std::cmp::min(account.amount, rent);
account.amount -= rent;
account.storage_paid_at = block_index; It means account can pay any rent with the amount left in his account? Or we have a check earlier? But if the code above guarantees that |
That's right, but the account will likely be deleted before it pays the rent by someone who's watching account balances. |
Just curious, what is the incentive for this activity if all the balance will be spent to cover rent? |
The idea is you can kill the account earlier, before balance got to 0. E.g. you have |
So if nobody was fast enough to delete an account that incentive to delete disappears? |
It's still an incentive for node validators. Since they are still paying for storage. |
Will be this "collective" incentive enough to cover the DeleteAction transaction cost for a signer? |
I hope so, otherwise we'll have to bump the |
Reopening since we discussed that this is needed. |
closes #1811