spectests: Add Fulu proposer lookahead epoch processing tests (#15667)

This commit is contained in:
terence
2025-09-10 11:51:19 -07:00
committed by GitHub
parent 5410232bef
commit 5c68ec5c39
9 changed files with 65 additions and 3 deletions

View File

@@ -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()

View File

@@ -0,0 +1,3 @@
### Added
- Fulu proposer lookahead epoch processing tests for mainnet and minimal configurations

View File

@@ -6588,7 +6588,7 @@
- name: process_proposer_lookahead
sources:
- file: beacon-chain/core/fulu/transition.go
search: func processProposerLookahead(
search: func ProcessProposerLookahead(
spec: |
<spec fn="process_proposer_lookahead" fork="fulu" hash="3ff130cc">
def process_proposer_lookahead(state: BeaconState) -> None:

View File

@@ -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",

View File

@@ -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")
}

View File

@@ -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",

View File

@@ -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")
}

View File

@@ -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",

View File

@@ -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
}