Skip to content

Commit

Permalink
Merge branch 'stable' into dev/etan/df-forkedblobs
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-status committed Mar 3, 2025
2 parents 603e980 + fad7b9a commit f602e20
Show file tree
Hide file tree
Showing 99 changed files with 810 additions and 1,457 deletions.
95 changes: 0 additions & 95 deletions AllTests-mainnet.md

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
2025-03-02 v25.3.0
==================

Nimbus `v25.3.0` is a `low-urgency` release except for the Gnosis Chiado testnet, for which it's a `high-urgency` release.

### Improvements

- Add Gnosis Chiado testnet Electra fork support:
https://github.com/status-im/nimbus-eth2/pull/6968

- Add SSZ support for the registerValidator beacon REST API endpoint:
https://github.com/status-im/nimbus-eth2/pull/6943

- Increase trusted node sync state download timeout to 3 minutes:
https://github.com/status-im/nimbus-eth2/pull/6969

- Add link to trusted node sync documentation regarding state download timeout:
https://github.com/status-im/nimbus-eth2/pull/6927

### Fixes

- Fix validator client graffiti with web3signer validators:
https://github.com/status-im/nimbus-eth2/pull/6927

- Fix sync completion percentages exceeding 100%:
https://github.com/status-im/nimbus-eth2/pull/6922

2025-02-13 v25.2.0
==================

Expand Down
211 changes: 0 additions & 211 deletions ConsensusSpecPreset-mainnet.md

Large diffs are not rendered by default.

220 changes: 0 additions & 220 deletions ConsensusSpecPreset-minimal.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ libbacktrace:
# - --base-el-rpc-port + --el-port-offset * [0, --nodes + --light-clients)
# - --base-el-ws-port + --el-port-offset * [0, --nodes + --light-clients)
# - --base-el-auth-rpc-port + --el-port-offset * [0, --nodes + --light-clients)
UNIT_TEST_BASE_PORT := 39960
REST_TEST_BASE_PORT := 40990
MINIMAL_TESTNET_BASE_PORT := 35001
MAINNET_TESTNET_BASE_PORT := 36501
UNIT_TEST_BASE_PORT := 29960
REST_TEST_BASE_PORT := 30990
MINIMAL_TESTNET_BASE_PORT := 25001
MAINNET_TESTNET_BASE_PORT := 26501

restapi-test:
./tests/simulation/restapi.sh \
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/beacon_chain_db_immutable.nim
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ type
current_sync_committee*: SyncCommittee # [New in Altair]
next_sync_committee*: SyncCommittee # [New in Altair]

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/bellatrix/beacon-chain.md#beaconstate
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/bellatrix/beacon-chain.md#beaconstate
# Memory-representation-equivalent to a Bellatrix BeaconState for in-place SSZ
# reading and writing
BellatrixBeaconStateNoImmutableValidators* = object
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/beacon_chain_file.nim
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const
ChainFileVersion = 1'u32
ChainFileHeaderValue = 0x424D494E'u32
ChainFileBufferSize* = 4096
MaxChunkSize = int(GOSSIP_MAX_SIZE)
MaxChunkSize = int(MAX_PAYLOAD_SIZE)
ChainFileHeaderArray = ChainFileHeaderValue.toBytesLE()
IncompleteWriteError = "Unable to write data to file, disk full?"
MaxForksCount* = 16384
Expand Down
18 changes: 11 additions & 7 deletions beacon_chain/consensus_object_pools/blob_quarantine.nim
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ import
from std/sequtils import mapIt
from std/strutils import join

const
MaxBlobs = 3 * SLOTS_PER_EPOCH * MAX_BLOBS_PER_BLOCK_ELECTRA
## Same limit as `MaxOrphans` in `block_quarantine`;
## blobs may arrive before an orphan is tagged `blobless`
func maxBlobs(MAX_BLOBS_PER_BLOCK_ELECTRA: uint64): uint64 =
# Same limit as `MaxOrphans` in `block_quarantine`;
# blobs may arrive before an orphan is tagged `blobless`
3 * SLOTS_PER_EPOCH * MAX_BLOBS_PER_BLOCK_ELECTRA

type
BlobQuarantine* = object
maxBlobs: uint64
blobs*: OrderedTable[
(Eth2Digest, BlobIndex, KzgCommitment), ForkedBlobSidecar]
onBlobSidecarCallback*: OnBlobSidecarCallback
Expand All @@ -39,7 +40,7 @@ func shortLog*(x: seq[BlobFetchRecord]): string =
"[" & x.mapIt(shortLog(it.block_root) & shortLog(it.indices)).join(", ") & "]"

func put*(quarantine: var BlobQuarantine, blobSidecar: ForkedBlobSidecar) =
if quarantine.blobs.lenu64 >= MaxBlobs:
if quarantine.blobs.lenu64 >= quarantine.maxBlobs:
# FIFO if full. For example, sync manager and request manager can race to
# put blobs in at the same time, so one gets blob insert -> block resolve
# -> blob insert sequence, which leaves garbage blobs.
Expand Down Expand Up @@ -124,5 +125,8 @@ func blobFetchRecord*(
BlobFetchRecord(block_root: blck.root, indices: indices)

func init*(
T: type BlobQuarantine, onBlobSidecarCallback: OnBlobSidecarCallback): T =
T(onBlobSidecarCallback: onBlobSidecarCallback)
T: type BlobQuarantine,
cfg: RuntimeConfig,
onBlobSidecarCallback: OnBlobSidecarCallback): T =
T(maxBlobs: cfg.MAX_BLOBS_PER_BLOCK_ELECTRA.maxBlobs(),
onBlobSidecarCallback: onBlobSidecarCallback)
6 changes: 0 additions & 6 deletions beacon_chain/consensus_object_pools/block_clearance.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
{.push raises: [].}

import
std/sequtils,
chronicles,
results,
stew/assign2,
../spec/[
beaconstate, forks, signatures, signatures_batch,
state_transition, state_transition_epoch],
Expand Down Expand Up @@ -504,10 +502,6 @@ proc addBackfillBlockData*(
return ok()
return err(error)
startTick = Moment.now()
parentBlock = dag.getForkedBlock(parent.bid.root).get()
trustedStateRoot =
withBlck(parentBlock):
forkyBlck.message.state_root
clearanceBlock = BlockSlotId.init(parent.bid, forkyBlck.message.slot)
updateFlags1 = dag.updateFlags
# TODO (cheatfate): {skipLastStateRootCalculation} flag here could
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/consensus_object_pools/spec_cache.nim
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func makeAttestationData*(

doAssert current_epoch == epochRef.epoch

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/phase0/validator.md#attestation-data
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/phase0/validator.md#attestation-data
AttestationData(
slot: slot,
index: committee_index.asUInt64,
Expand Down
8 changes: 4 additions & 4 deletions beacon_chain/el/eth1_chain.nim
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,19 @@ type
deposits*: seq[Deposit]
hasMissingDeposits*: bool

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/phase0/validator.md#get_eth1_data
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/phase0/validator.md#get_eth1_data
func compute_time_at_slot(genesis_time: uint64, slot: Slot): uint64 =
genesis_time + slot * SECONDS_PER_SLOT

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/phase0/validator.md#get_eth1_data
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/phase0/validator.md#get_eth1_data
func voting_period_start_time(state: ForkedHashedBeaconState): uint64 =
let eth1_voting_period_start_slot =
getStateField(state, slot) - getStateField(state, slot) mod
SLOTS_PER_ETH1_VOTING_PERIOD.uint64
compute_time_at_slot(
getStateField(state, genesis_time), eth1_voting_period_start_slot)

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/phase0/validator.md#get_eth1_data
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/phase0/validator.md#get_eth1_data
func is_candidate_block(cfg: RuntimeConfig,
blk: Eth1Block,
period_start: uint64): bool =
Expand Down Expand Up @@ -274,7 +274,7 @@ proc trackFinalizedState*(chain: var Eth1Chain,
if result:
chain.pruneOldBlocks(finalizedStateDepositIndex)

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/phase0/validator.md#get_eth1_data
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/phase0/validator.md#get_eth1_data
proc getBlockProposalData*(chain: var Eth1Chain,
state: ForkedHashedBeaconState,
finalizedEth1Data: Eth1Data,
Expand Down
2 changes: 1 addition & 1 deletion beacon_chain/el/merkle_minimal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{.push raises: [].}

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/tests/core/pyspec/eth2spec/utils/merkle_minimal.py
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/tests/core/pyspec/eth2spec/utils/merkle_minimal.py

# Merkle tree helpers
# ---------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion beacon_chain/fork_choice/fork_choice.nim
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import
export results, fork_choice_types
export proto_array.len

# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/phase0/fork-choice.md
# This is a port of https://github.com/sigp/lighthouse/pull/804
# which is a port of "Proto-Array": https://github.com/protolambda/lmd-ghost
# See also:
Expand Down
16 changes: 8 additions & 8 deletions beacon_chain/gossip_processing/gossip_validation.nim
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,11 @@ template checkedReject(
pool: ValidatorChangePool, error: ValidationError): untyped =
pool.dag.checkedReject(error)

func getMaxBlobsPerBlock(cfg: RuntimeConfig, wallTime: BeaconTime): uint64 =
if min(wallTime, wallTime - MAXIMUM_GOSSIP_CLOCK_DISPARITY).slotOrZero.epoch >=
cfg.ELECTRA_FORK_EPOCH:
func getMaxBlobsPerBlock(cfg: RuntimeConfig, slot: Slot): uint64 =
if slot >= cfg.ELECTRA_FORK_EPOCH.start_slot:
cfg.MAX_BLOBS_PER_BLOCK_ELECTRA
else:
MAX_BLOBS_PER_BLOCK
cfg.MAX_BLOBS_PER_BLOCK

template validateBeaconBlockBellatrix(
_: phase0.SignedBeaconBlock | altair.SignedBeaconBlock,
Expand Down Expand Up @@ -379,7 +378,7 @@ template validateBeaconBlockDeneb(
# limitation defined in Consensus Layer -- i.e. validate that
# len(body.signed_beacon_block.message.blob_kzg_commitments) <= MAX_BLOBS_PER_BLOCK
if not (lenu64(signed_beacon_block.message.body.blob_kzg_commitments) <=
dag.cfg.getMaxBlobsPerBlock(wallTime)):
dag.cfg.getMaxBlobsPerBlock(signed_beacon_block.message.slot)):
return dag.checkedReject("validateBeaconBlockDeneb: too many blob commitments")

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.4/specs/deneb/p2p-interface.md#blob_sidecar_subnet_id
Expand All @@ -395,12 +394,13 @@ proc validateBlobSidecar*(

# [REJECT] The sidecar's index is consistent with `MAX_BLOBS_PER_BLOCK`
# -- i.e. `blob_sidecar.index < MAX_BLOBS_PER_BLOCK`
if not (blob_sidecar.index < dag.cfg.getMaxBlobsPerBlock(wallTime)):
if not (blob_sidecar.index < dag.cfg.getMaxBlobsPerBlock(block_header.slot)):
return dag.checkedReject("BlobSidecar: index inconsistent")

# [REJECT] The sidecar is for the correct subnet -- i.e.
# `compute_subnet_for_blob_sidecar(blob_sidecar.index) == subnet_id`.
if not (compute_subnet_for_blob_sidecar(blob_sidecar.index) == subnet_id):
if not (dag.cfg.compute_subnet_for_blob_sidecar(
block_header.slot, blob_sidecar.index) == subnet_id):
return dag.checkedReject("BlobSidecar: subnet incorrect")

# [IGNORE] The sidecar is not from a future slot (with a
Expand Down Expand Up @@ -1556,7 +1556,7 @@ proc validateVoluntaryExit*(

ok()

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/altair/p2p-interface.md#sync_committee_subnet_id
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/altair/p2p-interface.md#sync_committee_subnet_id
proc validateSyncCommitteeMessage*(
dag: ChainDAGRef,
quarantine: ref Quarantine,
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/gossip_processing/light_client_processor.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2022-2024 Status Research & Development GmbH
# Copyright (c) 2022-2025 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).
Expand Down Expand Up @@ -564,7 +564,7 @@ proc processLightClientFinalityUpdate*(
self.latestFinalityUpdate = finality_update.toOptimistic
v

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/light-client/sync-protocol.md#process_light_client_finality_update
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/altair/light-client/sync-protocol.md#process_light_client_finality_update
proc processLightClientOptimisticUpdate*(
self: var LightClientProcessor, src: MsgSource,
optimistic_update: ForkedLightClientOptimisticUpdate
Expand Down
6 changes: 3 additions & 3 deletions beacon_chain/libnimbus_lc/libnimbus_lc.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ typedef struct ETHConsensusConfig ETHConsensusConfig;
* based on the given `config.yaml` file content - If successful.
* @return `NULL` - If the given `config.yaml` is malformed or incompatible.
*
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/configs/README.md
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/configs/README.md
*/
ETH_RESULT_USE_CHECK
ETHConsensusConfig *_Nullable ETHConsensusConfigCreateFromYaml(const char *configFileContent);
Expand Down Expand Up @@ -150,9 +150,9 @@ typedef struct ETHBeaconState ETHBeaconState;
* @return `NULL` - If the given `sszBytes` is malformed.
*
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.0/specs/phase0/beacon-chain.md#beaconstate
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/altair/beacon-chain.md#beaconstate
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/altair/beacon-chain.md#beaconstate
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.8/specs/bellatrix/beacon-chain.md#beaconstate
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/capella/beacon-chain.md#beaconstate
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/capella/beacon-chain.md#beaconstate
* @see https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.9/configs/README.md
*/
ETH_RESULT_USE_CHECK
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/libnimbus_lc/libnimbus_lc.nim
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ proc ETHBeaconStateCreateFromSsz(
##
## See:
## * https://github.com/ethereum/consensus-specs/blob/v1.4.0/specs/phase0/beacon-chain.md#beaconstate
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/specs/altair/beacon-chain.md#beaconstate
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/specs/altair/beacon-chain.md#beaconstate
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.8/specs/bellatrix/beacon-chain.md#beaconstate
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.3/specs/capella/beacon-chain.md#beaconstate
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.1/configs/README.md
## * https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.2/configs/README.md
let
consensusFork = ConsensusFork.decodeString($consensusVersion).valueOr:
return nil
Expand Down
Loading

0 comments on commit f602e20

Please sign in to comment.