Add missing config values from the spec (#14903)

* Add missing config values from the spec

* remove placeholders

* add some more values
This commit is contained in:
Radosław Kapka
2025-02-10 15:17:13 +01:00
committed by GitHub
parent 81a2a17c5f
commit dcd25d1d97
7 changed files with 49 additions and 15 deletions

View File

@@ -78,7 +78,7 @@ func (f *ForkChoice) ShouldOverrideFCU() (override bool) {
// }
// Only orphan a block if the head LMD vote is weak
if head.weight*100 > f.store.committeeWeight*params.BeaconConfig().ReorgWeightThreshold {
if head.weight*100 > f.store.committeeWeight*params.BeaconConfig().ReorgHeadWeightThreshold {
return
}
@@ -143,7 +143,7 @@ func (f *ForkChoice) GetProposerHead() [32]byte {
}
// Only orphan a block if the head LMD vote is weak
if head.weight*100 > f.store.committeeWeight*params.BeaconConfig().ReorgWeightThreshold {
if head.weight*100 > f.store.committeeWeight*params.BeaconConfig().ReorgHeadWeightThreshold {
return head.root
}

View File

@@ -153,6 +153,13 @@ func TestGetSpec(t *testing.T) {
config.UnsetDepositRequestsStartIndex = 92
config.MaxDepositRequestsPerPayload = 93
config.MaxPendingDepositsPerEpoch = 94
config.MaxBlobCommitmentsPerBlock = 95
config.MaxBytesPerTransaction = 96
config.MaxExtraDataBytes = 97
config.BytesPerLogsBloom = 98
config.MaxTransactionsPerPayload = 99
config.FieldElementsPerBlob = 100
config.KzgCommitmentInclusionProofDepth = 101
var dbp [4]byte
copy(dbp[:], []byte{'0', '0', '0', '1'})
@@ -191,7 +198,7 @@ func TestGetSpec(t *testing.T) {
data, ok := resp.Data.(map[string]interface{})
require.Equal(t, true, ok)
assert.Equal(t, 161, len(data))
assert.Equal(t, 168, len(data))
for k, v := range data {
t.Run(k, func(t *testing.T) {
switch k {
@@ -437,7 +444,7 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "76", v)
case "REORG_MAX_EPOCHS_SINCE_FINALIZATION":
assert.Equal(t, "2", v)
case "REORG_WEIGHT_THRESHOLD":
case "REORG_HEAD_WEIGHT_THRESHOLD":
assert.Equal(t, "20", v)
case "REORG_PARENT_WEIGHT_THRESHOLD":
assert.Equal(t, "160", v)
@@ -538,6 +545,20 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "9", v)
case "MAX_REQUEST_BLOB_SIDECARS_ELECTRA":
assert.Equal(t, "1152", v)
case "MAX_BLOB_COMMITMENTS_PER_BLOCK":
assert.Equal(t, "95", v)
case "MAX_BYTES_PER_TRANSACTION":
assert.Equal(t, "96", v)
case "MAX_EXTRA_DATA_BYTES":
assert.Equal(t, "97", v)
case "BYTES_PER_LOGS_BLOOM":
assert.Equal(t, "98", v)
case "MAX_TRANSACTIONS_PER_PAYLOAD":
assert.Equal(t, "99", v)
case "FIELD_ELEMENTS_PER_BLOB":
assert.Equal(t, "100", v)
case "KZG_COMMITMENT_INCLUSION_PROOF_DEPTH":
assert.Equal(t, "101", v)
default:
t.Errorf("Incorrect key: %s", k)
}

View File

@@ -0,0 +1,3 @@
### Fixed
- Add missing config values from the spec.

View File

@@ -70,7 +70,7 @@ type BeaconChainConfig struct {
// Fork choice algorithm constants.
ProposerScoreBoost uint64 `yaml:"PROPOSER_SCORE_BOOST" spec:"true"` // ProposerScoreBoost defines a value that is a % of the committee weight for fork-choice boosting.
ReorgWeightThreshold uint64 `yaml:"REORG_WEIGHT_THRESHOLD" spec:"true"` // ReorgWeightThreshold defines a value that is a % of the committee weight to consider a block weak and subject to being orphaned.
ReorgHeadWeightThreshold uint64 `yaml:"REORG_HEAD_WEIGHT_THRESHOLD" spec:"true"` // ReorgHeadWeightThreshold defines a value that is a % of the committee weight to consider a block weak and subject to being orphaned.
ReorgParentWeightThreshold uint64 `yaml:"REORG_PARENT_WEIGHT_THRESHOLD" spec:"true"` // ReorgParentWeightThreshold defines a value that is a % of the committee weight to consider a parent block strong and subject its child to being orphaned.
ReorgMaxEpochsSinceFinalization primitives.Epoch `yaml:"REORG_MAX_EPOCHS_SINCE_FINALIZATION" spec:"true"` // This defines a limit to consider safe to orphan a block if the network is finalizing
IntervalsPerSlot uint64 `yaml:"INTERVALS_PER_SLOT" spec:"true"` // IntervalsPerSlot defines the number of fork choice intervals in a slot defined in the fork choice spec.
@@ -217,6 +217,10 @@ type BeaconChainConfig struct {
TerminalBlockHash common.Hash `yaml:"TERMINAL_BLOCK_HASH" spec:"true"` // TerminalBlockHash of beacon chain.
TerminalBlockHashActivationEpoch primitives.Epoch `yaml:"TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH" spec:"true"` // TerminalBlockHashActivationEpoch of beacon chain.
TerminalTotalDifficulty string `yaml:"TERMINAL_TOTAL_DIFFICULTY" spec:"true"` // TerminalTotalDifficulty is part of the experimental Bellatrix spec. This value is type is currently TBD.
MaxBytesPerTransaction uint64 `yaml:"MAX_BYTES_PER_TRANSACTION" spec:"true"` // MaxBytesPerTransaction is the maximum number of bytes a single transaction can have.
MaxTransactionsPerPayload uint64 `yaml:"MAX_TRANSACTIONS_PER_PAYLOAD" spec:"true"` // MaxTransactionsPerPayload is the maximum number of transactions a single execution payload can include.
BytesPerLogsBloom uint64 `yaml:"BYTES_PER_LOGS_BLOOM" spec:"true"` // BytesPerLogsBloom is the number of bytes that constitute a log bloom filter.
MaxExtraDataBytes uint64 `yaml:"MAX_EXTRA_DATA_BYTES" spec:"true"` // MaxExtraDataBytes is the maximum number of bytes for the execution payload's extra data field.
DefaultFeeRecipient common.Address // DefaultFeeRecipient where the transaction fee goes to.
EthBurnAddressHex string // EthBurnAddressHex is the constant eth address written in hex format to burn fees in that network. the default is 0x0
DefaultBuilderGasLimit uint64 // DefaultBuilderGasLimit is the default used to set the gaslimit for the Builder APIs, typically at around 30M wei.
@@ -240,6 +244,9 @@ type BeaconChainConfig struct {
MaxRequestBlobSidecars uint64 `yaml:"MAX_REQUEST_BLOB_SIDECARS" spec:"true"` // MaxRequestBlobSidecars is the maximum number of blobs to request in a single request.
MaxRequestBlobSidecarsElectra uint64 `yaml:"MAX_REQUEST_BLOB_SIDECARS_ELECTRA" spec:"true"` // MaxRequestBlobSidecarsElectra is the maximum number of blobs to request in a single request.
MaxRequestBlocksDeneb uint64 `yaml:"MAX_REQUEST_BLOCKS_DENEB" spec:"true"` // MaxRequestBlocksDeneb is the maximum number of blocks in a single request after the deneb epoch.
FieldElementsPerBlob uint64 `yaml:"FIELD_ELEMENTS_PER_BLOB" spec:"true"` // FieldElementsPerBlob is the number of field elements that constitute a single blob.
MaxBlobCommitmentsPerBlock uint64 `yaml:"MAX_BLOB_COMMITMENTS_PER_BLOCK" spec:"true"` // MaxBlobCommitmentsPerBlock is the maximum number of KZG commitments that a block can have.
KzgCommitmentInclusionProofDepth uint64 `yaml:"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH" spec:"true"` // KzgCommitmentInclusionProofDepth is the depth of the merkle proof of a KZG commitment.
// Values introduced in Electra upgrade
MaxPerEpochActivationExitChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_EXIT_CHURN_LIMIT" spec:"true"` // MaxPerEpochActivationExitChurnLimit represents the maximum combined activation and exit churn.

View File

@@ -25,25 +25,17 @@ import (
// IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts.
var placeholderFields = []string{
"BLOB_SIDECAR_SUBNET_COUNT_FULU",
"BYTES_PER_LOGS_BLOOM", // Compile time constant on ExecutionPayload.logs_bloom.
"EIP6110_FORK_EPOCH",
"EIP6110_FORK_VERSION",
"EIP7002_FORK_EPOCH",
"EIP7002_FORK_VERSION",
"EIP7732_FORK_EPOCH",
"EIP7732_FORK_VERSION",
"FIELD_ELEMENTS_PER_BLOB", // Compile time constant.
"KZG_COMMITMENT_INCLUSION_PROOF_DEPTH", // Compile time constant on BlobSidecar.commitment_inclusion_proof.
"MAX_BLOBS_PER_BLOCK_FULU",
"MAX_BLOB_COMMITMENTS_PER_BLOCK", // Compile time constant on BeaconBlockBodyDeneb.blob_kzg_commitments.
"MAX_BYTES_PER_TRANSACTION", // Used for ssz of EL transactions. Unused in Prysm.
"MAX_EXTRA_DATA_BYTES", // Compile time constant on ExecutionPayload.extra_data.
"MAX_PAYLOAD_SIZE",
"MAX_REQUEST_BLOB_SIDECARS_FULU",
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
"MAX_TRANSACTIONS_PER_PAYLOAD", // Compile time constant on ExecutionPayload.transactions.
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
"NUMBER_OF_CUSTODY_GROUPS",
"REORG_HEAD_WEIGHT_THRESHOLD",
"TARGET_NUMBER_OF_PEERS",
"UPDATE_TIMEOUT",
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",

View File

@@ -111,7 +111,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{
// Fork choice algorithm constants.
ProposerScoreBoost: 40,
ReorgWeightThreshold: 20,
ReorgHeadWeightThreshold: 20,
ReorgParentWeightThreshold: 160,
ReorgMaxEpochsSinceFinalization: 2,
IntervalsPerSlot: 3,
@@ -262,6 +262,10 @@ var mainnetBeaconConfig = &BeaconChainConfig{
TerminalBlockHashActivationEpoch: 18446744073709551615,
TerminalBlockHash: [32]byte{},
TerminalTotalDifficulty: "58750000000000000000000", // Estimated: Sept 15, 2022
MaxBytesPerTransaction: 1073741824,
MaxTransactionsPerPayload: 1048576,
BytesPerLogsBloom: 256,
MaxExtraDataBytes: 32,
EthBurnAddressHex: "0x0000000000000000000000000000000000000000",
DefaultBuilderGasLimit: uint64(30000000),
@@ -279,6 +283,9 @@ var mainnetBeaconConfig = &BeaconChainConfig{
MinEpochsForBlobsSidecarsRequest: 4096,
MaxRequestBlobSidecars: 768,
MaxRequestBlocksDeneb: 128,
FieldElementsPerBlob: 4096,
MaxBlobCommitmentsPerBlock: 4096,
KzgCommitmentInclusionProofDepth: 17,
// Values related to electra
MaxRequestDataColumnSidecars: 16384,

View File

@@ -103,6 +103,10 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.EpochsPerSyncCommitteePeriod = 8
minimalConfig.MinEpochsForBlockRequests = 272
// New Deneb params
minimalConfig.MaxBlobCommitmentsPerBlock = 32
minimalConfig.KzgCommitmentInclusionProofDepth = 10
// New Electra params
minimalConfig.MinPerEpochChurnLimitElectra = 64000000000
minimalConfig.MaxPerEpochActivationExitChurnLimit = 128000000000