Commit 61981b3
authored
fix(test-driver): accept leanSpec mocked aggregate proofs (lambdaclass#488)
## Problem
ethlambda's Hive test-driver (`crates/net/rpc/src/test_driver.rs`) fails
devnet5 `lean-spec-tests-fork-choice` because it does not honor
leanSpec's MOCKED crypto mode.
leanSpec fork_choice fixtures generated with `proofSetting: 0` carry
PLACEHOLDER aggregate proofs: every proof blob is the sentinel bytes
`\x00MOCKED-AGGREGATION-PROOF\x00` followed by a sha256 fingerprint, NOT
a real proof. leanSpec's own verifier
(`packages/testing/src/consensus_testing/crypto_mode.py`) accepts any
sentinel-prefixed blob unchecked and only falls through to the real
verifier for genuine (`proofSetting=1`) proofs. A conformant client must
do the same.
The driver routed every `gossipAggregatedAttestation` step through the
verifying `store::on_gossip_aggregated_attestation`, which decompresses
the proof and fails deserialization on a mock blob
(`VerificationError::DeserializationFailed`). The driver then reported
`accepted=false` where the fixture expects `valid=true`, producing a
Hive "acceptance mismatch". This accounts for ~24 fork-choice failures.
## Fix
Detect the `MOCK_PROOF_PREFIX` sentinel before constructing the
aggregate and route mocked proofs through the non-verifying path
`store::on_gossip_aggregated_attestation_without_verification`. That
path still runs all NON-crypto validation (`validate_attestation_data`,
participant/index checks), so validation-rejection fixtures still reject
correctly. Genuine (`proofSetting=1`) proofs continue to run the real
verifier unchanged.
## Tests
New `crates/net/rpc/tests/test_driver_mocked_proofs.rs` replays real
fixtures through the router exactly as Hive does (init + per-step POST,
comparing `accepted` to each step's `valid` and `snapshot.headSlot` to
`checks.headSlot`), gated on fixtures being present:
- `test_valid_gossip_aggregated_attestation.json` (proofSetting=0): the
mocked aggregated-attestation step is now ACCEPTED; replay finds no
divergence.
- `test_aggregated_attestation_source_after_target_rejected.json`
(proofSetting=0): the validation-rejection step is still REJECTED,
proving only CRYPTO verification was skipped, not validation.
`cargo test -p ethlambda-rpc --release --test test_driver_mocked_proofs`
and the existing `test_driver_e2e` both pass; `make fmt` and `make lint`
are clean.
## Note
This is 1 of 2 independent PRs fixing the devnet5 fork-choice Hive
suite; the other folds block-borne attestation votes. Both touch
`apply_step` in the same file, so a trivial rebase may be needed when
the second merges.1 parent 38182c8 commit 61981b3
1 file changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
413 | 420 | | |
414 | 421 | | |
415 | 422 | | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
416 | 428 | | |
417 | 429 | | |
418 | 430 | | |
419 | 431 | | |
420 | 432 | | |
421 | 433 | | |
422 | 434 | | |
423 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
424 | 442 | | |
425 | 443 | | |
426 | 444 | | |
| |||
0 commit comments