Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move sync queue assertions to preset loader #6960

Merged
merged 1 commit into from
Feb 25, 2025
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
6 changes: 6 additions & 0 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const
MESSAGE_DOMAIN_INVALID_SNAPPY*: array[4, byte] = [0x00, 0x00, 0x00, 0x00]
MESSAGE_DOMAIN_VALID_SNAPPY*: array[4, byte] = [0x01, 0x00, 0x00, 0x00]

MAX_SUPPORTED_BLOBS_PER_BLOCK*: uint64 = 9 # revisit getShortMap(Blobs) if >9

type
Version* = distinct array[4, byte]
Eth1Address* = web3types.Address
Expand Down Expand Up @@ -873,6 +875,10 @@ proc readRuntimeConfig*(
checkCompatibility MAX_BLOBS_PER_BLOCK_ELECTRA
checkCompatibility MAX_REQUEST_BLOB_SIDECARS_ELECTRA

for suffix in ["", "_ELECTRA"]:
checkCompatibility MAX_SUPPORTED_BLOBS_PER_BLOCK,
"MAX_BLOBS_PER_BLOCK" & suffix, `<=`

# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.0/specs/phase0/fork-choice.md#configuration
# Isn't being used as a preset in the usual way: at any time, there's one correct value
checkCompatibility PROPOSER_SCORE_BOOST
Expand Down
13 changes: 0 additions & 13 deletions beacon_chain/sync/sync_queue.nim
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,6 @@ func getShortMap*[T](

proc getShortMap*[T](req: SyncRequest[T],
data: openArray[ref BlobSidecar]): string =
static:
doAssert(MAX_BLOBS_PER_BLOCK <= MAX_BLOBS_PER_BLOCK_ELECTRA)
doAssert(MAX_BLOBS_PER_BLOCK_ELECTRA < 10,
"getShortMap(Blobs) should be revisited")

var
res = newStringOfCap(req.data.count)
slider = req.data.slot
Expand Down Expand Up @@ -175,11 +170,6 @@ proc getShortMap*[T](
req: SyncRequest[T],
blobs: openArray[BlobSidecars]
): string =
static:
doAssert(MAX_BLOBS_PER_BLOCK <= MAX_BLOBS_PER_BLOCK_ELECTRA)
doAssert(MAX_BLOBS_PER_BLOCK_ELECTRA < 10,
"getShortMap(Blobs) should be revisited")

var
res = newStringOfCap(req.data.count)
slider = req.data.slot
Expand Down Expand Up @@ -980,9 +970,6 @@ proc checkResponse*[T](req: SyncRequest[T],

proc checkBlobsResponse*[T](req: SyncRequest[T],
data: openArray[Slot]): Result[void, cstring] =
static:
doAssert(MAX_BLOBS_PER_BLOCK <= MAX_BLOBS_PER_BLOCK_ELECTRA)

if len(data) == 0:
# Impossible to verify empty response.
return ok()
Expand Down
Loading