mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 23:48:06 -05:00
* use fast ssz anywhere applicable * use fastssz clearly * Merge branch 'master' into use-fastssz * Apply suggestions from code review * imports * Update beacon-chain/p2p/fork.go * Merge branch 'master' into use-fastssz * update go-ssz * update go-ssz * Merge refs/heads/master into use-fastssz * Merge refs/heads/master into use-fastssz
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package spectest
|
|
|
|
import (
|
|
"path"
|
|
"testing"
|
|
|
|
ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1"
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"
|
|
"github.com/prysmaticlabs/prysm/shared/params/spectest"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
)
|
|
|
|
func runAttestationTest(t *testing.T, config string) {
|
|
if err := spectest.SetConfig(t, config); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
testFolders, testsFolderPath := testutil.TestFolders(t, config, "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")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
att := ðpb.Attestation{}
|
|
if err := att.UnmarshalSSZ(attestationFile); err != nil {
|
|
t.Fatalf("Failed to unmarshal: %v", err)
|
|
}
|
|
|
|
body := ðpb.BeaconBlockBody{Attestations: []*ethpb.Attestation{att}}
|
|
testutil.RunBlockOperationTest(t, folderPath, body, blocks.ProcessAttestations)
|
|
})
|
|
}
|
|
}
|