diff --git a/beacon_chain/spec/eth2_merkleization.nim b/beacon_chain/spec/eth2_merkleization.nim index ab88cd40c..747e53ea2 100644 --- a/beacon_chain/spec/eth2_merkleization.nim +++ b/beacon_chain/spec/eth2_merkleization.nim @@ -18,6 +18,7 @@ from ./datatypes/phase0 import HashedBeaconState, SignedBeaconBlock from ./datatypes/altair import HashedBeaconState, SignedBeaconBlock from ./datatypes/bellatrix import HashedBeaconState, SignedBeaconBlock from ./datatypes/capella import HashedBeaconState, SignedBeaconBlock +from ./datatypes/deneb import HashedBeaconState, SignedBeaconBlock export ssz_codec, merkleization, proofs @@ -28,12 +29,14 @@ type # creating recursive module dependency through `forks`. func hash_tree_root*( x: phase0.HashedBeaconState | altair.HashedBeaconState | - bellatrix.HashedBeaconState | capella.HashedBeaconState) {. + bellatrix.HashedBeaconState | capella.HashedBeaconState | + deneb.HashedBeaconState) {. error: "HashedBeaconState should not be hashed".} func hash_tree_root*( x: phase0.SignedBeaconBlock | altair.SignedBeaconBlock | - bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock) {. + bellatrix.SignedBeaconBlock | capella.SignedBeaconBlock | + deneb.SignedBeaconBlock) {. error: "SignedBeaconBlock should not be hashed".} func depositCountBytes*(x: uint64): array[32, byte] = diff --git a/beacon_chain/spec/forks.nim b/beacon_chain/spec/forks.nim index b26297ef7..f2ea38b7c 100644 --- a/beacon_chain/spec/forks.nim +++ b/beacon_chain/spec/forks.nim @@ -551,6 +551,10 @@ template PayloadAttributes*( else: {.error: "PayloadAttributes does not support " & $kind.} +# `eth2_merkleization` cannot import `forks` (circular), so the check is here +static: doAssert ConsensusFork.high == ConsensusFork.Deneb, + "eth2_merkleization has been checked and `hash_tree_root` is up to date" + # TODO when https://github.com/nim-lang/Nim/issues/21086 fixed, use return type # `ref T` func new*(T: type ForkedHashedBeaconState, data: phase0.BeaconState):