diff --git a/beacon_chain/networking/eth2_network.nim b/beacon_chain/networking/eth2_network.nim index 70054014f..24986ea69 100644 --- a/beacon_chain/networking/eth2_network.nim +++ b/beacon_chain/networking/eth2_network.nim @@ -1829,19 +1829,15 @@ proc newBeaconSwitch*(config: BeaconNodeConf, seckey: PrivateKey, .withTcpTransport({ServerFlags.ReuseAddr}) .build() -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/p2p-interface.md#configuration -# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration func maxGossipMaxSize(): auto {.compileTime.} = - max(GOSSIP_MAX_SIZE, GOSSIP_MAX_SIZE_MERGE) + max(GOSSIP_MAX_SIZE, GOSSIP_MAX_SIZE_BELLATRIX) -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/p2p-interface.md#configuration -# https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration template gossipMaxSize(T: untyped): uint32 = const maxSize = static: when isFixedSize(T): fixedPortionSize(T) elif T is bellatrix.SignedBeaconBlock: - GOSSIP_MAX_SIZE_MERGE + GOSSIP_MAX_SIZE_BELLATRIX # TODO https://github.com/status-im/nim-ssz-serialization/issues/20 for # Attestation, AttesterSlashing, and SignedAggregateAndProof, which all # have lists bounded at MAX_VALIDATORS_PER_COMMITTEE (2048) items, thus diff --git a/beacon_chain/spec/beaconstate.nim b/beacon_chain/spec/beaconstate.nim index 88832e2fb..ad82b0065 100644 --- a/beacon_chain/spec/beaconstate.nim +++ b/beacon_chain/spec/beaconstate.nim @@ -121,7 +121,7 @@ func initiate_validator_exit*(cfg: RuntimeConfig, state: var ForkyBeaconState, # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slash_validator # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#modified-slash_validator -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/merge/beacon-chain.md#modified-slash_validator +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#modified-slash_validator proc get_slashing_penalty*(state: ForkyBeaconState, validator_effective_balance: Gwei): Gwei = # TODO Consider whether this is better than splitting the functions apart; in @@ -131,7 +131,7 @@ proc get_slashing_penalty*(state: ForkyBeaconState, elif state is altair.BeaconState: validator_effective_balance div MIN_SLASHING_PENALTY_QUOTIENT_ALTAIR elif state is bellatrix.BeaconState: - validator_effective_balance div MIN_SLASHING_PENALTY_QUOTIENT_MERGE + validator_effective_balance div MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX else: {.fatal: "invalid BeaconState type".} diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index 3ff91f836..4a16e8f96 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -27,9 +27,9 @@ const TTFB_TIMEOUT* = 5.seconds RESP_TIMEOUT* = 10.seconds - # https://github.com/ethereum/consensus-specs/blob/v1.1.7/specs/merge/p2p-interface.md#configuration - GOSSIP_MAX_SIZE_MERGE* = 10 * 1024 * 1024 # bytes - MAX_CHUNK_SIZE_MERGE* = 10 * 1024 * 1024 # bytes + # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/p2p-interface.md#configuration + GOSSIP_MAX_SIZE_BELLATRIX* = 10 * 1024 * 1024 # bytes + MAX_CHUNK_SIZE_BELLATRIX* = 10 * 1024 * 1024 # bytes defaultEth2TcpPort* = 9000 diff --git a/beacon_chain/spec/presets/mainnet/bellatrix_preset.nim b/beacon_chain/spec/presets/mainnet/bellatrix_preset.nim index e6a61e903..7c9c4d676 100644 --- a/beacon_chain/spec/presets/mainnet/bellatrix_preset.nim +++ b/beacon_chain/spec/presets/mainnet/bellatrix_preset.nim @@ -1,14 +1,14 @@ -# Mainnet preset - Merge -# https://github.com/ethereum/consensus-specs/blob/v1.1.6/presets/mainnet/merge.yaml +# Mainnet preset - Bellatrix +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/presets/mainnet/bellatrix.yaml const # Updated penalty values # --------------------------------------------------------------- # 2**24 (= 16,777,216) - INACTIVITY_PENALTY_QUOTIENT_MERGE*: uint64 = 16777216 + INACTIVITY_PENALTY_QUOTIENT_BELLATRIX*: uint64 = 16777216 # 2**5 (= 32) - MIN_SLASHING_PENALTY_QUOTIENT_MERGE*: uint64 = 32 + MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX*: uint64 = 32 # 3 - PROPORTIONAL_SLASHING_MULTIPLIER_MERGE*: uint64 = 3 + PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX*: uint64 = 3 # Execution diff --git a/beacon_chain/spec/presets/minimal/bellatrix_preset.nim b/beacon_chain/spec/presets/minimal/bellatrix_preset.nim index f2171d4c6..ada604864 100644 --- a/beacon_chain/spec/presets/minimal/bellatrix_preset.nim +++ b/beacon_chain/spec/presets/minimal/bellatrix_preset.nim @@ -1,14 +1,14 @@ -# Minimal preset - Merge -# https://github.com/ethereum/consensus-specs/blob/v1.1.7/presets/minimal/merge.yaml +# Minimal preset - Bellatrix +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/presets/minimal/bellatrix.yaml const # Updated penalty values # --------------------------------------------------------------- # 2**24 (= 16,777,216) - INACTIVITY_PENALTY_QUOTIENT_MERGE*: uint64 = 16777216 + INACTIVITY_PENALTY_QUOTIENT_BELLATRIX*: uint64 = 16777216 # 2**5 (= 32) - MIN_SLASHING_PENALTY_QUOTIENT_MERGE*: uint64 = 32 + MIN_SLASHING_PENALTY_QUOTIENT_BELLATRIX*: uint64 = 32 # 3 - PROPORTIONAL_SLASHING_MULTIPLIER_MERGE*: uint64 = 3 + PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX*: uint64 = 3 # Execution diff --git a/beacon_chain/spec/state_transition_epoch.nim b/beacon_chain/spec/state_transition_epoch.nim index f8bbaa9f2..31ff8cc7d 100644 --- a/beacon_chain/spec/state_transition_epoch.nim +++ b/beacon_chain/spec/state_transition_epoch.nim @@ -721,15 +721,16 @@ iterator get_inactivity_penalty_deltas*( state.inactivity_scores[index] yield (vidx, Gwei(penalty_numerator div penalty_denominator)) -# https://github.com/ethereum/consensus-specs/blob/v1.1.4/specs/merge/beacon-chain.md#modified-get_inactivity_penalty_deltas +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#modified-get_inactivity_penalty_deltas iterator get_inactivity_penalty_deltas*( cfg: RuntimeConfig, state: bellatrix.BeaconState, info: altair.EpochInfo): (ValidatorIndex, Gwei) = ## Return the inactivity penalty deltas by considering timely target ## participation flags and inactivity scores. let + # [Modified in Bellatrix] penalty_denominator = - cfg.INACTIVITY_SCORE_BIAS * INACTIVITY_PENALTY_QUOTIENT_MERGE + cfg.INACTIVITY_SCORE_BIAS * INACTIVITY_PENALTY_QUOTIENT_BELLATRIX previous_epoch = get_previous_epoch(state) for index in 0 ..< state.validators.len: @@ -853,7 +854,7 @@ func process_registry_updates*( # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slashings # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#slashings -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/merge/beacon-chain.md#slashings +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#slashings func get_adjusted_total_slashing_balance*( state: ForkyBeaconState, total_balance: Gwei): Gwei = let multiplier = @@ -864,21 +865,21 @@ func get_adjusted_total_slashing_balance*( elif state is altair.BeaconState: PROPORTIONAL_SLASHING_MULTIPLIER_ALTAIR elif state is bellatrix.BeaconState: - PROPORTIONAL_SLASHING_MULTIPLIER_MERGE + PROPORTIONAL_SLASHING_MULTIPLIER_BELLATRIX else: {.fatal: "process_slashings: incorrect BeaconState type".} min(sum(state.slashings.data) * multiplier, total_balance) # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slashings # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#slashings -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/merge/beacon-chain.md#slashings +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#slashings func slashing_penalty_applies*(validator: Validator, epoch: Epoch): bool = validator.slashed and epoch + EPOCHS_PER_SLASHINGS_VECTOR div 2 == validator.withdrawable_epoch # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slashings # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#slashings -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/merge/beacon-chain.md#slashings +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#slashings func get_slashing_penalty*(validator: Validator, adjusted_total_slashing_balance, total_balance: Gwei): Gwei = @@ -890,7 +891,7 @@ func get_slashing_penalty*(validator: Validator, # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/phase0/beacon-chain.md#slashings # https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/altair/beacon-chain.md#slashings -# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/merge/beacon-chain.md#slashings +# https://github.com/ethereum/consensus-specs/blob/v1.1.8/specs/bellatrix/beacon-chain.md#slashings func process_slashings*(state: var ForkyBeaconState, total_balance: Gwei) = let epoch = get_current_epoch(state) diff --git a/ncli/ncli.nim b/ncli/ncli.nim index aa5fb4bf7..0efa96d3e 100644 --- a/ncli/ncli.nim +++ b/ncli/ncli.nim @@ -176,20 +176,20 @@ proc doSSZ(conf: NcliConf) = of "attestation": printit(Attestation) of "phase0_signed_block": printit(phase0.SignedBeaconBlock) of "altair_signed_block": printit(altair.SignedBeaconBlock) - of "merge_signed_block": printit(bellatrix.SignedBeaconBlock) + of "bellatrix_signed_block": printit(bellatrix.SignedBeaconBlock) of "phase0_block": printit(phase0.BeaconBlock) of "altair_block": printit(altair.BeaconBlock) - of "merge_block": printit(bellatrix.BeaconBlock) + of "bellatrix_block": printit(bellatrix.BeaconBlock) of "phase0_block_body": printit(phase0.BeaconBlockBody) of "altair_block_body": printit(altair.BeaconBlockBody) - of "merge_block_body": printit(bellatrix.BeaconBlockBody) + of "bellatrix_block_body": printit(bellatrix.BeaconBlockBody) of "block_header": printit(BeaconBlockHeader) of "deposit": printit(Deposit) of "deposit_data": printit(DepositData) of "eth1_data": printit(Eth1Data) of "phase0_state": printit(phase0.BeaconState) of "altiar_state": printit(altair.BeaconState) - of "merge_state": printit(bellatrix.BeaconState) + of "bellatrix_state": printit(bellatrix.BeaconState) of "proposer_slashing": printit(ProposerSlashing) of "voluntary_exit": printit(VoluntaryExit) diff --git a/ncli/ncli_db.nim b/ncli/ncli_db.nim index 612382cca..6dffb4b81 100644 --- a/ncli/ncli_db.nim +++ b/ncli/ncli_db.nim @@ -305,9 +305,9 @@ proc cmdDumpState(conf: DbConf) = defer: db.close() let - phase0State = (ref phase0.HashedBeaconState)() - altairState = (ref altair.HashedBeaconState)() - mergeState = (ref bellatrix.HashedBeaconState)() + phase0State = (ref phase0.HashedBeaconState)() + altairState = (ref altair.HashedBeaconState)() + bellatrixState = (ref bellatrix.HashedBeaconState)() for stateRoot in conf.stateRoot: if shouldShutDown: quit QuitSuccess @@ -323,7 +323,7 @@ proc cmdDumpState(conf: DbConf) = doit(phase0State[]) doit(altairState[]) - doit(mergeState[]) + doit(bellatrixState[]) echo "Couldn't load ", stateRoot