diff --git a/beacon_chain/beacon_chain_db_immutable.nim b/beacon_chain/beacon_chain_db_immutable.nim index 9aa13d504..01a2dd01c 100644 --- a/beacon_chain/beacon_chain_db_immutable.nim +++ b/beacon_chain/beacon_chain_db_immutable.nim @@ -8,9 +8,6 @@ {.push raises: [Defect].} import - stew/results, - serialization, - eth/db/kvstore, ./spec/datatypes/[base, altair, bellatrix], ./spec/[eth2_ssz_serialization, eth2_merkleization] diff --git a/beacon_chain/consensus_object_pools/attestation_pool.nim b/beacon_chain/consensus_object_pools/attestation_pool.nim index acc4e495f..eb08a52cc 100644 --- a/beacon_chain/consensus_object_pools/attestation_pool.nim +++ b/beacon_chain/consensus_object_pools/attestation_pool.nim @@ -490,7 +490,7 @@ func init( if participation_bitmap[validator_index] != 0: # If any flag got set, there was an attestation from this validator. validator_bits[index_in_committee] = true - result.add((slot, committee_index.uint64), validator_bits) + result[(slot, committee_index.uint64)] = validator_bits # This treats all types of rewards as equivalent, which isn't ideal update_attestation_pool_cache( diff --git a/beacon_chain/consensus_object_pools/blockchain_dag.nim b/beacon_chain/consensus_object_pools/blockchain_dag.nim index fd03a6346..9ec8d9ec1 100644 --- a/beacon_chain/consensus_object_pools/blockchain_dag.nim +++ b/beacon_chain/consensus_object_pools/blockchain_dag.nim @@ -21,11 +21,11 @@ export eth2_merkleization, eth2_ssz_serialization, block_pools_types, results, beacon_chain_db -# https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics +# https://github.com/ethereum/beacon-metrics/blob/master/metrics.md#interop-metrics declareGauge beacon_head_root, "Root of the head block of the beacon chain" declareGauge beacon_head_slot, "Slot of the head block of the beacon chain" -# https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics +# https://github.com/ethereum/beacon-metrics/blob/master/metrics.md#interop-metrics declareGauge beacon_finalized_epoch, "Current finalized epoch" # On epoch transition declareGauge beacon_finalized_root, "Current finalized root" # On epoch transition declareGauge beacon_current_justified_epoch, "Current justified epoch" # On epoch transition @@ -542,7 +542,7 @@ proc currentSyncCommitteeForPeriod*( proc updateBeaconMetrics( state: ForkedHashedBeaconState, bid: BlockId, cache: var StateCache) = - # https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#additional-metrics + # https://github.com/ethereum/beacon-metrics/blob/master/metrics.md#additional-metrics # both non-negative, so difference can't overflow or underflow int64 beacon_head_root.set(bid.root.toGaugeValue) diff --git a/beacon_chain/era_db.nim b/beacon_chain/era_db.nim index 63baff1ba..66b6f4818 100644 --- a/beacon_chain/era_db.nim +++ b/beacon_chain/era_db.nim @@ -352,10 +352,10 @@ proc getPartialState( false iterator getBlockIds*( - db: EraDB, historical_roots: openArray[Eth2Digest], startSlot: Slot): BlockId = + db: EraDB, historical_roots: openArray[Eth2Digest], start_slot: Slot): BlockId = var state = (ref PartialBeaconState)() # avoid stack overflow - slot = startSlot + slot = start_slot while true: # `case` ensures we're on a fork for which the `PartialBeaconState` diff --git a/beacon_chain/eth1/eth1_monitor.nim b/beacon_chain/eth1/eth1_monitor.nim index db17b32ce..e6a4cf0dc 100644 --- a/beacon_chain/eth1/eth1_monitor.nim +++ b/beacon_chain/eth1/eth1_monitor.nim @@ -11,7 +11,7 @@ import std/[deques, options, strformat, strutils, sequtils, tables, typetraits, uri, json], # Nimble packages: - chronos, json, metrics, chronicles/timings, stint/endians2, + chronos, metrics, chronicles/timings, stint/endians2, web3, web3/ethtypes as web3Types, web3/ethhexstrings, web3/engine_api, eth/common/eth_types, eth/async_utils, stew/[byteutils, objects, shims/hashes], diff --git a/beacon_chain/fork_choice/proto_array.nim b/beacon_chain/fork_choice/proto_array.nim index 2bde7d05c..cf6145969 100644 --- a/beacon_chain/fork_choice/proto_array.nim +++ b/beacon_chain/fork_choice/proto_array.nim @@ -103,7 +103,7 @@ func init*(T: type ProtoArray, indices: {node.root: 0}.toTable() ) -# https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/fork-choice.md#configuration +# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/fork-choice.md#configuration # https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/fork-choice.md#get_latest_attesting_balance const PROPOSER_SCORE_BOOST* = 40 func calculateProposerBoost(validatorBalances: openArray[Gwei]): int64 = diff --git a/beacon_chain/gossip_processing/block_processor.nim b/beacon_chain/gossip_processing/block_processor.nim index 9ca0395ac..bac5e05b7 100644 --- a/beacon_chain/gossip_processing/block_processor.nim +++ b/beacon_chain/gossip_processing/block_processor.nim @@ -330,7 +330,7 @@ proc runForkchoiceUpdated( # block hash provided by this event is stubbed with # `0x0000000000000000000000000000000000000000000000000000000000000000`." # and - # https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/bellatrix/validator.md#executionpayload + # https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/bellatrix/validator.md#executionpayload # notes "`finalized_block_hash` is the hash of the latest finalized execution # payload (`Hash32()` if none yet finalized)" if headBlockRoot.isZero: diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 8708ab16b..f976a37ce 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -170,7 +170,7 @@ type MounterProc* = proc(network: Eth2Node) {.gcsafe, raises: [Defect, CatchableError].} MessageContentPrinter* = proc(msg: pointer): string {.gcsafe, raises: [Defect].} - # https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#goodbye + # https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/p2p-interface.md#goodbye DisconnectionReason* = enum # might see other values on the wire! ClientShutDown = 1 diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 10aaa34a2..882d02f3c 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -126,7 +126,7 @@ template init(T: type RestServerRef, res.get() -# https://github.com/ethereum/eth2.0-metrics/blob/master/metrics.md#interop-metrics +# https://github.com/ethereum/beacon-metrics/blob/master/metrics.md#interop-metrics declareGauge beacon_slot, "Latest slot of the beacon chain state" declareGauge beacon_current_epoch, "Current epoch" diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 3fa99f4ef..644ad106f 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -512,7 +512,7 @@ proc is_valid_indexed_attestation*( # Attestation validation # ------------------------------------------------------------------------------------------ # https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/beacon-chain.md#attestations -# https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id +# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/p2p-interface.md#beacon_attestation_subnet_id func check_attestation_slot_target*(data: AttestationData): Result[Slot, cstring] = if not (data.target.epoch == epoch(data.slot)): diff --git a/beacon_chain/spec/digest.nim b/beacon_chain/spec/digest.nim index 1d2bcbffa..3629b82b9 100644 --- a/beacon_chain/spec/digest.nim +++ b/beacon_chain/spec/digest.nim @@ -126,5 +126,5 @@ proc readValue*(r: var JsonReader, a: var Eth2Digest) {.raises: [Defect, IOError func toGaugeValue*(hash: Eth2Digest): int64 = # Only the last 8 bytes are taken into consideration in accordance # to the ETH2 metrics spec: - # https://github.com/ethereum/eth2.0-metrics/blob/6a79914cb31f7d54858c7dd57eee75b6162ec737/metrics.md#interop-metrics + # https://github.com/ethereum/beacon-metrics/blob/6a79914cb31f7d54858c7dd57eee75b6162ec737/metrics.md#interop-metrics cast[int64](uint64.fromBytesLE(hash.data.toOpenArray(24, 31))) diff --git a/beacon_chain/spec/eth2_apis/rest_remote_signer_calls.nim b/beacon_chain/spec/eth2_apis/rest_remote_signer_calls.nim index 576cc68bb..da1306860 100644 --- a/beacon_chain/spec/eth2_apis/rest_remote_signer_calls.nim +++ b/beacon_chain/spec/eth2_apis/rest_remote_signer_calls.nim @@ -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 # * 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). @@ -9,7 +9,6 @@ import std/strutils, chronicles, metrics, chronos, chronos/apps/http/httpclient, presto, presto/client, - nimcrypto/utils as ncrutils, serialization, json_serialization, json_serialization/std/[options, net, sets], stew/[results, base10, byteutils], diff --git a/beacon_chain/spec/keystore.nim b/beacon_chain/spec/keystore.nim index dcdd9ef87..46a8e80e6 100644 --- a/beacon_chain/spec/keystore.nim +++ b/beacon_chain/spec/keystore.nim @@ -29,7 +29,7 @@ import nimcrypto/utils as ncrutils export results, burnMem, writeValue, readValue -{.localPassc: "-fno-lto".} # no LTO for crypto +{.localPassC: "-fno-lto".} # no LTO for crypto type KeystoreMode* = enum diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index 52328e660..206dd73f5 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -84,13 +84,13 @@ func getAttestationTopic*(forkDigest: ForkDigest, ## For subscribing and unsubscribing to/from a subnet. eth2Prefix(forkDigest) & "beacon_attestation_" & $(subnetId) & "/ssz_snappy" -# https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/altair/p2p-interface.md#topics-and-messages +# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/p2p-interface.md#topics-and-messages func getSyncCommitteeTopic*(forkDigest: ForkDigest, subcommitteeIdx: SyncSubcommitteeIndex): string = ## For subscribing and unsubscribing to/from a subnet. eth2Prefix(forkDigest) & "sync_committee_" & $subcommitteeIdx & "/ssz_snappy" -# https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/altair/p2p-interface.md#topics-and-messages +# https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/altair/p2p-interface.md#topics-and-messages func getSyncCommitteeContributionAndProofTopic*(forkDigest: ForkDigest): string = ## For subscribing and unsubscribing to/from a subnet. eth2Prefix(forkDigest) & "sync_committee_contribution_and_proof/ssz_snappy" diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index 593eaf860..64259f854 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -1038,23 +1038,23 @@ func process_inactivity_updates*( proc process_epoch*( cfg: RuntimeConfig, state: var phase0.BeaconState, flags: UpdateFlags, cache: var StateCache, info: var phase0.EpochInfo): Result[void, cstring] = - let currentEpoch = get_current_epoch(state) + let current_epoch = get_current_epoch(state) trace "process_epoch", - current_epoch = currentEpoch + current_epoch init(info, state) info.process_attestations(state, cache) process_justification_and_finalization(state, info.balances, flags) # state.slot hasn't been incremented yet. - if verifyFinalization in flags and currentEpoch >= 2: - doAssert state.current_justified_checkpoint.epoch + 2 >= currentEpoch + if verifyFinalization in flags and current_epoch >= 2: + doAssert state.current_justified_checkpoint.epoch + 2 >= current_epoch - if verifyFinalization in flags and currentEpoch >= 3: + if verifyFinalization in flags and current_epoch >= 3: # Rule 2/3/4 finalization results in the most pessimal case. The other # three finalization rules finalize more quickly as long as the any of # the finalization rules triggered. - doAssert state.finalized_checkpoint.epoch + 3 >= currentEpoch + doAssert state.finalized_checkpoint.epoch + 3 >= current_epoch process_rewards_and_penalties(state, info) ? process_registry_updates(cfg, state, cache) @@ -1115,7 +1115,7 @@ proc process_epoch*( process_inactivity_updates(cfg, state, info) # [New in Altair] - # https://github.com/ethereum/consensus-specs/blob/v1.1.1/specs/phase0/beacon-chain.md#rewards-and-penalties-1 + # https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/beacon-chain.md#process_rewards_and_penalties process_rewards_and_penalties(cfg, state, info) # https://github.com/ethereum/consensus-specs/blob/v1.2.0-rc.1/specs/phase0/beacon-chain.md#registry-updates