Files
proto/p/warp/helpers_test.go
zeekayandHanzo Dev 84e442e154 Depend on the renamed utility package
github.com/luxfi/utils is now github.com/luxfi/util. Import paths and the
module requirement follow the rename; the old module stays as an indirect
requirement that published dependencies still pull in.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-06 11:46:00 -07:00

61 lines
1.1 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package warp
import (
"bytes"
"errors"
"github.com/luxfi/crypto/bls"
"github.com/luxfi/crypto/bls/signer/localsigner"
"github.com/luxfi/ids"
"github.com/luxfi/util"
)
const pChainHeight uint64 = 1337
var (
errTest = errors.New("non-nil error")
testVdrs []*testValidator
)
type testValidator struct {
nodeID ids.NodeID
sk *localsigner.LocalSigner
vdr *Validator
}
func (v *testValidator) Compare(other *testValidator) int {
return bytes.Compare(v.vdr.PublicKeyBytes, other.vdr.PublicKeyBytes)
}
func newTestValidator() *testValidator {
sk, err := localsigner.New()
if err != nil {
panic(err)
}
nodeID := ids.GenerateTestNodeID()
pk := sk.PublicKey()
return &testValidator{
nodeID: nodeID,
sk: sk,
vdr: &Validator{
PublicKey: pk,
PublicKeyBytes: bls.PublicKeyToUncompressedBytes(pk),
Weight: 3,
NodeIDs: []ids.NodeID{nodeID},
},
}
}
func init() {
testVdrs = []*testValidator{
newTestValidator(),
newTestValidator(),
newTestValidator(),
}
utils.Sort(testVdrs)
}