config

package
v0.4.17 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config supports configuration of the Flow Rosetta server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	Cache                   bool
	ConstructionAccessNodes access.Pool
	DataAccessNodes         access.Pool
	Contracts               *Contracts
	DataDir                 string
	Mode                    string
	Network                 string
	Originators             []string
	Port                    uint16
	PurgeProxyAccounts      bool
	ResyncFrom              uint64
	SkipBlocks              map[flow.Identifier]struct{}
	SporkSealTolerance      uint64
	SporkSyncedTolerance    uint64
	Sporks                  []*Spork
	UseConsensusFollwer     bool
	Workers                 uint
}

Chain represents the definition of a Flow chain like mainnet and testnet.

func Init

func Init(ctx context.Context, filename string) *Chain

Init reads the given config file, decodes the JSON config, validates it, and returns the initialized config.

func (*Chain) FirstSpork

func (c *Chain) FirstSpork() *Spork

FirstSpork returns the config for the first spork in the chain.

func (*Chain) IsProxyContractDeployed

func (c *Chain) IsProxyContractDeployed() bool

IsProxyContractDeployed returns whether a deployed Proxy contract has been configured.

func (*Chain) LatestSpork

func (c *Chain) LatestSpork() *Spork

LatestSpork returns the config for the latest spork in the chain.

func (*Chain) PathFor

func (c *Chain) PathFor(subpath ...string) string

PathFor joins the given subpath elements with the chain's data directory.

func (*Chain) SporkFor

func (c *Chain) SporkFor(height uint64) *Spork

SporkFor returns the spork for the given height.

type Consensus

type Consensus struct {
	DisableSignatureCheck         bool       `json:"disable_signature_check"`
	RootProtocolStateURL          string     `json:"root_protocol_state_url"`
	RootProtocolStateSignatureURL string     `json:"root_protocol_state_signature_url"`
	SeedNodes                     []SeedNode `json:"seed_nodes"`
	SigningKey                    string     `json:"signing_key"`
}

Consensus defines the metadata needed to initialize a consensus follower for a live spork.

type Contracts

type Contracts struct {
	FlowFees             string `json:"flow_fees"`
	FlowToken            string `json:"flow_token"`
	FungibleToken        string `json:"fungible_token"`
	FlowColdStorageProxy string `json:"flow_cold_storage_proxy"`
}

Contracts defines the chain-specific addresses for various core contracts.

type SeedNode

type SeedNode struct {
	Host      string `json:"host"`
	Port      uint16 `json:"port"`
	PublicKey string `json:"public_key"`
}

SeedNode defines a seed node for the current spork.

type Spork

type Spork struct {
	AccessNodes access.Pool
	Chain       *Chain
	Consensus   *Consensus
	ID          uint
	Next        *Spork
	Prev        *Spork
	RootBlock   uint64
	Version     int
}

Spork provides the relevant metadata for a spork.

func (*Spork) String

func (s *Spork) String() string

Jump to

Keyboard shortcuts

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