feat(types): add MultiMessageAggregate [Devnet 5]#426
Conversation
Greptile SummaryThis PR replaces the raw
Confidence Score: 4/5The production code paths are correct and the wire format is properly preserved; the one concern is confined to a test helper that stores bytes which are no longer valid SSZ for the new type. All production read/write/verify paths look correct and the SSZ encoding is verified by the new round-trip test. The insert_header helper in the storage tests now writes [0u8; 4] as a dummy proof, which is invalid SSZ for MultiMessageAggregate — if a future test reads back one of those blocks via get_signed_block, the expect would panic. The fix is a one-liner: replace the dummy bytes with MultiMessageAggregate::default().to_ssz(). crates/storage/src/store.rs — specifically the insert_header test helper at line 1431
|
| Filename | Overview |
|---|---|
| crates/common/types/src/block.rs | Introduces MultiMessageAggregate SSZ container, replaces ByteList512KiB on SignedBlock.proof, and provides clean new/from_bytes/proof_bytes accessors; wire format is preserved. |
| crates/storage/src/store.rs | Read/write paths updated cleanly, but insert_header test helper stores vec![0u8; 4] which is now invalid SSZ for MultiMessageAggregate and would panic via expect if get_signed_block were ever called on those entries. |
| crates/blockchain/src/lib.rs | Removes manual offset-wrapping and uses MultiMessageAggregate::from_bytes; logic is equivalent and simpler. |
| crates/blockchain/src/reaggregate.rs | Drops the fallible merged_proof_bytes() call in favour of the infallible proof.proof_bytes(); empty-proof path now falls through to the crypto call rather than early-returning, which is harmless. |
| crates/blockchain/src/store.rs | Verification path simplified; early envelope-validation error replaced by a downstream crypto error for malformed proofs — behaviorally equivalent for the happy path. |
| crates/common/test-fixtures/src/verify_signatures.rs | Fixture conversion updated to use MultiMessageAggregate::from_bytes; functionally identical to the old wrap_merged_proof for valid input. |
Sequence Diagram
sequenceDiagram
participant Builder as BlockChainServer
participant Crypto as ethlambda_crypto
participant Types as MultiMessageAggregate
participant Storage as Store (BlockSignatures)
participant Verifier as verify_block_signatures
Builder->>Crypto: merge_type_1s_into_type_2(inputs)
Crypto-->>Builder: Vec~u8~ (raw Type-2 bytes)
Builder->>Types: MultiMessageAggregate::from_bytes(raw)
Types-->>Builder: MultiMessageAggregate
Builder->>Storage: proof.to_ssz()
Storage-->>Verifier: MultiMessageAggregate::from_ssz_bytes(stored)
Verifier->>Types: proof.proof_bytes()
Types-->>Verifier: raw Type-2 bytes
Verifier->>Crypto: verify_type_2_signature(raw bytes, ...)
Comments Outside Diff (1)
-
crates/storage/src/store.rs, line 1430-1432 (link)vec![0u8; 4]was a validByteList512KiB(four raw zero bytes), but it decodes to an invalidMultiMessageAggregate: the SSZ decoder reads those bytes as a variable-field offset of0, which is below the minimum of4, soMultiMessageAggregate::from_ssz_bytesreturns an error. Theexpect("valid block proof")at the read site would panic if any test ever calledget_signed_blockon a block inserted by this helper. Use the correctly-encoded empty aggregate instead.Prompt To Fix With AI
This is a comment left during a code review. Path: crates/storage/src/store.rs Line: 1430-1432 Comment: `vec![0u8; 4]` was a valid `ByteList512KiB` (four raw zero bytes), but it decodes to an invalid `MultiMessageAggregate`: the SSZ decoder reads those bytes as a variable-field offset of `0`, which is below the minimum of `4`, so `MultiMessageAggregate::from_ssz_bytes` returns an error. The `expect("valid block proof")` at the read site would panic if any test ever called `get_signed_block` on a block inserted by this helper. Use the correctly-encoded empty aggregate instead. How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
crates/storage/src/store.rs:1430-1432
`vec![0u8; 4]` was a valid `ByteList512KiB` (four raw zero bytes), but it decodes to an invalid `MultiMessageAggregate`: the SSZ decoder reads those bytes as a variable-field offset of `0`, which is below the minimum of `4`, so `MultiMessageAggregate::from_ssz_bytes` returns an error. The `expect("valid block proof")` at the read site would panic if any test ever called `get_signed_block` on a block inserted by this helper. Use the correctly-encoded empty aggregate instead.
```suggestion
batch
.put_batch(Table::BlockSignatures, vec![(key, MultiMessageAggregate::default().to_ssz())])
.expect("put sigs");
```
Reviews (1): Last reviewed commit: "feat(types): add MultiMessageAggregate" | Re-trigger Greptile
|
Great work! 👍 |
Thanks you! |
Addresses [review feedback on #426](#426 (comment)) left after merge: use `thiserror` instead of manual `Display` / `std::error::Error` impls for `MultiMessageAggregateError`. No behavior change; the error message is identical.
🗒️ Description / Motivation
MultiMessageAggregatetype required by the Devnet 5 specification.ByteList512KiBused bySignedBlock.proofwith the correct SSZ container.What Changed
MultiMessageAggregatecontaining aByteList512KiBproof.SignedBlock.proofto useMultiMessageAggregate.Correctness / Behavior Guarantees
Tests Added / Run
multi_message_aggregate_ssz_wraps_proof_bytes.cargo fmt --all.cargo check --workspace --all-targetssuccessfully.Related Issues / PRs
MultiMessageAggregatetype #415✅ Verification Checklist
make lint(clippy with-D warnings) — cleancargo test --workspace --release— all passing