Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ filegroup(
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
)

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

bls_test_version = "v0.1.1"

Expand All @@ -229,7 +229,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "24399b60ce3fbeb2311952d213dc3731b6dcb0f8881b016c283de5b518d2bbba",
sha256 = "e5106f78ff5690ed73e88d809755752f310e4bcd7a1986ac330e6c5f00a9db0e",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
)

Expand All @@ -245,7 +245,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "8e656ee48d2e2ebc9cf9baedb81f27925bc625b3e3fbb2883444a08758a5884a",
sha256 = "617dd1debde7b13f24f1955470ddce1bbce2b0bc70fb4e45ad46ed0efc0419fa",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
)

Expand All @@ -261,7 +261,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "8bd137da6cc57a25383bfac5bc37e31265098145278bd8002b88e24c8b4718b9",
sha256 = "d7ae9609a28d01b9c961c4f944e652593b18ebe24702219410cd66087c9570bc",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
)

Expand All @@ -276,7 +276,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "2bc1edb6e4a4f86c00317c04618a90b0ca29ee1eba833d0a64dd67fdd83fdbe3",
sha256 = "c5898001aaab2a5bb38a39ff9d17a52f1f9befcc26e63752cbf556040f0c884e",
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
7 changes: 7 additions & 0 deletions beacon-chain/core/epoch/epoch_processing.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ func ProcessRegistryUpdates(ctx context.Context, state state.BeaconState) (state
return nil, errors.Wrap(err, "could not get churn limit")
}

if state.Version() >= version.Deneb {
// Cap churn limit to max per epoch churn limit. New in EIP7514.
if churnLimit > params.BeaconConfig().MaxPerEpochActivationChurnLimit {
churnLimit = params.BeaconConfig().MaxPerEpochActivationChurnLimit
}
}

// Prevent churn limit cause index out of bound.
if churnLimit < limit {
limit = churnLimit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
slot := primitives.Slot(1)
driftGenesisTime(f, slot, 0)
newRoot := indexToHash(1)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err := prepareForkchoiceState(
ctx,
slot,
Expand All @@ -74,6 +75,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
slot = primitives.Slot(2)
driftGenesisTime(f, slot, 0)
newRoot = indexToHash(2)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err = prepareForkchoiceState(
ctx,
slot,
Expand Down Expand Up @@ -101,6 +103,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
slot = primitives.Slot(3)
driftGenesisTime(f, slot, 0)
newRoot = indexToHash(3)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err = prepareForkchoiceState(
ctx,
slot,
Expand Down Expand Up @@ -129,6 +132,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
slot = primitives.Slot(4)
driftGenesisTime(f, slot, 0)
newRoot = indexToHash(4)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err = prepareForkchoiceState(
ctx,
slot,
Expand Down Expand Up @@ -335,6 +339,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
cSlot := primitives.Slot(2)
driftGenesisTime(f, cSlot, 0)
c := indexToHash(2)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err := prepareForkchoiceState(
ctx,
cSlot,
Expand All @@ -354,6 +359,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {

bSlot := primitives.Slot(1)
b := indexToHash(1)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err = prepareForkchoiceState(
ctx,
bSlot,
Expand All @@ -378,6 +384,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
// A block D, building on B, is received at slot N+3. It should not be able to win without boosting.
dSlot := primitives.Slot(3)
d := indexToHash(3)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err = prepareForkchoiceState(
ctx,
dSlot,
Expand All @@ -398,6 +405,7 @@ func TestForkChoice_BoostProposerRoot_PreventsExAnteAttack(t *testing.T) {
// If the same block arrives with boosting then it becomes head:
driftGenesisTime(f, dSlot, 0)
d2 := indexToHash(30)
f.store.proposerBoostRoot = [32]byte{}
state, blkRoot, err = prepareForkchoiceState(
ctx,
dSlot,
Expand Down
3 changes: 2 additions & 1 deletion beacon-chain/forkchoice/doubly-linked-tree/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ func (s *Store) insert(ctx context.Context,
secondsIntoSlot := (timeNow - s.genesisTime) % params.BeaconConfig().SecondsPerSlot
currentSlot := slots.CurrentSlot(s.genesisTime)
boostThreshold := params.BeaconConfig().SecondsPerSlot / params.BeaconConfig().IntervalsPerSlot
if currentSlot == slot && secondsIntoSlot < boostThreshold {
isFirstBlock := s.proposerBoostRoot == [32]byte{}
if currentSlot == slot && secondsIntoSlot < boostThreshold && isFirstBlock {
s.proposerBoostRoot = root
}

Expand Down
4 changes: 3 additions & 1 deletion beacon-chain/rpc/eth/beacon/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func TestGetSpec(t *testing.T) {
resp, err := server.GetSpec(context.Background(), &emptypb.Empty{})
require.NoError(t, err)

assert.Equal(t, 111, len(resp.Data))
assert.Equal(t, 112, len(resp.Data))
for k, v := range resp.Data {
switch k {
case "CONFIG_NAME":
Expand Down Expand Up @@ -380,6 +380,8 @@ func TestGetSpec(t *testing.T) {
assert.Equal(t, "20", v)
case "REORG_PARENT_WEIGHT_THRESHOLD":
assert.Equal(t, "160", v)
case "MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT":
assert.Equal(t, "8", v)
case "SAFE_SLOTS_TO_IMPORT_OPTIMISTICALLY":
default:
t.Errorf("Incorrect key: %s", k)
Expand Down
5 changes: 4 additions & 1 deletion config/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,17 @@ type BeaconChainConfig struct {

// Mev-boost circuit breaker
MaxBuilderConsecutiveMissedSlots primitives.Slot // MaxBuilderConsecutiveMissedSlots defines the number of consecutive skip slot to fallback from using relay/builder to local execution engine for block construction.
MaxBuilderEpochMissedSlots primitives.Slot // MaxBuilderEpochMissedSlots is defines the number of total skip slot (per epoch rolling windows) to fallback from using relay/builder to local execution engine for block construction.
MaxBuilderEpochMissedSlots primitives.Slot // MaxBuilderEpochMissedSlots is defining the number of total skip slot (per epoch rolling windows) to fallback from using relay/builder to local execution engine for block construction.
LocalBlockValueBoost uint64 // LocalBlockValueBoost is the value boost for local block construction. This is used to prioritize local block construction over relay/builder block construction.

// Execution engine timeout value
ExecutionEngineTimeoutValue uint64 // ExecutionEngineTimeoutValue defines the seconds to wait before timing out engine endpoints with execution payload execution semantics (newPayload, forkchoiceUpdated).

// Subnet value
BlobsidecarSubnetCount uint64 `yaml:"BLOB_SIDECAR_SUBNET_COUNT"` // BlobsidecarSubnetCount is the number of blobsidecar subnets used in the gossipsub protocol.

// Values introduced in Deneb hard fork
MaxPerEpochActivationChurnLimit uint64 `yaml:"MAX_PER_EPOCH_ACTIVATION_CHURN_LIMIT" spec:"true"` // MaxPerEpochActivationChurnLimit is the maximum amount of churn allotted for validator activation.
}

// InitializeForkSchedule initializes the schedules forks baked into the config.
Expand Down
2 changes: 2 additions & 0 deletions config/params/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ var placeholderFields = []string{
"SUBNETS_PER_NODE",
"TTFB_TIMEOUT",
"UPDATE_TIMEOUT",
"WHISK_EPOCHS_PER_SHUFFLING_PHASE",
"WHISK_FORK_EPOCH",
"WHISK_FORK_VERSION",
"WHISK_PROPOSER_SELECTION_GAP",
}

func TestPlaceholderFieldsDistinctSorted(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions config/params/mainnet_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ var mainnetBeaconConfig = &BeaconChainConfig{

// Subnet value
BlobsidecarSubnetCount: 6,

MaxPerEpochActivationChurnLimit: 8,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not need the min here too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no change here

}

// MainnetTestConfig provides a version of the mainnet config that has a different name
Expand Down
3 changes: 2 additions & 1 deletion config/params/minimal_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.MaxCommitteesPerSlot = 4
minimalConfig.TargetCommitteeSize = 4
minimalConfig.MaxValidatorsPerCommittee = 2048
minimalConfig.MinPerEpochChurnLimit = 4
minimalConfig.MinPerEpochChurnLimit = 2 // Changed in EIP7514
minimalConfig.MaxPerEpochActivationChurnLimit = 4 // New in EIP7514
minimalConfig.ChurnLimitQuotient = 32
minimalConfig.ShuffleRoundCount = 10
minimalConfig.MinGenesisActiveValidatorCount = 64
Expand Down
4 changes: 2 additions & 2 deletions config/params/testdata/e2e_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ INACTIVITY_SCORE_BIAS: 4
INACTIVITY_SCORE_RECOVERY_RATE: 16
# 2**4 * 10**9 (= 16,000,000,000) Gwei
EJECTION_BALANCE: 16000000000
# 2**2 (= 4)
MIN_PER_EPOCH_CHURN_LIMIT: 4
# 2**1 (= 2)
MIN_PER_EPOCH_CHURN_LIMIT: 2
# [customized] scale queue churn at much lower validator counts for testing
CHURN_LIMIT_QUOTIENT: 65536

Expand Down
3 changes: 3 additions & 0 deletions config/params/testnet_e2e_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func E2EMainnetTestConfig() *BeaconChainConfig {
e2eConfig.CapellaForkVersion = []byte{3, 0, 0, 254}
e2eConfig.DenebForkVersion = []byte{4, 0, 0, 254}

// Deneb changes.
e2eConfig.MinPerEpochChurnLimit = 2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not need max here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should just use the default which is 8


e2eConfig.InitializeForkSchedule()
return e2eConfig
}
8 changes: 3 additions & 5 deletions testing/endtoend/evaluators/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ import (
"google.golang.org/protobuf/types/known/emptypb"
)

// churnLimit is normally 4 unless the validator set is extremely large.
var churnLimit = 4
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am removing this to use the default config

var depositValCount = e2e.DepositCount
var numOfExits = 2

Expand All @@ -39,7 +37,7 @@ var depositsInBlockStart = params.E2ETestConfig().EpochsPerEth1VotingPeriod * 2

// deposits included + finalization + MaxSeedLookahead for activation.
var depositActivationStartEpoch = depositsInBlockStart + 2 + params.E2ETestConfig().MaxSeedLookahead
var depositEndEpoch = depositActivationStartEpoch + primitives.Epoch(math.Ceil(float64(depositValCount)/float64(churnLimit)))
var depositEndEpoch = depositActivationStartEpoch + primitives.Epoch(math.Ceil(float64(depositValCount)/float64(params.BeaconConfig().MinPerEpochChurnLimit)))
var exitSubmissionEpoch = primitives.Epoch(7)

// ProcessesDepositsInBlocks ensures the expected amount of deposits are accepted into blocks.
Expand Down Expand Up @@ -249,8 +247,8 @@ func activatesDepositedValidators(ec *e2etypes.EvaluationContext, conns ...*grpc
return fmt.Errorf("missing %d validators for post-genesis deposits", len(expected))
}

if deposits != churnLimit {
return fmt.Errorf("expected %d deposits to be processed in epoch %d, received %d", churnLimit, epoch, deposits)
if uint64(deposits) != params.BeaconConfig().MinPerEpochChurnLimit {
return fmt.Errorf("expected %d deposits to be processed in epoch %d, received %d", params.BeaconConfig().MinPerEpochChurnLimit, epoch, deposits)
}

if lowBalance > 0 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ type KZGTestData struct {

func TestVerifyBlobKZGProofBatch(t *testing.T) {
require.NoError(t, kzgPrysm.Start())
testFolders, testFolderPath := utils.TestFolders(t, "general", "deneb", "kzg/verify_blob_kzg_proof_batch/small")
testFolders, testFolderPath := utils.TestFolders(t, "general", "deneb", "kzg/verify_blob_kzg_proof_batch/kzg-mainnet")
if len(testFolders) == 0 {
t.Fatalf("No test folders found for %s/%s/%s", "general", "deneb", "kzg/verify_blob_kzg_proof_batch/small")
t.Fatalf("No test folders found for %s/%s/%s", "general", "deneb", "kzg/verify_blob_kzg_proof_batch/kzg-mainnet")
}
for _, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions testing/spectest/general/phase0/bls/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func TestAggregate(t *testing.T) {
}

func testAggregate(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate/small")
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate/bls")
if len(testFolders) == 0 {
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/aggregate/small")
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/aggregate/bls")
}
for _, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions testing/spectest/general/phase0/bls/aggregate_verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func TestAggregateVerify(t *testing.T) {
}

func testAggregateVerify(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate_verify/small")
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/aggregate_verify/bls")
if len(testFolders) == 0 {
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/aggregate_verify/small")
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/aggregate_verify/bls")
}
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func TestFastAggregateVerify(t *testing.T) {
}

func testFastAggregateVerify(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/fast_aggregate_verify/small")
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/fast_aggregate_verify/bls")
if len(testFolders) == 0 {
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/fast_aggregate_verify/small")
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/fast_aggregate_verify/bls")
}
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions testing/spectest/general/phase0/bls/sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ func TestSign(t *testing.T) {
}

func testSign(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/sign/small")
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/sign/bls")
if len(testFolders) == 0 {
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/sign/small")
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/sign/bls")
}
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions testing/spectest/general/phase0/bls/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func TestVerify(t *testing.T) {
}

func testVerify(t *testing.T) {
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/verify/small")
testFolders, testFolderPath := utils.TestFolders(t, "general", "phase0", "bls/verify/bls")
if len(testFolders) == 0 {
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/verify/small")
t.Fatalf("No test folders found for %s/%s/%s", "general", "phase0", "bls/verify/bls")
}
for i, folder := range testFolders {
t.Run(folder.Name(), func(t *testing.T) {
Expand Down