github.com/koko1123/flow-go-1@v0.29.6/state/protocol/params.go (about)

     1  package protocol
     2  
     3  import (
     4  	"github.com/koko1123/flow-go-1/model/flow"
     5  )
     6  
     7  // Params are parameters of the protocol state, divided into parameters of
     8  // this specific instance of the state (varies from node to node) and global
     9  // parameters of the state.
    10  type Params interface {
    11  	InstanceParams
    12  	GlobalParams
    13  }
    14  
    15  // InstanceParams represents protocol state parameters that vary between instances.
    16  // For example, two nodes both running in the same spork on Flow Mainnet may have
    17  // different instance params.
    18  type InstanceParams interface {
    19  
    20  	// Root returns the root header of the current protocol state. This will be
    21  	// the head of the protocol state snapshot used to bootstrap this state and
    22  	// may differ from node to node for the same protocol state.
    23  	Root() (*flow.Header, error)
    24  
    25  	// Seal returns the root block seal of the current protocol state. This will be
    26  	// the seal for the root block used to bootstrap this state and may differ from
    27  	// node to node for the same protocol state.
    28  	Seal() (*flow.Seal, error)
    29  }
    30  
    31  // GlobalParams represents protocol state parameters that do not vary between instances.
    32  // Any nodes running in the same spork, on the same network (same chain ID) must
    33  // have the same global params.
    34  type GlobalParams interface {
    35  
    36  	// ChainID returns the chain ID for the current Flow network. The chain ID
    37  	// uniquely identifies a Flow network in perpetuity across epochs and sporks.
    38  	ChainID() (flow.ChainID, error)
    39  
    40  	// SporkID returns the unique identifier for this network within the current spork.
    41  	// This ID is determined at the beginning of a spork during bootstrapping and is
    42  	// part of the root protocol state snapshot.
    43  	SporkID() (flow.Identifier, error)
    44  
    45  	// ProtocolVersion returns the protocol version, the major software version
    46  	// of the protocol software.
    47  	ProtocolVersion() (uint, error)
    48  }