Skip to content

Conversation

etan-status
Copy link
Contributor

@etan-status etan-status commented Mar 31, 2024

When initializing from a state that's not aligned to an epoch boundary, an earlier state is loaded that's epoch aligned, and subsequently topped up with the missing blocks. dag.headSyncCommittee is initialized prior to topping up the missing blocks, though. If the sync committee changes while applying the blocks (e.g., a sync committee period boundary hits), the cached information becomes unlinked from dag.head, leading to valid blocks based on that chain being rejected. To fix this, move cache initialization after the top up with blocks. This has been observed on Goerli by initializing from 7919502 and attempting to top up 7920111. The block gets rejected with an invalid state root on nodes that have restarted after setting 7919502 as head, while it gets accepted by all other nodes. Error message is block: state root verification failed. The incorrect initialization behaviour was introduced in #4592, before which the sync committee cache was initialized after applying blocks.

When initializing from a state that's not aligned to an epoch boundary,
an earlier state is loaded that's epoch aligned, and subsequently topped
up with the missing blocks. `dag.headSyncCommittee` is initialized prior
to topping up the missing blocks, though. If the sync committee changes
while applying the blocks (e.g., a sync committee period boundary hits),
the cached information becomes unlinked from `dag.head`, leading to
valid blocks based on that chain being rejected. To fix this, move cache
initialization after the top up with blocks. This has been observed on
Goerli by initializing from 7919502 and attempting to top up 7920111.
The block gets rejected with an invalid state root on nodes that have
restarted after setting 7920111 as head, while it gets accepted by all
other nodes. Error message is `block: state root verification failed`.
The incorrect initialization behaviour was introduced in #4592, before
which the sync committee cache was initialized after applying blocks.
Copy link

github-actions bot commented Apr 1, 2024

Unit Test Results

         9 files  ±0    1 115 suites  ±0   30m 52s ⏱️ + 5m 52s
  4 245 tests ±0    3 898 ✔️ ±0  347 💤 ±0  0 ±0 
16 929 runs  ±0  16 531 ✔️ ±0  398 💤 ±0  0 ±0 

Results for commit 8522a1f. ± Comparison against base commit 109007d.

♻️ This comment has been updated with latest results.

@etan-status etan-status merged commit df0ff5f into unstable Apr 3, 2024
@etan-status etan-status deleted the dev/etan/af-cacheinit branch April 3, 2024 21:03
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.

2 participants