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 in Multiclient E2E For Electra #14946

Merged
merged 4 commits into from
Feb 18, 2025
Merged
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
4 changes: 4 additions & 0 deletions changelog/nisdas_enable_multiclient_e2e_electra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Added

- Enable multiclient E2E for electra
- Enable Scenario E2E tests with electra
3 changes: 1 addition & 2 deletions testing/endtoend/components/lighthouse_beacon.go
Original file line number Diff line number Diff line change
@@ -189,7 +189,6 @@ func (node *LighthouseBeaconNode) Start(ctx context.Context) error {
fmt.Sprintf("--metrics-port=%d", e2e.TestParams.Ports.LighthouseBeaconNodeMetricsPort+index),
"--metrics",
"--http",
"--http-allow-sync-stalled",
"--enable-private-discovery",
"--debug-level=debug",
"--suggested-fee-recipient=0x878705ba3f8bc32fcf7f4caa1a35e72af65cf766",
@@ -266,7 +265,7 @@ func (node *LighthouseBeaconNode) createTestnetDir(ctx context.Context, index in
if err := file.WriteFile(bootPath, enrYaml); err != nil {
return "", err
}
deployPath := filepath.Join(testNetDir, "deploy_block.txt")
deployPath := filepath.Join(testNetDir, "deposit_contract_block.txt")
deployYaml := []byte("0")
if err := file.WriteFile(deployPath, deployYaml); err != nil {
return "", err
6 changes: 3 additions & 3 deletions testing/endtoend/deps.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # gazelle:keep

lighthouse_version = "v4.6.0-rc.0"
lighthouse_archive_name = "lighthouse-%s-x86_64-unknown-linux-gnu-portable.tar.gz" % lighthouse_version
lighthouse_version = "v7.0.0-beta.0"
lighthouse_archive_name = "lighthouse-%s-x86_64-unknown-linux-gnu.tar.gz" % lighthouse_version

def e2e_deps():
http_archive(
@@ -14,7 +14,7 @@ def e2e_deps():

http_archive(
name = "lighthouse",
integrity = "sha256-9jmQN1AJUyogscUYibFchZMUXH0ZRKofW4oPhAFVRAE=",
integrity = "sha256-qMPifuh7u0epItu8DzZ8YdZ2fVZNW7WKnbmmAgjh/us=",
build_file = "@prysm//testing/endtoend:lighthouse.BUILD",
url = ("https://github.com/sigp/lighthouse/releases/download/%s/" + lighthouse_archive_name) % lighthouse_version,
)
18 changes: 9 additions & 9 deletions testing/endtoend/endtoend_test.go
Original file line number Diff line number Diff line change
@@ -633,12 +633,12 @@ func (r *testRunner) multiScenarioMulticlient(ec *e2etypes.EvaluationContext, ep
recoveryEpochStart, recoveryEpochEnd := lastForkEpoch+3, lastForkEpoch+4
secondRecoveryEpochStart, secondRecoveryEpochEnd := lastForkEpoch+8, lastForkEpoch+9

newPayloadMethod := "engine_newPayloadV3"
newPayloadMethod := "engine_newPayloadV4"
forkChoiceUpdatedMethod := "engine_forkchoiceUpdatedV3"
// Fallback if deneb is not set.
if params.BeaconConfig().DenebForkEpoch == math.MaxUint64 {
newPayloadMethod = "engine_newPayloadV2"
forkChoiceUpdatedMethod = "engine_forkchoiceUpdatedV2"
// Fallback if Electra is not set.
if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 {
newPayloadMethod = "engine_newPayloadV3"
forkChoiceUpdatedMethod = "engine_forkchoiceUpdatedV3"
}

switch primitives.Epoch(epoch) {
@@ -754,10 +754,10 @@ func (r *testRunner) multiScenario(ec *e2etypes.EvaluationContext, epoch uint64,
secondRecoveryEpochStart, secondRecoveryEpochEnd := lastForkEpoch+8, lastForkEpoch+9
thirdRecoveryEpochStart, thirdRecoveryEpochEnd := lastForkEpoch+13, lastForkEpoch+14

newPayloadMethod := "engine_newPayloadV3"
// Fallback if deneb is not set.
if params.BeaconConfig().DenebForkEpoch == math.MaxUint64 {
newPayloadMethod = "engine_newPayloadV2"
newPayloadMethod := "engine_newPayloadV4"
// Fallback if Electra is not set.
if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 {
newPayloadMethod = "engine_newPayloadV3"
}
switch primitives.Epoch(epoch) {
case freezeStartEpoch:
6 changes: 3 additions & 3 deletions testing/endtoend/evaluators/beaconapi/requests.go
Original file line number Diff line number Diff line change
@@ -80,8 +80,8 @@ var getRequests = map[string]endpoint{
withParams(func(_ primitives.Epoch) []string {
return []string{"head"}
})),
"/beacon/blocks/{param1}/attestations": newMetadata[structs.GetBlockAttestationsResponse](
v1PathTemplate,
"/beacon/blocks/{param1}/attestations": newMetadata[structs.GetBlockAttestationsV2Response](
v2PathTemplate,
withParams(func(_ primitives.Epoch) []string {
return []string{"head"}
})),
@@ -99,7 +99,7 @@ var getRequests = map[string]endpoint{
return []string{"head"}
})),
"/beacon/pool/attestations": newMetadata[structs.ListAttestationsResponse](
v1PathTemplate,
v2PathTemplate,
withSanityCheckOnly()),
"/beacon/pool/attester_slashings": newMetadata[structs.GetAttesterSlashingsResponse](
v1PathTemplate,
11 changes: 10 additions & 1 deletion testing/endtoend/evaluators/beaconapi/verify.go
Original file line number Diff line number Diff line change
@@ -154,7 +154,7 @@ func postEvaluation(nodeIdx int, requests map[string]endpoint, epoch primitives.
if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil {
return errors.Wrap(err, msgSSZUnmarshalFailed)
}
} else {
} else if epoch < params.BeaconConfig().ElectraForkEpoch {
b := &ethpb.SignedBeaconBlockDeneb{}
if err := b.UnmarshalSSZ(blockData.getSszResp()); err != nil {
return errors.Wrap(err, msgSSZUnmarshalFailed)
@@ -163,6 +163,15 @@ func postEvaluation(nodeIdx int, requests map[string]endpoint, epoch primitives.
if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil {
return errors.Wrap(err, msgSSZUnmarshalFailed)
}
} else {
b := &ethpb.SignedBeaconBlockElectra{}
if err := b.UnmarshalSSZ(blockData.getSszResp()); err != nil {
return errors.Wrap(err, msgSSZUnmarshalFailed)
}
bb := &ethpb.SignedBlindedBeaconBlockElectra{}
if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil {
return errors.Wrap(err, msgSSZUnmarshalFailed)
}
}

// verify that dependent root of proposer duties matches block header
9 changes: 9 additions & 0 deletions testing/endtoend/evaluators/execution_engine.go
Original file line number Diff line number Diff line change
@@ -130,6 +130,15 @@ func retrieveHeadSlot(resp *structs.GetBlockV2Response) (uint64, error) {
if err != nil {
return 0, err
}
case version.String(version.Electra):
b := &structs.BeaconBlockElectra{}
if err := json.Unmarshal(resp.Data.Message, b); err != nil {
return 0, err
}
headSlot, err = strconv.ParseUint(b.Slot, 10, 64)
if err != nil {
return 0, err
}
default:
return 0, errors.New("no valid block type retrieved")
}
4 changes: 2 additions & 2 deletions testing/endtoend/mainnet_e2e_test.go
Original file line number Diff line number Diff line change
@@ -10,10 +10,10 @@ import (

// Run mainnet e2e config with the current release validator against latest beacon node.
func TestEndToEnd_MainnetConfig_ValidatorAtCurrentRelease(t *testing.T) {
r := e2eMainnet(t, true, false, types.InitForkCfg(version.Bellatrix, version.Deneb, params.E2EMainnetTestConfig()))
r := e2eMainnet(t, true, false, types.InitForkCfg(version.Bellatrix, version.Electra, params.E2EMainnetTestConfig()))
r.run()
}

func TestEndToEnd_MainnetConfig_MultiClient(t *testing.T) {
e2eMainnet(t, false, true, types.InitForkCfg(version.Bellatrix, version.Deneb, params.E2EMainnetTestConfig()), types.WithValidatorCrossClient()).run()
e2eMainnet(t, false, true, types.InitForkCfg(version.Bellatrix, version.Electra, params.E2EMainnetTestConfig()), types.WithValidatorCrossClient()).run()
}
4 changes: 2 additions & 2 deletions testing/endtoend/mainnet_scenario_e2e_test.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import (
)

func TestEndToEnd_MultiScenarioRun_Multiclient(t *testing.T) {
cfg := types.InitForkCfg(version.Bellatrix, version.Deneb, params.E2EMainnetTestConfig())
runner := e2eMainnet(t, false, true, cfg, types.WithEpochs(24))
cfg := types.InitForkCfg(version.Bellatrix, version.Electra, params.E2EMainnetTestConfig())
runner := e2eMainnet(t, false, true, cfg, types.WithEpochs(26))
// override for scenario tests
runner.config.Evaluators = scenarioEvalsMulti(cfg)
runner.config.EvalInterceptor = runner.multiScenarioMulticlient
4 changes: 2 additions & 2 deletions testing/endtoend/minimal_scenario_e2e_test.go
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import (
)

func TestEndToEnd_MultiScenarioRun(t *testing.T) {
cfg := types.InitForkCfg(version.Bellatrix, version.Deneb, params.E2ETestConfig())
runner := e2eMinimal(t, cfg, types.WithEpochs(26))
cfg := types.InitForkCfg(version.Bellatrix, version.Electra, params.E2ETestConfig())
runner := e2eMinimal(t, cfg, types.WithEpochs(28))
// override for scenario tests
runner.config.Evaluators = scenarioEvals(cfg)
runner.config.EvalInterceptor = runner.multiScenario