mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
5e939378d0
* Ignore latest messages in fork choice prior to latest justified * Make sure Compact Committee Roots isn't changed by process_final_updates * WIP add attestation bitfields length to match committee length * Begin work on updating spec tests to 0.8.2 * WIP set up for new spec test structure * Fix slashings * Get mainnet tests mostly passing for attestations and attester slashings * Fix process attestation test * Undo change * Complete spec tests for all operations Still need sanity block tests * Fix BLS sigs * Reduce amount of reused code in core/blocks/spectests/ * Fix tests * Update block sanity tests to 0.8.2 * Update epoch spec tests to 0.8.2 * Clean up all tests and fix shuffling/epoch tests * WIP update bls tests to 0.8.2 * WIP update bls tests to 0.8.3 * Finish BLS spectest update to 0.8.3 * Fix shuffling spec tests * Fix more tests * Update proto ssz spec tests to 0.8.3 * Attempt to fix PrevEpochFFGDataMismatches test * Goimports * Fix documentation * fix test * Use custom general spec tests * Reduce code footprint * Remove unneeded minimal skip * Fix for comments * Fix for comments * Fix test * Small fixes * Cleanup block spec tests a bit * Undo change * fix validator * Fix validator tests * Run gazelle * Fix error output for epoch spec tests
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package spectest
|
|
|
|
import (
|
|
"bytes"
|
|
"encoding/hex"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
|
|
|
"github.com/ghodss/yaml"
|
|
"github.com/prysmaticlabs/prysm/shared/bls"
|
|
)
|
|
|
|
func TestAggregatePubkeysYaml(t *testing.T) {
|
|
file, err := testutil.BazelFileBytes("tests/general/phase0/bls/aggregate_pubkeys/small/agg_pub_keys/data.yaml")
|
|
if err != nil {
|
|
t.Fatalf("Failed to read file: %v", err)
|
|
}
|
|
|
|
test := &AggregatePubkeysTest{}
|
|
if err := yaml.Unmarshal(file, test); err != nil {
|
|
t.Fatalf("Failed to unmarshal: %v", err)
|
|
}
|
|
|
|
pubBytes, err := hex.DecodeString(test.Input[0][2:])
|
|
if err != nil {
|
|
t.Fatalf("Cannot decode string to bytes: %v", err)
|
|
}
|
|
pk, err := bls.PublicKeyFromBytes(pubBytes)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, pk2 := range test.Input[1:] {
|
|
pubBytes2, err := hex.DecodeString(pk2[2:])
|
|
if err != nil {
|
|
t.Fatalf("Cannot decode string to bytes: %v", err)
|
|
}
|
|
p, err := bls.PublicKeyFromBytes(pubBytes2)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
pk.Aggregate(p)
|
|
}
|
|
|
|
outputBytes, err := hex.DecodeString(test.Output[2:])
|
|
if err != nil {
|
|
t.Fatalf("Cannot decode string to bytes: %v", err)
|
|
}
|
|
if !bytes.Equal(outputBytes, pk.Marshal()) {
|
|
t.Fatal("Output does not equal marshaled aggregated public " +
|
|
"key bytes")
|
|
}
|
|
}
|