Skip to content

Commit

Permalink
Merge branch 'develop' into ssz-finality-optimistic
Browse files Browse the repository at this point in the history
  • Loading branch information
Inspector-Butters authored Feb 10, 2025
2 parents 6605db2 + 9fbe356 commit 37901ab
Show file tree
Hide file tree
Showing 16 changed files with 69 additions and 30 deletions.
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ filegroup(
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
)

consensus_spec_version = "v1.5.0-beta.1"
consensus_spec_version = "v1.5.0-beta.2"

bls_test_version = "v0.1.1"

Expand All @@ -271,7 +271,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-R6r60geCfEjMaB1Ag3svaMFXFIgaJvkTJhfKsf76rFE=",
integrity = "sha256-X/bMxbKg1clo2aFEjBoeuFq/U+BF1eQopgRP/7nI3Qg=",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
)

Expand All @@ -287,7 +287,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-2Pem2gMHxW/6bBhZ2BaqkQruQSd/dTS3WMaMQO8rZ/o=",
integrity = "sha256-WSxdri5OJGuNApW+odKle5UzToDyEOx+F3lMiqamJAg=",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
)

Expand All @@ -303,7 +303,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-5yP05JTV1MhcUZ2kSh+T+kXjG+uW3A5877veC5c1mD4=",
integrity = "sha256-LYE8l3y/zSt4YVrehrJ3ralqtgeYNildiIp+HR6+xAI=",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
)

Expand All @@ -318,7 +318,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-O6Rg6h19T0RsJs0sBDZ9O1k4LnCJ/gu2ilHijFBVfME=",
integrity = "sha256-jvZQ90qcJMTOqMsPO7sgeEVQmewZTHcz7LVDkNqwTFQ=",
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
25 changes: 23 additions & 2 deletions beacon-chain/rpc/eth/config/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'})
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion beacon-chain/state/state-native/setters_consolidation.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (b *BeaconState) SetPendingConsolidations(val []*ethpb.PendingConsolidation
b.pendingConsolidations = val

b.markFieldAsDirty(types.PendingConsolidations)
b.rebuildTrie[types.PendingConsolidations] = true
return nil
}

Expand Down
1 change: 0 additions & 1 deletion beacon-chain/state/state-native/setters_deposits.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ func (b *BeaconState) SetPendingDeposits(val []*ethpb.PendingDeposit) error {
b.pendingDeposits = val

b.markFieldAsDirty(types.PendingDeposits)
b.rebuildTrie[types.PendingDeposits] = true
return nil
}

Expand Down
4 changes: 0 additions & 4 deletions beacon-chain/state/state-native/setters_participation.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ func (b *BeaconState) SetPreviousParticipationBits(val []byte) error {

b.previousEpochParticipation = val
b.markFieldAsDirty(types.PreviousEpochParticipationBits)
b.rebuildTrie[types.PreviousEpochParticipationBits] = true
return nil
}

Expand All @@ -41,7 +40,6 @@ func (b *BeaconState) SetCurrentParticipationBits(val []byte) error {

b.currentEpochParticipation = val
b.markFieldAsDirty(types.CurrentEpochParticipationBits)
b.rebuildTrie[types.CurrentEpochParticipationBits] = true
return nil
}

Expand Down Expand Up @@ -126,7 +124,6 @@ func (b *BeaconState) ModifyPreviousParticipationBits(mutator func(val []byte) (
defer b.lock.Unlock()
b.previousEpochParticipation = participation
b.markFieldAsDirty(types.PreviousEpochParticipationBits)
b.rebuildTrie[types.PreviousEpochParticipationBits] = true
return nil
}

Expand Down Expand Up @@ -161,6 +158,5 @@ func (b *BeaconState) ModifyCurrentParticipationBits(mutator func(val []byte) ([
defer b.lock.Unlock()
b.currentEpochParticipation = participation
b.markFieldAsDirty(types.CurrentEpochParticipationBits)
b.rebuildTrie[types.CurrentEpochParticipationBits] = true
return nil
}
3 changes: 3 additions & 0 deletions changelog/nisdas_remove_useless_assignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- We remove the unused `rebuildTrie` assignments for fields which do not use them.
3 changes: 3 additions & 0 deletions changelog/radek_add-missing-config-values.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- Add missing config values from the spec.
3 changes: 3 additions & 0 deletions changelog/tt_add_pectra_testnet_dates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- Add Pectra testnet dates. (Sepolia and Holesky)
3 changes: 3 additions & 0 deletions changelog/tt_new_spec_test_beta2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Changed

- Update electra spec test to beta2
9 changes: 8 additions & 1 deletion config/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
12 changes: 3 additions & 9 deletions config/params/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,22 @@ import (
// These are variables that we don't use in Prysm. (i.e. future hardfork, light client... etc)
// IMPORTANT: Use one field per line and sort these alphabetically to reduce conflicts.
var placeholderFields = []string{
"BALANCE_PER_ADDITIONAL_CUSTODY_GROUP",
"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",
"VALIDATOR_CUSTODY_REQUIREMENT",
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",
"WHISK_FORK_EPOCH",
"WHISK_FORK_VERSION",
Expand Down
9 changes: 8 additions & 1 deletion config/params/mainnet_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ var mainnetBeaconConfig = &BeaconChainConfig{

// Fork choice algorithm constants.
ProposerScoreBoost: 40,
ReorgWeightThreshold: 20,
ReorgHeadWeightThreshold: 20,
ReorgParentWeightThreshold: 160,
ReorgMaxEpochsSinceFinalization: 2,
IntervalsPerSlot: 3,
Expand Down Expand Up @@ -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),

Expand All @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions config/params/minimal_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions config/params/testnet_holesky_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func HoleskyConfig() *BeaconChainConfig {
cfg.CapellaForkVersion = []byte{0x4, 0x1, 0x70, 0x0}
cfg.DenebForkEpoch = 29696
cfg.DenebForkVersion = []byte{0x05, 0x1, 0x70, 0x0}
cfg.ElectraForkEpoch = math.MaxUint64
cfg.ElectraForkVersion = []byte{0x06, 0x1, 0x70, 0x0} // TODO: Define holesky fork version for electra. This is a placeholder value.
cfg.ElectraForkEpoch = 115968 // Mon, Feb 24 at 21:55:12 UTC
cfg.ElectraForkVersion = []byte{0x06, 0x1, 0x70, 0x0}
cfg.FuluForkEpoch = math.MaxUint64
cfg.FuluForkVersion = []byte{0x07, 0x1, 0x70, 0x0} // TODO: Define holesky fork version for fulu. This is a placeholder value.
cfg.TerminalTotalDifficulty = "0"
Expand Down
4 changes: 2 additions & 2 deletions config/params/testnet_sepolia_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ func SepoliaConfig() *BeaconChainConfig {
cfg.CapellaForkVersion = []byte{0x90, 0x00, 0x00, 0x72}
cfg.DenebForkEpoch = 132608
cfg.DenebForkVersion = []byte{0x90, 0x00, 0x00, 0x73}
cfg.ElectraForkEpoch = math.MaxUint64
cfg.ElectraForkVersion = []byte{0x90, 0x00, 0x00, 0x74} // TODO: Define sepolia fork version for electra. This is a placeholder value.
cfg.ElectraForkEpoch = 222464 // Wed, Mar 5 at 07:29:36 UTC
cfg.ElectraForkVersion = []byte{0x90, 0x00, 0x00, 0x74}
cfg.FuluForkEpoch = math.MaxUint64
cfg.FuluForkVersion = []byte{0x90, 0x00, 0x00, 0x75} // TODO: Define sepolia fork version for fulu. This is a placeholder value.
cfg.TerminalTotalDifficulty = "17000000000000000"
Expand Down

0 comments on commit 37901ab

Please sign in to comment.