Skip to content

Commit a92517b

Browse files
authored
create_blob_sidecars() likely doesn't work properly with Fulu/columns (#7413)
1 parent 1be3185 commit a92517b

File tree

7 files changed

+16
-19
lines changed

7 files changed

+16
-19
lines changed

beacon_chain/rpc/rest_beacon_api.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
{.push raises: [].}
8+
{.push raises: [], gcsafe.}
99

1010
import
1111
std/[typetraits, sequtils, sets],
@@ -1042,7 +1042,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
10421042
doAssert strictVerification notin node.dag.updateFlags
10431043
return RestApiResponse.jsonError(Http400, InvalidBlockObjectError)
10441044

1045-
when consensusFork >= ConsensusFork.Deneb:
1045+
when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
10461046
await node.router.routeSignedBeaconBlock(
10471047
forkyBlck, Opt.some(
10481048
forkyBlck.create_blob_sidecars(kzg_proofs, blobs)),
@@ -1099,7 +1099,7 @@ proc installBeaconApiHandlers*(router: var RestRouter, node: BeaconNode) =
10991099
doAssert strictVerification notin node.dag.updateFlags
11001100
return RestApiResponse.jsonError(Http400, InvalidBlockObjectError)
11011101

1102-
when consensusFork >= ConsensusFork.Deneb:
1102+
when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
11031103
await node.router.routeSignedBeaconBlock(
11041104
forkyBlck, Opt.some(
11051105
forkyBlck.create_blob_sidecars(kzg_proofs, blobs)),

beacon_chain/spec/helpers.nim

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,7 @@ func verify_blob_sidecar_inclusion_proof*(
227227
ok()
228228

229229
func create_blob_sidecars*(
230-
forkyBlck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock |
231-
fulu.SignedBeaconBlock,
230+
forkyBlck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock,
232231
kzg_proofs: deneb.KzgProofs,
233232
blobs: Blobs): seq[BlobSidecar] =
234233
template kzg_commitments: untyped =

beacon_chain/spec/validator.nim

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
55
# at your option. This file may not be copied, modified, or distributed except according to those terms.
66

7-
{.push raises: [].}
7+
{.push raises: [], gcsafe.}
88

99
# Helpers and functions pertaining to managing the validator set
1010

@@ -445,13 +445,12 @@ func compute_proposer_indices*(
445445
epoch: Epoch, seed: Eth2Digest,
446446
indices: seq[ValidatorIndex]
447447
): seq[Opt[ValidatorIndex]] =
448-
let startSlot = epoch.start_slot()
449448
var proposerIndices: seq[Opt[ValidatorIndex]]
450449

451-
for i in 0..<SLOTS_PER_EPOCH:
450+
for epochSlot in epoch.slots():
452451
var buffer: array[32 + 8, byte]
453452
buffer[0..31] = seed.data
454-
buffer[32..39] = uint_to_bytes((startSlot + i).asUInt64)
453+
buffer[32..39] = uint_to_bytes(epochSlot.asUInt64)
455454

456455
let slotSeed = eth2digest(buffer) # Concatenate manually using buffer
457456
let proposerIndex = compute_proposer_index(state, indices, slotSeed)
@@ -524,14 +523,12 @@ func get_beacon_proposer_indices*(
524523
shuffled_index, seq_len, epoch_shuffle_seed))
525524

526525
res
527-
528526
else:
529527
# Not using shuffled indices here is not a bug,
530528
# as the method of computing proposer in the below
531529
# function does not require shuffled indices post Fulu
532530
get_beacon_proposer_indices(state, epoch)
533531

534-
535532
func initialize_proposer_lookahead*(state: electra.BeaconState,
536533
cache: var StateCache):
537534
HashArray[Limit ((MIN_SEED_LOOKAHEAD + 1) * SLOTS_PER_EPOCH), uint64] =

beacon_chain/validators/beacon_validators.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ proc proposeBlockAux(
559559
)
560560

561561
blobsOpt =
562-
when consensusFork >= ConsensusFork.Deneb:
562+
when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
563563
Opt.some(
564564
signedBlock.create_blob_sidecars(
565565
engineBlock.blobsBundle.proofs, engineBlock.blobsBundle.blobs

research/wss_sim.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
{.push raises: [].}
8+
{.push raises: [], gcsafe.}
99

1010
# `wss_sim` loads a state and a set of validator keys, then simulates a
1111
# beacon chain running with the given validators producing blocks
@@ -306,7 +306,7 @@ cli do(validatorsDir: string, secretsDir: string,
306306
proposerPrivkey).toValidatorSig())
307307

308308
dump(".", signedBlock)
309-
when consensusFork >= ConsensusFork.Deneb:
309+
when consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
310310
let blobs = signedBlock.create_blob_sidecars(
311311
payload.blobsBundle.proofs, payload.blobsBundle.blobs)
312312
for blob in blobs:

tests/test_block_processor.nim

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
66
# at your option. This file may not be copied, modified, or distributed except according to those terms.
77

8-
{.push raises: [].}
8+
{.push raises: [], gcsafe.}
99
{.used.}
1010

1111
import
@@ -73,9 +73,8 @@ suite "Block processor" & preset():
7373
discard processor.runQueueProcessingLoop()
7474

7575
asyncTest "Reverse order block add & get" & preset():
76-
let
77-
missing = await processor[].addBlock(
78-
MsgSource.gossip, ForkedSignedBeaconBlock.init(b2))
76+
let missing = await processor[].addBlock(
77+
MsgSource.gossip, ForkedSignedBeaconBlock.init(b2))
7978

8079
check: missing.error == VerifierError.MissingParent
8180

tests/test_sync_manager.nim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ func createBlobs(
7575
var res = newSeq[ref BlobSidecar](len(slots))
7676
for blck in blocks:
7777
withBlck(blck[]):
78-
when consensusFork >= ConsensusFork.Deneb:
78+
when consensusFork >= ConsensusFork.Fulu:
79+
doAssert false # create_blob_sidecars() might not work as such
80+
elif consensusFork in [ConsensusFork.Deneb, ConsensusFork.Electra]:
7981
template kzgs: untyped = forkyBlck.message.body.blob_kzg_commitments
8082
for i, slot in slots:
8183
if slot == forkyBlck.message.slot:

0 commit comments

Comments
 (0)