From 351c2fd48a8bf05457b1b8af42457c9c8c520f07 Mon Sep 17 00:00:00 2001 From: tersec Date: Mon, 24 Jan 2022 16:23:13 +0000 Subject: [PATCH] rename mergeData to bellatrixData and mergeFork to bellatrixFork (#3315) --- .../consensus_object_pools/blockchain_dag.nim | 10 +-- .../gossip_processing/gossip_validation.nim | 2 +- .../eth2_apis/eth2_rest_serialization.nim | 10 +-- beacon_chain/spec/forks.nim | 70 +++++++++---------- beacon_chain/spec/state_transition.nim | 4 +- beacon_chain/sync/sync_protocol.nim | 2 +- beacon_chain/validator_client/api.nim | 2 +- ncli/ncli.nim | 2 +- research/block_sim.nim | 2 +- research/wss_sim.nim | 4 +- .../bellatrix/test_fixture_sanity_blocks.nim | 9 +-- .../bellatrix/test_fixture_sanity_slots.nim | 4 +- tests/test_beacon_chain_db.nim | 14 ++-- tests/test_gossip_validation.nim | 2 +- 14 files changed, 69 insertions(+), 68 deletions(-) diff --git a/beacon_chain/consensus_object_pools/blockchain_dag.nim b/beacon_chain/consensus_object_pools/blockchain_dag.nim index e61fcafe0..62eb03a1f 100644 --- a/beacon_chain/consensus_object_pools/blockchain_dag.nim +++ b/beacon_chain/consensus_object_pools/blockchain_dag.nim @@ -142,7 +142,7 @@ func init*( of BeaconStateFork.Altair: false of BeaconStateFork.Bellatrix: # https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/beacon-chain.md#is_merge_transition_complete - state.data.mergeData.data.latest_execution_payload_header != + state.data.bellatrixData.data.latest_execution_payload_header != ExecutionPayloadHeader() ) epochStart = epoch.start_slot() @@ -349,7 +349,7 @@ proc getStateData( case expectedFork of BeaconStateFork.Bellatrix: - if not db.getState(root.get(), state.data.mergeData.data, rollback): + if not db.getState(root.get(), state.data.bellatrixData.data, rollback): return false of BeaconStateFork.Altair: if not db.getState(root.get(), state.data.altairData.data, rollback): @@ -516,11 +516,11 @@ proc init*(T: type ChainDAGRef, cfg: RuntimeConfig, db: BeaconChainDB, configFork = altairFork(cfg) quit 1 of BeaconStateFork.Bellatrix: - if tmpState.data.mergeData.data.fork != mergeFork(cfg): + if tmpState.data.bellatrixData.data.fork != bellatrixFork(cfg): error "State from database does not match network, check --network parameter", genesisRef, tailRef, headRef, tailRoot, headRoot, - stateFork = tmpState.data.mergeData.data.fork, - configFork = mergeFork(cfg) + stateFork = tmpState.data.bellatrixData.data.fork, + configFork = bellatrixFork(cfg) quit 1 let dag = ChainDAGRef( diff --git a/beacon_chain/gossip_processing/gossip_validation.nim b/beacon_chain/gossip_processing/gossip_validation.nim index 950ed863f..c34866bce 100644 --- a/beacon_chain/gossip_processing/gossip_validation.nim +++ b/beacon_chain/gossip_processing/gossip_validation.nim @@ -216,7 +216,7 @@ template validateBeaconBlockBellatrix( # shows how this gets folded into the state each block; checking this # is equivalent, without ever requiring state replay or any similarly # expensive computation. - blockData.mergeData.message.body.execution_payload != + blockData.bellatrixData.message.body.execution_payload != default(ExecutionPayload) if executionEnabled: diff --git a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim index 97d0a4e95..7146f0d9f 100644 --- a/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim +++ b/beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim @@ -734,7 +734,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: ForkedBeaconBlock) {. writer.writeField("version", "merge") when false: # TODO SerializationError - writer.writeField("data", value.mergeData) + writer.writeField("data", value.bellatrixData) writer.endRecord() ## ForkedSignedBeaconBlock @@ -823,7 +823,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], writer.writeField("version", "merge") when false: # TODO SerializationError - writer.writeField("data", value.mergeData) + writer.writeField("data", value.bellatrixData) writer.endRecord() # ForkedHashedBeaconState is used where a `ForkedBeaconState` normally would @@ -891,11 +891,11 @@ proc readValue*(reader: var JsonReader[RestJson], toValue(altairData) of BeaconStateFork.Bellatrix: try: - tmp[].mergeData.data = RestJson.decode( + tmp[].bellatrixData.data = RestJson.decode( string(data.get()), bellatrix.BeaconState, requireAllFields = true) except SerializationError: reader.raiseUnexpectedValue("Incorrect altair beacon state format") - toValue(mergeData) + toValue(bellatrixData) proc writeValue*(writer: var JsonWriter[RestJson], value: ForkedHashedBeaconState) {. raises: [IOError, Defect].} = @@ -911,7 +911,7 @@ proc writeValue*(writer: var JsonWriter[RestJson], value: ForkedHashedBeaconStat writer.writeField("version", "merge") when false: # TODO SerializationError - writer.writeField("data", value.mergeData.data) + writer.writeField("data", value.bellatrixData.data) writer.endRecord() # Web3SignerRequest diff --git a/beacon_chain/spec/forks.nim b/beacon_chain/spec/forks.nim index 8cf19d7cd..786322cb1 100644 --- a/beacon_chain/spec/forks.nim +++ b/beacon_chain/spec/forks.nim @@ -52,9 +52,9 @@ type ForkedHashedBeaconState* = object case kind*: BeaconStateFork - of BeaconStateFork.Phase0: phase0Data*: phase0.HashedBeaconState - of BeaconStateFork.Altair: altairData*: altair.HashedBeaconState - of BeaconStateFork.Bellatrix: mergeData*: bellatrix.HashedBeaconState + of BeaconStateFork.Phase0: phase0Data*: phase0.HashedBeaconState + of BeaconStateFork.Altair: altairData*: altair.HashedBeaconState + of BeaconStateFork.Bellatrix: bellatrixData*: bellatrix.HashedBeaconState BeaconBlockFork* {.pure.} = enum Phase0 @@ -78,15 +78,15 @@ type ForkedBeaconBlock* = object case kind*: BeaconBlockFork - of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock - of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock - of BeaconBlockFork.Bellatrix: mergeData*: bellatrix.BeaconBlock + of BeaconBlockFork.Phase0: phase0Data*: phase0.BeaconBlock + of BeaconBlockFork.Altair: altairData*: altair.BeaconBlock + of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.BeaconBlock ForkedTrustedBeaconBlock* = object case kind*: BeaconBlockFork - of BeaconBlockFork.Phase0: phase0Data*: phase0.TrustedBeaconBlock - of BeaconBlockFork.Altair: altairData*: altair.TrustedBeaconBlock - of BeaconBlockFork.Bellatrix: mergeData*: bellatrix.TrustedBeaconBlock + of BeaconBlockFork.Phase0: phase0Data*: phase0.TrustedBeaconBlock + of BeaconBlockFork.Altair: altairData*: altair.TrustedBeaconBlock + of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.TrustedBeaconBlock ForkySignedBeaconBlock* = phase0.SignedBeaconBlock | @@ -95,9 +95,9 @@ type ForkedSignedBeaconBlock* = object case kind*: BeaconBlockFork - of BeaconBlockFork.Phase0: phase0Data*: phase0.SignedBeaconBlock - of BeaconBlockFork.Altair: altairData*: altair.SignedBeaconBlock - of BeaconBlockFork.Bellatrix: mergeData*: bellatrix.SignedBeaconBlock + of BeaconBlockFork.Phase0: phase0Data*: phase0.SignedBeaconBlock + of BeaconBlockFork.Altair: altairData*: altair.SignedBeaconBlock + of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.SignedBeaconBlock ForkySigVerifiedSignedBeaconBlock* = phase0.SigVerifiedSignedBeaconBlock | @@ -111,9 +111,9 @@ type ForkedTrustedSignedBeaconBlock* = object case kind*: BeaconBlockFork - of BeaconBlockFork.Phase0: phase0Data*: phase0.TrustedSignedBeaconBlock - of BeaconBlockFork.Altair: altairData*: altair.TrustedSignedBeaconBlock - of BeaconBlockFork.Bellatrix: mergeData*: bellatrix.TrustedSignedBeaconBlock + of BeaconBlockFork.Phase0: phase0Data*: phase0.TrustedSignedBeaconBlock + of BeaconBlockFork.Altair: altairData*: altair.TrustedSignedBeaconBlock + of BeaconBlockFork.Bellatrix: bellatrixData*: bellatrix.TrustedSignedBeaconBlock SomeForkySignedBeaconBlock* = ForkySignedBeaconBlock | @@ -152,28 +152,28 @@ template init*(T: type ForkedHashedBeaconState, data: phase0.HashedBeaconState): template init*(T: type ForkedHashedBeaconState, data: altair.HashedBeaconState): T = T(kind: BeaconStateFork.Altair, altairData: data) template init*(T: type ForkedHashedBeaconState, data: bellatrix.HashedBeaconState): T = - T(kind: BeaconStateFork.Bellatrix, mergeData: data) + T(kind: BeaconStateFork.Bellatrix, bellatrixData: data) template init*(T: type ForkedBeaconBlock, blck: phase0.BeaconBlock): T = T(kind: BeaconBlockFork.Phase0, phase0Data: blck) template init*(T: type ForkedBeaconBlock, blck: altair.BeaconBlock): T = T(kind: BeaconBlockFork.Altair, altairData: blck) template init*(T: type ForkedBeaconBlock, blck: bellatrix.BeaconBlock): T = - T(kind: BeaconBlockFork.Bellatrix, mergeData: blck) + T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck) template init*(T: type ForkedTrustedBeaconBlock, blck: phase0.TrustedBeaconBlock): T = T(kind: BeaconBlockFork.Phase0, phase0Data: blck) template init*(T: type ForkedTrustedBeaconBlock, blck: altair.TrustedBeaconBlock): T = T(kind: BeaconBlockFork.Altair, altairData: blck) template init*(T: type ForkedTrustedBeaconBlock, blck: bellatrix.TrustedBeaconBlock): T = - T(kind: BeaconBlockFork.Bellatrix, mergeData: blck) + T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck) template init*(T: type ForkedSignedBeaconBlock, blck: phase0.SignedBeaconBlock): T = T(kind: BeaconBlockFork.Phase0, phase0Data: blck) template init*(T: type ForkedSignedBeaconBlock, blck: altair.SignedBeaconBlock): T = T(kind: BeaconBlockFork.Altair, altairData: blck) template init*(T: type ForkedSignedBeaconBlock, blck: bellatrix.SignedBeaconBlock): T = - T(kind: BeaconBlockFork.Bellatrix, mergeData: blck) + T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck) template init*(T: type ForkedSignedBeaconBlock, forked: ForkedBeaconBlock, blockRoot: Eth2Digest, signature: ValidatorSig): T = @@ -190,16 +190,16 @@ template init*(T: type ForkedSignedBeaconBlock, forked: ForkedBeaconBlock, signature: signature)) of BeaconBlockFork.Bellatrix: T(kind: BeaconBlockFork.Bellatrix, - mergeData: bellatrix.SignedBeaconBlock(message: forked.mergeData, - root: blockRoot, - signature: signature)) + bellatrixData: bellatrix.SignedBeaconBlock(message: forked.bellatrixData, + root: blockRoot, + signature: signature)) template init*(T: type ForkedTrustedSignedBeaconBlock, blck: phase0.TrustedSignedBeaconBlock): T = T(kind: BeaconBlockFork.Phase0, phase0Data: blck) template init*(T: type ForkedTrustedSignedBeaconBlock, blck: altair.TrustedSignedBeaconBlock): T = T(kind: BeaconBlockFork.Altair, altairData: blck) template init*(T: type ForkedTrustedSignedBeaconBlock, blck: bellatrix.TrustedSignedBeaconBlock): T = - T(kind: BeaconBlockFork.Bellatrix, mergeData: blck) + T(kind: BeaconBlockFork.Bellatrix, bellatrixData: blck) template toFork*[T: phase0.TrustedSignedBeaconBlock]( t: type T): BeaconBlockFork = @@ -220,7 +220,7 @@ template withState*(x: ForkedHashedBeaconState, body: untyped): untyped = case x.kind of BeaconStateFork.Bellatrix: const stateFork {.inject, used.} = BeaconStateFork.Bellatrix - template state: untyped {.inject, used.} = x.mergeData + template state: untyped {.inject, used.} = x.bellatrixData body of BeaconStateFork.Altair: const stateFork {.inject, used.} = BeaconStateFork.Altair @@ -259,11 +259,11 @@ func assign*(tgt: var ForkedHashedBeaconState, src: ForkedHashedBeaconState) = if tgt.kind == src.kind: case tgt.kind of BeaconStateFork.Bellatrix: - assign(tgt.mergeData, src.mergeData): + assign(tgt.bellatrixData, src.bellatrixData): of BeaconStateFork.Altair: - assign(tgt.altairData, src.altairData): + assign(tgt.altairData, src.altairData): of BeaconStateFork.Phase0: - assign(tgt.phase0Data, src.phase0Data): + assign(tgt.phase0Data, src.phase0Data): else: # Ensure case object and discriminator get updated simultaneously, even # with nimOldCaseObjects. This is infrequent. @@ -276,7 +276,7 @@ template getStateField*(x: ForkedHashedBeaconState, y: untyped): untyped = # ``` # Without `unsafeAddr`, the `validators` list would be copied to a temporary variable. (case x.kind - of BeaconStateFork.Bellatrix: unsafeAddr x.mergeData.data.y + of BeaconStateFork.Bellatrix: unsafeAddr x.bellatrixData.data.y of BeaconStateFork.Altair: unsafeAddr x.altairData.data.y of BeaconStateFork.Phase0: unsafeAddr x.phase0Data.data.y)[] @@ -324,7 +324,7 @@ template withBlck*( body of BeaconBlockFork.Bellatrix: const stateFork {.inject, used.} = BeaconStateFork.Bellatrix - template blck: untyped {.inject.} = x.mergeData + template blck: untyped {.inject.} = x.bellatrixData body func proposer_index*(x: ForkedBeaconBlock): uint64 = @@ -338,7 +338,7 @@ template getForkedBlockField*(x: ForkedSignedBeaconBlock | ForkedTrustedSignedBe (case x.kind of BeaconBlockFork.Phase0: unsafeAddr x.phase0Data.message.y of BeaconBlockFork.Altair: unsafeAddr x.altairData.message.y - of BeaconBlockFork.Bellatrix: unsafeAddr x.mergeData.message.y)[] + of BeaconBlockFork.Bellatrix: unsafeAddr x.bellatrixData.message.y)[] template signature*(x: ForkedSignedBeaconBlock): ValidatorSig = withBlck(x): blck.signature @@ -370,8 +370,8 @@ template withStateAndBlck*( case s.kind of BeaconStateFork.Bellatrix: const stateFork {.inject.} = BeaconStateFork.Bellatrix - template state: untyped {.inject.} = s.mergeData - template blck: untyped {.inject.} = b.mergeData + template state: untyped {.inject.} = s.bellatrixData + template blck: untyped {.inject.} = b.bellatrixData body of BeaconStateFork.Altair: const stateFork {.inject.} = BeaconStateFork.Altair @@ -396,7 +396,7 @@ func altairFork*(cfg: RuntimeConfig): Fork = current_version: cfg.ALTAIR_FORK_VERSION, epoch: cfg.ALTAIR_FORK_EPOCH) -func mergeFork*(cfg: RuntimeConfig): Fork = +func bellatrixFork*(cfg: RuntimeConfig): Fork = # TODO in theory, the altair + merge forks could be in same epoch, so the # previous fork version would be the GENESIS_FORK_VERSION Fork( @@ -406,7 +406,7 @@ func mergeFork*(cfg: RuntimeConfig): Fork = proc forkAtEpoch*(cfg: RuntimeConfig, epoch: Epoch): Fork = case cfg.stateForkAtEpoch(epoch) - of BeaconStateFork.Bellatrix: cfg.mergeFork + of BeaconStateFork.Bellatrix: cfg.bellatrixFork of BeaconStateFork.Altair: cfg.altairFork of BeaconStateFork.Phase0: cfg.genesisFork @@ -428,7 +428,7 @@ func getForkSchedule*(cfg: RuntimeConfig): array[3, Fork] = ## This procedure is used by HTTP REST framework and validator client. ## ## NOTE: Update this procedure when new fork will be scheduled. - [cfg.genesisFork(), cfg.altairFork(), cfg.mergeFork()] + [cfg.genesisFork(), cfg.altairFork(), cfg.bellatrixFork()] type # The first few fields of a state, shared across all forks diff --git a/beacon_chain/spec/state_transition.nim b/beacon_chain/spec/state_transition.nim index 1204a7294..8244fcafd 100644 --- a/beacon_chain/spec/state_transition.nim +++ b/beacon_chain/spec/state_transition.nim @@ -174,7 +174,7 @@ func maybeUpgradeStateToBellatrix( var newState = upgrade_to_bellatrix(cfg, state.altairData.data) state = (ref ForkedHashedBeaconState)( kind: BeaconStateFork.Bellatrix, - mergeData: bellatrix.HashedBeaconState( + bellatrixData: bellatrix.HashedBeaconState( root: hash_tree_root(newState[]), data: newState[]))[] proc maybeUpgradeState*( @@ -534,4 +534,4 @@ proc makeBeaconBlock*( case state.kind of BeaconStateFork.Phase0: makeBeaconBlock(phase0) of BeaconStateFork.Altair: makeBeaconBlock(altair) - of BeaconStateFork.Bellatrix: makeBeaconBlock(merge) + of BeaconStateFork.Bellatrix: makeBeaconBlock(bellatrix) diff --git a/beacon_chain/sync/sync_protocol.nim b/beacon_chain/sync/sync_protocol.nim index 00ac4f3af..c3b72764b 100644 --- a/beacon_chain/sync/sync_protocol.nim +++ b/beacon_chain/sync/sync_protocol.nim @@ -103,7 +103,7 @@ proc sendResponseChunk*(response: UntypedResponse, response.peer.network.forkDigests.altair.data) of BeaconBlockFork.Bellatrix: response.stream.writeChunk(some ResponseCode.Success, - SSZ.encode(val.mergeData), + SSZ.encode(val.bellatrixData), response.peer.network.forkDigests.bellatrix.data) func shortLog*(s: StatusMsg): auto = diff --git a/beacon_chain/validator_client/api.nim b/beacon_chain/validator_client/api.nim index c257dabea..daa51c899 100644 --- a/beacon_chain/validator_client/api.nim +++ b/beacon_chain/validator_client/api.nim @@ -776,7 +776,7 @@ proc publishBlock*(vc: ValidatorClientRef, of BeaconBlockFork.Bellatrix: raiseAssert "trying to publish merge block" # TODO this doesn't build due to some nim-presto error - # publishBlock(it, data.mergeData) + # publishBlock(it, data.bellatrixData) do: if apiResponse.isErr(): debug "Unable to publish block", endpoint = node, diff --git a/ncli/ncli.nim b/ncli/ncli.nim index 0efa96d3e..2d9eda47d 100644 --- a/ncli/ncli.nim +++ b/ncli/ncli.nim @@ -78,7 +78,7 @@ template saveSSZFile(filename: string, value: ForkedHashedBeaconState) = case value.kind: of BeaconStateFork.Phase0: SSZ.saveFile(filename, value.phase0Data.data) of BeaconStateFork.Altair: SSZ.saveFile(filename, value.altairData.data) - of BeaconStateFork.Bellatrix: SSZ.saveFile(filename, value.mergeData.data) + of BeaconStateFork.Bellatrix: SSZ.saveFile(filename, value.bellatrixData.data) proc doTransition(conf: NcliConf) = let diff --git a/research/block_sim.nim b/research/block_sim.nim index 5a75c5330..6c8a7378c 100644 --- a/research/block_sim.nim +++ b/research/block_sim.nim @@ -260,7 +260,7 @@ cli do(slots = SLOTS_PER_EPOCH * 6, elif T is altair.SignedBeaconBlock: addr stateData.data.altairData elif T is bellatrix.SignedBeaconBlock: - addr stateData.data.mergeData + addr stateData.data.bellatrixData else: static: doAssert false message = makeBeaconBlock( diff --git a/research/wss_sim.nim b/research/wss_sim.nim index 1ff59996d..d6ac29e01 100644 --- a/research/wss_sim.nim +++ b/research/wss_sim.nim @@ -181,9 +181,9 @@ cli do(validatorsDir: string, secretsDir: string, validators[proposer]).toValidatorSig()) dump(".", signedBlock) of BeaconBlockFork.Bellatrix: - blockRoot = hash_tree_root(message.mergeData) + blockRoot = hash_tree_root(message.bellatrixData) let signedBlock = bellatrix.SignedBeaconBlock( - message: message.mergeData, + message: message.bellatrixData, root: blockRoot, signature: get_block_signature( fork, genesis_validators_root, slot, blockRoot, diff --git a/tests/consensus_spec/bellatrix/test_fixture_sanity_blocks.nim b/tests/consensus_spec/bellatrix/test_fixture_sanity_blocks.nim index e4807233e..f639d0594 100644 --- a/tests/consensus_spec/bellatrix/test_fixture_sanity_blocks.nim +++ b/tests/consensus_spec/bellatrix/test_fixture_sanity_blocks.nim @@ -36,9 +36,10 @@ proc runTest(testName, testDir, unitTestName: string) = var preState = newClone(parseTest( testPath/"pre.ssz_snappy", SSZ, bellatrix.BeaconState)) - fhPreState = (ref ForkedHashedBeaconState)(mergeData: bellatrix.HashedBeaconState( - data: preState[], root: hash_tree_root(preState[])), - kind: BeaconStateFork.Bellatrix) + fhPreState = (ref ForkedHashedBeaconState)( + bellatrixData: bellatrix.HashedBeaconState( + data: preState[], root: hash_tree_root(preState[])), + kind: BeaconStateFork.Bellatrix) cache = StateCache() info = ForkedEpochInfo() @@ -68,7 +69,7 @@ proc runTest(testName, testDir, unitTestName: string) = let postState = newClone(parseTest( testPath/"post.ssz_snappy", SSZ, bellatrix.BeaconState)) when false: - reportDiff(fhPreState.mergeData.data, postState) + reportDiff(fhPreState.bellatrixData.data, postState) doAssert getStateRoot(fhPreState[]) == postState[].hash_tree_root() `testImpl _ blck _ testName`() diff --git a/tests/consensus_spec/bellatrix/test_fixture_sanity_slots.nim b/tests/consensus_spec/bellatrix/test_fixture_sanity_slots.nim index f46826a64..45e3880c2 100644 --- a/tests/consensus_spec/bellatrix/test_fixture_sanity_slots.nim +++ b/tests/consensus_spec/bellatrix/test_fixture_sanity_slots.nim @@ -31,7 +31,7 @@ proc runTest(identifier: string) = preState = newClone(parseTest( testDir/"pre.ssz_snappy", SSZ, bellatrix.BeaconState)) fhPreState = (ref ForkedHashedBeaconState)( - mergeData: bellatrix.HashedBeaconState( + bellatrixData: bellatrix.HashedBeaconState( data: preState[], root: hash_tree_root(preState[])), kind: BeaconStateFork.Bellatrix) cache = StateCache() @@ -45,7 +45,7 @@ proc runTest(identifier: string) = getStateField(fhPreState[], slot) + num_slots, cache, info, {}).isOk() getStateRoot(fhPreState[]) == postState[].hash_tree_root() - let newPreState = newClone(fhPreState.mergeData.data) + let newPreState = newClone(fhPreState.bellatrixData.data) reportDiff(newPreState, postState) `testImpl _ slots _ identifier`() diff --git a/tests/test_beacon_chain_db.nim b/tests/test_beacon_chain_db.nim index f4324d428..0c827ff79 100644 --- a/tests/test_beacon_chain_db.nim +++ b/tests/test_beacon_chain_db.nim @@ -248,8 +248,8 @@ suite "Beacon chain DB" & preset(): var db = makeTestDB(SLOTS_PER_EPOCH) for state in testStatesBellatrix: - let root = state[].mergeData.root - db.putState(root, state[].mergeData.data) + let root = state[].bellatrixData.root + db.putState(root, state[].bellatrixData.data) check: db.containsState(root) @@ -307,8 +307,8 @@ suite "Beacon chain DB" & preset(): let stateBuffer = (bellatrix.BeaconStateRef)() for state in testStatesBellatrix: - let root = state[].mergeData.root - db.putState(root, state[].mergeData.data) + let root = state[].bellatrixData.root + db.putState(root, state[].bellatrixData.data) check: db.getState(root, stateBuffer[], noRollback) @@ -378,7 +378,7 @@ suite "Beacon chain DB" & preset(): dag = init(ChainDAGRef, defaultRuntimeConfig, db, validatorMonitor, {}) state = (ref ForkedHashedBeaconState)( kind: BeaconStateFork.Bellatrix, - mergeData: bellatrix.HashedBeaconState(data: bellatrix.BeaconState( + bellatrixData: bellatrix.HashedBeaconState(data: bellatrix.BeaconState( slot: 10.Slot))) root = Eth2Digest() @@ -390,8 +390,8 @@ suite "Beacon chain DB" & preset(): assign(state[], restoreAddr[].data) check: - state[].mergeData.data.slot == 10.Slot - not db.getState(root, state[].mergeData.data, restore) + state[].bellatrixData.data.slot == 10.Slot + not db.getState(root, state[].bellatrixData.data, restore) # assign() has switched the case object fork state[].kind == BeaconStateFork.Phase0 diff --git a/tests/test_gossip_validation.nim b/tests/test_gossip_validation.nim index 4c04df1a3..8fe0f71d1 100644 --- a/tests/test_gossip_validation.nim +++ b/tests/test_gossip_validation.nim @@ -205,7 +205,7 @@ suite "Gossip validation - Extra": # Not based on preset config dag.addHeadBlock(verifier, blck.altairData, nilCallback) of BeaconBlockFork.Bellatrix: const nilCallback = OnMergeBlockAdded(nil) - dag.addHeadBlock(verifier, blck.mergeData, nilCallback) + dag.addHeadBlock(verifier, blck.bellatrixData, nilCallback) check: added.isOk() dag.updateHead(added[], quarantine[]) dag