mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 13:28:01 -05:00
spectests: Add Fulu proposer lookahead epoch processing tests (#15667)
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
3
changelog/ttsao_add-fulu-proposer-lookahead-tests.md
Normal file
3
changelog/ttsao_add-fulu-proposer-lookahead-tests.md
Normal file
@@ -0,0 +1,3 @@
|
||||
### Added
|
||||
|
||||
- Fulu proposer lookahead epoch processing tests for mainnet and minimal configurations
|
||||
@@ -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:
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user