Skip to content

Commit 1be3185

Browse files
authored
add fulu.KzgProofs/fulu.BlobsBundle and disambiguate elsewhere (#7412)
1 parent d207850 commit 1be3185

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

beacon_chain/el/engine_api_conversions.nim

Lines changed: 4 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

1010
import
1111
kzg4844/[kzg_abi, kzg],
@@ -191,7 +191,7 @@ func asConsensusType*(payload: engine_api.GetPayloadV3Response):
191191
commitments: KzgCommitments.init(
192192
payload.blobsBundle.commitments.mapIt(
193193
kzg_abi.KzgCommitment(bytes: it.data))),
194-
proofs: KzgProofs.init(
194+
proofs: deneb.KzgProofs.init(
195195
payload.blobsBundle.proofs.mapIt(
196196
kzg_abi.KzgProof(bytes: it.data))),
197197
blobs: Blobs.init(
@@ -211,7 +211,7 @@ func asConsensusType*(
211211
commitments: KzgCommitments.init(
212212
payload.blobsBundle.commitments.mapIt(
213213
kzg_abi.KzgCommitment(bytes: it.data))),
214-
proofs: KzgProofs.init(
214+
proofs: deneb.KzgProofs.init(
215215
payload.blobsBundle.proofs.mapIt(
216216
kzg_abi.KzgProof(bytes: it.data))),
217217
blobs: Blobs.init(
@@ -231,7 +231,7 @@ func asConsensusType*(
231231
commitments: KzgCommitments.init(
232232
payload.blobsBundle.commitments.mapIt(
233233
kzg_abi.KzgCommitment(bytes: it.data))),
234-
proofs: KzgProofs.init(
234+
proofs: deneb.KzgProofs.init(
235235
payload.blobsBundle.proofs.mapIt(
236236
kzg_abi.KzgProof(bytes: it.data))),
237237
blobs: Blobs.init(

beacon_chain/spec/datatypes/fulu.nim

Lines changed: 16 additions & 6 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
# Types specific to Fulu (i.e. known to have changed across hard forks) - see
1111
# `base` for types and guidelines common across forks
@@ -35,7 +35,7 @@ from ./altair import
3535
from ./capella import
3636
ExecutionBranch, HistoricalSummary, SignedBLSToExecutionChange,
3737
SignedBLSToExecutionChangeList, Withdrawal, EXECUTION_PAYLOAD_GINDEX
38-
from ./deneb import Blobs, BlobsBundle, KzgCommitments, KzgProofs
38+
from ./deneb import Blobs, KzgCommitments, KzgProofs
3939

4040
export json_serialization, base
4141

@@ -90,12 +90,12 @@ type
9090
DataColumn* = List[KzgCell, Limit(MAX_BLOB_COMMITMENTS_PER_BLOCK)]
9191
DataColumnIndices* = List[ColumnIndex, Limit(NUMBER_OF_COLUMNS)]
9292

93-
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-beta.3/specs/fulu/das-core.md#datacolumnsidecar
93+
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.5/specs/fulu/das-core.md#datacolumnsidecar
9494
DataColumnSidecar* = object
9595
index*: ColumnIndex # Index of column in extended matrix
9696
column*: DataColumn
9797
kzg_commitments*: KzgCommitments
98-
kzg_proofs*: KzgProofs
98+
kzg_proofs*: deneb.KzgProofs
9999
signed_block_header*: SignedBeaconBlockHeader
100100
kzg_commitments_inclusion_proof*:
101101
array[KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH, Eth2Digest]
@@ -125,6 +125,16 @@ type
125125
column_index*: ColumnIndex
126126
row_index*: RowIndex
127127

128+
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.5/specs/fulu/validator.md#blobsbundle
129+
KzgProofs* = List[KzgProof,
130+
Limit FIELD_ELEMENTS_PER_EXT_BLOB * MAX_BLOB_COMMITMENTS_PER_BLOCK]
131+
132+
# https://github.com/ethereum/consensus-specs/blob/v1.6.0-alpha.5/specs/fulu/validator.md#blobsbundle
133+
BlobsBundle* = object
134+
commitments*: KzgCommitments
135+
proofs*: fulu.KzgProofs
136+
blobs*: Blobs
137+
128138
# Not in spec, defined in order to compute custody subnets
129139
CgcBits* = BitArray[DATA_COLUMN_SIDECAR_SUBNET_COUNT]
130140

@@ -166,7 +176,7 @@ type
166176
ExecutionPayloadForSigning* = object
167177
executionPayload*: ExecutionPayload
168178
blockValue*: Wei
169-
blobsBundle*: BlobsBundle
179+
blobsBundle*: deneb.BlobsBundle # [New in Fulu]
170180
executionRequests*: seq[seq[byte]]
171181

172182
# https://github.com/ethereum/consensus-specs/blob/v1.5.0-alpha.10/specs/deneb/beacon-chain.md#executionpayloadheader
@@ -608,7 +618,7 @@ type
608618

609619
BlockContents* = object
610620
`block`*: BeaconBlock
611-
kzg_proofs*: KzgProofs
621+
kzg_proofs*: deneb.KzgProofs
612622
blobs*: Blobs
613623

614624
func shortLog*(v: DataColumnSidecar): auto =

beacon_chain/spec/eth2_apis/eth2_rest_serialization.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ RestJson.useDefaultSerializationFor(
4646
BeaconBlockHeader,
4747
BlobSidecar,
4848
BlobSidecarInfoObject,
49-
BlobsBundle,
5049
Checkpoint,
5150
ConsolidationRequest,
5251
ContributionAndProof,
@@ -224,6 +223,7 @@ RestJson.useDefaultSerializationFor(
224223
deneb.BeaconBlock,
225224
deneb.BeaconBlockBody,
226225
deneb.BeaconState,
226+
deneb.BlobsBundle,
227227
deneb.BlockContents,
228228
deneb.ExecutionPayload,
229229
deneb.ExecutionPayloadHeader,

beacon_chain/spec/helpers.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
# Uncategorized helper functions from the spec
1111

@@ -229,7 +229,7 @@ func verify_blob_sidecar_inclusion_proof*(
229229
func create_blob_sidecars*(
230230
forkyBlck: deneb.SignedBeaconBlock | electra.SignedBeaconBlock |
231231
fulu.SignedBeaconBlock,
232-
kzg_proofs: KzgProofs,
232+
kzg_proofs: deneb.KzgProofs,
233233
blobs: Blobs): seq[BlobSidecar] =
234234
template kzg_commitments: untyped =
235235
forkyBlck.message.body.blob_kzg_commitments

beacon_chain/spec/peerdas_helpers.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func get_data_column_sidecars*(signed_beacon_block: fulu.SignedBeaconBlock,
235235
index: ColumnIndex(column_index),
236236
column: DataColumn.init(column_cells),
237237
kzg_commitments: blck.body.blob_kzg_commitments,
238-
kzg_proofs: KzgProofs.init(column_proofs),
238+
kzg_proofs: deneb.KzgProofs.init(column_proofs),
239239
signed_block_header: signed_beacon_block_header)
240240
blck.body.build_proof(
241241
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH_GINDEX.GeneralizedIndex,
@@ -292,7 +292,7 @@ proc assemble_data_column_sidecars*(signed_beacon_block: fulu.SignedBeaconBlock,
292292
index: ColumnIndex(columnIndex),
293293
column: DataColumn.init(column),
294294
kzg_commitments: blck.body.blob_kzg_commitments,
295-
kzg_proofs: KzgProofs.init(kzgProofOfColumn),
295+
kzg_proofs: deneb.KzgProofs.init(kzgProofOfColumn),
296296
signed_block_header: signed_beacon_block_header)
297297
blck.body.build_proof(
298298
KZG_COMMITMENTS_INCLUSION_PROOF_DEPTH_GINDEX.GeneralizedIndex,

tests/test_mev_calls.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
{.used.}
1010

1111
import
@@ -274,7 +274,7 @@ proc setupEngineAPI*(router: var RestRouter, node: TestNodeRef) =
274274
execution_payload: electra.ExecutionPayload(
275275
parent_hash: blck.message.body.execution_payload_header.parent_hash
276276
),
277-
blobs_bundle: BlobsBundle()
277+
blobs_bundle: deneb.BlobsBundle()
278278
)
279279
respondSszOrJson(contentType, payload)
280280
else:

tests/test_sync_manager.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
{.used.}
1010

1111
import std/[strutils, sequtils]
@@ -83,7 +83,7 @@ func createBlobs(
8383
if kzgs.len > 0:
8484
forkyBlck.root = hash_tree_root(forkyBlck.message)
8585
var
86-
kzg_proofs: KzgProofs
86+
kzg_proofs: deneb.KzgProofs
8787
blobs: Blobs
8888
for _ in kzgs:
8989
doAssert kzg_proofs.add default(KzgProof)
@@ -1739,7 +1739,7 @@ suite "SyncManager test suite":
17391739

17401740
test "[SyncQueue] checkBlobsResponse() test":
17411741
const maxBlobsPerBlockElectra = 9
1742-
1742+
17431743
proc checkBlobsResponse[T](
17441744
req: SyncRequest[T],
17451745
data: openArray[Slot]): Result[void, cstring] =

0 commit comments

Comments
 (0)