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

Persisted db hashes may not match persisted data #1708

Closed
Tracked by #2531
batconjurer opened this issue Jul 12, 2023 · 6 comments · Fixed by #2778
Closed
Tracked by #2531

Persisted db hashes may not match persisted data #1708

batconjurer opened this issue Jul 12, 2023 · 6 comments · Fixed by #2778
Assignees
Labels
pre-mainnet Must happen before mainnet.

Comments

@batconjurer
Copy link
Member

The app root hash field is stored along with all data to disk. On restart, the hash field is read but not checked against the data that has been reloaded. It is possible that flushing to disk can be interrupted and thus the correct hash is persisted but not all the data is written. Thus on start up, the ledger starts to make progress (since it has the correct app hash), but will result in state divergence one block later.

To fix

  • Try to make db flushed more atomic (likely not a foolproof solution)
  • Recompute the hash of the backing data and check it against the persisted hash on startup.
@bengtlofgren
Copy link
Contributor

bengtlofgren commented Jul 13, 2023

Can you provide the relevant lines and files in the code where it reads the hash?

@batconjurer
Copy link
Member Author

let result = self.wl_storage.storage.get_state();

@batconjurer
Copy link
Member Author

If you chase that function down, it leads here:

pub fn root(&self) -> MerkleRoot {

@cwgoes cwgoes added the pre-mainnet Must happen before mainnet. label Feb 5, 2024
@cwgoes
Copy link
Collaborator

cwgoes commented Feb 5, 2024

@batconjurer Is this issue still applicable?

@batconjurer
Copy link
Member Author

Oh wow, haven't thought about this in a while. I'll need to dig back into it

@batconjurer
Copy link
Member Author

batconjurer commented Feb 5, 2024

Yes, this is still relevant @cwgoes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pre-mainnet Must happen before mainnet.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants