Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 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.4"
consensus_spec_version = "v1.5.0-beta.5"

bls_test_version = "v0.1.1"

Expand All @@ -271,7 +271,7 @@ filegroup(
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-QG0NUqaCvP5lKaKKwF/fmeICZVjONMlb7EE+MtYl0C0=",
integrity = "sha256-H+Pt4z+HCVDnEBAv814yvsjR7f5l1IpumjFoTj2XnLE=",
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-8NQngTSSqzW/j3tOUi3r5h+94ChRbLNWTt7BOGqr4+E=",
integrity = "sha256-Dqiwf5BG7yYyURGf+i87AIdArAyztvcgjoi2kSxrGvo=",
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-gFqxbaBnJ7dtdoj0zFbVrtlHv/bLNuWjrTHkyCAjFjI=",
integrity = "sha256-xrmsFF243pzXHAjh1EQYKS9gtcwmtHK3wRZDSLlVVRk=",
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-9paalF0POULpP2ga+4ouHSETKYrWNCUCZoJHPuFw06E=",
integrity = "sha256-c+gGapqifCvFtmtxfhOwieBDO2Syxp13GECWEpWM/Ho=",
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 @@ -370,6 +370,22 @@ filegroup(
url = "https://github.com/eth-clients/holesky/archive/32a72e21c6e53c262f27d50dd540cb654517d03a.tar.gz", # 2025-03-17
)

http_archive(
name = "mainnet",
build_file_content = """
filegroup(
name = "configs",
srcs = [
"metadata/config.yaml",
],
visibility = ["//visibility:public"],
)
""",
integrity = "sha256-NZr/gsQK9rBHRnznlPBiNzJpK8MPMrfUa3f+QYqn1+g=",
strip_prefix = "mainnet-978f1794eada6f85bee76e4d2d5959a5fb8e0cc5",
url = "https://github.com/eth-clients/mainnet/archive/978f1794eada6f85bee76e4d2d5959a5fb8e0cc5.tar.gz",
)

http_archive(
name = "sepolia_testnet",
build_file_content = """
Expand Down
7 changes: 4 additions & 3 deletions beacon-chain/rpc/eth/beacon/handlers_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ func TestListAttestations(t *testing.T) {
t.Run("Pre-Electra", func(t *testing.T) {
bs, err := util.NewBeaconState()
require.NoError(t, err)

chainService := &blockchainmock.ChainService{State: bs}
slot := primitives.Slot(0)
chainService := &blockchainmock.ChainService{State: bs, Slot: &slot}
s := &Server{
ChainInfoFetcher: chainService,
TimeFetcher: chainService,
Expand Down Expand Up @@ -1734,7 +1734,8 @@ func TestGetAttesterSlashings(t *testing.T) {
t.Run("pre-electra-ok", func(t *testing.T) {
bs, err := util.NewBeaconState()
require.NoError(t, err)
chainService := &blockchainmock.ChainService{State: bs}
slot := primitives.Slot(0)
chainService := &blockchainmock.ChainService{State: bs, Slot: &slot}

s := &Server{
ChainInfoFetcher: chainService,
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/rpc/eth/blob/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestBlobs(t *testing.T) {

mockChainService := &mockChain.ChainService{
FinalizedRoots: map[[32]byte]bool{},
Genesis: time.Now().Add(-time.Duration(uint64(params.BeaconConfig().SlotsPerEpoch)*uint64(params.BeaconConfig().DenebForkEpoch)*params.BeaconConfig().SecondsPerSlot) * time.Second),
}
s := &Server{
OptimisticModeFetcher: mockChainService,
Expand Down
3 changes: 3 additions & 0 deletions changelog/tt_8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- Add support for Electra fork epoch
2 changes: 2 additions & 0 deletions config/params/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ go_test(
"config_test.go",
"configset_test.go",
"loader_test.go",
"mainnet_config_export_test.go",
"mainnet_config_test.go",
"testnet_config_test.go",
"testnet_holesky_config_test.go",
Expand All @@ -61,6 +62,7 @@ go_test(
"@eth2_networks//:configs",
"@holesky_testnet//:configs",
"@hoodi_testnet//:configs",
"@mainnet//:configs",
"@sepolia_testnet//:configs",
],
embed = [":go_default_library"],
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 @@ -35,6 +35,8 @@ var placeholderFields = []string{
"EIP7441_FORK_VERSION",
"EIP7732_FORK_EPOCH",
"EIP7732_FORK_VERSION",
"EIP7805_FORK_EPOCH",
"EIP7805_FORK_VERSION",
"EPOCHS_PER_SHUFFLING_PHASE",
"MAX_BLOBS_PER_BLOCK_FULU",
"MAX_REQUEST_BLOB_SIDECARS_FULU",
Expand Down
2 changes: 1 addition & 1 deletion config/params/mainnet_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const (
// Deneb Fork Epoch for mainnet config.
mainnetDenebForkEpoch = 269568 // March 13, 2024, 13:55:35 UTC
// Electra Fork Epoch for mainnet config
mainnetElectraForkEpoch = math.MaxUint64 // Far future / to be defined
mainnetElectraForkEpoch = 364032 // May 7, 2025, 10:05:11 UTC
// Fulu Fork Epoch for mainnet config
mainnetFuluForkEpoch = math.MaxUint64 // Far future / to be defined
)
Expand Down
6 changes: 6 additions & 0 deletions config/params/mainnet_config_export_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package params

// Re-exports for blackbox testing.
const MainnetDenebForkEpoch = mainnetDenebForkEpoch
var MainnetBeaconConfig = mainnetBeaconConfig

34 changes: 28 additions & 6 deletions config/params/mainnet_config_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package params
package params_test

import (
"path"
"testing"

"github.com/OffchainLabs/prysm/v6/config/params"
"github.com/OffchainLabs/prysm/v6/consensus-types/primitives"
"github.com/OffchainLabs/prysm/v6/testing/require"
"github.com/bazelbuild/rules_go/go/tools/bazel"
)

func TestMaxRequestBlock(t *testing.T) {
Expand All @@ -13,21 +17,39 @@ func TestMaxRequestBlock(t *testing.T) {
description string
}{
{
epoch: primitives.Epoch(mainnetDenebForkEpoch - 1), // Assuming the fork epoch is not 0
expectedMaxBlock: mainnetBeaconConfig.MaxRequestBlocks,
epoch: primitives.Epoch(params.MainnetDenebForkEpoch - 1), // Assuming the fork epoch is not 0
expectedMaxBlock: params.MainnetBeaconConfig.MaxRequestBlocks,
},
{
epoch: primitives.Epoch(mainnetDenebForkEpoch),
expectedMaxBlock: mainnetBeaconConfig.MaxRequestBlocksDeneb,
epoch: primitives.Epoch(params.MainnetDenebForkEpoch),
expectedMaxBlock: params.MainnetBeaconConfig.MaxRequestBlocksDeneb,
},
}

for _, tc := range testCases {
t.Run(tc.description, func(t *testing.T) {
maxBlocks := MaxRequestBlock(tc.epoch)
maxBlocks := params.MaxRequestBlock(tc.epoch)
if maxBlocks != tc.expectedMaxBlock {
t.Errorf("For epoch %d, expected max blocks %d, got %d", tc.epoch, tc.expectedMaxBlock, maxBlocks)
}
})
}
}

func TestMainnetConfigMatchesUpstreamYaml(t *testing.T) {
presetFPs := presetsFilePath(t, "mainnet")
mn, err := params.ByName(params.MainnetName)
require.NoError(t, err)
cfg := mn.Copy()
for _, fp := range presetFPs {
cfg, err = params.UnmarshalConfigFile(fp, cfg)
require.NoError(t, err)
}
fPath, err := bazel.Runfile("external/mainnet")
require.NoError(t, err)
configFP := path.Join(fPath, "metadata", "config.yaml")
pcfg, err := params.UnmarshalConfigFile(configFP, nil)
require.NoError(t, err)
fields := fieldsFromYamls(t, append(presetFPs, configFP))
assertYamlFieldsMatch(t, "mainnet", fields, pcfg, params.BeaconConfig())
}
Loading