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

State::updateToLatestVersion() does not update historic state #2009

Open
dimalit opened this issue Sep 26, 2024 · 3 comments
Open

State::updateToLatestVersion() does not update historic state #2009

dimalit opened this issue Sep 26, 2024 · 3 comments
Assignees
Labels
bug Something isn't working epic:archive-node
Milestone

Comments

@dimalit
Copy link
Contributor

dimalit commented Sep 26, 2024

This would fail:

    State state(...);

    State writer = state.createStateModifyCopy();
    < change writer state >
    writer.commit( dev::eth::CommitBehaviour::RemoveEmptyAccounts );
    writer.mutableHistoricState().saveRootForBlock(1);
    writer.mutableHistoricState().setRootByBlockNumber(1);

    State sr = state.createStateReadOnlyCopy();
    < check that sr.mutableHistoricState() has updated data >

This is detectable only in tests, but it looks like inconsistency

@dimalit dimalit changed the title State::updateToLatestVersion() does not update historc state State::updateToLatestVersion() does not update historic state Sep 26, 2024
@DmytroNazarenko DmytroNazarenko added bug Something isn't working epic:archive-node labels Sep 27, 2024
@DmytroNazarenko DmytroNazarenko added this to the SKALE 3.2 milestone Sep 27, 2024
@kladkogex
Copy link
Collaborator

Hey guys

The version does not exist anymore in the pull request that I am preparing for 3.1, so I am going to close this bug if there is no objection

State::updateToLatestVersion()

@dimalit
Copy link
Contributor Author

dimalit commented Nov 7, 2024

In our new (snapshot-based) State architecture, Client::restartMining() calls State::createStateCopyAndClearCaches();

But actually, to work correctly, restartMining() should ensure that State is in sync with latest changes in the DB. So, it needs:

  1. state root in HistoricState updated to latest block;
  2. correct values of storageUsed;
  3. maybe something else (to research)

@kladkogex
Copy link
Collaborator

Ok - I will check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working epic:archive-node
Projects
Status: No status
Development

No branches or pull requests

3 participants