Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion ConsensusSpecPreset-mainnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3478,6 +3478,22 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
+ [Valid] EF - Fulu - Finality - finality_rule_4 [Preset: mainnet] OK
```
OK: 5/5 Fail: 0/5 Skip: 0/5
## EF - Fulu - Fork [Preset: mainnet]
```diff
+ EF - Fulu - Fork - fork_base_state [Preset: mainnet] OK
+ EF - Fulu - Fork - fork_many_next_epoch [Preset: mainnet] OK
+ EF - Fulu - Fork - fork_next_epoch [Preset: mainnet] OK
+ EF - Fulu - Fork - fork_next_epoch_with_block [Preset: mainnet] OK
+ EF - Fulu - Fork - fork_random_low_balances [Preset: mainnet] OK
+ EF - Fulu - Fork - fork_random_misc_balances [Preset: mainnet] OK
+ EF - Fulu - Fork - fulu_fork_random_0 [Preset: mainnet] OK
+ EF - Fulu - Fork - fulu_fork_random_1 [Preset: mainnet] OK
+ EF - Fulu - Fork - fulu_fork_random_2 [Preset: mainnet] OK
+ EF - Fulu - Fork - fulu_fork_random_3 [Preset: mainnet] OK
+ EF - Fulu - Fork - fulu_fork_random_low_balances [Preset: mainnet] OK
+ EF - Fulu - Fork - fulu_fork_random_misc_balances [Preset: mainnet] OK
```
OK: 12/12 Fail: 0/12 Skip: 0/12
## EF - Fulu - Operations - Attestation [Preset: mainnet]
```diff
+ [Invalid] EF - Fulu - Operations - Attestation - invalid_after_max_inclusion_slot OK
Expand Down Expand Up @@ -4061,6 +4077,21 @@ OK: 59/59 Fail: 0/59 Skip: 0/59
+ [Valid] EF - Fulu - Sanity - Blocks - zero_blob [Preset: mainnet] OK
```
OK: 73/73 Fail: 0/73 Skip: 0/73
## EF - Fulu - Sanity - Slots [Preset: mainnet]
```diff
+ EF - Fulu - Slots - double_empty_epoch [Preset: mainnet] OK
+ EF - Fulu - Slots - empty_epoch [Preset: mainnet] OK
+ EF - Fulu - Slots - historical_accumulator [Preset: mainnet] OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey [Preset: mainnet] OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey_above_upward_threshold [Preset: OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey_below_upward_threshold [Preset: OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey_compounding [Preset: mainnet] OK
+ EF - Fulu - Slots - over_epoch_boundary [Preset: mainnet] OK
+ EF - Fulu - Slots - pending_consolidation [Preset: mainnet] OK
+ EF - Fulu - Slots - slots_1 [Preset: mainnet] OK
+ EF - Fulu - Slots - slots_2 [Preset: mainnet] OK
```
OK: 11/11 Fail: 0/11 Skip: 0/11
## EF - Light client - Single merkle proof [Preset: mainnet]
```diff
+ Light client - Single merkle proof - mainnet/altair/light_client/single_merkle_proof/Beaco OK
Expand Down Expand Up @@ -4651,4 +4682,4 @@ OK: 106/133 Fail: 0/133 Skip: 27/133
OK: 5/5 Fail: 0/5 Skip: 0/5

---TOTAL---
OK: 3798/3825 Fail: 0/3825 Skip: 27/3825
OK: 3821/3848 Fail: 0/3848 Skip: 27/3848
35 changes: 34 additions & 1 deletion ConsensusSpecPreset-minimal.md
Original file line number Diff line number Diff line change
Expand Up @@ -3672,6 +3672,24 @@ OK: 5/5 Fail: 0/5 Skip: 0/5
+ [Valid] EF - Fulu - Finality - finality_rule_4 [Preset: minimal] OK
```
OK: 5/5 Fail: 0/5 Skip: 0/5
## EF - Fulu - Fork [Preset: minimal]
```diff
+ EF - Fulu - Fork - fork_base_state [Preset: minimal] OK
+ EF - Fulu - Fork - fork_many_next_epoch [Preset: minimal] OK
+ EF - Fulu - Fork - fork_next_epoch [Preset: minimal] OK
+ EF - Fulu - Fork - fork_next_epoch_with_block [Preset: minimal] OK
+ EF - Fulu - Fork - fork_random_large_validator_set [Preset: minimal] OK
+ EF - Fulu - Fork - fork_random_low_balances [Preset: minimal] OK
+ EF - Fulu - Fork - fork_random_misc_balances [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_0 [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_1 [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_2 [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_3 [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_large_validator_set [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_low_balances [Preset: minimal] OK
+ EF - Fulu - Fork - fulu_fork_random_misc_balances [Preset: minimal] OK
```
OK: 14/14 Fail: 0/14 Skip: 0/14
## EF - Fulu - Operations - Attestation [Preset: minimal]
```diff
+ [Invalid] EF - Fulu - Operations - Attestation - invalid_after_max_inclusion_slot OK
Expand Down Expand Up @@ -4294,6 +4312,21 @@ OK: 59/59 Fail: 0/59 Skip: 0/59
+ [Valid] EF - Fulu - Sanity - Blocks - zero_blob [Preset: minimal] OK
```
OK: 80/80 Fail: 0/80 Skip: 0/80
## EF - Fulu - Sanity - Slots [Preset: minimal]
```diff
+ EF - Fulu - Slots - double_empty_epoch [Preset: minimal] OK
+ EF - Fulu - Slots - empty_epoch [Preset: minimal] OK
+ EF - Fulu - Slots - historical_accumulator [Preset: minimal] OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey [Preset: minimal] OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey_above_upward_threshold [Preset: OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey_below_upward_threshold [Preset: OK
+ EF - Fulu - Slots - multiple_pending_deposits_same_pubkey_compounding [Preset: minimal] OK
+ EF - Fulu - Slots - over_epoch_boundary [Preset: minimal] OK
+ EF - Fulu - Slots - pending_consolidation [Preset: minimal] OK
+ EF - Fulu - Slots - slots_1 [Preset: minimal] OK
+ EF - Fulu - Slots - slots_2 [Preset: minimal] OK
```
OK: 11/11 Fail: 0/11 Skip: 0/11
## EF - Light client - Data collection [Preset: minimal]
```diff
+ Light client - Data collection - minimal/altair/light_client/data_collection/pyspec_tests/ OK
Expand Down Expand Up @@ -5131,4 +5164,4 @@ OK: 282/314 Fail: 0/314 Skip: 32/314
OK: 5/5 Fail: 0/5 Skip: 0/5

---TOTAL---
OK: 4237/4269 Fail: 0/4269 Skip: 32/4269
OK: 4262/4294 Fail: 0/4294 Skip: 32/4294
40 changes: 20 additions & 20 deletions beacon_chain/sync/request_manager.nim
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# beacon_chain
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-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).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

{.push raises: [].}

import std/[sequtils, strutils]
import chronos, chronicles
import
../spec/datatypes/[phase0, deneb, fulu],
../spec/[forks, network, peerdas_helpers],
../networking/eth2_network,
../consensus_object_pools/block_quarantine,
Expand All @@ -20,47 +18,49 @@ import
../gossip_processing/block_processor

from std/algorithm import binarySearch, sort
from std/sequtils import mapIt
from std/strutils import join
from ../beacon_clock import GetBeaconTimeFn
export block_quarantine, sync_manager

logScope:
topics = "requman"

const
SYNC_MAX_REQUESTED_BLOCKS* = 32 # Spec allows up to MAX_REQUEST_BLOCKS.
SYNC_MAX_REQUESTED_BLOCKS = 32 # Spec allows up to MAX_REQUEST_BLOCKS.
## Maximum number of blocks which will be requested in each
## `beaconBlocksByRoot` invocation.
PARALLEL_REQUESTS* = 2
## Number of peers we using to resolve our request.
PARALLEL_REQUESTS = 2
## Number of peers we're using to resolve our request.

PARALLEL_REQUESTS_DATA_COLUMNS* = 32
PARALLEL_REQUESTS_DATA_COLUMNS = 32

BLOB_GOSSIP_WAIT_TIME_NS* = 2 * 1_000_000_000
BLOB_GOSSIP_WAIT_TIME_NS = 2 * 1_000_000_000
## How long to wait for blobs to arri ve over gossip before fetching.

DATA_COLUMN_GOSSIP_WAIT_TIME_NS* = 2 * 1_000_000_000
DATA_COLUMN_GOSSIP_WAIT_TIME_NS = 2 * 1_000_000_000
## How long to wait for blobs to arri ve over gossip before fetching.

POLL_INTERVAL = 1.seconds

type
BlockVerifierFn* = proc(
BlockVerifierFn = proc(
signedBlock: ForkedSignedBeaconBlock,
maybeFinalized: bool
): Future[Result[void, VerifierError]] {.async: (raises: [CancelledError]).}

BlockLoaderFn* = proc(
BlockLoaderFn = proc(
blockRoot: Eth2Digest
): Opt[ForkedTrustedSignedBeaconBlock] {.gcsafe, raises: [].}

BlobLoaderFn* = proc(
BlobLoaderFn = proc(
blobId: BlobIdentifier): Opt[ref BlobSidecar] {.gcsafe, raises: [].}

DataColumnLoaderFn* = proc(
DataColumnLoaderFn = proc(
columnId: DataColumnIdentifier):
Opt[ref DataColumnSidecar] {.gcsafe, raises: [].}

InhibitFn* = proc: bool {.gcsafe, raises: [].}
InhibitFn = proc: bool {.gcsafe, raises: [].}

RequestManager* = object
network*: Eth2Node
Expand Down Expand Up @@ -112,7 +112,7 @@ proc init*(T: type RequestManager, network: Eth2Node,
blobLoader: blobLoader,
dataColumnLoader: dataColumnLoader)

proc checkResponse(roots: openArray[Eth2Digest],
func checkResponse(roots: openArray[Eth2Digest],
blocks: openArray[ref ForkedSignedBeaconBlock]): bool =
## This procedure checks peer's response.
var checks = @roots
Expand All @@ -130,7 +130,7 @@ func cmpSidecarIdentifier(x: BlobIdentifier | DataColumnIdentifier,
y: ref BlobSidecar | ref DataColumnSidecar): int =
cmp(x.index, y.index)

proc checkResponse(idList: seq[BlobIdentifier],
func checkResponse(idList: seq[BlobIdentifier],
blobs: openArray[ref BlobSidecar]): bool =
if blobs.len > idList.len:
return false
Expand All @@ -154,7 +154,7 @@ proc checkResponse(idList: seq[BlobIdentifier],
inc i
true

proc checkResponse(idList: seq[DataColumnIdentifier],
func checkResponse(idList: seq[DataColumnIdentifier],
columns: openArray[ref DataColumnSidecar]): bool =
if columns.len > idList.len:
return false
Expand Down Expand Up @@ -295,9 +295,9 @@ proc fetchBlobsFromNetwork(self: RequestManager,
if not(isNil(peer)):
self.network.peerPool.release(peer)

proc checkPeerCustody*(rman: RequestManager,
peer: Peer):
bool =
proc checkPeerCustody(rman: RequestManager,
peer: Peer):
bool =
# Returns true if the peer custodies atleast
# ONE of the common custody columns, straight
# away returns true if the peer is a supernode.
Expand Down
13 changes: 11 additions & 2 deletions tests/consensus_spec/test_fixture_fork.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2021-2024 Status Research & Development GmbH
# Copyright (c) 2021-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 @@ -85,4 +85,13 @@ suite "EF - Electra - Fork " & preset():
SszTestsDir/const_preset/"electra"/"fork"/"fork"/"pyspec_tests"
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(deneb.BeaconState, electra.BeaconState, "Electra", OpForkDir,
upgrade_to_electra, suiteName, path)
upgrade_to_electra, suiteName, path)

from ../../beacon_chain/spec/datatypes/fulu import BeaconState

suite "EF - Fulu - Fork " & preset():
const OpForkDir =
SszTestsDir/const_preset/"fulu"/"fork"/"fork"/"pyspec_tests"
for kind, path in walkDir(OpForkDir, relative = true, checkDir = true):
runTest(electra.BeaconState, fulu.BeaconState, "Fulu", OpForkDir,
upgrade_to_fulu, suiteName, path)
47 changes: 28 additions & 19 deletions tests/consensus_spec/test_fixture_sanity_slots.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# beacon_chain
# Copyright (c) 2018-2024 Status Research & Development GmbH
# Copyright (c) 2018-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 @@ -53,48 +53,57 @@ func sanitySlotsDir(preset_dir: string): string {.compileTime.} =
from ../../beacon_chain/spec/datatypes/phase0 import BeaconState

suite "EF - Phase 0 - Sanity - Slots " & preset():
const phase0SanitySlotsDir = sanitySlotsDir("phase0")
const sanitySlotsDir = sanitySlotsDir("phase0")
for kind, path in walkDir(
phase0SanitySlotsDir, relative = true, checkDir = true):
runTest(phase0.BeaconState, phase0SanitySlotsDir, "Phase 0", suiteName, path)
sanitySlotsDir, relative = true, checkDir = true):
runTest(phase0.BeaconState, sanitySlotsDir, "Phase 0", suiteName, path)

from ../../beacon_chain/spec/datatypes/altair import BeaconState

suite "EF - Altair - Sanity - Slots " & preset():
const altairSanitySlotsDir = sanitySlotsDir("altair")
const sanitySlotsDir = sanitySlotsDir("altair")
for kind, path in walkDir(
altairSanitySlotsDir, relative = true, checkDir = true):
runTest(altair.BeaconState, altairSanitySlotsDir, "Altair", suiteName, path)
sanitySlotsDir, relative = true, checkDir = true):
runTest(altair.BeaconState, sanitySlotsDir, "Altair", suiteName, path)

from ../../beacon_chain/spec/datatypes/bellatrix import BeaconState

suite "EF - Bellatrix - Sanity - Slots " & preset():
const bellatrixSanitySlotsDir = sanitySlotsDir("bellatrix")
const sanitySlotsDir = sanitySlotsDir("bellatrix")
for kind, path in walkDir(
bellatrixSanitySlotsDir, relative = true, checkDir = true):
runTest(bellatrix.BeaconState, bellatrixSanitySlotsDir, "Bellatrix", suiteName, path)
sanitySlotsDir, relative = true, checkDir = true):
runTest(bellatrix.BeaconState, sanitySlotsDir, "Bellatrix", suiteName, path)

from ../../beacon_chain/spec/datatypes/capella import BeaconState

suite "EF - Capella - Sanity - Slots " & preset():
const capellaSanitySlotsDir = sanitySlotsDir("capella")
const sanitySlotsDir = sanitySlotsDir("capella")
for kind, path in walkDir(
capellaSanitySlotsDir, relative = true, checkDir = true):
runTest(capella.BeaconState, capellaSanitySlotsDir, "Capella", suiteName, path)
sanitySlotsDir, relative = true, checkDir = true):
runTest(capella.BeaconState, sanitySlotsDir, "Capella", suiteName, path)

from ../../beacon_chain/spec/datatypes/deneb import BeaconState

suite "EF - Deneb - Sanity - Slots " & preset():
const denebSanitySlotsDir = sanitySlotsDir("deneb")
const sanitySlotsDir = sanitySlotsDir("deneb")
for kind, path in walkDir(
denebSanitySlotsDir, relative = true, checkDir = true):
runTest(deneb.BeaconState, denebSanitySlotsDir, "Deneb", suiteName, path)
sanitySlotsDir, relative = true, checkDir = true):
runTest(deneb.BeaconState, sanitySlotsDir, "Deneb", suiteName, path)

from ../../beacon_chain/spec/datatypes/electra import BeaconState

suite "EF - Electra - Sanity - Slots " & preset():
const electraSanitySlotsDir = sanitySlotsDir("electra")
const sanitySlotsDir = sanitySlotsDir("electra")
for kind, path in walkDir(
electraSanitySlotsDir, relative = true, checkDir = true):
sanitySlotsDir, relative = true, checkDir = true):
runTest(
electra.BeaconState, electraSanitySlotsDir, "Electra", suiteName, path)
electra.BeaconState, sanitySlotsDir, "Electra", suiteName, path)

from ../../beacon_chain/spec/datatypes/fulu import BeaconState

suite "EF - Fulu - Sanity - Slots " & preset():
const sanitySlotsDir = sanitySlotsDir("fulu")
for kind, path in walkDir(
sanitySlotsDir, relative = true, checkDir = true):
runTest(
fulu.BeaconState, sanitySlotsDir, "Fulu", suiteName, path)