mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-23 11:57:18 +00:00
6f20d17d15
Co-authored-by: Radosław Kapka <rkapka@wp.pl>
47 lines
1.1 KiB
Go
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)
|
|
})
|
|
}
|