mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-31 23:41:22 +00:00
84335b0084
* Add merge spectests * fix build * gazelle * operation * all tests should pass * go fmt * fix test * fix dependency * rm unused constants * rename to bellatrix * Gaz * Rm unused files * Use Bellatrix for test names * Add more spec tests * Gaz and fix test * sync with dev * Preston's feedback * Go fmt * sync with dev Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package epoch_processing
|
|
|
|
import (
|
|
"context"
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/state"
|
|
"github.com/prysmaticlabs/prysm/testing/require"
|
|
"github.com/prysmaticlabs/prysm/testing/spectest/utils"
|
|
)
|
|
|
|
// RunInactivityUpdatesTest executes "epoch_processing/inactivity_updates" tests.
|
|
func RunInactivityUpdatesTest(t *testing.T, config string) {
|
|
require.NoError(t, utils.SetConfig(t, config))
|
|
|
|
testPath := "epoch_processing/inactivity_updates/pyspec_tests"
|
|
testFolders, testsFolderPath := utils.TestFolders(t, config, "bellatrix", testPath)
|
|
for _, folder := range testFolders {
|
|
helpers.ClearCache()
|
|
t.Run(folder.Name(), func(t *testing.T) {
|
|
folderPath := path.Join(testsFolderPath, folder.Name())
|
|
RunEpochOperationTest(t, folderPath, processInactivityUpdates)
|
|
})
|
|
}
|
|
}
|
|
|
|
func processInactivityUpdates(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
|
ctx := context.Background()
|
|
vp, bp, err := altair.InitializePrecomputeValidators(ctx, st)
|
|
require.NoError(t, err)
|
|
vp, _, err = altair.ProcessEpochParticipation(ctx, st, bp, vp)
|
|
require.NoError(t, err)
|
|
|
|
st, _, err = altair.ProcessInactivityScores(ctx, st, vp)
|
|
require.NoError(t, err, "Could not process reward")
|
|
|
|
return st, nil
|
|
}
|