Skip to content

Commit 02f792b

Browse files
committed
Fix test harness to pair block attestations with signature proofs
build_signed_block was creating an empty attestation_signatures list, so the zip in on_block_core discarded all in-block attestations before they reached fork choice. Now builds one empty AggregatedSignatureProof per attestation, matching each attestation's aggregation_bits. This fixes all 7 headSlot-mismatch failures in fork choice spec tests. All 48 forkchoice spec tests now pass.
1 parent e720507 commit 02f792b

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

crates/blockchain/tests/forkchoice_spectests.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use ethlambda_blockchain::{MILLISECONDS_PER_SLOT, store};
88
use ethlambda_storage::{Store, backend::InMemoryBackend};
99
use ethlambda_types::{
1010
attestation::{AttestationData, XmssSignature},
11-
block::{AttestationSignatures, Block, BlockSignatures, SignedBlock},
11+
block::{AggregatedSignatureProof, Block, BlockSignatures, SignedBlock},
1212
primitives::{H256, HashTreeRoot as _},
1313
signature::SIGNATURE_SIZE,
1414
state::State,
@@ -158,11 +158,22 @@ fn run(path: &Path) -> datatest_stable::Result<()> {
158158
fn build_signed_block(block_data: types::BlockStepData) -> SignedBlock {
159159
let block: Block = block_data.to_block();
160160

161+
// Build one empty proof per attestation, matching the aggregation_bits from
162+
// each attestation in the block body. on_block_core zips attestations with
163+
// signatures, so they must be the same length for attestations to reach
164+
// fork choice.
165+
let proofs: Vec<_> = block
166+
.body
167+
.attestations
168+
.iter()
169+
.map(|att| AggregatedSignatureProof::empty(att.aggregation_bits.clone()))
170+
.collect();
171+
161172
SignedBlock {
162173
message: block,
163174
signature: BlockSignatures {
164175
proposer_signature: XmssSignature::try_from(vec![0u8; SIGNATURE_SIZE]).unwrap(),
165-
attestation_signatures: AttestationSignatures::new(),
176+
attestation_signatures: proofs.try_into().expect("attestation proofs within limit"),
166177
},
167178
}
168179
}

0 commit comments

Comments
 (0)