rename `stateForkForDigest` > `consensusForkForDigest` (#4727)

This commit is contained in:
Etan Kissling 2023-03-11 17:58:48 +01:00 committed by GitHub
parent b0cccae7f4
commit d8f39dd24f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -635,7 +635,7 @@ func consensusForkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): ConsensusFork =
elif epoch >= cfg.ALTAIR_FORK_EPOCH: ConsensusFork.Altair elif epoch >= cfg.ALTAIR_FORK_EPOCH: ConsensusFork.Altair
else: ConsensusFork.Phase0 else: ConsensusFork.Phase0
func stateForkForDigest*( func consensusForkForDigest*(
forkDigests: ForkDigests, forkDigest: ForkDigest): Opt[ConsensusFork] = forkDigests: ForkDigests, forkDigest: ForkDigest): Opt[ConsensusFork] =
static: doAssert high(ConsensusFork) == ConsensusFork.Deneb static: doAssert high(ConsensusFork) == ConsensusFork.Deneb
if forkDigest == forkDigests.deneb: if forkDigest == forkDigests.deneb:

View File

@ -147,7 +147,7 @@ proc readChunkPayload*(
except CatchableError: except CatchableError:
return neterr UnexpectedEOF return neterr UnexpectedEOF
let contextFork = let contextFork =
peer.network.forkDigests[].stateForkForDigest(contextBytes).valueOr: peer.network.forkDigests[].consensusForkForDigest(contextBytes).valueOr:
return neterr InvalidContextBytes return neterr InvalidContextBytes
withLcDataFork(lcDataForkAtStateFork(contextFork)): withLcDataFork(lcDataForkAtStateFork(contextFork)):

View File

@ -87,7 +87,7 @@ proc loadSteps(path: string, fork_digests: ForkDigests): seq[TestStep] =
distinctBase(ForkDigest).fromHex(s{"update_fork_digest"}.getStr( distinctBase(ForkDigest).fromHex(s{"update_fork_digest"}.getStr(
distinctBase(fork_digests.altair).toHex())).ForkDigest distinctBase(fork_digests.altair).toHex())).ForkDigest
update_state_fork = update_state_fork =
fork_digests.stateForkForDigest(update_fork_digest) fork_digests.consensusForkForDigest(update_fork_digest)
.expect("Unknown update fork " & $update_fork_digest) .expect("Unknown update fork " & $update_fork_digest)
update_filename = s["update"].getStr() update_filename = s["update"].getStr()
@ -112,7 +112,7 @@ proc loadSteps(path: string, fork_digests: ForkDigests): seq[TestStep] =
distinctBase(ForkDigest).fromHex( distinctBase(ForkDigest).fromHex(
s["store_fork_digest"].getStr()).ForkDigest s["store_fork_digest"].getStr()).ForkDigest
store_state_fork = store_state_fork =
fork_digests.stateForkForDigest(store_fork_digest) fork_digests.consensusForkForDigest(store_fork_digest)
.expect("Unknown store fork " & $store_fork_digest) .expect("Unknown store fork " & $store_fork_digest)
result.add TestStep( result.add TestStep(
@ -169,7 +169,7 @@ proc runTest(path: string) =
# Reduce stack size by making this a `proc` # Reduce stack size by making this a `proc`
proc loadBootstrap(): ForkedLightClientBootstrap = proc loadBootstrap(): ForkedLightClientBootstrap =
let bootstrap_state_fork = 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) .expect("Unknown bootstrap fork " & $meta.bootstrap_fork_digest)
var bootstrap {.noinit.}: ForkedLightClientBootstrap var bootstrap {.noinit.}: ForkedLightClientBootstrap
withLcDataFork(lcDataForkAtStateFork(bootstrap_state_fork)): withLcDataFork(lcDataForkAtStateFork(bootstrap_state_fork)):
@ -186,7 +186,7 @@ proc runTest(path: string) =
proc initializeStore( proc initializeStore(
bootstrap: ref ForkedLightClientBootstrap): ForkedLightClientStore = bootstrap: ref ForkedLightClientBootstrap): ForkedLightClientStore =
let store_state_fork = 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) .expect("Unknown store fork " & $meta.store_fork_digest)
var store {.noinit.}: ForkedLightClientStore var store {.noinit.}: ForkedLightClientStore
withLcDataFork(lcDataForkAtStateFork(store_state_fork)): withLcDataFork(lcDataForkAtStateFork(store_state_fork)):