From d8f39dd24fc3119a4df567c86e1d69b86668612a Mon Sep 17 00:00:00 2001 From: Etan Kissling Date: Sat, 11 Mar 2023 17:58:48 +0100 Subject: [PATCH] rename `stateForkForDigest` > `consensusForkForDigest` (#4727) --- beacon_chain/spec/forks.nim | 2 +- beacon_chain/sync/sync_protocol.nim | 2 +- tests/consensus_spec/test_fixture_light_client_sync.nim | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/beacon_chain/spec/forks.nim b/beacon_chain/spec/forks.nim index dbdf29837..cc38a400b 100644 --- a/beacon_chain/spec/forks.nim +++ b/beacon_chain/spec/forks.nim @@ -635,7 +635,7 @@ func consensusForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): ConsensusFork = elif epoch >= cfg.ALTAIR_FORK_EPOCH: ConsensusFork.Altair else: ConsensusFork.Phase0 -func stateForkForDigest*( +func consensusForkForDigest*( forkDigests: ForkDigests, forkDigest: ForkDigest): Opt[ConsensusFork] = static: doAssert high(ConsensusFork) == ConsensusFork.Deneb if forkDigest == forkDigests.deneb: diff --git a/beacon_chain/sync/sync_protocol.nim b/beacon_chain/sync/sync_protocol.nim index 58e664522..149a26e0c 100644 --- a/beacon_chain/sync/sync_protocol.nim +++ b/beacon_chain/sync/sync_protocol.nim @@ -147,7 +147,7 @@ proc readChunkPayload*( except CatchableError: return neterr UnexpectedEOF let contextFork = - peer.network.forkDigests[].stateForkForDigest(contextBytes).valueOr: + peer.network.forkDigests[].consensusForkForDigest(contextBytes).valueOr: return neterr InvalidContextBytes withLcDataFork(lcDataForkAtStateFork(contextFork)): diff --git a/tests/consensus_spec/test_fixture_light_client_sync.nim b/tests/consensus_spec/test_fixture_light_client_sync.nim index ca5099c52..7be059cb1 100644 --- a/tests/consensus_spec/test_fixture_light_client_sync.nim +++ b/tests/consensus_spec/test_fixture_light_client_sync.nim @@ -87,7 +87,7 @@ proc loadSteps(path: string, fork_digests: ForkDigests): seq[TestStep] = distinctBase(ForkDigest).fromHex(s{"update_fork_digest"}.getStr( distinctBase(fork_digests.altair).toHex())).ForkDigest update_state_fork = - fork_digests.stateForkForDigest(update_fork_digest) + fork_digests.consensusForkForDigest(update_fork_digest) .expect("Unknown update fork " & $update_fork_digest) update_filename = s["update"].getStr() @@ -112,7 +112,7 @@ proc loadSteps(path: string, fork_digests: ForkDigests): seq[TestStep] = distinctBase(ForkDigest).fromHex( s["store_fork_digest"].getStr()).ForkDigest store_state_fork = - fork_digests.stateForkForDigest(store_fork_digest) + fork_digests.consensusForkForDigest(store_fork_digest) .expect("Unknown store fork " & $store_fork_digest) result.add TestStep( @@ -169,7 +169,7 @@ proc runTest(path: string) = # Reduce stack size by making this a `proc` proc loadBootstrap(): ForkedLightClientBootstrap = let bootstrap_state_fork = - meta.fork_digests.stateForkForDigest(meta.bootstrap_fork_digest) + meta.fork_digests.consensusForkForDigest(meta.bootstrap_fork_digest) .expect("Unknown bootstrap fork " & $meta.bootstrap_fork_digest) var bootstrap {.noinit.}: ForkedLightClientBootstrap withLcDataFork(lcDataForkAtStateFork(bootstrap_state_fork)): @@ -186,7 +186,7 @@ proc runTest(path: string) = proc initializeStore( bootstrap: ref ForkedLightClientBootstrap): ForkedLightClientStore = let store_state_fork = - meta.fork_digests.stateForkForDigest(meta.store_fork_digest) + meta.fork_digests.consensusForkForDigest(meta.store_fork_digest) .expect("Unknown store fork " & $meta.store_fork_digest) var store {.noinit.}: ForkedLightClientStore withLcDataFork(lcDataForkAtStateFork(store_state_fork)):