2021-08-23 20:09:24 +00:00
|
|
|
package epoch_processing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"path"
|
|
|
|
"testing"
|
|
|
|
|
2024-02-15 05:46:47 +00:00
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/epoch"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/testing/spectest/utils"
|
2021-08-23 20:09:24 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// RunSlashingsResetTests executes "epoch_processing/slashings_reset" tests.
|
|
|
|
func RunSlashingsResetTests(t *testing.T, config string) {
|
|
|
|
require.NoError(t, utils.SetConfig(t, config))
|
|
|
|
|
|
|
|
testFolders, testsFolderPath := utils.TestFolders(t, config, "altair", "epoch_processing/slashings_reset/pyspec_tests")
|
2022-11-30 17:32:10 +00:00
|
|
|
if len(testFolders) == 0 {
|
|
|
|
t.Fatalf("No test folders found for %s/%s/%s", config, "altair", "epoch_processing/slashings_reset/pyspec_tests")
|
|
|
|
}
|
2021-08-23 20:09:24 +00:00
|
|
|
for _, folder := range testFolders {
|
|
|
|
t.Run(folder.Name(), func(t *testing.T) {
|
|
|
|
folderPath := path.Join(testsFolderPath, folder.Name())
|
|
|
|
RunEpochOperationTest(t, folderPath, processSlashingsResetWrapper)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-27 13:34:38 +00:00
|
|
|
func processSlashingsResetWrapper(t *testing.T, st state.BeaconState) (state.BeaconState, error) {
|
|
|
|
st, err := epoch.ProcessSlashingsReset(st)
|
2021-08-23 20:09:24 +00:00
|
|
|
require.NoError(t, err, "Could not process final updates")
|
2022-06-27 13:34:38 +00:00
|
|
|
return st, nil
|
2021-08-23 20:09:24 +00:00
|
|
|
}
|