Skip to content

Commit 799ea19

Browse files
committed
test-fixtures: drop legacy flat ProofField decode path
SignedBlock.proof fixtures have used the nested PR #799 container shape ({ proof: { data: "0x..." } }) since the current leanSpec pin. The flat PR #717 shape ({ data: "0x..." }) was only kept for older Hive spec-asset simulators; those will move to the new format too. Replace the untagged ProofField enum with a single MergedProof struct so there is one decode path, and update the verify_signatures e2e payload to the nested shape. The Hive test-driver verify_signatures endpoint now accepts only the nested format.
1 parent a29ed51 commit 799ea19

2 files changed

Lines changed: 17 additions & 29 deletions

File tree

crates/common/test-fixtures/src/verify_signatures.rs

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//! Signature-verification test fixture types (leanSpec PR #717 schema).
1+
//! Signature-verification test fixture types (leanSpec PR #799 schema).
22
//!
33
//! Used both by the offline spec-test runner and the Hive
44
//! `/lean/v0/test_driver/verify_signatures/run` endpoint, which receive the
55
//! same JSON shapes from the lean spec-assets simulator.
66
//!
7-
//! Fixture shape after PR #717:
7+
//! Fixture shape after PR #799:
88
//!
99
//! signedBlock:
1010
//! block: {...standard block fields...}
11-
//! proof: { data: "0x<hex-encoded merged Type-2 bytes>" }
11+
//! proof: { proof: { data: "0x<hex-encoded merged Type-2 bytes>" } }
1212
1313
use crate::{Block, TestInfo, TestState};
14-
use ethlambda_types::block::{ByteList512KiB, SignedBlock};
14+
use ethlambda_types::block::SignedBlock;
1515
use serde::Deserialize;
1616
use std::collections::HashMap;
1717
use std::fmt;
@@ -56,28 +56,21 @@ pub struct VerifySignaturesTest {
5656
pub struct TestSignedBlock {
5757
#[serde(alias = "message")]
5858
pub block: Block,
59-
pub proof: ProofField,
59+
pub proof: MergedProof,
6060
}
6161

62-
/// Merged Type-2 proof bytes, in either fixture shape.
62+
/// Merged Type-2 proof container for `SignedBlock.proof` (leanSpec PR #799).
6363
///
64-
/// leanSpec PR #799 typed `SignedBlock.proof` as a multi-signature container,
65-
/// nesting the bytes one level deeper: `{ "proof": { "data": "0x..." } }`.
66-
/// The flat `{ "data": "0x..." }` shape (PR #717) is still accepted since the
67-
/// Hive test driver receives the same JSON from older spec-assets simulators.
64+
/// The multi-signature container nests the raw lean-multisig wire one level
65+
/// deep: `{ "proof": { "data": "0x..." } }`.
6866
#[derive(Debug, Clone, Deserialize)]
69-
#[serde(untagged)]
70-
pub enum ProofField {
71-
Typed { proof: HexBytes },
72-
Flat(HexBytes),
67+
pub struct MergedProof {
68+
pub proof: HexBytes,
7369
}
7470

75-
impl ProofField {
71+
impl MergedProof {
7672
pub fn decode(&self) -> Result<Vec<u8>, hex::FromHexError> {
77-
match self {
78-
Self::Typed { proof } => proof.decode(),
79-
Self::Flat(bytes) => bytes.decode(),
80-
}
73+
self.proof.decode()
8174
}
8275
}
8376

@@ -130,21 +123,16 @@ impl TestSignedBlock {
130123
/// Materialize a `SignedBlock` preserving the fixture-supplied merged
131124
/// Type-2 proof bytes verbatim.
132125
///
133-
/// The typed shape carries the raw lean-multisig wire, so it gets wrapped
134-
/// into the SSZ-container envelope `SignedBlock.proof` stores. The flat
135-
/// shape already includes that envelope and passes through unchanged.
126+
/// The container carries the raw lean-multisig wire, so it gets wrapped
127+
/// into the SSZ-container envelope that `SignedBlock.proof` stores.
136128
pub fn try_into_signed_block_with_proofs(self) -> Result<SignedBlock, SignedBlockConvertError> {
137129
let bytes = self
138130
.proof
139131
.decode()
140132
.map_err(|err| SignedBlockConvertError::InvalidProofHex(err.to_string()))?;
141133
let len = bytes.len();
142-
let proof = match self.proof {
143-
ProofField::Typed { .. } => SignedBlock::wrap_merged_proof(&bytes)
144-
.map_err(|_| SignedBlockConvertError::ProofTooLarge(len))?,
145-
ProofField::Flat(_) => ByteList512KiB::try_from(bytes)
146-
.map_err(|_| SignedBlockConvertError::ProofTooLarge(len))?,
147-
};
134+
let proof = SignedBlock::wrap_merged_proof(&bytes)
135+
.map_err(|_| SignedBlockConvertError::ProofTooLarge(len))?;
148136
Ok(SignedBlock {
149137
message: self.block.into(),
150138
proof,

crates/net/rpc/tests/test_driver_e2e.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ async fn verify_signatures_with_empty_validator_set_fails_cleanly() {
261261
"stateRoot": ZERO_ROOT,
262262
"body": {"attestations": {"data": []}},
263263
},
264-
"proof": {"data": "0x"},
264+
"proof": {"proof": {"data": "0x"}},
265265
});
266266

267267
let body = json!({

0 commit comments

Comments
 (0)