mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
19abe81472
* finish the BLS API wrapper * all tests passing * unexported comment * gofmt tests for bls * block processing test into own package to avoid cycle * randao tests pass * blocks test passing * use common deposit generator * helper * resolved import cycle * setup initial * builds * almost done with blockchain tests * fix blockchain tests * getting through with chaintests * revert client change * lint * sync master conflict gazelle * randao test fixes * randao proposer impl * tests pass
43 lines
857 B
Go
43 lines
857 B
Go
package forkutils
|
|
|
|
import (
|
|
"math"
|
|
"testing"
|
|
|
|
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
|
)
|
|
|
|
func TestForkVersion(t *testing.T) {
|
|
fork := &pb.Fork{
|
|
Epoch: 10,
|
|
PreviousVersion: 2,
|
|
CurrentVersion: 3,
|
|
}
|
|
|
|
if ForkVersion(fork, 9) != 2 {
|
|
t.Errorf("fork Version not equal to 2 %d", ForkVersion(fork, 9))
|
|
}
|
|
|
|
if ForkVersion(fork, 11) != 3 {
|
|
t.Errorf("fork Version not equal to 3 %d", ForkVersion(fork, 11))
|
|
}
|
|
}
|
|
|
|
func TestDomainVersion(t *testing.T) {
|
|
fork := &pb.Fork{
|
|
Epoch: 10,
|
|
PreviousVersion: 2,
|
|
CurrentVersion: 3,
|
|
}
|
|
|
|
constant := uint64(math.Pow(2, 32))
|
|
|
|
if DomainVersion(fork, 9, 2) != 2*constant+2 {
|
|
t.Errorf("incorrect domain version %d", DomainVersion(fork, 9, 2))
|
|
}
|
|
|
|
if DomainVersion(fork, 11, 3) != 3*constant+3 {
|
|
t.Errorf("incorrect domain version %d", DomainVersion(fork, 11, 3))
|
|
}
|
|
}
|