Skip to content
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

fix(fork-network): flush the first pass changes before starting the second pass #12121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VanBarbascu
Copy link
Contributor

@VanBarbascu VanBarbascu commented Sep 20, 2024

There is a corner case where the last batch of changes is smaller than the batch threshold and it may not get flushed before the seconds pass. This will recreate the keys for the accounts that were deleted in the uncommitted batch.

To test this, we created a network with a validator and an RPC node.
Created an account (A with key Ka) by sending some $N to it.
 Add another key to that account (Kb). Now A has Ka and Kb as full access keys.

Delete Ka. Now A has just Kb as full access key.

On this state, we run fork-network.

In the first pass, we change account A to rA and delete A.
Change key Kb to rKb and delete Kb.

Without this fix, the default batch size is too large to flush the changes from the first pass of prepare_shard_state.

Moving to the second pass, the A implicit account is still in the flat state and we will add a key to it.

If we flush before the second pass, account A will no longer be in the flat state.

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.

Project coverage is 71.54%. Comparing base (08065ff) to head (056a7c6).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
tools/fork-network/src/cli.rs 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12121      +/-   ##
==========================================
+ Coverage   71.52%   71.54%   +0.01%     
==========================================
  Files         819      819              
  Lines      164694   164733      +39     
  Branches   164694   164733      +39     
==========================================
+ Hits       117804   117857      +53     
+ Misses      41745    41730      -15     
- Partials     5145     5146       +1     
Flag Coverage Δ
backward-compatibility 0.17% <0.00%> (-0.01%) ⬇️
db-migration 0.17% <0.00%> (-0.01%) ⬇️
genesis-check 1.26% <0.00%> (-0.01%) ⬇️
integration-tests 38.67% <0.00%> (+0.03%) ⬆️
linux 71.32% <0.00%> (+<0.01%) ⬆️
linux-nightly 71.11% <0.00%> (+0.01%) ⬆️
macos 54.15% <0.00%> (+0.04%) ⬆️
pytests 1.52% <0.00%> (-0.01%) ⬇️
sanity-checks 1.33% <0.00%> (-0.01%) ⬇️
unittests 65.27% <0.00%> (-0.01%) ⬇️
upgradability 0.21% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant