From 403d88b1368132323c989f65477ded2a770c9f97 Mon Sep 17 00:00:00 2001 From: Potuz Date: Wed, 31 Dec 2025 13:32:30 -0300 Subject: [PATCH] Add e2e test for state-diff feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Register EnableStateDiff and StateDiffExponents flags with the beacon-chain CLI, and add an e2e test that runs with the state-diff feature enabled. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- cmd/beacon-chain/main.go | 1 + config/features/flags.go | 1 + testing/endtoend/BUILD.bazel | 1 + testing/endtoend/minimal_hdiff_e2e_test.go | 16 ++++++++++++++++ testing/endtoend/types/types.go | 9 +++++++++ 5 files changed, 28 insertions(+) create mode 100644 testing/endtoend/minimal_hdiff_e2e_test.go diff --git a/cmd/beacon-chain/main.go b/cmd/beacon-chain/main.go index df25adde48..24bcdb1b49 100644 --- a/cmd/beacon-chain/main.go +++ b/cmd/beacon-chain/main.go @@ -156,6 +156,7 @@ var appFlags = []cli.Flag{ dasFlags.BackfillOldestSlot, dasFlags.BlobRetentionEpochFlag, flags.BatchVerifierLimit, + flags.StateDiffExponents, } func init() { diff --git a/config/features/flags.go b/config/features/flags.go index e4723ff6db..a3b66743fc 100644 --- a/config/features/flags.go +++ b/config/features/flags.go @@ -270,6 +270,7 @@ var BeaconChainFlags = combinedFlags([]cli.Flag{ DisableQUIC, EnableDiscoveryReboot, enableExperimentalAttestationPool, + EnableStateDiff, forceHeadFlag, blacklistRoots, }, deprecatedBeaconFlags, deprecatedFlags, upcomingDeprecation) diff --git a/testing/endtoend/BUILD.bazel b/testing/endtoend/BUILD.bazel index ab15472fe5..4058159e4d 100644 --- a/testing/endtoend/BUILD.bazel +++ b/testing/endtoend/BUILD.bazel @@ -95,6 +95,7 @@ go_test( "endtoend_setup_test.go", "endtoend_test.go", "minimal_e2e_test.go", + "minimal_hdiff_e2e_test.go", "minimal_slashing_e2e_test.go", "slasher_simulator_e2e_test.go", ], diff --git a/testing/endtoend/minimal_hdiff_e2e_test.go b/testing/endtoend/minimal_hdiff_e2e_test.go new file mode 100644 index 0000000000..4ddd2f15b7 --- /dev/null +++ b/testing/endtoend/minimal_hdiff_e2e_test.go @@ -0,0 +1,16 @@ +package endtoend + +import ( + "testing" + + "github.com/OffchainLabs/prysm/v7/config/params" + "github.com/OffchainLabs/prysm/v7/runtime/version" + "github.com/OffchainLabs/prysm/v7/testing/endtoend/types" +) + +func TestEndToEnd_MinimalConfig_WithStateDiff(t *testing.T) { + r := e2eMinimal(t, types.InitForkCfg(version.Bellatrix, version.Electra, params.E2ETestConfig()), + types.WithStateDiff(), + ) + r.run() +} diff --git a/testing/endtoend/types/types.go b/testing/endtoend/types/types.go index 8de400bc58..3468356e93 100644 --- a/testing/endtoend/types/types.go +++ b/testing/endtoend/types/types.go @@ -67,6 +67,15 @@ func WithSSZOnly() E2EConfigOpt { } } +func WithStateDiff() E2EConfigOpt { + return func(cfg *E2EConfig) { + cfg.BeaconFlags = append(cfg.BeaconFlags, + "--enable-state-diff", + "--state-diff-exponents=6,5", // Small exponents for quick testing + ) + } +} + // E2EConfig defines the struct for all configurations needed for E2E testing. type E2EConfig struct { TestCheckpointSync bool