feat: world-state per-block message insertion (A-1380)#24785
Open
spalladino wants to merge 2 commits into
Open
feat: world-state per-block message insertion (A-1380)#24785spalladino wants to merge 2 commits into
spalladino wants to merge 2 commits into
Conversation
Lift the non-first-block guard out of NativeWorldStateService.handleL2BlockAndMessages so any block may carry an L1-to-L2 message bundle and transition the message tree. First-in-checkpoint bundles are still padded to NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP (bit-identical trees for the legacy call shape); non-first bundles are appended unpadded (post-flip compact-append semantics). The transitional non-first-blocks- carry-no-messages invariant now lives at the synchronizer call site as an assertion. Per-block unwind already works natively: the append-only message tree commits a per-block snapshot on every sync_block (like the note-hash tree) and unwinds per block regardless of leaf count, with no C++ change required.
…kpoint blocks (A-1380) Align the TXE world-state caller with the per-block message-insertion semantics of handleL2BlockAndMessages: pad the bundle only when the block is first in its checkpoint, matching native world state. TXE mines one block per checkpoint (always the first block), so this is a no-op for current behaviour but keeps the caller consistent with the new per-block shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the Fast Inbox stack (AZIP-22, FI-10 / A-1380). Base: `spl/a-1379-archiver-buckets`.
What this changes
C++ investigation outcome (no barretenberg change needed)
Investigated the native sync/unwind paths under `barretenberg/cpp/src/barretenberg/world_state/`. Per-block message insertion and per-block unwind already work with no C++ change:
The TS-side pending-chain rollback (`handleChainPruned` -> `unwindBlocks`) just unwinds to a block number and carries no checkpoint assumption about the message tree either.
Tests
world-state type-checks clean and all world-state unit tests pass (76 across the two modified suites). The full `yarn build` still fails only in the pre-existing stale-artifact packages (noir-protocol-circuits-types, simulator, prover-client), unrelated to this change.
Review follow-up
Codex (routine review) confirmed the C++ no-change conclusion and the pre-flip synchronizer soundness, and flagged that the TXE world-state caller (
txe/src/state_machine/synchronizer.ts) padded the bundle unconditionally. TXE mines one block per checkpoint (always the first block), so this was a no-op in practice, but the second commit makes its padding conditional onindexWithinCheckpoint === 0to keep the caller aligned with the new per-block semantics.