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

Database State Root #79

Closed
1 task done
frisitano opened this issue Dec 12, 2024 · 1 comment · Fixed by #81
Closed
1 task done

Database State Root #79

frisitano opened this issue Dec 12, 2024 · 1 comment · Fixed by #81
Assignees
Labels
bug Something isn't working

Comments

@frisitano
Copy link
Collaborator

Describe the bug

When syncing the scroll chain using --debug.tip incrementally (i.e. syncing to block 10 and then doing a second run to sync to block 100) we have errors with the state root. I suspect this is due to some issue related to trie data stored in the database. We must investigate this and identify the cause.

Steps to reproduce

RUST_LOG=debug cargo run --bin scroll-reth --features scroll --manifest-path crates/scroll/bin/Cargo.toml -- node --chain scroll-mainnet --debug.tip 0xd73993f9db2b3f3cf884a2d0ae8b5e695cfcfe36b856c6ec334334de7f2f2fdb

RUST_LOG=debug cargo run --bin scroll-reth --features scroll --manifest-path crates/scroll/bin/Cargo.toml -- node --chain scroll-mainnet --debug.tip 0xce5b5c594918c338a260ea642a05213d2ebfdf6065787d3b9920dc9de62fedd4

Node logs

No response

Platform(s)

Mac (Apple Silicon)

What version/commit are you on?

reth-scroll-cli Version: 1.1.2-dev
Commit SHA: f0dca57
Build Timestamp: 2024-12-12T15:11:59.038065000Z
Build Features: scroll
Build Profile: debug

What database version are you on?

.

Which chain / network are you on?

scroll-mainnet

What type of node are you running?

Archive (default)

What prune config do you use, if any?

No response

If you've built Reth from source, provide the full command you used

No response

Code of Conduct

  • I agree to follow the Code of Conduct
@frisitano frisitano self-assigned this Dec 12, 2024
@frisitano frisitano added the bug Something isn't working label Dec 12, 2024
@frisitano
Copy link
Collaborator Author

This issue is related to the PrefixSetLoader. When we unpack into Nibbles in the PrefixSetLoader we should unpack into bits when the scroll feature is activated.

// Walk account changeset and insert account prefixes.
let mut account_changeset_cursor = self.cursor_read::<tables::AccountChangeSets>()?;
let mut account_hashed_state_cursor = self.cursor_read::<tables::HashedAccounts>()?;
for account_entry in account_changeset_cursor.walk_range(range.clone())? {
let (_, AccountBeforeTx { address, .. }) = account_entry?;
let hashed_address = KH::hash_key(address);
account_prefix_set.insert(Nibbles::unpack(hashed_address));
if account_hashed_state_cursor.seek_exact(hashed_address)?.is_none() {
destroyed_accounts.insert(hashed_address);
}
}

In #81, we modify this to unpack the bits when the scroll feature flag is activated. We also add this modification to other parts of the code relevant to scroll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant