Skip to content

Commit d396a99

Browse files
nisdasrkapka
andauthored
Add in Multiclient E2E For Electra (#14946)
* Add in Multiclient E2E * Fix Execution Engine * Update testing/endtoend/endtoend_test.go Co-authored-by: Radosław Kapka <[email protected]> * Update testing/endtoend/endtoend_test.go Co-authored-by: Radosław Kapka <[email protected]> --------- Co-authored-by: Radosław Kapka <[email protected]>
1 parent e3f8f12 commit d396a99

File tree

10 files changed

+45
-24
lines changed

10 files changed

+45
-24
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Added
2+
3+
- Enable multiclient E2E for electra
4+
- Enable Scenario E2E tests with electra

testing/endtoend/components/lighthouse_beacon.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ func (node *LighthouseBeaconNode) Start(ctx context.Context) error {
189189
fmt.Sprintf("--metrics-port=%d", e2e.TestParams.Ports.LighthouseBeaconNodeMetricsPort+index),
190190
"--metrics",
191191
"--http",
192-
"--http-allow-sync-stalled",
193192
"--enable-private-discovery",
194193
"--debug-level=debug",
195194
"--suggested-fee-recipient=0x878705ba3f8bc32fcf7f4caa1a35e72af65cf766",
@@ -266,7 +265,7 @@ func (node *LighthouseBeaconNode) createTestnetDir(ctx context.Context, index in
266265
if err := file.WriteFile(bootPath, enrYaml); err != nil {
267266
return "", err
268267
}
269-
deployPath := filepath.Join(testNetDir, "deploy_block.txt")
268+
deployPath := filepath.Join(testNetDir, "deposit_contract_block.txt")
270269
deployYaml := []byte("0")
271270
if err := file.WriteFile(deployPath, deployYaml); err != nil {
272271
return "", err

testing/endtoend/deps.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # gazelle:keep
22

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

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

1515
http_archive(
1616
name = "lighthouse",
17-
integrity = "sha256-9jmQN1AJUyogscUYibFchZMUXH0ZRKofW4oPhAFVRAE=",
17+
integrity = "sha256-qMPifuh7u0epItu8DzZ8YdZ2fVZNW7WKnbmmAgjh/us=",
1818
build_file = "@prysm//testing/endtoend:lighthouse.BUILD",
1919
url = ("https://github.com/sigp/lighthouse/releases/download/%s/" + lighthouse_archive_name) % lighthouse_version,
2020
)

testing/endtoend/endtoend_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,12 @@ func (r *testRunner) multiScenarioMulticlient(ec *e2etypes.EvaluationContext, ep
633633
recoveryEpochStart, recoveryEpochEnd := lastForkEpoch+3, lastForkEpoch+4
634634
secondRecoveryEpochStart, secondRecoveryEpochEnd := lastForkEpoch+8, lastForkEpoch+9
635635

636-
newPayloadMethod := "engine_newPayloadV3"
636+
newPayloadMethod := "engine_newPayloadV4"
637637
forkChoiceUpdatedMethod := "engine_forkchoiceUpdatedV3"
638-
// Fallback if deneb is not set.
639-
if params.BeaconConfig().DenebForkEpoch == math.MaxUint64 {
640-
newPayloadMethod = "engine_newPayloadV2"
641-
forkChoiceUpdatedMethod = "engine_forkchoiceUpdatedV2"
638+
// Fallback if Electra is not set.
639+
if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 {
640+
newPayloadMethod = "engine_newPayloadV3"
641+
forkChoiceUpdatedMethod = "engine_forkchoiceUpdatedV3"
642642
}
643643

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

757-
newPayloadMethod := "engine_newPayloadV3"
758-
// Fallback if deneb is not set.
759-
if params.BeaconConfig().DenebForkEpoch == math.MaxUint64 {
760-
newPayloadMethod = "engine_newPayloadV2"
757+
newPayloadMethod := "engine_newPayloadV4"
758+
// Fallback if Electra is not set.
759+
if params.BeaconConfig().ElectraForkEpoch == math.MaxUint64 {
760+
newPayloadMethod = "engine_newPayloadV3"
761761
}
762762
switch primitives.Epoch(epoch) {
763763
case freezeStartEpoch:

testing/endtoend/evaluators/beaconapi/requests.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ var getRequests = map[string]endpoint{
8080
withParams(func(_ primitives.Epoch) []string {
8181
return []string{"head"}
8282
})),
83-
"/beacon/blocks/{param1}/attestations": newMetadata[structs.GetBlockAttestationsResponse](
84-
v1PathTemplate,
83+
"/beacon/blocks/{param1}/attestations": newMetadata[structs.GetBlockAttestationsV2Response](
84+
v2PathTemplate,
8585
withParams(func(_ primitives.Epoch) []string {
8686
return []string{"head"}
8787
})),
@@ -99,7 +99,7 @@ var getRequests = map[string]endpoint{
9999
return []string{"head"}
100100
})),
101101
"/beacon/pool/attestations": newMetadata[structs.ListAttestationsResponse](
102-
v1PathTemplate,
102+
v2PathTemplate,
103103
withSanityCheckOnly()),
104104
"/beacon/pool/attester_slashings": newMetadata[structs.GetAttesterSlashingsResponse](
105105
v1PathTemplate,

testing/endtoend/evaluators/beaconapi/verify.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func postEvaluation(nodeIdx int, requests map[string]endpoint, epoch primitives.
154154
if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil {
155155
return errors.Wrap(err, msgSSZUnmarshalFailed)
156156
}
157-
} else {
157+
} else if epoch < params.BeaconConfig().ElectraForkEpoch {
158158
b := &ethpb.SignedBeaconBlockDeneb{}
159159
if err := b.UnmarshalSSZ(blockData.getSszResp()); err != nil {
160160
return errors.Wrap(err, msgSSZUnmarshalFailed)
@@ -163,6 +163,15 @@ func postEvaluation(nodeIdx int, requests map[string]endpoint, epoch primitives.
163163
if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil {
164164
return errors.Wrap(err, msgSSZUnmarshalFailed)
165165
}
166+
} else {
167+
b := &ethpb.SignedBeaconBlockElectra{}
168+
if err := b.UnmarshalSSZ(blockData.getSszResp()); err != nil {
169+
return errors.Wrap(err, msgSSZUnmarshalFailed)
170+
}
171+
bb := &ethpb.SignedBlindedBeaconBlockElectra{}
172+
if err := bb.UnmarshalSSZ(blindedBlockData.getSszResp()); err != nil {
173+
return errors.Wrap(err, msgSSZUnmarshalFailed)
174+
}
166175
}
167176

168177
// verify that dependent root of proposer duties matches block header

testing/endtoend/evaluators/execution_engine.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,15 @@ func retrieveHeadSlot(resp *structs.GetBlockV2Response) (uint64, error) {
130130
if err != nil {
131131
return 0, err
132132
}
133+
case version.String(version.Electra):
134+
b := &structs.BeaconBlockElectra{}
135+
if err := json.Unmarshal(resp.Data.Message, b); err != nil {
136+
return 0, err
137+
}
138+
headSlot, err = strconv.ParseUint(b.Slot, 10, 64)
139+
if err != nil {
140+
return 0, err
141+
}
133142
default:
134143
return 0, errors.New("no valid block type retrieved")
135144
}

testing/endtoend/mainnet_e2e_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010

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

1717
func TestEndToEnd_MainnetConfig_MultiClient(t *testing.T) {
18-
e2eMainnet(t, false, true, types.InitForkCfg(version.Bellatrix, version.Deneb, params.E2EMainnetTestConfig()), types.WithValidatorCrossClient()).run()
18+
e2eMainnet(t, false, true, types.InitForkCfg(version.Bellatrix, version.Electra, params.E2EMainnetTestConfig()), types.WithValidatorCrossClient()).run()
1919
}

testing/endtoend/mainnet_scenario_e2e_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

1111
func TestEndToEnd_MultiScenarioRun_Multiclient(t *testing.T) {
12-
cfg := types.InitForkCfg(version.Bellatrix, version.Deneb, params.E2EMainnetTestConfig())
13-
runner := e2eMainnet(t, false, true, cfg, types.WithEpochs(24))
12+
cfg := types.InitForkCfg(version.Bellatrix, version.Electra, params.E2EMainnetTestConfig())
13+
runner := e2eMainnet(t, false, true, cfg, types.WithEpochs(26))
1414
// override for scenario tests
1515
runner.config.Evaluators = scenarioEvalsMulti(cfg)
1616
runner.config.EvalInterceptor = runner.multiScenarioMulticlient

testing/endtoend/minimal_scenario_e2e_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
)
1010

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

0 commit comments

Comments
 (0)