mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 01:32:18 +00:00
5aac06f04e
* begin move * use same import path * imports * regen protos * regen * no rename * generate ssz * gaz * fmt * edit build file * imports * modify * remove generated files * remove protos * edit imports in prysm * beacon chain all builds * edit script * add generated pbs * add replace rules * license for ethereumapis protos * change visibility * fmt * update build files to gaz ignore * use proper form * edit imports * wrap block * revert scripts * revert go mod
34 lines
1.3 KiB
Go
34 lines
1.3 KiB
Go
package operations
|
|
|
|
import (
|
|
"path"
|
|
"testing"
|
|
|
|
"github.com/golang/snappy"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
|
ethpb "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
"github.com/prysmaticlabs/prysm/spectest/utils"
|
|
)
|
|
|
|
// RunAttestationTest executes "operations/attestation" tests.
|
|
func RunAttestationTest(t *testing.T, config string) {
|
|
require.NoError(t, utils.SetConfig(t, config))
|
|
testFolders, testsFolderPath := utils.TestFolders(t, config, "phase0", "operations/attestation/pyspec_tests")
|
|
for _, folder := range testFolders {
|
|
t.Run(folder.Name(), func(t *testing.T) {
|
|
folderPath := path.Join(testsFolderPath, folder.Name())
|
|
attestationFile, err := testutil.BazelFileBytes(folderPath, "attestation.ssz_snappy")
|
|
require.NoError(t, err)
|
|
attestationSSZ, err := snappy.Decode(nil /* dst */, attestationFile)
|
|
require.NoError(t, err, "Failed to decompress")
|
|
att := ðpb.Attestation{}
|
|
require.NoError(t, att.UnmarshalSSZ(attestationSSZ), "Failed to unmarshal")
|
|
|
|
body := ðpb.BeaconBlockBody{Attestations: []*ethpb.Attestation{att}}
|
|
RunBlockOperationTest(t, folderPath, body, blocks.ProcessAttestations)
|
|
})
|
|
}
|
|
}
|