reduce code repetition in `test_toblindedblock` (#6453)

Use `withAll` to generate the tests for various blinded block types
instead of copy pasting them for every fork.
This commit is contained in:
Etan Kissling 2024-07-27 00:03:11 +02:00 committed by GitHub
parent 292c2b6de7
commit c373e3ab35
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 29 deletions

View File

@ -88,10 +88,10 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
OK: 1/1 Fail: 0/1 Skip: 0/1 OK: 1/1 Fail: 0/1 Skip: 0/1
## Blinded block conversions ## Blinded block conversions
```diff ```diff
+ Bellatrix toSignedBlindedBlock OK + Bellatrix toSignedBlindedBeaconBlock OK
+ Capella toSignedBlindedBlock OK + Capella toSignedBlindedBeaconBlock OK
+ Deneb toSignedBlindedBlock OK + Deneb toSignedBlindedBeaconBlock OK
+ Electra toSignedBlindedBlock OK + Electra toSignedBlindedBeaconBlock OK
``` ```
OK: 4/4 Fail: 0/4 Skip: 0/4 OK: 4/4 Fail: 0/4 Skip: 0/4
## Block pool altair processing [Preset: mainnet] ## Block pool altair processing [Preset: mainnet]

View File

@ -116,28 +116,16 @@ template deneb_steps() =
do_check do_check
suite "Blinded block conversions": suite "Blinded block conversions":
test "Bellatrix toSignedBlindedBlock": withAll(ConsensusFork):
var b = default(bellatrix.SignedBeaconBlock) when consensusFork >= ConsensusFork.Bellatrix:
do_check test $consensusFork & " toSignedBlindedBeaconBlock":
bellatrix_steps var b = default(consensusFork.SignedBeaconBlock)
test "Capella toSignedBlindedBlock":
var b = default(capella.SignedBeaconBlock)
do_check
bellatrix_steps
capella_steps
test "Deneb toSignedBlindedBlock":
var b = default(deneb.SignedBeaconBlock)
do_check
bellatrix_steps
capella_steps
deneb_steps
test "Electra toSignedBlindedBlock":
var b = default(electra.SignedBeaconBlock)
do_check do_check
bellatrix_steps bellatrix_steps
when consensusFork >= ConsensusFork.Capella:
capella_steps capella_steps
when consensusFork >= ConsensusFork.Deneb:
deneb_steps deneb_steps
when consensusFork >= ConsensusFork.Electra:
debugComment "add electra_steps" debugComment "add electra_steps"
static: doAssert consensusFork.high == ConsensusFork.Electra