mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 08:37:37 +00:00
5a66807989
* First take at updating everything to v5 * Patch gRPC gateway to use prysm v5 Fix patch * Update go ssz --------- Co-authored-by: Preston Van Loon <pvanloon@offchainlabs.com>
45 lines
1.4 KiB
Go
45 lines
1.4 KiB
Go
package epoch_processing
|
|
|
|
import (
|
|
"context"
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/altair"
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
|
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/state"
|
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
|
"github.com/prysmaticlabs/prysm/v5/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, "altair", testPath)
|
|
if len(testFolders) == 0 {
|
|
t.Fatalf("No test folders found for %s/%s/%s", config, "altair", 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
|
|
}
|