switch some beacon_chain/spec/ from eip4844.Foo to deneb.Foo (#4642)
This commit is contained in:
parent
629b005c27
commit
72797cad09
|
@ -0,0 +1,2 @@
|
||||||
|
import ./eip4844
|
||||||
|
export eip4844
|
|
@ -16,7 +16,7 @@ import
|
||||||
./datatypes/[phase0, altair, bellatrix, capella],
|
./datatypes/[phase0, altair, bellatrix, capella],
|
||||||
./eth2_merkleization
|
./eth2_merkleization
|
||||||
|
|
||||||
from ./datatypes/eip4844 import SignedBeaconBlock, TrustedSignedBeaconBlock
|
from ./datatypes/deneb import SignedBeaconBlock, TrustedSignedBeaconBlock
|
||||||
|
|
||||||
export phase0, altair, ssz_codec, ssz_serialization, eth2_merkleization
|
export phase0, altair, ssz_codec, ssz_serialization, eth2_merkleization
|
||||||
|
|
||||||
|
@ -54,13 +54,13 @@ template readSszBytes*(
|
||||||
data: openArray[byte], val: var capella.TrustedSignedBeaconBlock, updateRoot = true) =
|
data: openArray[byte], val: var capella.TrustedSignedBeaconBlock, updateRoot = true) =
|
||||||
readAndUpdateRoot(data, val, updateRoot)
|
readAndUpdateRoot(data, val, updateRoot)
|
||||||
template readSszBytes*(
|
template readSszBytes*(
|
||||||
data: openArray[byte], val: var eip4844.SignedBeaconBlock, updateRoot = true) =
|
data: openArray[byte], val: var deneb.SignedBeaconBlock, updateRoot = true) =
|
||||||
readAndUpdateRoot(data, val, updateRoot)
|
readAndUpdateRoot(data, val, updateRoot)
|
||||||
template readSszBytes*(
|
template readSszBytes*(
|
||||||
data: openArray[byte], val: var eip4844.TrustedSignedBeaconBlock, updateRoot = true) =
|
data: openArray[byte], val: var deneb.TrustedSignedBeaconBlock, updateRoot = true) =
|
||||||
readAndUpdateRoot(data, val, updateRoot)
|
readAndUpdateRoot(data, val, updateRoot)
|
||||||
template readSszBytes*(
|
template readSszBytes*(
|
||||||
data: openArray[byte], val: var eip4844.SignedBeaconBlockAndBlobsSidecar, updateRoot = true) =
|
data: openArray[byte], val: var deneb.SignedBeaconBlockAndBlobsSidecar, updateRoot = true) =
|
||||||
readSszValue(data, val)
|
readSszValue(data, val)
|
||||||
val.beacon_block.root = hash_tree_root(val.beacon_block.message)
|
val.beacon_block.root = hash_tree_root(val.beacon_block.message)
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,11 @@ import
|
||||||
"."/[
|
"."/[
|
||||||
block_id, eth2_merkleization, eth2_ssz_serialization,
|
block_id, eth2_merkleization, eth2_ssz_serialization,
|
||||||
forks_light_client, presets],
|
forks_light_client, presets],
|
||||||
./datatypes/[phase0, altair, bellatrix, capella, eip4844],
|
./datatypes/[phase0, altair, bellatrix, capella, deneb],
|
||||||
./mev/bellatrix_mev
|
./mev/bellatrix_mev
|
||||||
|
|
||||||
export
|
export
|
||||||
extras, block_id, phase0, altair, bellatrix, capella, eip4844,
|
extras, block_id, phase0, altair, bellatrix, capella, deneb,
|
||||||
eth2_merkleization, eth2_ssz_serialization, forks_light_client,
|
eth2_merkleization, eth2_ssz_serialization, forks_light_client,
|
||||||
presets, bellatrix_mev
|
presets, bellatrix_mev
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ type
|
||||||
altair.BeaconState |
|
altair.BeaconState |
|
||||||
bellatrix.BeaconState |
|
bellatrix.BeaconState |
|
||||||
capella.BeaconState |
|
capella.BeaconState |
|
||||||
eip4844.BeaconState
|
deneb.BeaconState
|
||||||
|
|
||||||
ForkyHashedBeaconState* =
|
ForkyHashedBeaconState* =
|
||||||
phase0.HashedBeaconState |
|
phase0.HashedBeaconState |
|
||||||
altair.HashedBeaconState |
|
altair.HashedBeaconState |
|
||||||
bellatrix.HashedBeaconState |
|
bellatrix.HashedBeaconState |
|
||||||
capella.HashedBeaconState |
|
capella.HashedBeaconState |
|
||||||
eip4844.HashedBeaconState
|
deneb.HashedBeaconState
|
||||||
|
|
||||||
ForkedHashedBeaconState* = object
|
ForkedHashedBeaconState* = object
|
||||||
case kind*: ConsensusFork
|
case kind*: ConsensusFork
|
||||||
|
@ -68,38 +68,38 @@ type
|
||||||
of ConsensusFork.Altair: altairData*: altair.HashedBeaconState
|
of ConsensusFork.Altair: altairData*: altair.HashedBeaconState
|
||||||
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.HashedBeaconState
|
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.HashedBeaconState
|
||||||
of ConsensusFork.Capella: capellaData*: capella.HashedBeaconState
|
of ConsensusFork.Capella: capellaData*: capella.HashedBeaconState
|
||||||
of ConsensusFork.EIP4844: eip4844Data*: eip4844.HashedBeaconState
|
of ConsensusFork.EIP4844: eip4844Data*: deneb.HashedBeaconState
|
||||||
|
|
||||||
ForkyExecutionPayload* =
|
ForkyExecutionPayload* =
|
||||||
bellatrix.ExecutionPayload |
|
bellatrix.ExecutionPayload |
|
||||||
capella.ExecutionPayload |
|
capella.ExecutionPayload |
|
||||||
eip4844.ExecutionPayload
|
deneb.ExecutionPayload
|
||||||
|
|
||||||
ForkyExecutionPayloadHeader* =
|
ForkyExecutionPayloadHeader* =
|
||||||
bellatrix.ExecutionPayloadHeader |
|
bellatrix.ExecutionPayloadHeader |
|
||||||
capella.ExecutionPayloadHeader |
|
capella.ExecutionPayloadHeader |
|
||||||
eip4844.ExecutionPayloadHeader
|
deneb.ExecutionPayloadHeader
|
||||||
|
|
||||||
ForkyBeaconBlockBody* =
|
ForkyBeaconBlockBody* =
|
||||||
phase0.BeaconBlockBody |
|
phase0.BeaconBlockBody |
|
||||||
altair.BeaconBlockBody |
|
altair.BeaconBlockBody |
|
||||||
bellatrix.BeaconBlockBody |
|
bellatrix.BeaconBlockBody |
|
||||||
capella.BeaconBlockBody |
|
capella.BeaconBlockBody |
|
||||||
eip4844.BeaconBlockBody
|
deneb.BeaconBlockBody
|
||||||
|
|
||||||
ForkySigVerifiedBeaconBlockBody* =
|
ForkySigVerifiedBeaconBlockBody* =
|
||||||
phase0.SigVerifiedBeaconBlockBody |
|
phase0.SigVerifiedBeaconBlockBody |
|
||||||
altair.SigVerifiedBeaconBlockBody |
|
altair.SigVerifiedBeaconBlockBody |
|
||||||
bellatrix.SigVerifiedBeaconBlockBody |
|
bellatrix.SigVerifiedBeaconBlockBody |
|
||||||
capella.SigVerifiedBeaconBlockBody |
|
capella.SigVerifiedBeaconBlockBody |
|
||||||
eip4844.SigVerifiedBeaconBlockBody
|
deneb.SigVerifiedBeaconBlockBody
|
||||||
|
|
||||||
ForkyTrustedBeaconBlockBody* =
|
ForkyTrustedBeaconBlockBody* =
|
||||||
phase0.TrustedBeaconBlockBody |
|
phase0.TrustedBeaconBlockBody |
|
||||||
altair.TrustedBeaconBlockBody |
|
altair.TrustedBeaconBlockBody |
|
||||||
bellatrix.TrustedBeaconBlockBody |
|
bellatrix.TrustedBeaconBlockBody |
|
||||||
capella.TrustedBeaconBlockBody |
|
capella.TrustedBeaconBlockBody |
|
||||||
eip4844.TrustedBeaconBlockBody
|
deneb.TrustedBeaconBlockBody
|
||||||
|
|
||||||
SomeForkyBeaconBlockBody* =
|
SomeForkyBeaconBlockBody* =
|
||||||
ForkyBeaconBlockBody |
|
ForkyBeaconBlockBody |
|
||||||
|
@ -111,21 +111,21 @@ type
|
||||||
altair.BeaconBlock |
|
altair.BeaconBlock |
|
||||||
bellatrix.BeaconBlock |
|
bellatrix.BeaconBlock |
|
||||||
capella.BeaconBlock |
|
capella.BeaconBlock |
|
||||||
eip4844.BeaconBlock
|
deneb.BeaconBlock
|
||||||
|
|
||||||
ForkySigVerifiedBeaconBlock* =
|
ForkySigVerifiedBeaconBlock* =
|
||||||
phase0.SigVerifiedBeaconBlock |
|
phase0.SigVerifiedBeaconBlock |
|
||||||
altair.SigVerifiedBeaconBlock |
|
altair.SigVerifiedBeaconBlock |
|
||||||
bellatrix.SigVerifiedBeaconBlock |
|
bellatrix.SigVerifiedBeaconBlock |
|
||||||
capella.SigVerifiedBeaconBlock |
|
capella.SigVerifiedBeaconBlock |
|
||||||
eip4844.SigVerifiedBeaconBlock
|
deneb.SigVerifiedBeaconBlock
|
||||||
|
|
||||||
ForkyTrustedBeaconBlock* =
|
ForkyTrustedBeaconBlock* =
|
||||||
phase0.TrustedBeaconBlock |
|
phase0.TrustedBeaconBlock |
|
||||||
altair.TrustedBeaconBlock |
|
altair.TrustedBeaconBlock |
|
||||||
bellatrix.TrustedBeaconBlock |
|
bellatrix.TrustedBeaconBlock |
|
||||||
capella.TrustedBeaconBlock |
|
capella.TrustedBeaconBlock |
|
||||||
eip4844.TrustedBeaconBlock
|
deneb.TrustedBeaconBlock
|
||||||
|
|
||||||
SomeForkyBeaconBlock* =
|
SomeForkyBeaconBlock* =
|
||||||
ForkyBeaconBlock |
|
ForkyBeaconBlock |
|
||||||
|
@ -138,7 +138,7 @@ type
|
||||||
of ConsensusFork.Altair: altairData*: altair.BeaconBlock
|
of ConsensusFork.Altair: altairData*: altair.BeaconBlock
|
||||||
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.BeaconBlock
|
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.BeaconBlock
|
||||||
of ConsensusFork.Capella: capellaData*: capella.BeaconBlock
|
of ConsensusFork.Capella: capellaData*: capella.BeaconBlock
|
||||||
of ConsensusFork.EIP4844: eip4844Data*: eip4844.BeaconBlock
|
of ConsensusFork.EIP4844: eip4844Data*: deneb.BeaconBlock
|
||||||
|
|
||||||
Web3SignerForkedBeaconBlock* = object
|
Web3SignerForkedBeaconBlock* = object
|
||||||
case kind*: ConsensusFork
|
case kind*: ConsensusFork
|
||||||
|
@ -162,14 +162,14 @@ type
|
||||||
of ConsensusFork.Altair: altairData*: altair.TrustedBeaconBlock
|
of ConsensusFork.Altair: altairData*: altair.TrustedBeaconBlock
|
||||||
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.TrustedBeaconBlock
|
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.TrustedBeaconBlock
|
||||||
of ConsensusFork.Capella: capellaData*: capella.TrustedBeaconBlock
|
of ConsensusFork.Capella: capellaData*: capella.TrustedBeaconBlock
|
||||||
of ConsensusFork.EIP4844: eip4844Data*: eip4844.TrustedBeaconBlock
|
of ConsensusFork.EIP4844: eip4844Data*: deneb.TrustedBeaconBlock
|
||||||
|
|
||||||
ForkySignedBeaconBlock* =
|
ForkySignedBeaconBlock* =
|
||||||
phase0.SignedBeaconBlock |
|
phase0.SignedBeaconBlock |
|
||||||
altair.SignedBeaconBlock |
|
altair.SignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock |
|
bellatrix.SignedBeaconBlock |
|
||||||
capella.SignedBeaconBlock |
|
capella.SignedBeaconBlock |
|
||||||
eip4844.SignedBeaconBlock
|
deneb.SignedBeaconBlock
|
||||||
|
|
||||||
ForkedSignedBeaconBlock* = object
|
ForkedSignedBeaconBlock* = object
|
||||||
case kind*: ConsensusFork
|
case kind*: ConsensusFork
|
||||||
|
@ -177,7 +177,7 @@ type
|
||||||
of ConsensusFork.Altair: altairData*: altair.SignedBeaconBlock
|
of ConsensusFork.Altair: altairData*: altair.SignedBeaconBlock
|
||||||
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.SignedBeaconBlock
|
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.SignedBeaconBlock
|
||||||
of ConsensusFork.Capella: capellaData*: capella.SignedBeaconBlock
|
of ConsensusFork.Capella: capellaData*: capella.SignedBeaconBlock
|
||||||
of ConsensusFork.EIP4844: eip4844Data*: eip4844.SignedBeaconBlock
|
of ConsensusFork.EIP4844: eip4844Data*: deneb.SignedBeaconBlock
|
||||||
|
|
||||||
ForkySignedBlindedBeaconBlock* =
|
ForkySignedBlindedBeaconBlock* =
|
||||||
phase0.SignedBeaconBlock |
|
phase0.SignedBeaconBlock |
|
||||||
|
@ -197,21 +197,21 @@ type
|
||||||
altair.SigVerifiedSignedBeaconBlock |
|
altair.SigVerifiedSignedBeaconBlock |
|
||||||
bellatrix.SigVerifiedSignedBeaconBlock |
|
bellatrix.SigVerifiedSignedBeaconBlock |
|
||||||
capella.SigVerifiedSignedBeaconBlock |
|
capella.SigVerifiedSignedBeaconBlock |
|
||||||
eip4844.SigVerifiedSignedBeaconBlock
|
deneb.SigVerifiedSignedBeaconBlock
|
||||||
|
|
||||||
ForkyMsgTrustedSignedBeaconBlock* =
|
ForkyMsgTrustedSignedBeaconBlock* =
|
||||||
phase0.MsgTrustedSignedBeaconBlock |
|
phase0.MsgTrustedSignedBeaconBlock |
|
||||||
altair.MsgTrustedSignedBeaconBlock |
|
altair.MsgTrustedSignedBeaconBlock |
|
||||||
bellatrix.MsgTrustedSignedBeaconBlock |
|
bellatrix.MsgTrustedSignedBeaconBlock |
|
||||||
capella.MsgTrustedSignedBeaconBlock |
|
capella.MsgTrustedSignedBeaconBlock |
|
||||||
eip4844.MsgTrustedSignedBeaconBlock
|
deneb.MsgTrustedSignedBeaconBlock
|
||||||
|
|
||||||
ForkyTrustedSignedBeaconBlock* =
|
ForkyTrustedSignedBeaconBlock* =
|
||||||
phase0.TrustedSignedBeaconBlock |
|
phase0.TrustedSignedBeaconBlock |
|
||||||
altair.TrustedSignedBeaconBlock |
|
altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.TrustedSignedBeaconBlock |
|
bellatrix.TrustedSignedBeaconBlock |
|
||||||
capella.TrustedSignedBeaconBlock |
|
capella.TrustedSignedBeaconBlock |
|
||||||
eip4844.TrustedSignedBeaconBlock
|
deneb.TrustedSignedBeaconBlock
|
||||||
|
|
||||||
ForkedMsgTrustedSignedBeaconBlock* = object
|
ForkedMsgTrustedSignedBeaconBlock* = object
|
||||||
case kind*: ConsensusFork
|
case kind*: ConsensusFork
|
||||||
|
@ -219,7 +219,7 @@ type
|
||||||
of ConsensusFork.Altair: altairData*: altair.MsgTrustedSignedBeaconBlock
|
of ConsensusFork.Altair: altairData*: altair.MsgTrustedSignedBeaconBlock
|
||||||
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.MsgTrustedSignedBeaconBlock
|
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.MsgTrustedSignedBeaconBlock
|
||||||
of ConsensusFork.Capella: capellaData*: capella.MsgTrustedSignedBeaconBlock
|
of ConsensusFork.Capella: capellaData*: capella.MsgTrustedSignedBeaconBlock
|
||||||
of ConsensusFork.EIP4844: eip4844Data*: eip4844.MsgTrustedSignedBeaconBlock
|
of ConsensusFork.EIP4844: eip4844Data*: deneb.MsgTrustedSignedBeaconBlock
|
||||||
|
|
||||||
ForkedTrustedSignedBeaconBlock* = object
|
ForkedTrustedSignedBeaconBlock* = object
|
||||||
case kind*: ConsensusFork
|
case kind*: ConsensusFork
|
||||||
|
@ -227,7 +227,7 @@ type
|
||||||
of ConsensusFork.Altair: altairData*: altair.TrustedSignedBeaconBlock
|
of ConsensusFork.Altair: altairData*: altair.TrustedSignedBeaconBlock
|
||||||
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.TrustedSignedBeaconBlock
|
of ConsensusFork.Bellatrix: bellatrixData*: bellatrix.TrustedSignedBeaconBlock
|
||||||
of ConsensusFork.Capella: capellaData*: capella.TrustedSignedBeaconBlock
|
of ConsensusFork.Capella: capellaData*: capella.TrustedSignedBeaconBlock
|
||||||
of ConsensusFork.EIP4844: eip4844Data*: eip4844.TrustedSignedBeaconBlock
|
of ConsensusFork.EIP4844: eip4844Data*: deneb.TrustedSignedBeaconBlock
|
||||||
|
|
||||||
SomeForkySignedBeaconBlock* =
|
SomeForkySignedBeaconBlock* =
|
||||||
ForkySignedBeaconBlock |
|
ForkySignedBeaconBlock |
|
||||||
|
@ -262,9 +262,9 @@ type ForkySignedBeaconBlockMaybeBlobs* =
|
||||||
altair.SignedBeaconBlock |
|
altair.SignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock |
|
bellatrix.SignedBeaconBlock |
|
||||||
capella.SignedBeaconBlock |
|
capella.SignedBeaconBlock |
|
||||||
eip4844.SignedBeaconBlockAndBlobsSidecar
|
deneb.SignedBeaconBlockAndBlobsSidecar
|
||||||
# ForkySignedBeaconBlockMaybeBlobs should only contain types that are gossiped.
|
# ForkySignedBeaconBlockMaybeBlobs should only contain types that are gossiped.
|
||||||
static: doAssert not (default(eip4844.SignedBeaconBlock) is ForkySignedBeaconBlockMaybeBlobs)
|
static: doAssert not (default(deneb.SignedBeaconBlock) is ForkySignedBeaconBlockMaybeBlobs)
|
||||||
|
|
||||||
template toSignedBeaconBlock*(b: ForkySignedBeaconBlockMaybeBlobs): ForkySignedBeaconBlock =
|
template toSignedBeaconBlock*(b: ForkySignedBeaconBlockMaybeBlobs): ForkySignedBeaconBlock =
|
||||||
when b is eip4844.SignedBeaconBlockAndBlobsSidecar:
|
when b is eip4844.SignedBeaconBlockAndBlobsSidecar:
|
||||||
|
@ -273,11 +273,11 @@ template toSignedBeaconBlock*(b: ForkySignedBeaconBlockMaybeBlobs): ForkySignedB
|
||||||
b
|
b
|
||||||
|
|
||||||
func optBlobs*(b: ForkySignedBeaconBlockMaybeBlobs):
|
func optBlobs*(b: ForkySignedBeaconBlockMaybeBlobs):
|
||||||
Opt[eip4844.BlobsSidecar] =
|
Opt[deneb.BlobsSidecar] =
|
||||||
when b is phase0.SignedBeaconBlock or b is altair.SignedBeaconBlock or
|
when b is phase0.SignedBeaconBlock or b is altair.SignedBeaconBlock or
|
||||||
b is bellatrix.SignedBeaconBlock or b is capella.SignedBeaconBlock:
|
b is bellatrix.SignedBeaconBlock or b is capella.SignedBeaconBlock:
|
||||||
Opt.none(eip4844.BlobsSidecar)
|
Opt.none(eip4844.BlobsSidecar)
|
||||||
elif b is eip4844.SignedBeaconBlockAndBlobsSidecar:
|
elif b is deneb.SignedBeaconBlockAndBlobsSidecar:
|
||||||
Opt.some(b.blobs_sidecar)
|
Opt.some(b.blobs_sidecar)
|
||||||
|
|
||||||
macro getSymbolFromForkModule(fork: static ConsensusFork,
|
macro getSymbolFromForkModule(fork: static ConsensusFork,
|
||||||
|
@ -336,9 +336,9 @@ func new*(T: type ForkedHashedBeaconState, data: capella.BeaconState):
|
||||||
ref ForkedHashedBeaconState =
|
ref ForkedHashedBeaconState =
|
||||||
(ref T)(kind: ConsensusFork.Capella, capellaData: capella.HashedBeaconState(
|
(ref T)(kind: ConsensusFork.Capella, capellaData: capella.HashedBeaconState(
|
||||||
data: data, root: hash_tree_root(data)))
|
data: data, root: hash_tree_root(data)))
|
||||||
func new*(T: type ForkedHashedBeaconState, data: eip4844.BeaconState):
|
func new*(T: type ForkedHashedBeaconState, data: deneb.BeaconState):
|
||||||
ref ForkedHashedBeaconState =
|
ref ForkedHashedBeaconState =
|
||||||
(ref T)(kind: ConsensusFork.EIP4844, eip4844Data: eip4844.HashedBeaconState(
|
(ref T)(kind: ConsensusFork.EIP4844, eip4844Data: deneb.HashedBeaconState(
|
||||||
data: data, root: hash_tree_root(data)))
|
data: data, root: hash_tree_root(data)))
|
||||||
|
|
||||||
template init*(T: type ForkedBeaconBlock, blck: phase0.BeaconBlock): T =
|
template init*(T: type ForkedBeaconBlock, blck: phase0.BeaconBlock): T =
|
||||||
|
@ -349,7 +349,7 @@ template init*(T: type ForkedBeaconBlock, blck: bellatrix.BeaconBlock): T =
|
||||||
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
||||||
template init*(T: type ForkedBeaconBlock, blck: capella.BeaconBlock): T =
|
template init*(T: type ForkedBeaconBlock, blck: capella.BeaconBlock): T =
|
||||||
T(kind: ConsensusFork.Capella, capellaData: blck)
|
T(kind: ConsensusFork.Capella, capellaData: blck)
|
||||||
template init*(T: type ForkedBeaconBlock, blck: eip4844.BeaconBlock): T =
|
template init*(T: type ForkedBeaconBlock, blck: deneb.BeaconBlock): T =
|
||||||
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
||||||
|
|
||||||
template init*(T: type ForkedTrustedBeaconBlock, blck: phase0.TrustedBeaconBlock): T =
|
template init*(T: type ForkedTrustedBeaconBlock, blck: phase0.TrustedBeaconBlock): T =
|
||||||
|
@ -369,7 +369,7 @@ template init*(T: type ForkedSignedBeaconBlock, blck: bellatrix.SignedBeaconBloc
|
||||||
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
||||||
template init*(T: type ForkedSignedBeaconBlock, blck: capella.SignedBeaconBlock): T =
|
template init*(T: type ForkedSignedBeaconBlock, blck: capella.SignedBeaconBlock): T =
|
||||||
T(kind: ConsensusFork.Capella, capellaData: blck)
|
T(kind: ConsensusFork.Capella, capellaData: blck)
|
||||||
template init*(T: type ForkedSignedBeaconBlock, blck: eip4844.SignedBeaconBlock): T =
|
template init*(T: type ForkedSignedBeaconBlock, blck: deneb.SignedBeaconBlock): T =
|
||||||
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
||||||
|
|
||||||
func init*(T: type ForkedSignedBeaconBlock, forked: ForkedBeaconBlock,
|
func init*(T: type ForkedSignedBeaconBlock, forked: ForkedBeaconBlock,
|
||||||
|
@ -397,7 +397,7 @@ func init*(T: type ForkedSignedBeaconBlock, forked: ForkedBeaconBlock,
|
||||||
signature: signature))
|
signature: signature))
|
||||||
of ConsensusFork.EIP4844:
|
of ConsensusFork.EIP4844:
|
||||||
T(kind: ConsensusFork.EIP4844,
|
T(kind: ConsensusFork.EIP4844,
|
||||||
eip4844Data: eip4844.SignedBeaconBlock(message: forked.eip4844Data,
|
eip4844Data: deneb.SignedBeaconBlock(message: forked.eip4844Data,
|
||||||
root: blockRoot,
|
root: blockRoot,
|
||||||
signature: signature))
|
signature: signature))
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: bellatrix.MsgTru
|
||||||
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
||||||
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: capella.MsgTrustedSignedBeaconBlock): T =
|
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: capella.MsgTrustedSignedBeaconBlock): T =
|
||||||
T(kind: ConsensusFork.Capella, capellaData: blck)
|
T(kind: ConsensusFork.Capella, capellaData: blck)
|
||||||
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: eip4844.MsgTrustedSignedBeaconBlock): T =
|
template init*(T: type ForkedMsgTrustedSignedBeaconBlock, blck: deneb.MsgTrustedSignedBeaconBlock): T =
|
||||||
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
||||||
|
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ template init*(T: type ForkedTrustedSignedBeaconBlock, blck: bellatrix.TrustedSi
|
||||||
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
T(kind: ConsensusFork.Bellatrix, bellatrixData: blck)
|
||||||
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: capella.TrustedSignedBeaconBlock): T =
|
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: capella.TrustedSignedBeaconBlock): T =
|
||||||
T(kind: ConsensusFork.Capella, capellaData: blck)
|
T(kind: ConsensusFork.Capella, capellaData: blck)
|
||||||
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: eip4844.TrustedSignedBeaconBlock): T =
|
template init*(T: type ForkedTrustedSignedBeaconBlock, blck: deneb.TrustedSignedBeaconBlock): T =
|
||||||
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
T(kind: ConsensusFork.EIP4844, eip4844Data: blck)
|
||||||
|
|
||||||
template toString*(kind: ConsensusFork): string =
|
template toString*(kind: ConsensusFork): string =
|
||||||
|
@ -530,17 +530,17 @@ template toFork*[T:
|
||||||
ConsensusFork.Capella
|
ConsensusFork.Capella
|
||||||
|
|
||||||
template toFork*[T:
|
template toFork*[T:
|
||||||
eip4844.BeaconState |
|
deneb.BeaconState |
|
||||||
eip4844.HashedBeaconState |
|
deneb.HashedBeaconState |
|
||||||
eip4844.ExecutionPayload |
|
deneb.ExecutionPayload |
|
||||||
eip4844.ExecutionPayloadHeader |
|
deneb.ExecutionPayloadHeader |
|
||||||
eip4844.BeaconBlock |
|
deneb.BeaconBlock |
|
||||||
eip4844.SignedBeaconBlock |
|
deneb.SignedBeaconBlock |
|
||||||
eip4844.SignedBeaconBlockAndBlobsSidecar |
|
deneb.SignedBeaconBlockAndBlobsSidecar |
|
||||||
eip4844.TrustedBeaconBlock |
|
deneb.TrustedBeaconBlock |
|
||||||
eip4844.SigVerifiedSignedBeaconBlock |
|
deneb.SigVerifiedSignedBeaconBlock |
|
||||||
eip4844.MsgTrustedSignedBeaconBlock |
|
deneb.MsgTrustedSignedBeaconBlock |
|
||||||
eip4844.TrustedSignedBeaconBlock](
|
deneb.TrustedSignedBeaconBlock](
|
||||||
t: type T): ConsensusFork =
|
t: type T): ConsensusFork =
|
||||||
ConsensusFork.EIP4844
|
ConsensusFork.EIP4844
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ template withEpochInfo*(
|
||||||
|
|
||||||
template withEpochInfo*(
|
template withEpochInfo*(
|
||||||
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
|
state: altair.BeaconState | bellatrix.BeaconState | capella.BeaconState |
|
||||||
eip4844.BeaconState,
|
deneb.BeaconState,
|
||||||
x: var ForkedEpochInfo, body: untyped): untyped =
|
x: var ForkedEpochInfo, body: untyped): untyped =
|
||||||
if x.kind != EpochInfoFork.Altair:
|
if x.kind != EpochInfoFork.Altair:
|
||||||
# Rare, so efficiency not critical
|
# Rare, so efficiency not critical
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
|
|
||||||
import
|
import
|
||||||
./datatypes/[phase0, altair, bellatrix, capella, eip4844],
|
./datatypes/[phase0, altair, bellatrix, capella, deneb],
|
||||||
./eth2_merkleization
|
./eth2_merkleization
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -21,27 +21,27 @@ type
|
||||||
ForkyLightClientHeader* =
|
ForkyLightClientHeader* =
|
||||||
altair.LightClientHeader |
|
altair.LightClientHeader |
|
||||||
capella.LightClientHeader |
|
capella.LightClientHeader |
|
||||||
eip4844.LightClientHeader
|
deneb.LightClientHeader
|
||||||
|
|
||||||
ForkyLightClientBootstrap* =
|
ForkyLightClientBootstrap* =
|
||||||
altair.LightClientBootstrap |
|
altair.LightClientBootstrap |
|
||||||
capella.LightClientBootstrap |
|
capella.LightClientBootstrap |
|
||||||
eip4844.LightClientBootstrap
|
deneb.LightClientBootstrap
|
||||||
|
|
||||||
ForkyLightClientUpdate* =
|
ForkyLightClientUpdate* =
|
||||||
altair.LightClientUpdate |
|
altair.LightClientUpdate |
|
||||||
capella.LightClientUpdate |
|
capella.LightClientUpdate |
|
||||||
eip4844.LightClientUpdate
|
deneb.LightClientUpdate
|
||||||
|
|
||||||
ForkyLightClientFinalityUpdate* =
|
ForkyLightClientFinalityUpdate* =
|
||||||
altair.LightClientFinalityUpdate |
|
altair.LightClientFinalityUpdate |
|
||||||
capella.LightClientFinalityUpdate |
|
capella.LightClientFinalityUpdate |
|
||||||
eip4844.LightClientFinalityUpdate
|
deneb.LightClientFinalityUpdate
|
||||||
|
|
||||||
ForkyLightClientOptimisticUpdate* =
|
ForkyLightClientOptimisticUpdate* =
|
||||||
altair.LightClientOptimisticUpdate |
|
altair.LightClientOptimisticUpdate |
|
||||||
capella.LightClientOptimisticUpdate |
|
capella.LightClientOptimisticUpdate |
|
||||||
eip4844.LightClientOptimisticUpdate
|
deneb.LightClientOptimisticUpdate
|
||||||
|
|
||||||
SomeForkyLightClientUpdateWithSyncCommittee* =
|
SomeForkyLightClientUpdateWithSyncCommittee* =
|
||||||
ForkyLightClientUpdate
|
ForkyLightClientUpdate
|
||||||
|
@ -62,7 +62,7 @@ type
|
||||||
ForkyLightClientStore* =
|
ForkyLightClientStore* =
|
||||||
altair.LightClientStore |
|
altair.LightClientStore |
|
||||||
capella.LightClientStore |
|
capella.LightClientStore |
|
||||||
eip4844.LightClientStore
|
deneb.LightClientStore
|
||||||
|
|
||||||
ForkedLightClientHeader* = object
|
ForkedLightClientHeader* = object
|
||||||
case kind*: LightClientDataFork
|
case kind*: LightClientDataFork
|
||||||
|
@ -73,7 +73,7 @@ type
|
||||||
of LightClientDataFork.Capella:
|
of LightClientDataFork.Capella:
|
||||||
capellaData*: capella.LightClientHeader
|
capellaData*: capella.LightClientHeader
|
||||||
of LightClientDataFork.EIP4844:
|
of LightClientDataFork.EIP4844:
|
||||||
eip4844Data*: eip4844.LightClientHeader
|
eip4844Data*: deneb.LightClientHeader
|
||||||
|
|
||||||
ForkedLightClientBootstrap* = object
|
ForkedLightClientBootstrap* = object
|
||||||
case kind*: LightClientDataFork
|
case kind*: LightClientDataFork
|
||||||
|
@ -84,7 +84,7 @@ type
|
||||||
of LightClientDataFork.Capella:
|
of LightClientDataFork.Capella:
|
||||||
capellaData*: capella.LightClientBootstrap
|
capellaData*: capella.LightClientBootstrap
|
||||||
of LightClientDataFork.EIP4844:
|
of LightClientDataFork.EIP4844:
|
||||||
eip4844Data*: eip4844.LightClientBootstrap
|
eip4844Data*: deneb.LightClientBootstrap
|
||||||
|
|
||||||
ForkedLightClientUpdate* = object
|
ForkedLightClientUpdate* = object
|
||||||
case kind*: LightClientDataFork
|
case kind*: LightClientDataFork
|
||||||
|
@ -95,7 +95,7 @@ type
|
||||||
of LightClientDataFork.Capella:
|
of LightClientDataFork.Capella:
|
||||||
capellaData*: capella.LightClientUpdate
|
capellaData*: capella.LightClientUpdate
|
||||||
of LightClientDataFork.EIP4844:
|
of LightClientDataFork.EIP4844:
|
||||||
eip4844Data*: eip4844.LightClientUpdate
|
eip4844Data*: deneb.LightClientUpdate
|
||||||
|
|
||||||
ForkedLightClientFinalityUpdate* = object
|
ForkedLightClientFinalityUpdate* = object
|
||||||
case kind*: LightClientDataFork
|
case kind*: LightClientDataFork
|
||||||
|
@ -106,7 +106,7 @@ type
|
||||||
of LightClientDataFork.Capella:
|
of LightClientDataFork.Capella:
|
||||||
capellaData*: capella.LightClientFinalityUpdate
|
capellaData*: capella.LightClientFinalityUpdate
|
||||||
of LightClientDataFork.EIP4844:
|
of LightClientDataFork.EIP4844:
|
||||||
eip4844Data*: eip4844.LightClientFinalityUpdate
|
eip4844Data*: deneb.LightClientFinalityUpdate
|
||||||
|
|
||||||
ForkedLightClientOptimisticUpdate* = object
|
ForkedLightClientOptimisticUpdate* = object
|
||||||
case kind*: LightClientDataFork
|
case kind*: LightClientDataFork
|
||||||
|
@ -117,7 +117,7 @@ type
|
||||||
of LightClientDataFork.Capella:
|
of LightClientDataFork.Capella:
|
||||||
capellaData*: capella.LightClientOptimisticUpdate
|
capellaData*: capella.LightClientOptimisticUpdate
|
||||||
of LightClientDataFork.EIP4844:
|
of LightClientDataFork.EIP4844:
|
||||||
eip4844Data*: eip4844.LightClientOptimisticUpdate
|
eip4844Data*: deneb.LightClientOptimisticUpdate
|
||||||
|
|
||||||
SomeForkedLightClientUpdateWithSyncCommittee* =
|
SomeForkedLightClientUpdateWithSyncCommittee* =
|
||||||
ForkedLightClientUpdate
|
ForkedLightClientUpdate
|
||||||
|
@ -144,7 +144,7 @@ type
|
||||||
of LightClientDataFork.Capella:
|
of LightClientDataFork.Capella:
|
||||||
capellaData*: capella.LightClientStore
|
capellaData*: capella.LightClientStore
|
||||||
of LightClientDataFork.EIP4844:
|
of LightClientDataFork.EIP4844:
|
||||||
eip4844Data*: eip4844.LightClientStore
|
eip4844Data*: deneb.LightClientStore
|
||||||
|
|
||||||
func lcDataForkAtEpoch*(
|
func lcDataForkAtEpoch*(
|
||||||
cfg: RuntimeConfig, epoch: Epoch): LightClientDataFork =
|
cfg: RuntimeConfig, epoch: Epoch): LightClientDataFork =
|
||||||
|
@ -180,12 +180,12 @@ template kind*(
|
||||||
|
|
||||||
template kind*(
|
template kind*(
|
||||||
x: typedesc[ # `SomeLightClientObject` doesn't work here (Nim 1.6)
|
x: typedesc[ # `SomeLightClientObject` doesn't work here (Nim 1.6)
|
||||||
eip4844.LightClientHeader |
|
deneb.LightClientHeader |
|
||||||
eip4844.LightClientBootstrap |
|
deneb.LightClientBootstrap |
|
||||||
eip4844.LightClientUpdate |
|
deneb.LightClientUpdate |
|
||||||
eip4844.LightClientFinalityUpdate |
|
deneb.LightClientFinalityUpdate |
|
||||||
eip4844.LightClientOptimisticUpdate |
|
deneb.LightClientOptimisticUpdate |
|
||||||
eip4844.LightClientStore]): LightClientDataFork =
|
deneb.LightClientStore]): LightClientDataFork =
|
||||||
LightClientDataFork.EIP4844
|
LightClientDataFork.EIP4844
|
||||||
|
|
||||||
template LightClientHeader*(kind: static LightClientDataFork): auto =
|
template LightClientHeader*(kind: static LightClientDataFork): auto =
|
||||||
|
@ -874,24 +874,24 @@ func toEIP4844LightClientHeader(
|
||||||
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
phase0.SignedBeaconBlock | phase0.TrustedSignedBeaconBlock |
|
||||||
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock
|
||||||
): eip4844.LightClientHeader =
|
): deneb.LightClientHeader =
|
||||||
# Note that during fork transitions, `finalized_header` may still
|
# Note that during fork transitions, `finalized_header` may still
|
||||||
# point to earlier forks. While Bellatrix blocks also contain an
|
# point to earlier forks. While Bellatrix blocks also contain an
|
||||||
# `ExecutionPayload` (minus `withdrawals_root`), it was not included
|
# `ExecutionPayload` (minus `withdrawals_root`), it was not included
|
||||||
# in the corresponding light client data. To ensure compatibility
|
# in the corresponding light client data. To ensure compatibility
|
||||||
# with legacy data going through `upgrade_lc_header_to_capella`,
|
# with legacy data going through `upgrade_lc_header_to_capella`,
|
||||||
# leave out execution data.
|
# leave out execution data.
|
||||||
eip4844.LightClientHeader(
|
deneb.LightClientHeader(
|
||||||
beacon: blck.message.toBeaconBlockHeader())
|
beacon: blck.message.toBeaconBlockHeader())
|
||||||
|
|
||||||
func toEIP4844LightClientHeader(
|
func toEIP4844LightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
||||||
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
|
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock
|
||||||
): eip4844.LightClientHeader =
|
): deneb.LightClientHeader =
|
||||||
template payload: untyped = blck.message.body.execution_payload
|
template payload: untyped = blck.message.body.execution_payload
|
||||||
eip4844.LightClientHeader(
|
deneb.LightClientHeader(
|
||||||
beacon: blck.message.toBeaconBlockHeader(),
|
beacon: blck.message.toBeaconBlockHeader(),
|
||||||
execution: eip4844.ExecutionPayloadHeader(
|
execution: deneb.ExecutionPayloadHeader(
|
||||||
parent_hash: payload.parent_hash,
|
parent_hash: payload.parent_hash,
|
||||||
fee_recipient: payload.fee_recipient,
|
fee_recipient: payload.fee_recipient,
|
||||||
state_root: payload.state_root,
|
state_root: payload.state_root,
|
||||||
|
@ -912,12 +912,12 @@ func toEIP4844LightClientHeader(
|
||||||
|
|
||||||
func toEIP4844LightClientHeader(
|
func toEIP4844LightClientHeader(
|
||||||
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
blck: # `SomeSignedBeaconBlock` doesn't work here (Nim 1.6)
|
||||||
eip4844.SignedBeaconBlock | eip4844.TrustedSignedBeaconBlock
|
deneb.SignedBeaconBlock | deneb.TrustedSignedBeaconBlock
|
||||||
): eip4844.LightClientHeader =
|
): deneb.LightClientHeader =
|
||||||
template payload: untyped = blck.message.body.execution_payload
|
template payload: untyped = blck.message.body.execution_payload
|
||||||
eip4844.LightClientHeader(
|
deneb.LightClientHeader(
|
||||||
beacon: blck.message.toBeaconBlockHeader(),
|
beacon: blck.message.toBeaconBlockHeader(),
|
||||||
execution: eip4844.ExecutionPayloadHeader(
|
execution: deneb.ExecutionPayloadHeader(
|
||||||
parent_hash: payload.parent_hash,
|
parent_hash: payload.parent_hash,
|
||||||
fee_recipient: payload.fee_recipient,
|
fee_recipient: payload.fee_recipient,
|
||||||
state_root: payload.state_root,
|
state_root: payload.state_root,
|
||||||
|
@ -943,7 +943,7 @@ func toLightClientHeader*(
|
||||||
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
altair.SignedBeaconBlock | altair.TrustedSignedBeaconBlock |
|
||||||
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock |
|
bellatrix.SignedBeaconBlock | bellatrix.TrustedSignedBeaconBlock |
|
||||||
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock |
|
capella.SignedBeaconBlock | capella.TrustedSignedBeaconBlock |
|
||||||
eip4844.SignedBeaconBlock | eip4844.TrustedSignedBeaconBlock,
|
deneb.SignedBeaconBlock | deneb.TrustedSignedBeaconBlock,
|
||||||
kind: static LightClientDataFork): auto =
|
kind: static LightClientDataFork): auto =
|
||||||
when kind == LightClientDataFork.EIP4844:
|
when kind == LightClientDataFork.EIP4844:
|
||||||
blck.toEIP4844LightClientHeader()
|
blck.toEIP4844LightClientHeader()
|
||||||
|
|
Loading…
Reference in New Issue