mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-06 20:13:59 -05:00
**What type of PR is this?** Bug fix **What does this PR do? Why is it needed?** This PR fixes a bug in the state diff `getBaseAndDiffChain()` method. In the process of finding the diff chain indices, there could be a scenario where multiple levels return the same diff slot number not equal to the base (full snapshot) slot number. This resulted in multiple diff items being added to the diff chain for the same slot, but on different levels, which resulted in errors reading the diff. Fix: we keep a `lastSeenAnchorSlot` equal to the `BaseAnchorSlot` and update it every time we see a new anchor slot. We ignore if the current found anchor slot is equal to the `lastSeenAnchorSlot`. Scenario example: exponents: [20, 14, 10, 7, 5] offset: 0 slots saved: slot 2^11, and slot (2^11 + 2^5) slot to read: slot (2^11 + 2^5) resulting list of anchor slots (diff chain indices): [0, 0, 2^11, 2^11, 2^11 + 2^5]
55 B
55 B
Fixed
- Fix state diff repetitive anchor slot bug.