info

package
v1.11.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2024 License: BSD-3-Clause Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitBootstrapped

func AwaitBootstrapped(ctx context.Context, c Client, chainID string, freq time.Duration, options ...rpc.Option) (bool, error)

AwaitBootstrapped polls the node every [freq] to check if [chainID] has finished bootstrapping. Returns true once [chainID] reports that it has finished bootstrapping. Only returns an error if [ctx] returns an error.

func NewService

func NewService(
	parameters Parameters,
	log logging.Logger,
	validators validators.Manager,
	chainManager chains.Manager,
	vmManager vms.Manager,
	myIP *utils.Atomic[netip.AddrPort],
	network network.Network,
	benchlist benchlist.Manager,
) (http.Handler, error)

Types

type ACP

type ACP struct {
	SupportWeight json.Uint64         `json:"supportWeight"`
	Supporters    set.Set[ids.NodeID] `json:"supporters"`
	ObjectWeight  json.Uint64         `json:"objectWeight"`
	Objectors     set.Set[ids.NodeID] `json:"objectors"`
	AbstainWeight json.Uint64         `json:"abstainWeight"`
}

type ACPsReply

type ACPsReply struct {
	ACPs map[uint32]*ACP `json:"acps"`
}

type Client

type Client interface {
	GetNodeVersion(context.Context, ...rpc.Option) (*GetNodeVersionReply, error)
	GetNodeID(context.Context, ...rpc.Option) (ids.NodeID, *signer.ProofOfPossession, error)
	GetNodeIP(context.Context, ...rpc.Option) (netip.AddrPort, error)
	GetNetworkID(context.Context, ...rpc.Option) (uint32, error)
	GetNetworkName(context.Context, ...rpc.Option) (string, error)
	GetBlockchainID(context.Context, string, ...rpc.Option) (ids.ID, error)
	Peers(context.Context, ...rpc.Option) ([]Peer, error)
	IsBootstrapped(context.Context, string, ...rpc.Option) (bool, error)
	GetTxFee(context.Context, ...rpc.Option) (*GetTxFeeResponse, error)
	Uptime(context.Context, ids.ID, ...rpc.Option) (*UptimeResponse, error)
	GetVMs(context.Context, ...rpc.Option) (map[ids.ID][]string, error)
}

Client interface for an Info API Client. See also AwaitBootstrapped.

func NewClient

func NewClient(uri string) Client

NewClient returns a new Info API Client

type GetBlockchainIDArgs

type GetBlockchainIDArgs struct {
	Alias string `json:"alias"`
}

GetBlockchainIDArgs are the arguments for calling GetBlockchainID

type GetBlockchainIDReply

type GetBlockchainIDReply struct {
	BlockchainID ids.ID `json:"blockchainID"`
}

GetBlockchainIDReply are the results from calling GetBlockchainID

type GetNetworkIDReply

type GetNetworkIDReply struct {
	NetworkID json.Uint32 `json:"networkID"`
}

GetNetworkIDReply are the results from calling GetNetworkID

type GetNetworkNameReply

type GetNetworkNameReply struct {
	NetworkName string `json:"networkName"`
}

GetNetworkNameReply is the result from calling GetNetworkName

type GetNodeIDReply

type GetNodeIDReply struct {
	NodeID  ids.NodeID                `json:"nodeID"`
	NodePOP *signer.ProofOfPossession `json:"nodePOP"`
}

GetNodeIDReply are the results from calling GetNodeID

type GetNodeIPReply

type GetNodeIPReply struct {
	IP netip.AddrPort `json:"ip"`
}

GetNodeIPReply are the results from calling GetNodeIP

type GetNodeVersionReply

type GetNodeVersionReply struct {
	Version            string            `json:"version"`
	DatabaseVersion    string            `json:"databaseVersion"`
	RPCProtocolVersion json.Uint32       `json:"rpcProtocolVersion"`
	GitCommit          string            `json:"gitCommit"`
	VMVersions         map[string]string `json:"vmVersions"`
}

GetNodeVersionReply are the results from calling GetNodeVersion

type GetTxFeeResponse

type GetTxFeeResponse struct {
	TxFee                         json.Uint64 `json:"txFee"`
	CreateAssetTxFee              json.Uint64 `json:"createAssetTxFee"`
	CreateSubnetTxFee             json.Uint64 `json:"createSubnetTxFee"`
	TransformSubnetTxFee          json.Uint64 `json:"transformSubnetTxFee"`
	CreateBlockchainTxFee         json.Uint64 `json:"createBlockchainTxFee"`
	AddPrimaryNetworkValidatorFee json.Uint64 `json:"addPrimaryNetworkValidatorFee"`
	AddPrimaryNetworkDelegatorFee json.Uint64 `json:"addPrimaryNetworkDelegatorFee"`
	AddSubnetValidatorFee         json.Uint64 `json:"addSubnetValidatorFee"`
	AddSubnetDelegatorFee         json.Uint64 `json:"addSubnetDelegatorFee"`
}

type GetVMsReply

type GetVMsReply struct {
	VMs map[ids.ID][]string `json:"vms"`
	Fxs map[ids.ID]string   `json:"fxs"`
}

GetVMsReply contains the response metadata for GetVMs

type Info

type Info struct {
	Parameters
	// contains filtered or unexported fields
}

Info is the API service for unprivileged info on a node

func (*Info) Acps

func (i *Info) Acps(_ *http.Request, _ *struct{}, reply *ACPsReply) error

func (*Info) GetBlockchainID

func (i *Info) GetBlockchainID(_ *http.Request, args *GetBlockchainIDArgs, reply *GetBlockchainIDReply) error

GetBlockchainID returns the blockchain ID that resolves the alias that was supplied

func (*Info) GetNetworkID

func (i *Info) GetNetworkID(_ *http.Request, _ *struct{}, reply *GetNetworkIDReply) error

GetNetworkID returns the network ID this node is running on

func (*Info) GetNetworkName

func (i *Info) GetNetworkName(_ *http.Request, _ *struct{}, reply *GetNetworkNameReply) error

GetNetworkName returns the network name this node is running on

func (*Info) GetNodeID

func (i *Info) GetNodeID(_ *http.Request, _ *struct{}, reply *GetNodeIDReply) error

GetNodeID returns the node ID of this node

func (*Info) GetNodeIP

func (i *Info) GetNodeIP(_ *http.Request, _ *struct{}, reply *GetNodeIPReply) error

GetNodeIP returns the IP of this node

func (*Info) GetNodeVersion

func (i *Info) GetNodeVersion(_ *http.Request, _ *struct{}, reply *GetNodeVersionReply) error

GetNodeVersion returns the version this node is running

func (*Info) GetTxFee

func (i *Info) GetTxFee(_ *http.Request, _ *struct{}, reply *GetTxFeeResponse) error

GetTxFee returns the transaction fee in nLUX.

func (*Info) GetVMs

func (i *Info) GetVMs(_ *http.Request, _ *struct{}, reply *GetVMsReply) error

GetVMs lists the virtual machines installed on the node

func (*Info) IsBootstrapped

func (i *Info) IsBootstrapped(_ *http.Request, args *IsBootstrappedArgs, reply *IsBootstrappedResponse) error

IsBootstrapped returns nil and sets [reply.IsBootstrapped] == true iff [args.Chain] exists and is done bootstrapping Returns an error if the chain doesn't exist

func (*Info) Peers

func (i *Info) Peers(_ *http.Request, args *PeersArgs, reply *PeersReply) error

Peers returns the list of current validators

func (*Info) Uptime

func (i *Info) Uptime(_ *http.Request, args *UptimeRequest, reply *UptimeResponse) error

type IsBootstrappedArgs

type IsBootstrappedArgs struct {
	// Alias of the chain
	// Can also be the string representation of the chain's ID
	Chain string `json:"chain"`
}

IsBootstrappedArgs are the arguments for calling IsBootstrapped

type IsBootstrappedResponse

type IsBootstrappedResponse struct {
	// True iff the chain exists and is done bootstrapping
	IsBootstrapped bool `json:"isBootstrapped"`
}

IsBootstrappedResponse are the results from calling IsBootstrapped

type Parameters

type Parameters struct {
	Version                       *version.Application
	NodeID                        ids.NodeID
	NodePOP                       *signer.ProofOfPossession
	NetworkID                     uint32
	TxFee                         uint64
	CreateAssetTxFee              uint64
	CreateSubnetTxFee             uint64
	TransformSubnetTxFee          uint64
	CreateBlockchainTxFee         uint64
	AddPrimaryNetworkValidatorFee uint64
	AddPrimaryNetworkDelegatorFee uint64
	AddSubnetValidatorFee         uint64
	AddSubnetDelegatorFee         uint64
	VMManager                     vms.Manager
}

type Peer

type Peer struct {
	peer.Info

	Benched []string `json:"benched"`
}

type PeersArgs

type PeersArgs struct {
	NodeIDs []ids.NodeID `json:"nodeIDs"`
}

PeersArgs are the arguments for calling Peers

type PeersReply

type PeersReply struct {
	// Number of elements in [Peers]
	NumPeers json.Uint64 `json:"numPeers"`
	// Each element is a peer
	Peers []Peer `json:"peers"`
}

PeersReply are the results from calling Peers

type UptimeRequest

type UptimeRequest struct {
	// if omitted, defaults to primary network
	SubnetID ids.ID `json:"subnetID"`
}

type UptimeResponse

type UptimeResponse struct {
	// RewardingStakePercentage shows what percent of network stake thinks we're
	// above the uptime requirement.
	RewardingStakePercentage json.Float64 `json:"rewardingStakePercentage"`

	// WeightedAveragePercentage is the average perceived uptime of this node,
	// weighted by stake.
	// Note that this is different from RewardingStakePercentage, which shows
	// the percent of the network stake that thinks this node is above the
	// uptime requirement. WeightedAveragePercentage is weighted by uptime.
	// i.e If uptime requirement is 85 and a peer reports 40 percent it will be
	// counted (40*weight) in WeightedAveragePercentage but not in
	// RewardingStakePercentage since 40 < 85
	WeightedAveragePercentage json.Float64 `json:"weightedAveragePercentage"`
}

UptimeResponse are the results from calling Uptime

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL