diff --git a/consensus/e2e_tests/utils_test.go b/consensus/e2e_tests/utils_test.go index 41340abc6..bd2a400f7 100644 --- a/consensus/e2e_tests/utils_test.go +++ b/consensus/e2e_tests/utils_test.go @@ -11,8 +11,10 @@ import ( "github.com/benbjohnson/clock" "github.com/golang/mock/gomock" + "github.com/pokt-network/pocket/consensus" typesCons "github.com/pokt-network/pocket/consensus/types" + "github.com/pokt-network/pocket/internal/testutil" persistenceMocks "github.com/pokt-network/pocket/persistence/types/mocks" "github.com/pokt-network/pocket/runtime" "github.com/pokt-network/pocket/runtime/configs" @@ -432,6 +434,20 @@ func basePersistenceMock(t *testing.T, _ modules.EventsChannel, bus modules.Bus) Return(bus.GetRuntimeMgr().GetGenesis().Validators, nil). AnyTimes() + persistenceReadContextMock. + EXPECT(). + GetAllStakedActors(gomock.Any()). + DoAndReturn(func(height int64) ([]*coreTypes.Actor, error) { + genesisState := bus.GetRuntimeMgr().GetGenesis() + return testutil.Concatenate[*coreTypes.Actor]( + genesisState.Validators, + genesisState.Servicers, + genesisState.Fishermen, + genesisState.Applications, + ), nil + }). + AnyTimes() + persistenceReadContextMock. EXPECT(). GetBlockHash(gomock.Any()). diff --git a/internal/testutil/slice.go b/internal/testutil/slice.go new file mode 100644 index 000000000..270142541 --- /dev/null +++ b/internal/testutil/slice.go @@ -0,0 +1,12 @@ +package testutil + +// Concatenate appends the contents of multiple slices of any type (T) into a +// single slice of type T. +func Concatenate[T any](tt ...[]T) []T { + var result []T + for _, t := range tt { + result = append(result, t...) + } + + return result +}