Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add mainnet fork epoch #13601

Merged
merged 8 commits into from Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 13 additions & 11 deletions WORKSPACE
Expand Up @@ -234,7 +234,9 @@ filegroup(
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
)

consensus_spec_version = "v1.4.0-beta.6"
consensus_spec_version = "v1.4.0-beta.7"

consensus_spec_test_version = "v1.4.0-beta.7-hotfix"

bls_test_version = "v0.1.1"

Expand All @@ -250,8 +252,8 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "7dc467d7be97525c88a1d3683665c1354cc86297fd62009e7cf5000905b25652",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
sha256 = "c282c0f86f23f3d2e0f71f5975769a4077e62a7e3c7382a16bd26a7e589811a0",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_test_version,
)

http_archive(
Expand All @@ -266,8 +268,8 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "e163011254b6ce100205fb779ba660faedc9bc9f7bb4408c25746a7aa5e8d8bc",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
sha256 = "4649c35aa3b8eb0cfdc81bee7c05649f90ef36bede5b0513e1f2e8baf37d6033",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_test_version,
)

http_archive(
Expand All @@ -282,8 +284,8 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "b73c81b6386053a2141f6f43b457489668621c7013f740ed93edf9ac0e34f091",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
sha256 = "c5a03f724f757456ffaabd2a899992a71d2baf45ee4db65ca3518f2b7ee928c8",
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_test_version,
)

http_archive(
Expand All @@ -297,7 +299,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "47726c527512d03ef3e706a8e7f8d5db6a5f2153351db0470dab780f6a87c4dd",
sha256 = "049c29267310e6b88280f4f834a75866c2f5b9036fa97acb9d9c6db8f64d9118",
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 Expand Up @@ -328,9 +330,9 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
sha256 = "2701e1e1a3ec10c673fe7dbdbbe6f02c8ae8c922aebbf6e720d8c72d5458aafe",
strip_prefix = "eth2-networks-7b4897888cebef23801540236f73123e21774954",
url = "https://github.com/eth-clients/eth2-networks/archive/7b4897888cebef23801540236f73123e21774954.tar.gz",
sha256 = "77e7e3ed65e33b7bb19d30131f4c2bb39e4dfeb188ab9ae84651c3cc7600131d",
strip_prefix = "eth2-networks-934c948e69205dcf2deb87e4ae6cc140c335f94d",
url = "https://github.com/eth-clients/eth2-networks/archive/934c948e69205dcf2deb87e4ae6cc140c335f94d.tar.gz",
)

http_archive(
Expand Down
21 changes: 9 additions & 12 deletions beacon-chain/sync/rpc_beacon_blocks_by_range_test.go
Expand Up @@ -440,9 +440,7 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {
if !validateBlocks {
return
}
// Use a step of 1 to be inline with our specs.
req.Step = 1
for i := req.StartSlot; i < req.StartSlot.Add(req.Count*req.Step); i += primitives.Slot(req.Step) {
for i := req.StartSlot; i < req.StartSlot.Add(req.Count); i += primitives.Slot(req.Step) {
if !success {
continue
}
Expand Down Expand Up @@ -471,20 +469,21 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {
p1.Connect(p2)
assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected")

capacity := int64(flags.Get().BlockBatchLimit * 3)
clock := startup.NewClock(time.Unix(0, 0), [32]byte{})
reqSize := params.MaxRequestBlock(slots.ToEpoch(clock.CurrentSlot()))
r := &Service{cfg: &config{p2p: p1, beaconDB: d, chain: &chainMock.ChainService{}, clock: clock}, availableBlocker: mockBlocker{avail: true}, rateLimiter: newRateLimiter(p1)}

pcl := protocol.ID(p2p.RPCBlocksByRangeTopicV1)
topic := string(pcl)
r.rateLimiter.limiterMap[topic] = leakybucket.NewCollector(0.000001, capacity, time.Second, false)
defaultBlockBurstFactor := 2 // TODO: can we update the default value set in TestMain to match flags?
r.rateLimiter.limiterMap[topic] = leakybucket.NewCollector(0.000001, int64(flags.Get().BlockBatchLimit*defaultBlockBurstFactor), time.Second, false)
req := &ethpb.BeaconBlocksByRangeRequest{
StartSlot: 100,
Step: 5,
Count: uint64(capacity),
Count: reqSize,
}
saveBlocks(req)

// This doesn't error because reqSize by default is 128, which is exactly the burst factor * batch limit
assert.NoError(t, sendRequest(p1, p2, r, req, true, true))

remainingCapacity := r.rateLimiter.limiterMap[topic].Remaining(p2.PeerID().String())
Expand All @@ -498,18 +497,17 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {
p1.Connect(p2)
assert.Equal(t, 1, len(p1.BHost.Network().Peers()), "Expected peers to be connected")

capacity := int64(flags.Get().BlockBatchLimit * 3)
clock := startup.NewClock(time.Unix(0, 0), [32]byte{})
reqSize := params.MaxRequestBlock(slots.ToEpoch(clock.CurrentSlot())) - 1
r := &Service{cfg: &config{p2p: p1, beaconDB: d, clock: clock, chain: &chainMock.ChainService{}}, availableBlocker: mockBlocker{avail: true}, rateLimiter: newRateLimiter(p1)}

pcl := protocol.ID(p2p.RPCBlocksByRangeTopicV1)
topic := string(pcl)
r.rateLimiter.limiterMap[topic] = leakybucket.NewCollector(0.000001, capacity, time.Second, false)
r.rateLimiter.limiterMap[topic] = leakybucket.NewCollector(0.000001, int64(flags.Get().BlockBatchLimit), time.Second, false)

req := &ethpb.BeaconBlocksByRangeRequest{
StartSlot: 100,
Step: 5,
Count: uint64(capacity + 1),
Count: reqSize,
}
saveBlocks(req)

Expand Down Expand Up @@ -538,7 +536,6 @@ func TestRPCBeaconBlocksByRange_RPCHandlerRateLimitOverflow(t *testing.T) {

req := &ethpb.BeaconBlocksByRangeRequest{
StartSlot: 100,
Step: 1,
Count: uint64(flags.Get().BlockBatchLimit),
}
saveBlocks(req)
Expand Down
9 changes: 6 additions & 3 deletions config/params/mainnet_config.go
Expand Up @@ -23,7 +23,10 @@ const (
mainnetAltairForkEpoch = 74240 // Oct 27, 2021, 10:56:23am UTC
// Bellatrix Fork Epoch for mainnet config.
mainnetBellatrixForkEpoch = 144896 // Sept 6, 2022, 11:34:47am UTC
mainnetDenebForkEpoch = math.MaxUint64
// Capella Fork Epoch for mainnet config.
mainnetCapellaForkEpoch = 194048 // April 12, 2023, 22:27:35 UTC
prestonvanloon marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

@saolyn saolyn Feb 15, 2024

Choose a reason for hiding this comment

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

That being said, for consistency or at least appearing the same as the above comments, it should be:

Suggested change
mainnetCapellaForkEpoch = 194048 // April 12, 2023, 22:27:35 UTC
mainnetCapellaForkEpoch = 194048 // Apr 12, 2023, 22:27:35pm UTC

// Deneb Fork Epoch for mainnet config.
mainnetDenebForkEpoch = 269568 // March 13, 2024, 13:55:35 UTC
Copy link
Contributor

@saolyn saolyn Feb 15, 2024

Choose a reason for hiding this comment

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

Same here:

Suggested change
mainnetDenebForkEpoch = 269568 // March 13, 2024, 13:55:35 UTC
mainnetDenebForkEpoch = 269568 // Mar 13, 2024, 13:55:35pm UTC

)

var mainnetNetworkConfig = &NetworkConfig{
Expand Down Expand Up @@ -202,9 +205,9 @@ var mainnetBeaconConfig = &BeaconChainConfig{
BellatrixForkVersion: []byte{2, 0, 0, 0},
BellatrixForkEpoch: mainnetBellatrixForkEpoch,
CapellaForkVersion: []byte{3, 0, 0, 0},
CapellaForkEpoch: 194048,
CapellaForkEpoch: mainnetCapellaForkEpoch,
DenebForkVersion: []byte{4, 0, 0, 0},
DenebForkEpoch: math.MaxUint64,
DenebForkEpoch: mainnetDenebForkEpoch,

// New values introduced in Altair hard fork 1.
// Participation flag indices.
Expand Down
1 change: 1 addition & 0 deletions config/params/minimal_config.go
Expand Up @@ -90,6 +90,7 @@ func MinimalSpecConfig() *BeaconChainConfig {
minimalConfig.CapellaForkVersion = []byte{3, 0, 0, 1}
minimalConfig.CapellaForkEpoch = math.MaxUint64
minimalConfig.DenebForkVersion = []byte{4, 0, 0, 1}
minimalConfig.DenebForkEpoch = math.MaxUint64

minimalConfig.SyncCommitteeSize = 32
minimalConfig.InactivityScoreBias = 4
Expand Down