Skip to content

Commit 415a42a

Browse files
authored
Add proto for DataColumnIdentifier, DataColumnSidecar, DataColumnSidecarsByRangeRequest and MetadataV2. (#14649)
* Add data column sidecars proto. * Fix Terence's comment. * Re-add everything.
1 parent 25eae3a commit 415a42a

13 files changed

+1246
-43
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ The format is based on Keep a Changelog, and this project adheres to Semantic Ve
2626
- Validator REST mode Electra block support.
2727
- Added validator index label to `validator_statuses` metric.
2828
- Added Validator REST mode use of Attestation V2 endpoints and Electra attestations.
29+
- PeerDAS: Added proto for `DataColumnIdentifier`, `DataColumnSidecar`, `DataColumnSidecarsByRangeRequest` and `MetadataV2`.
2930

3031
### Changed
3132

beacon-chain/rpc/eth/config/handlers_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ func TestGetSpec(t *testing.T) {
7979
config.DenebForkEpoch = 105
8080
config.ElectraForkVersion = []byte("ElectraForkVersion")
8181
config.ElectraForkEpoch = 107
82+
config.Eip7594ForkEpoch = 109
8283
config.BLSWithdrawalPrefixByte = byte('b')
8384
config.ETH1AddressWithdrawalPrefixByte = byte('c')
8485
config.GenesisDelay = 24
@@ -189,7 +190,7 @@ func TestGetSpec(t *testing.T) {
189190
data, ok := resp.Data.(map[string]interface{})
190191
require.Equal(t, true, ok)
191192

192-
assert.Equal(t, 155, len(data))
193+
assert.Equal(t, 156, len(data))
193194
for k, v := range data {
194195
t.Run(k, func(t *testing.T) {
195196
switch k {
@@ -267,6 +268,8 @@ func TestGetSpec(t *testing.T) {
267268
assert.Equal(t, "0x"+hex.EncodeToString([]byte("ElectraForkVersion")), v)
268269
case "ELECTRA_FORK_EPOCH":
269270
assert.Equal(t, "107", v)
271+
case "EIP7594_FORK_EPOCH":
272+
assert.Equal(t, "109", v)
270273
case "MIN_ANCHOR_POW_BLOCK_DIFFICULTY":
271274
assert.Equal(t, "1000", v)
272275
case "BLS_WITHDRAWAL_PREFIX":

config/params/config.go

+14-4
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ type BeaconChainConfig struct {
166166
DenebForkEpoch primitives.Epoch `yaml:"DENEB_FORK_EPOCH" spec:"true"` // DenebForkEpoch is used to represent the assigned fork epoch for deneb.
167167
ElectraForkVersion []byte `yaml:"ELECTRA_FORK_VERSION" spec:"true"` // ElectraForkVersion is used to represent the fork version for electra.
168168
ElectraForkEpoch primitives.Epoch `yaml:"ELECTRA_FORK_EPOCH" spec:"true"` // ElectraForkEpoch is used to represent the assigned fork epoch for electra.
169+
Eip7594ForkEpoch primitives.Epoch `yaml:"EIP7594_FORK_EPOCH" spec:"true"` // EIP7594ForkEpoch is used to represent the assigned fork epoch for peer das.
169170

170171
ForkVersionSchedule map[[fieldparams.VersionLength]byte]primitives.Epoch // Schedule of fork epochs by version.
171172
ForkVersionNames map[[fieldparams.VersionLength]byte]string // Human-readable names of fork versions.
@@ -255,6 +256,13 @@ type BeaconChainConfig struct {
255256
MaxDepositRequestsPerPayload uint64 `yaml:"MAX_DEPOSIT_REQUESTS_PER_PAYLOAD" spec:"true"` // MaxDepositRequestsPerPayload is the maximum number of execution layer deposits in each payload
256257
UnsetDepositRequestsStartIndex uint64 `yaml:"UNSET_DEPOSIT_REQUESTS_START_INDEX" spec:"true"` // UnsetDepositRequestsStartIndex is used to check the start index for eip6110
257258

259+
// PeerDAS Values
260+
SamplesPerSlot uint64 `yaml:"SAMPLES_PER_SLOT"` // SamplesPerSlot refers to the number of random samples a node queries per slot.
261+
CustodyRequirement uint64 `yaml:"CUSTODY_REQUIREMENT"` // CustodyRequirement refers to the minimum amount of subnets a peer must custody and serve samples from.
262+
MinEpochsForDataColumnSidecarsRequest primitives.Epoch `yaml:"MIN_EPOCHS_FOR_DATA_COLUMN_SIDECARS_REQUESTS"` // MinEpochsForDataColumnSidecarsRequest is the minimum number of epochs the node will keep the data columns for.
263+
MaxCellsInExtendedMatrix uint64 `yaml:"MAX_CELLS_IN_EXTENDED_MATRIX" spec:"true"` // MaxCellsInExtendedMatrix is the full data of one-dimensional erasure coding extended blobs (in row major format).
264+
NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix.
265+
258266
// Networking Specific Parameters
259267
GossipMaxSize uint64 `yaml:"GOSSIP_MAX_SIZE" spec:"true"` // GossipMaxSize is the maximum allowed size of uncompressed gossip messages.
260268
MaxChunkSize uint64 `yaml:"MAX_CHUNK_SIZE" spec:"true"` // MaxChunkSize is the maximum allowed size of uncompressed req/resp chunked responses.
@@ -272,10 +280,6 @@ type BeaconChainConfig struct {
272280
AttestationSubnetPrefixBits uint64 `yaml:"ATTESTATION_SUBNET_PREFIX_BITS" spec:"true"` // AttestationSubnetPrefixBits is defined as (ceillog2(ATTESTATION_SUBNET_COUNT) + ATTESTATION_SUBNET_EXTRA_BITS).
273281
SubnetsPerNode uint64 `yaml:"SUBNETS_PER_NODE" spec:"true"` // SubnetsPerNode is the number of long-lived subnets a beacon node should be subscribed to.
274282
NodeIdBits uint64 `yaml:"NODE_ID_BITS" spec:"true"` // NodeIdBits defines the bit length of a node id.
275-
276-
// PeerDAS
277-
NumberOfColumns uint64 `yaml:"NUMBER_OF_COLUMNS" spec:"true"` // NumberOfColumns in the extended data matrix.
278-
MaxCellsInExtendedMatrix uint64 `yaml:"MAX_CELLS_IN_EXTENDED_MATRIX" spec:"true"` // MaxCellsInExtendedMatrix is the full data of one-dimensional erasure coding extended blobs (in row major format).
279283
}
280284

281285
// InitializeForkSchedule initializes the schedules forks baked into the config.
@@ -360,6 +364,12 @@ func DenebEnabled() bool {
360364
return BeaconConfig().DenebForkEpoch < math.MaxUint64
361365
}
362366

367+
// PeerDASEnabled centralizes the check to determine if code paths
368+
// that are specific to peerdas should be allowed to execute.
369+
func PeerDASEnabled() bool {
370+
return BeaconConfig().Eip7594ForkEpoch < math.MaxUint64
371+
}
372+
363373
// WithinDAPeriod checks if the block epoch is within MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS of the given current epoch.
364374
func WithinDAPeriod(block, current primitives.Epoch) bool {
365375
return block+BeaconConfig().MinEpochsForBlobsSidecarsRequest >= current

config/params/loader_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ import (
2525
// IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts.
2626
var placeholderFields = []string{
2727
"BYTES_PER_LOGS_BLOOM", // Compile time constant on ExecutionPayload.logs_bloom.
28-
"CUSTODY_REQUIREMENT",
2928
"EIP6110_FORK_EPOCH",
3029
"EIP6110_FORK_VERSION",
3130
"EIP7002_FORK_EPOCH",
3231
"EIP7002_FORK_VERSION",
33-
"EIP7594_FORK_EPOCH",
3432
"EIP7594_FORK_VERSION",
3533
"EIP7732_FORK_EPOCH",
3634
"EIP7732_FORK_VERSION",
@@ -43,7 +41,6 @@ var placeholderFields = []string{
4341
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
4442
"MAX_TRANSACTIONS_PER_PAYLOAD", // Compile time constant on ExecutionPayload.transactions.
4543
"REORG_HEAD_WEIGHT_THRESHOLD",
46-
"SAMPLES_PER_SLOT",
4744
"TARGET_NUMBER_OF_PEERS",
4845
"UPDATE_TIMEOUT",
4946
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",

config/params/mainnet_config.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
216216
DenebForkEpoch: mainnetDenebForkEpoch,
217217
ElectraForkVersion: []byte{5, 0, 0, 0},
218218
ElectraForkEpoch: mainnetElectraForkEpoch,
219+
Eip7594ForkEpoch: math.MaxUint64,
219220

220221
// New values introduced in Altair hard fork 1.
221222
// Participation flag indices.
@@ -295,8 +296,11 @@ var mainnetBeaconConfig = &BeaconChainConfig{
295296
UnsetDepositRequestsStartIndex: math.MaxUint64,
296297

297298
// PeerDAS
298-
NumberOfColumns: 128,
299-
MaxCellsInExtendedMatrix: 768,
299+
NumberOfColumns: 128,
300+
MaxCellsInExtendedMatrix: 768,
301+
SamplesPerSlot: 8,
302+
CustodyRequirement: 4,
303+
MinEpochsForDataColumnSidecarsRequest: 4096,
300304

301305
// Values related to networking parameters.
302306
GossipMaxSize: 10 * 1 << 20, // 10 MiB

proto/prysm/v1alpha1/BUILD.bazel

+22
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ ssz_electra_objs = [
174174
"SignedConsolidation",
175175
]
176176

177+
ssz_fulu_objs = [
178+
"DataColumnIdentifier",
179+
"DataColumnSidecar",
180+
]
181+
177182
ssz_gen_marshal(
178183
name = "ssz_generated_phase0",
179184
out = "phase0.ssz.go",
@@ -251,6 +256,19 @@ ssz_gen_marshal(
251256
objs = ssz_electra_objs,
252257
)
253258

259+
ssz_gen_marshal(
260+
name = "ssz_generated_fulu",
261+
out = "fulu.ssz.go",
262+
exclude_objs = ssz_phase0_objs + ssz_altair_objs + ssz_bellatrix_objs + ssz_capella_objs + ssz_deneb_objs + ssz_electra_objs,
263+
go_proto = ":go_proto",
264+
includes = [
265+
"//consensus-types/primitives:go_default_library",
266+
"//math:go_default_library",
267+
"//proto/engine/v1:go_default_library",
268+
],
269+
objs = ssz_fulu_objs,
270+
)
271+
254272
ssz_gen_marshal(
255273
name = "ssz_generated_non_core",
256274
out = "non-core.ssz.go",
@@ -263,8 +281,10 @@ ssz_gen_marshal(
263281
objs = [
264282
"BeaconBlocksByRangeRequest",
265283
"BlobSidecarsByRangeRequest",
284+
"DataColumnSidecarsByRangeRequest",
266285
"MetaDataV0",
267286
"MetaDataV1",
287+
"MetaDataV2",
268288
"SignedValidatorRegistrationV1",
269289
"ValidatorRegistrationV1",
270290
"BuilderBid",
@@ -313,6 +333,7 @@ go_library(
313333
":ssz_generated_capella", # keep
314334
":ssz_generated_deneb", # keep
315335
":ssz_generated_electra", # keep
336+
":ssz_generated_fulu", # keep
316337
":ssz_generated_non_core", # keep
317338
":ssz_generated_phase0", # keep
318339
],
@@ -354,6 +375,7 @@ ssz_proto_files(
354375
"beacon_state.proto",
355376
"blobs.proto",
356377
"light_client.proto",
378+
"data_columns.proto",
357379
"sync_committee.proto",
358380
"withdrawals.proto",
359381
],

0 commit comments

Comments
 (0)