prysm-pulse/crypto/bls/signature_batch_test.go
Nishant Das 6f20d17d15
Rename To Signature Batch (#9926)
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2021-11-23 17:57:06 +01:00

47 lines
1.1 KiB
Go

package bls
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/assert"
)
func TestCopySignatureSet(t *testing.T) {
t.Run("blst", func(t *testing.T) {
key, err := RandKey()
assert.NoError(t, err)
key2, err := RandKey()
assert.NoError(t, err)
key3, err := RandKey()
assert.NoError(t, err)
message := [32]byte{'C', 'D'}
message2 := [32]byte{'E', 'F'}
message3 := [32]byte{'H', 'I'}
sig := key.Sign(message[:])
sig2 := key2.Sign(message2[:])
sig3 := key3.Sign(message3[:])
set := &SignatureBatch{
Signatures: [][]byte{sig.Marshal()},
PublicKeys: []PublicKey{key.PublicKey()},
Messages: [][32]byte{message},
}
set2 := &SignatureBatch{
Signatures: [][]byte{sig2.Marshal()},
PublicKeys: []PublicKey{key.PublicKey()},
Messages: [][32]byte{message},
}
set3 := &SignatureBatch{
Signatures: [][]byte{sig3.Marshal()},
PublicKeys: []PublicKey{key.PublicKey()},
Messages: [][32]byte{message},
}
aggSet := set.Join(set2).Join(set3)
aggSet2 := aggSet.Copy()
assert.DeepEqual(t, aggSet, aggSet2)
})
}