diff --git a/beacon-chain/core/fulu/transition.go b/beacon-chain/core/fulu/transition.go index 7fa0fa6d54..c3a75cb356 100644 --- a/beacon-chain/core/fulu/transition.go +++ b/beacon-chain/core/fulu/transition.go @@ -16,10 +16,10 @@ func ProcessEpoch(ctx context.Context, state state.BeaconState) error { if err := electra.ProcessEpoch(ctx, state); err != nil { return errors.Wrap(err, "could not process epoch in fulu transition") } - return processProposerLookahead(ctx, state) + return ProcessProposerLookahead(ctx, state) } -func processProposerLookahead(ctx context.Context, state state.BeaconState) error { +func ProcessProposerLookahead(ctx context.Context, state state.BeaconState) error { _, span := trace.StartSpan(ctx, "fulu.processProposerLookahead") defer span.End() diff --git a/changelog/ttsao_add-fulu-proposer-lookahead-tests.md b/changelog/ttsao_add-fulu-proposer-lookahead-tests.md new file mode 100644 index 0000000000..4f6a77e5d3 --- /dev/null +++ b/changelog/ttsao_add-fulu-proposer-lookahead-tests.md @@ -0,0 +1,3 @@ +### Added + +- Fulu proposer lookahead epoch processing tests for mainnet and minimal configurations diff --git a/specrefs/functions.yml b/specrefs/functions.yml index ea2247b63c..dba347b7c5 100644 --- a/specrefs/functions.yml +++ b/specrefs/functions.yml @@ -6588,7 +6588,7 @@ - name: process_proposer_lookahead sources: - file: beacon-chain/core/fulu/transition.go - search: func processProposerLookahead( + search: func ProcessProposerLookahead( spec: | def process_proposer_lookahead(state: BeaconState) -> None: diff --git a/testing/spectest/mainnet/BUILD.bazel b/testing/spectest/mainnet/BUILD.bazel index 10deb54e86..4c57835e76 100644 --- a/testing/spectest/mainnet/BUILD.bazel +++ b/testing/spectest/mainnet/BUILD.bazel @@ -169,6 +169,7 @@ go_test( "fulu__epoch_processing__participation_flag_updates_test.go", "fulu__epoch_processing__pending_consolidations_test.go", "fulu__epoch_processing__pending_deposits_updates_test.go", + "fulu__epoch_processing__proposer_lookahead_test.go", "fulu__epoch_processing__randao_mixes_reset_test.go", "fulu__epoch_processing__registry_updates_test.go", "fulu__epoch_processing__rewards_and_penalties_test.go", diff --git a/testing/spectest/mainnet/fulu__epoch_processing__proposer_lookahead_test.go b/testing/spectest/mainnet/fulu__epoch_processing__proposer_lookahead_test.go new file mode 100644 index 0000000000..3ddb6a89a6 --- /dev/null +++ b/testing/spectest/mainnet/fulu__epoch_processing__proposer_lookahead_test.go @@ -0,0 +1,11 @@ +package mainnet + +import ( + "testing" + + "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing" +) + +func TestMainnet_fulu_EpochProcessing_ProposerLookahead(t *testing.T) { + epoch_processing.RunProposerLookaheadTests(t, "mainnet") +} diff --git a/testing/spectest/minimal/BUILD.bazel b/testing/spectest/minimal/BUILD.bazel index eed7ba0b7d..27bb04f406 100644 --- a/testing/spectest/minimal/BUILD.bazel +++ b/testing/spectest/minimal/BUILD.bazel @@ -174,6 +174,7 @@ go_test( "fulu__epoch_processing__participation_flag_updates_test.go", "fulu__epoch_processing__pending_consolidations_test.go", "fulu__epoch_processing__pending_deposits_updates_test.go", + "fulu__epoch_processing__proposer_lookahead_test.go", "fulu__epoch_processing__randao_mixes_reset_test.go", "fulu__epoch_processing__registry_updates_test.go", "fulu__epoch_processing__rewards_and_penalties_test.go", diff --git a/testing/spectest/minimal/fulu__epoch_processing__proposer_lookahead_test.go b/testing/spectest/minimal/fulu__epoch_processing__proposer_lookahead_test.go new file mode 100644 index 0000000000..1aa04028f4 --- /dev/null +++ b/testing/spectest/minimal/fulu__epoch_processing__proposer_lookahead_test.go @@ -0,0 +1,11 @@ +package minimal + +import ( + "testing" + + "github.com/OffchainLabs/prysm/v6/testing/spectest/shared/fulu/epoch_processing" +) + +func TestMinimal_fulu_EpochProcessing_ProposerLookahead(t *testing.T) { + epoch_processing.RunProposerLookaheadTests(t, "minimal") +} diff --git a/testing/spectest/shared/fulu/epoch_processing/BUILD.bazel b/testing/spectest/shared/fulu/epoch_processing/BUILD.bazel index 735c0f858c..f23558ea12 100644 --- a/testing/spectest/shared/fulu/epoch_processing/BUILD.bazel +++ b/testing/spectest/shared/fulu/epoch_processing/BUILD.bazel @@ -13,6 +13,7 @@ go_library( "participation_flag_updates.go", "pending_consolidations.go", "pending_deposit_updates.go", + "proposer_lookahead.go", "randao_mixes_reset.go", "registry_updates.go", "rewards_and_penalties.go", @@ -25,6 +26,7 @@ go_library( deps = [ "//beacon-chain/core/electra:go_default_library", "//beacon-chain/core/epoch/precompute:go_default_library", + "//beacon-chain/core/fulu:go_default_library", "//beacon-chain/core/helpers:go_default_library", "//beacon-chain/state:go_default_library", "//beacon-chain/state/state-native:go_default_library", diff --git a/testing/spectest/shared/fulu/epoch_processing/proposer_lookahead.go b/testing/spectest/shared/fulu/epoch_processing/proposer_lookahead.go new file mode 100644 index 0000000000..2360b28aef --- /dev/null +++ b/testing/spectest/shared/fulu/epoch_processing/proposer_lookahead.go @@ -0,0 +1,33 @@ +package epoch_processing + +import ( + "path" + "testing" + + "github.com/OffchainLabs/prysm/v6/beacon-chain/core/fulu" + "github.com/OffchainLabs/prysm/v6/beacon-chain/state" + "github.com/OffchainLabs/prysm/v6/testing/require" + "github.com/OffchainLabs/prysm/v6/testing/spectest/utils" +) + +// RunProposerLookaheadTests executes "epoch_processing/proposer_lookahead" tests. +func RunProposerLookaheadTests(t *testing.T, config string) { + require.NoError(t, utils.SetConfig(t, config)) + + testFolders, testsFolderPath := utils.TestFolders(t, config, "fulu", "epoch_processing/proposer_lookahead/pyspec_tests") + for _, folder := range testFolders { + t.Run(folder.Name(), func(t *testing.T) { + folderPath := path.Join(testsFolderPath, folder.Name()) + RunEpochOperationTest(t, folderPath, processProposerLookaheadWrapper) + }) + } +} + +func processProposerLookaheadWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) { + ctx := t.Context() + err := fulu.ProcessProposerLookahead(ctx, st) + if err != nil { + return nil, err + } + return st, nil +}