Compare commits

...

1 Commits

Author SHA1 Message Date
terence tsao
63e9be4944 Configure e2e preset with field parameters for testing environment 2025-09-06 11:27:50 -07:00
7 changed files with 111 additions and 2 deletions

View File

@@ -14,6 +14,13 @@ config_setting(
},
)
config_setting(
name = "e2e",
flag_values = {
"//proto:network": "e2e",
},
)
go_library(
name = "go_default_library",
srcs = ["util.go"],

View File

@@ -5,6 +5,7 @@ go_library(
srcs = select({
"//config:mainnet": ["mainnet.go"],
"//config:minimal": ["minimal.go"],
"//config:e2e": ["e2e.go"],
}),
importpath = "github.com/OffchainLabs/prysm/v6/config/fieldparams",
visibility = ["//visibility:public"],

49
config/fieldparams/e2e.go Normal file
View File

@@ -0,0 +1,49 @@
package field_params
const (
Preset = "e2e"
BlockRootsLength = 64 // SLOTS_PER_HISTORICAL_ROOT
StateRootsLength = 64 // SLOTS_PER_HISTORICAL_ROOT
RandaoMixesLength = 64 // EPOCHS_PER_HISTORICAL_VECTOR
HistoricalRootsLength = 16777216 // HISTORICAL_ROOTS_LIMIT
ValidatorRegistryLimit = 1099511627776 // VALIDATOR_REGISTRY_LIMIT
Eth1DataVotesLength = 16 // SLOTS_PER_ETH1_VOTING_PERIOD (2 * SLOTS_PER_EPOCH)
PreviousEpochAttestationsLength = 512 // MAX_ATTESTATIONS * SLOTS_PER_EPOCH
CurrentEpochAttestationsLength = 512 // MAX_ATTESTATIONS * SLOTS_PER_EPOCH
SlashingsLength = 64 // EPOCHS_PER_SLASHINGS_VECTOR
SyncCommitteeLength = 32 // SYNC_COMMITTEE_SIZE
RootLength = 32 // RootLength defines the byte length of a Merkle root.
BLSSignatureLength = 96 // BLSSignatureLength defines the byte length of a BLSSignature.
BLSPubkeyLength = 48 // BLSPubkeyLength defines the byte length of a BLSSignature.
MaxTxsPerPayloadLength = 1048576 // MaxTxsPerPayloadLength defines the maximum number of transactions that can be included in a payload.
MaxBytesPerTxLength = 1073741824 // MaxBytesPerTxLength defines the maximum number of bytes that can be included in a transaction.
FeeRecipientLength = 20 // FeeRecipientLength defines the byte length of a fee recipient.
LogsBloomLength = 256 // LogsBloomLength defines the byte length of a logs bloom.
VersionLength = 4 // VersionLength defines the byte length of a fork version number.
SlotsPerEpoch = 6 // SlotsPerEpoch defines the number of slots per epoch.
SyncCommitteeAggregationBytesLength = 1 // SyncCommitteeAggregationBytesLength defines the sync committee aggregate bytes.
SyncAggregateSyncCommitteeBytesLength = 4 // SyncAggregateSyncCommitteeBytesLength defines the length of sync committee bytes in a sync aggregate.
MaxWithdrawalsPerPayload = 4 // MaxWithdrawalsPerPayloadLength defines the maximum number of withdrawals that can be included in a payload.
MaxBlobCommitmentsPerBlock = 4096 // MaxBlobCommitmentsPerBlock defines the theoretical limit of blobs can be included in a block.
LogMaxBlobCommitments = 12 // Log_2 of MaxBlobCommitmentsPerBlock
BlobLength = 131072 // BlobLength defines the byte length of a blob.
BlobSize = 131072 // defined to match blob.size in bazel ssz codegen
BlobSidecarSize = 131928 // defined to match blob sidecar size in bazel ssz codegen
KzgCommitmentSize = 48 // KzgCommitmentSize defines the byte length of a KZG commitment.
KzgCommitmentInclusionProofDepth = 17 // Merkle proof depth for blob_kzg_commitments list item
ExecutionBranchDepth = 4 // ExecutionBranchDepth defines the number of leaves in a merkle proof of the execution payload header.
SyncCommitteeBranchDepth = 5 // SyncCommitteeBranchDepth defines the number of leaves in a merkle proof of a sync committee.
SyncCommitteeBranchDepthElectra = 6 // SyncCommitteeBranchDepthElectra defines the number of leaves in a merkle proof of a sync committee.
FinalityBranchDepth = 6 // FinalityBranchDepth defines the number of leaves in a merkle proof of the finalized checkpoint root.
FinalityBranchDepthElectra = 7 // FinalityBranchDepthElectra defines the number of leaves in a merkle proof of the finalized checkpoint root.
PendingDepositsLimit = 134217728 // Maximum number of pending balance deposits in the beacon state.
PendingPartialWithdrawalsLimit = 64 // Maximum number of pending partial withdrawals in the beacon state.
PendingConsolidationsLimit = 64 // Maximum number of pending consolidations in the beacon state.
MaxAttesterSlashingsElectra = 1 // Maximum number of attester slashings in a block.
MaxRandomByte = uint64(1<<8 - 1) // Maximum value for a random value using for proposer and sync committee sampling.
MaxRandomValueElectra = uint64(1<<16 - 1) // Maximum value for a random value using for proposer and sync committee sampling.
// Introduced in Fulu network upgrade.
NumberOfColumns = 128 // NumberOfColumns refers to the specified number of data columns that can exist in a network.
CellsPerBlob = 64 // CellsPerBlob refers to the number of cells in a (non-extended) blob.
)

View File

@@ -26,3 +26,10 @@ config_setting(
"@prysm//proto:network": "minimal",
},
)
config_setting(
name = "ssz_e2e",
flag_values = {
"@prysm//proto:network": "e2e",
},
)

View File

@@ -403,6 +403,7 @@ ssz_proto_files(
"//conditions:default": "mainnet",
"//proto:ssz_mainnet": "mainnet",
"//proto:ssz_minimal": "minimal",
"//proto:ssz_e2e": "e2e",
}),
)

View File

@@ -84,6 +84,45 @@ minimal = {
"proposer_lookahead_size": "16", # (MIN_SEED_LOOKAHEAD + 1) * SLOTS_PER_EPOCH
}
e2e = {
"block_roots.size": "64,32",
"state_roots.size": "64,32",
"eth1_data_votes.size": "16", # 2 * SLOTS_PER_EPOCH
"randao_mixes.size": "64,32",
"previous_epoch_attestations.max": "512", # MAX_ATTESTATIONS * SLOTS_PER_EPOCH
"current_epoch_attestations.max": "512", # MAX_ATTESTATIONS * SLOTS_PER_EPOCH
"slashings.size": "64",
"sync_committee_bits.size": "32",
"sync_committee_bytes.size": "4",
"sync_committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector32",
"sync_committee_aggregate_bytes.size": "1",
"sync_committee_aggregate_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector8",
"withdrawal.size": "4",
"blob.size": "131072",
"logs_bloom.size": "256",
"extra_data.size": "32",
"max_blobs_per_block.size": "6",
"max_blob_commitments.size": "4096",
"max_cell_proofs_length.size": "33554432", # FIELD_ELEMENTS_PER_EXT_BLOB * MAX_BLOB_COMMITMENTS_PER_BLOCK
"kzg_commitment_inclusion_proof_depth.size": "17",
"max_withdrawal_requests_per_payload.size": "16",
"max_deposit_requests_per_payload.size": "8192",
"max_attesting_indices.size": "8192",
"max_committees_per_slot.size": "4",
"committee_bits.size": "1",
"committee_bits.type": "github.com/prysmaticlabs/go-bitfield.Bitvector4",
"pending_deposits_limit": "134217728",
"pending_partial_withdrawals_limit": "64",
"pending_consolidations_limit": "64",
"max_consolidation_requests_per_payload.size": "2",
"field_elements_per_cell.size": "64",
"field_elements_per_ext_blob.size": "8192",
"bytes_per_cell.size": "2048", # FIELD_ELEMENTS_PER_CELL * BYTES_PER_FIELD_ELEMENT
"cells_per_blob.size": "128",
"kzg_commitments_inclusion_proof_depth.size": "4",
"proposer_lookahead_size": "12", # (MIN_SEED_LOOKAHEAD + 1) * SLOTS_PER_EPOCH = (1 + 1) * 6
}
###### Rules definitions #######
def _ssz_proto_files_impl(ctx):
@@ -95,6 +134,8 @@ def _ssz_proto_files_impl(ctx):
subs = mainnet
elif (ctx.attr.config.lower() == "minimal"):
subs = minimal
elif (ctx.attr.config.lower() == "e2e"):
subs = e2e
else:
fail("%s is an unknown configuration" % ctx.attr.config)

View File

@@ -11,7 +11,10 @@ def _go_test_transition_impl(settings, attr):
settings["@io_bazel_rules_go//go/config:tags"] = ["minimal"] + settings["@io_bazel_rules_go//go/config:tags"]
elif attr.eth_network == "mainnet": # Default / optional
settings["//proto:network"] = "mainnet"
settings["@io_bazel_rules_go//go/config:tags"] = ["mainnet"] + settings["@io_bazel_rules_go//go/config:tags"]
settings["@io_bazel_rules_go//go/config:tags"] = ["mainnet"] + settings["@io_bazel_rules_go//go/config:tags"]
elif attr.eth_network == "e2e":
settings["//proto:network"] = "e2e"
settings["@io_bazel_rules_go//go/config:tags"] = ["e2e"] + settings["@io_bazel_rules_go//go/config:tags"]
if attr.gotags:
settings["@io_bazel_rules_go//go/config:tags"] = attr.gotags + settings["@io_bazel_rules_go//go/config:tags"]
@@ -41,7 +44,7 @@ def _go_test_transition_rule(**kwargs):
kwargs = dict(kwargs)
attrs = dict(kwargs["attrs"])
attrs.update({
"eth_network": attr.string(values = ["mainnet", "minimal"]),
"eth_network": attr.string(values = ["mainnet", "minimal", "e2e"]),
})
kwargs["attrs"] = attrs
kwargs["cfg"] = go_test_transition