fix(statedb): snapshot locked balance on statedb account #1187
Conversation
…dable + locked bank balance after locked balance changes via precompile
Greptile SummaryThis PR snapshots the EVM-denom locked balance (vesting
Confidence Score: 5/5Safe to merge. The snapshot approach correctly reconstructs the bank balance when a staking precompile modifies DelegatedVesting mid-execution, and the fallback re-read path is preserved for accounts without a snapshot. The logic is sound: load-time locked balance is snapshotted and carried through the full EVM execution lifecycle, eliminating the stale re-read that caused incorrect bank balance reconstruction after precompile-driven delegation from vesting tokens. Fallback to SetBalance (re-read path) for accounts created without a snapshot is correct and unchanged. DeleteAccount explicitly passes zero locked after the BaseAccount conversion, which produces the same result as the previous re-read. Integration and unit tests cover the primary vesting delegation scenario. No files require special attention. Important Files Changed
|
…counts locked balacne
|
@greptile re review |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1187 +/- ##
==========================================
+ Coverage 66.32% 66.99% +0.66%
==========================================
Files 336 320 -16
Lines 23959 23433 -526
==========================================
- Hits 15891 15698 -193
+ Misses 6891 6578 -313
+ Partials 1177 1157 -20
🚀 New features to boost your workflow:
|
Co-authored-by: Vlad J <vladjdk@gmail.com>
|
@mergify backport to release/v0.7.x |
|
@mergify backport to release/v0.6.x |
❌ No backport have been createdDetails
GitHub error:
Cherry-pick of 008c171 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
❌ No backport have been createdDetails
GitHub error:
Cherry-pick of 008c171 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
) (#1189) * fix(statedb): snapshot locked balance on statedb account (#1187) * snapshot locked balance on statedb account creation to calculate spendable + locked bank balance after locked balance changes via precompile * lint formatting * modify x/erc20 registering code hash to not silently drop existing accounts locked balacne * update comments * Update x/vm/keeper/statedb.go Co-authored-by: Vlad J <vladjdk@gmail.com> --------- Co-authored-by: Vlad J <vladjdk@gmail.com> (cherry picked from commit 008c171) # Conflicts: # x/vm/statedb/state_object.go * conflicts --------- Co-authored-by: mattac21 <matt@cosmoslabs.io>
) (#1190) * fix(statedb): snapshot locked balance on statedb account (#1187) * snapshot locked balance on statedb account creation to calculate spendable + locked bank balance after locked balance changes via precompile * lint formatting * modify x/erc20 registering code hash to not silently drop existing accounts locked balacne * update comments * Update x/vm/keeper/statedb.go Co-authored-by: Vlad J <vladjdk@gmail.com> --------- Co-authored-by: Vlad J <vladjdk@gmail.com> (cherry picked from commit 008c171) # Conflicts: # tests/integration/precompiles/staking/test_staking.go # x/vm/keeper/statedb.go # x/vm/statedb/state_object.go * fix conflicts * bump sol --------- Co-authored-by: mattac21 <matt@cosmoslabs.io> Co-authored-by: Vlad <vladjdk@gmail.com>
Description
Snapshots accounts locked balance when EVM accounts are fetched from the keeper. This is to ensure that the accounts total bank balance is properly reconstructed when its locked balance has been modified via a precompile.
Closes: STACK-2786
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
mainbranch