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 roots cannot be indexes by the chunk hash #1183

Closed
SkidanovAlex opened this issue Aug 16, 2019 · 0 comments
Closed

State roots cannot be indexes by the chunk hash #1183

SkidanovAlex opened this issue Aug 16, 2019 · 0 comments
Assignees

Comments

@SkidanovAlex
Copy link
Collaborator

The state root after chunk application depends on the incoming receipts, which are not specific to any particular chunks. A chunk included on two different forks (at the same or at different heights) can have different incoming receipts when it is processed.

There are several possible solutions, two that come to mind:

  1. Index by (chunk_hash, block_hash)
  2. Index by (block_hash, shard_id)

Without this change a chunk validation might fail if the same chunk was processed on a different fork and saved an inconsistent state root.

cross_shard_tx test with the block production time configured sufficiently low reproduces this bug with ~25% chance.

@SkidanovAlex SkidanovAlex self-assigned this Aug 16, 2019
SkidanovAlex added a commit that referenced this issue Aug 16, 2019
Also fixing a bug we discovered earlier that if the last block of an epoch doesn't have a chunk for a particular shard, we do not do updated necessary for the epoch switch. Fixing it by forcefully executing `apply_transactions` with no txs and receipts for the last block. Conveniently, with the fix for #1183 it is possible (before we would not be able to store two different post-state roots for the same chunk)
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

No branches or pull requests

1 participant