rename `(with|at)StateFork` > `(with|at)ConsensusFork` (#4725)

This commit is contained in:
Etan Kissling 2023-03-11 15:39:29 +01:00 committed by GitHub
parent eba5f9af26
commit b0cccae7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 15 deletions

View File

@ -348,7 +348,7 @@ proc installMessageValidators*(
when lcDataFork > LightClientDataFork.None:
let
contextFork = consensusFork # Avoid capturing `Deneb` (Nim 1.6)
digest = forkDigests[].atStateFork(contextFork)
digest = forkDigests[].atConsensusFork(contextFork)
lightClient.network.addValidator(
getLightClientFinalityUpdateTopic(digest),
@ -413,7 +413,7 @@ proc updateGossipStatus*(
for gossipFork in oldGossipForks:
if gossipFork >= ConsensusFork.Altair:
let forkDigest = lightClient.forkDigests[].atStateFork(gossipFork)
let forkDigest = lightClient.forkDigests[].atConsensusFork(gossipFork)
lightClient.network.unsubscribe(
getLightClientFinalityUpdateTopic(forkDigest))
lightClient.network.unsubscribe(
@ -421,7 +421,7 @@ proc updateGossipStatus*(
for gossipFork in newGossipForks:
if gossipFork >= ConsensusFork.Altair:
let forkDigest = lightClient.forkDigests[].atStateFork(gossipFork)
let forkDigest = lightClient.forkDigests[].atConsensusFork(gossipFork)
lightClient.network.subscribe(
getLightClientFinalityUpdateTopic(forkDigest),
basicParams)

View File

@ -160,7 +160,7 @@ proc loadChainDag(
RestVersioned[ForkedLightClientFinalityUpdate](
data: data,
jsonVersion: contextFork,
sszContext: dag.forkDigests[].atStateFork(contextFork)))
sszContext: dag.forkDigests[].atConsensusFork(contextFork)))
proc onLightClientOptimisticUpdate(data: ForkedLightClientOptimisticUpdate) =
if dag == nil: return
withForkyOptimisticUpdate(data):
@ -171,7 +171,7 @@ proc loadChainDag(
RestVersioned[ForkedLightClientOptimisticUpdate](
data: data,
jsonVersion: contextFork,
sszContext: dag.forkDigests[].atStateFork(contextFork)))
sszContext: dag.forkDigests[].atConsensusFork(contextFork)))
var extraFlags = {enableTestFeatures}
if config.deploymentPhase <= DeploymentPhase.Testnet:
@ -818,11 +818,11 @@ proc updateBlocksGossipStatus*(
oldGossipForks = currentGossipState - targetGossipState
for gossipFork in oldGossipForks:
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
let forkDigest = node.dag.forkDigests[].atConsensusFork(gossipFork)
node.network.unsubscribe(getBeaconBlocksTopic(forkDigest))
for gossipFork in newGossipForks:
let forkDigest = node.dag.forkDigests[].atStateFork(gossipFork)
let forkDigest = node.dag.forkDigests[].atConsensusFork(gossipFork)
node.network.subscribe(
getBeaconBlocksTopic(forkDigest), blocksTopicParams,
enableTopicMetrics = true)

View File

@ -247,11 +247,11 @@ programMain:
oldGossipForks = currentGossipState - targetGossipState
for gossipFork in oldGossipForks:
let forkDigest = forkDigests[].atStateFork(gossipFork)
let forkDigest = forkDigests[].atConsensusFork(gossipFork)
network.unsubscribe(getBeaconBlocksTopic(forkDigest))
for gossipFork in newGossipForks:
let forkDigest = forkDigests[].atStateFork(gossipFork)
let forkDigest = forkDigests[].atConsensusFork(gossipFork)
network.subscribe(
getBeaconBlocksTopic(forkDigest), blocksTopicParams,
enableTopicMetrics = true)

View File

@ -105,7 +105,7 @@ proc installLightClientApiHandlers*(router: var RestRouter, node: BeaconNode) =
updates.add RestVersioned[ForkedLightClientUpdate](
data: update,
jsonVersion: contextFork,
sszContext: node.dag.forkDigests[].atStateFork(contextFork))
sszContext: node.dag.forkDigests[].atConsensusFork(contextFork))
return
if contentType == sszMediaType:

View File

@ -278,7 +278,7 @@ template BeaconBlockType*(fork: static ConsensusFork): auto =
template BeaconBlockBodyType*(fork: static ConsensusFork): auto =
getSymbolFromForkModule(fork, "BeaconBlockBody")
template withStateFork*(
template withConsensusFork*(
x: ConsensusFork, body: untyped): untyped =
case x
of ConsensusFork.Deneb:
@ -651,7 +651,7 @@ func stateForkForDigest*(
else:
err()
func atStateFork*(
func atConsensusFork*(
forkDigests: ForkDigests, consensusFork: ConsensusFork): ForkDigest =
case consensusFork
of ConsensusFork.Deneb:
@ -667,7 +667,7 @@ func atStateFork*(
template atEpoch*(
forkDigests: ForkDigests, epoch: Epoch, cfg: RuntimeConfig): ForkDigest =
forkDigests.atStateFork(cfg.consensusForkAtEpoch(epoch))
forkDigests.atConsensusFork(cfg.consensusForkAtEpoch(epoch))
template asSigned*(
x: ForkedMsgTrustedSignedBeaconBlock |

View File

@ -65,7 +65,7 @@ suite "EF - Light client - Single merkle proof" & preset():
if kind != pcDir or not dirExists(suitePath):
continue
let objName = path
withStateFork(fork):
withConsensusFork(fork):
for kind, path in walkDir(suitePath, relative = true, checkDir = true):
case objName
of "BeaconBlockBody":

View File

@ -61,7 +61,7 @@ suite "EF - Light client - Update ranking" & preset():
skip()
continue
for kind, path in walkDir(testsPath, relative = true, checkDir = true):
withStateFork(fork):
withConsensusFork(fork):
const lcDataFork = lcDataForkAtStateFork(consensusFork)
when lcDataFork > LightClientDataFork.None:
runTest(testsPath/path, lcDataFork)