github.com/ava-labs/subnet-evm@v0.6.4/utils/snow.go (about)

     1  // (c) 2019-2020, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package utils
     5  
     6  import (
     7  	"github.com/ava-labs/avalanchego/api/metrics"
     8  	"github.com/ava-labs/avalanchego/ids"
     9  	"github.com/ava-labs/avalanchego/snow"
    10  	"github.com/ava-labs/avalanchego/snow/validators"
    11  	"github.com/ava-labs/avalanchego/utils/crypto/bls"
    12  	"github.com/ava-labs/avalanchego/utils/logging"
    13  )
    14  
    15  func TestSnowContext() *snow.Context {
    16  	sk, err := bls.NewSecretKey()
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  	pk := bls.PublicFromSecretKey(sk)
    21  	return &snow.Context{
    22  		NetworkID:      0,
    23  		SubnetID:       ids.Empty,
    24  		ChainID:        ids.Empty,
    25  		NodeID:         ids.EmptyNodeID,
    26  		PublicKey:      pk,
    27  		Log:            logging.NoLog{},
    28  		BCLookup:       ids.NewAliaser(),
    29  		Metrics:        metrics.NewOptionalGatherer(),
    30  		ChainDataDir:   "",
    31  		ValidatorState: &validators.TestState{},
    32  	}
    33  }