rename forkDigests.merge to forkDigests.bellatrix (#3245)
This commit is contained in:
parent
66c9b7fbce
commit
5878d34117
|
@ -628,7 +628,7 @@ template forkAtEpoch*(dag: ChainDAGRef, epoch: Epoch): Fork =
|
||||||
|
|
||||||
proc forkDigestAtEpoch*(dag: ChainDAGRef, epoch: Epoch): ForkDigest =
|
proc forkDigestAtEpoch*(dag: ChainDAGRef, epoch: Epoch): ForkDigest =
|
||||||
case dag.cfg.stateForkAtEpoch(epoch)
|
case dag.cfg.stateForkAtEpoch(epoch)
|
||||||
of BeaconStateFork.Bellatrix: dag.forkDigests.merge
|
of BeaconStateFork.Bellatrix: dag.forkDigests.bellatrix
|
||||||
of BeaconStateFork.Altair: dag.forkDigests.altair
|
of BeaconStateFork.Altair: dag.forkDigests.altair
|
||||||
of BeaconStateFork.Phase0: dag.forkDigests.phase0
|
of BeaconStateFork.Phase0: dag.forkDigests.phase0
|
||||||
|
|
||||||
|
|
|
@ -2164,7 +2164,7 @@ proc updateForkId*(node: Eth2Node, epoch: Epoch, genesisValidatorsRoot: Eth2Dige
|
||||||
|
|
||||||
func forkDigestAtEpoch(node: Eth2Node, epoch: Epoch): ForkDigest =
|
func forkDigestAtEpoch(node: Eth2Node, epoch: Epoch): ForkDigest =
|
||||||
case node.cfg.stateForkAtEpoch(epoch)
|
case node.cfg.stateForkAtEpoch(epoch)
|
||||||
of BeaconStateFork.Bellatrix: node.forkDigests.merge
|
of BeaconStateFork.Bellatrix: node.forkDigests.bellatrix
|
||||||
of BeaconStateFork.Altair: node.forkDigests.altair
|
of BeaconStateFork.Altair: node.forkDigests.altair
|
||||||
of BeaconStateFork.Phase0: node.forkDigests.phase0
|
of BeaconStateFork.Phase0: node.forkDigests.phase0
|
||||||
|
|
||||||
|
@ -2213,7 +2213,7 @@ proc broadcastBeaconBlock*(node: Eth2Node, blck: altair.SignedBeaconBlock) =
|
||||||
node.broadcast(topic, blck)
|
node.broadcast(topic, blck)
|
||||||
|
|
||||||
proc broadcastBeaconBlock*(node: Eth2Node, blck: merge.SignedBeaconBlock) =
|
proc broadcastBeaconBlock*(node: Eth2Node, blck: merge.SignedBeaconBlock) =
|
||||||
let topic = getBeaconBlocksTopic(node.forkDigests.merge)
|
let topic = getBeaconBlocksTopic(node.forkDigests.bellatrix)
|
||||||
node.broadcast(topic, blck)
|
node.broadcast(topic, blck)
|
||||||
|
|
||||||
proc broadcastBeaconBlock*(node: Eth2Node, forked: ForkedSignedBeaconBlock) =
|
proc broadcastBeaconBlock*(node: Eth2Node, forked: ForkedSignedBeaconBlock) =
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2018-2021 Status Research & Development GmbH
|
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -575,7 +575,7 @@ proc updateAttestationSubnetHandlers(node: BeaconNode, slot: Slot) =
|
||||||
let forkDigests: array[BeaconStateFork, auto] = [
|
let forkDigests: array[BeaconStateFork, auto] = [
|
||||||
node.dag.forkDigests.phase0,
|
node.dag.forkDigests.phase0,
|
||||||
node.dag.forkDigests.altair,
|
node.dag.forkDigests.altair,
|
||||||
node.dag.forkDigests.merge
|
node.dag.forkDigests.bellatrix
|
||||||
]
|
]
|
||||||
|
|
||||||
for gossipFork in node.gossipState:
|
for gossipFork in node.gossipState:
|
||||||
|
@ -780,7 +780,7 @@ proc updateGossipStatus(node: BeaconNode, slot: Slot) {.async.} =
|
||||||
let forkDigests: array[BeaconStateFork, auto] = [
|
let forkDigests: array[BeaconStateFork, auto] = [
|
||||||
node.dag.forkDigests.phase0,
|
node.dag.forkDigests.phase0,
|
||||||
node.dag.forkDigests.altair,
|
node.dag.forkDigests.altair,
|
||||||
node.dag.forkDigests.merge
|
node.dag.forkDigests.bellatrix
|
||||||
]
|
]
|
||||||
|
|
||||||
const removeMessageHandlers: array[BeaconStateFork, auto] = [
|
const removeMessageHandlers: array[BeaconStateFork, auto] = [
|
||||||
|
@ -1064,7 +1064,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
# Validators introduced in phase0 are also used in altair and merge, but with
|
# Validators introduced in phase0 are also used in altair and merge, but with
|
||||||
# different fork digest
|
# different fork digest
|
||||||
installPhase0Validators(node.dag.forkDigests.altair)
|
installPhase0Validators(node.dag.forkDigests.altair)
|
||||||
installPhase0Validators(node.dag.forkDigests.merge)
|
installPhase0Validators(node.dag.forkDigests.bellatrix)
|
||||||
|
|
||||||
node.network.addValidator(
|
node.network.addValidator(
|
||||||
getBeaconBlocksTopic(node.dag.forkDigests.altair),
|
getBeaconBlocksTopic(node.dag.forkDigests.altair),
|
||||||
|
@ -1073,7 +1073,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
MsgSource.gossip, signedBlock)))
|
MsgSource.gossip, signedBlock)))
|
||||||
|
|
||||||
node.network.addValidator(
|
node.network.addValidator(
|
||||||
getBeaconBlocksTopic(node.dag.forkDigests.merge),
|
getBeaconBlocksTopic(node.dag.forkDigests.bellatrix),
|
||||||
proc (signedBlock: merge.SignedBeaconBlock): ValidationResult =
|
proc (signedBlock: merge.SignedBeaconBlock): ValidationResult =
|
||||||
toValidationResult(node.processor[].blockValidator(
|
toValidationResult(node.processor[].blockValidator(
|
||||||
MsgSource.gossip, signedBlock)))
|
MsgSource.gossip, signedBlock)))
|
||||||
|
@ -1097,7 +1097,7 @@ proc installMessageValidators(node: BeaconNode) =
|
||||||
await node.processor.contributionValidator(MsgSource.gossip, msg)))
|
await node.processor.contributionValidator(MsgSource.gossip, msg)))
|
||||||
|
|
||||||
installSyncCommitteeeValidators(node.dag.forkDigests.altair)
|
installSyncCommitteeeValidators(node.dag.forkDigests.altair)
|
||||||
installSyncCommitteeeValidators(node.dag.forkDigests.merge)
|
installSyncCommitteeeValidators(node.dag.forkDigests.bellatrix)
|
||||||
|
|
||||||
proc stop(node: BeaconNode) =
|
proc stop(node: BeaconNode) =
|
||||||
bnStatus = BeaconNodeStatus.Stopping
|
bnStatus = BeaconNodeStatus.Stopping
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2021 Status Research & Development GmbH
|
# Copyright (c) 2021-2022 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
{.push raises: [Defect].}
|
{.push raises: [Defect].}
|
||||||
|
|
||||||
import
|
import
|
||||||
stew/[assign2],
|
stew/assign2,
|
||||||
chronicles,
|
chronicles,
|
||||||
../extras,
|
../extras,
|
||||||
"."/[eth2_merkleization, eth2_ssz_serialization, presets],
|
"."/[eth2_merkleization, eth2_ssz_serialization, presets],
|
||||||
|
@ -73,8 +73,8 @@ type
|
||||||
|
|
||||||
ForkedBeaconBlock* = object
|
ForkedBeaconBlock* = object
|
||||||
case kind*: BeaconBlockFork
|
case kind*: BeaconBlockFork
|
||||||
of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock
|
of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock
|
||||||
of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock
|
of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock
|
||||||
of BeaconBlockFork.Bellatrix: mergeData*: merge.BeaconBlock
|
of BeaconBlockFork.Bellatrix: mergeData*: merge.BeaconBlock
|
||||||
|
|
||||||
ForkedTrustedBeaconBlock* = object
|
ForkedTrustedBeaconBlock* = object
|
||||||
|
@ -117,9 +117,10 @@ type
|
||||||
ForkyEpochInfo* = phase0.EpochInfo | altair.EpochInfo
|
ForkyEpochInfo* = phase0.EpochInfo | altair.EpochInfo
|
||||||
|
|
||||||
ForkDigests* = object
|
ForkDigests* = object
|
||||||
phase0*: ForkDigest
|
phase0*: ForkDigest
|
||||||
altair*: ForkDigest
|
altair*: ForkDigest
|
||||||
merge*: ForkDigest
|
bellatrix*: ForkDigest
|
||||||
|
sharding*: ForkDigest
|
||||||
|
|
||||||
template toFork*[T: phase0.BeaconState | phase0.HashedBeaconState](
|
template toFork*[T: phase0.BeaconState | phase0.HashedBeaconState](
|
||||||
t: type T): BeaconStateFork =
|
t: type T): BeaconStateFork =
|
||||||
|
@ -501,6 +502,8 @@ func init*(T: type ForkDigests,
|
||||||
compute_fork_digest(cfg.GENESIS_FORK_VERSION, genesisValidatorsRoot),
|
compute_fork_digest(cfg.GENESIS_FORK_VERSION, genesisValidatorsRoot),
|
||||||
altair:
|
altair:
|
||||||
compute_fork_digest(cfg.ALTAIR_FORK_VERSION, genesisValidatorsRoot),
|
compute_fork_digest(cfg.ALTAIR_FORK_VERSION, genesisValidatorsRoot),
|
||||||
merge:
|
bellatrix:
|
||||||
compute_fork_digest(cfg.MERGE_FORK_VERSION, genesisValidatorsRoot),
|
compute_fork_digest(cfg.MERGE_FORK_VERSION, genesisValidatorsRoot),
|
||||||
|
sharding:
|
||||||
|
compute_fork_digest(cfg.SHARDING_FORK_VERSION, genesisValidatorsRoot),
|
||||||
)
|
)
|
||||||
|
|
|
@ -79,7 +79,7 @@ proc readChunkPayload*(conn: Connection, peer: Peer,
|
||||||
return ok ForkedSignedBeaconBlock.init(res.get)
|
return ok ForkedSignedBeaconBlock.init(res.get)
|
||||||
else:
|
else:
|
||||||
return err(res.error)
|
return err(res.error)
|
||||||
elif contextBytes == peer.network.forkDigests.merge:
|
elif contextBytes == peer.network.forkDigests.bellatrix:
|
||||||
let res = await readChunkPayload(conn, peer, merge.SignedBeaconBlock)
|
let res = await readChunkPayload(conn, peer, merge.SignedBeaconBlock)
|
||||||
if res.isOk:
|
if res.isOk:
|
||||||
return ok ForkedSignedBeaconBlock.init(res.get)
|
return ok ForkedSignedBeaconBlock.init(res.get)
|
||||||
|
@ -104,7 +104,7 @@ proc sendResponseChunk*(response: UntypedResponse,
|
||||||
of BeaconBlockFork.Bellatrix:
|
of BeaconBlockFork.Bellatrix:
|
||||||
response.stream.writeChunk(some ResponseCode.Success,
|
response.stream.writeChunk(some ResponseCode.Success,
|
||||||
SSZ.encode(val.mergeData),
|
SSZ.encode(val.mergeData),
|
||||||
response.peer.network.forkDigests.merge.bytes)
|
response.peer.network.forkDigests.bellatrix.bytes)
|
||||||
|
|
||||||
func shortLog*(s: StatusMsg): auto =
|
func shortLog*(s: StatusMsg): auto =
|
||||||
(
|
(
|
||||||
|
|
Loading…
Reference in New Issue