-
Notifications
You must be signed in to change notification settings - Fork 980
Open
Labels
Description
Description
Electra's new attestation type has introduced a match boilerplate.
lighthouse/consensus/types/src/beacon_block_body.rs
Lines 236 to 243 in c4f2284
| match self { | |
| Self::Base(body) => body.attestations.len(), | |
| Self::Altair(body) => body.attestations.len(), | |
| Self::Bellatrix(body) => body.attestations.len(), | |
| Self::Capella(body) => body.attestations.len(), | |
| Self::Deneb(body) => body.attestations.len(), | |
| Self::Electra(body) => body.attestations.len(), | |
| } |
lighthouse/beacon_node/beacon_chain/tests/block_verification.rs
Lines 727 to 757 in 9a01b6b
| BeaconBlockBodyRefMut::Base(ref mut blk) => { | |
| blk.attester_slashings | |
| .push(attester_slashing.as_base().unwrap().clone()) | |
| .expect("should update attester slashing"); | |
| } | |
| BeaconBlockBodyRefMut::Altair(ref mut blk) => { | |
| blk.attester_slashings | |
| .push(attester_slashing.as_base().unwrap().clone()) | |
| .expect("should update attester slashing"); | |
| } | |
| BeaconBlockBodyRefMut::Bellatrix(ref mut blk) => { | |
| blk.attester_slashings | |
| .push(attester_slashing.as_base().unwrap().clone()) | |
| .expect("should update attester slashing"); | |
| } | |
| BeaconBlockBodyRefMut::Capella(ref mut blk) => { | |
| blk.attester_slashings | |
| .push(attester_slashing.as_base().unwrap().clone()) | |
| .expect("should update attester slashing"); | |
| } | |
| BeaconBlockBodyRefMut::Deneb(ref mut blk) => { | |
| blk.attester_slashings | |
| .push(attester_slashing.as_base().unwrap().clone()) | |
| .expect("should update attester slashing"); | |
| } | |
| BeaconBlockBodyRefMut::Electra(ref mut blk) => { | |
| blk.attester_slashings | |
| .push(attester_slashing.as_electra().unwrap().clone()) | |
| .expect("should update attester slashing"); | |
| } | |
| } |
In previous issues, I stressed how we want fork addition to be as easy as possible to foster innovation. Having to add 1000 lines of mindless code just to develop a new feature is not optimal.
We can use some macro magic to prevent a new ForkName::EIP9999 variant from having to modify all these statements.
Reactions are currently unavailable