From 5670a00c58c3dec5d2a38ab0dbd6c7a567c88d6f Mon Sep 17 00:00:00 2001 From: nisdas Date: Tue, 18 Feb 2025 12:22:11 +0800 Subject: [PATCH 1/4] Add in Multiclient E2E --- changelog/nisdas_enable_multiclient_e2e_electra.md | 4 ++++ testing/endtoend/components/lighthouse_beacon.go | 3 +-- testing/endtoend/deps.bzl | 6 +++--- testing/endtoend/endtoend_test.go | 14 +++++++------- testing/endtoend/evaluators/beaconapi/requests.go | 6 +++--- testing/endtoend/evaluators/beaconapi/verify.go | 11 ++++++++++- testing/endtoend/mainnet_e2e_test.go | 4 ++-- testing/endtoend/mainnet_scenario_e2e_test.go | 4 ++-- testing/endtoend/minimal_scenario_e2e_test.go | 4 ++-- 9 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 changelog/nisdas_enable_multiclient_e2e_electra.md diff --git a/changelog/nisdas_enable_multiclient_e2e_electra.md b/changelog/nisdas_enable_multiclient_e2e_electra.md new file mode 100644 index 000000000000..11ae5f6d1e40 --- /dev/null +++ b/changelog/nisdas_enable_multiclient_e2e_electra.md @@ -0,0 +1,4 @@ +### Added + +- Enable multiclient E2E for electra +- Enable Scenario E2E tests with electra \ No newline at end of file diff --git a/testing/endtoend/components/lighthouse_beacon.go b/testing/endtoend/components/lighthouse_beacon.go index 105565af62db..0d370623757a 100644 --- a/testing/endtoend/components/lighthouse_beacon.go +++ b/testing/endtoend/components/lighthouse_beacon.go @@ -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 diff --git a/testing/endtoend/deps.bzl b/testing/endtoend/deps.bzl index 88984aed464f..313c7f5e7f74 100644 --- a/testing/endtoend/deps.bzl +++ b/testing/endtoend/deps.bzl @@ -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, ) diff --git a/testing/endtoend/endtoend_test.go b/testing/endtoend/endtoend_test.go index 8e8f3d51e4f8..0d5b2a422765 100644 --- a/testing/endtoend/endtoend_test.go +++ b/testing/endtoend/endtoend_test.go @@ -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" + 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" + newPayloadMethod := "engine_newPayloadV4" // Fallback if deneb is not set. - if params.BeaconConfig().DenebForkEpoch == math.MaxUint64 { - newPayloadMethod = "engine_newPayloadV2" + if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 { + newPayloadMethod = "engine_newPayloadV3" } switch primitives.Epoch(epoch) { case freezeStartEpoch: diff --git a/testing/endtoend/evaluators/beaconapi/requests.go b/testing/endtoend/evaluators/beaconapi/requests.go index 291b70741f5c..fa4ada71ee07 100644 --- a/testing/endtoend/evaluators/beaconapi/requests.go +++ b/testing/endtoend/evaluators/beaconapi/requests.go @@ -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, diff --git a/testing/endtoend/evaluators/beaconapi/verify.go b/testing/endtoend/evaluators/beaconapi/verify.go index 1352fc1c32e0..f4daa391a732 100644 --- a/testing/endtoend/evaluators/beaconapi/verify.go +++ b/testing/endtoend/evaluators/beaconapi/verify.go @@ -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 := ðpb.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 := ðpb.SignedBeaconBlockElectra{} + if err := b.UnmarshalSSZ(blockData.getSszResp()); err != nil { + return errors.Wrap(err, msgSSZUnmarshalFailed) + } + bb := ðpb.SignedBlindedBeaconBlockElectra{} + if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil { + return errors.Wrap(err, msgSSZUnmarshalFailed) + } } // verify that dependent root of proposer duties matches block header diff --git a/testing/endtoend/mainnet_e2e_test.go b/testing/endtoend/mainnet_e2e_test.go index feaa908b56c6..dfdaf28dc489 100644 --- a/testing/endtoend/mainnet_e2e_test.go +++ b/testing/endtoend/mainnet_e2e_test.go @@ -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() } diff --git a/testing/endtoend/mainnet_scenario_e2e_test.go b/testing/endtoend/mainnet_scenario_e2e_test.go index 26f77c32ac54..1b9364083ab8 100644 --- a/testing/endtoend/mainnet_scenario_e2e_test.go +++ b/testing/endtoend/mainnet_scenario_e2e_test.go @@ -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 diff --git a/testing/endtoend/minimal_scenario_e2e_test.go b/testing/endtoend/minimal_scenario_e2e_test.go index ebb14aa02347..ca6cd61e069e 100644 --- a/testing/endtoend/minimal_scenario_e2e_test.go +++ b/testing/endtoend/minimal_scenario_e2e_test.go @@ -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 From 8ff52a164e876608111c5e23477f605a92495a04 Mon Sep 17 00:00:00 2001 From: nisdas Date: Tue, 18 Feb 2025 15:15:30 +0800 Subject: [PATCH 2/4] Fix Execution Engine --- testing/endtoend/evaluators/execution_engine.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/testing/endtoend/evaluators/execution_engine.go b/testing/endtoend/evaluators/execution_engine.go index 7719ceaaf4cb..98f0a59e57c0 100644 --- a/testing/endtoend/evaluators/execution_engine.go +++ b/testing/endtoend/evaluators/execution_engine.go @@ -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") } From 208c7b880278afcf330966f1d0ea962d36cd113d Mon Sep 17 00:00:00 2001 From: Nishant Das Date: Tue, 18 Feb 2025 18:24:14 +0800 Subject: [PATCH 3/4] Update testing/endtoend/endtoend_test.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RadosÅ‚aw Kapka --- testing/endtoend/endtoend_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/endtoend/endtoend_test.go b/testing/endtoend/endtoend_test.go index 0d5b2a422765..d38142a1a0eb 100644 --- a/testing/endtoend/endtoend_test.go +++ b/testing/endtoend/endtoend_test.go @@ -755,7 +755,7 @@ func (r *testRunner) multiScenario(ec *e2etypes.EvaluationContext, epoch uint64, thirdRecoveryEpochStart, thirdRecoveryEpochEnd := lastForkEpoch+13, lastForkEpoch+14 newPayloadMethod := "engine_newPayloadV4" - // Fallback if deneb is not set. + // Fallback if Electra is not set. if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 { newPayloadMethod = "engine_newPayloadV3" } From e11176b5456d76b93c58b83e46ddad0425284138 Mon Sep 17 00:00:00 2001 From: Nishant Das Date: Tue, 18 Feb 2025 18:24:23 +0800 Subject: [PATCH 4/4] Update testing/endtoend/endtoend_test.go MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: RadosÅ‚aw Kapka --- testing/endtoend/endtoend_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/endtoend/endtoend_test.go b/testing/endtoend/endtoend_test.go index d38142a1a0eb..7bd90fa90777 100644 --- a/testing/endtoend/endtoend_test.go +++ b/testing/endtoend/endtoend_test.go @@ -635,7 +635,7 @@ func (r *testRunner) multiScenarioMulticlient(ec *e2etypes.EvaluationContext, ep newPayloadMethod := "engine_newPayloadV4" forkChoiceUpdatedMethod := "engine_forkchoiceUpdatedV3" - // Fallback if deneb is not set. + // Fallback if Electra is not set. if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 { newPayloadMethod = "engine_newPayloadV3" forkChoiceUpdatedMethod = "engine_forkchoiceUpdatedV3"