Documentation
¶
Index ¶
- Constants
- Variables
- func AddFlags(cmd *cobra.Command)
- func FindConfigDir(dir string) (string, bool)
- func FindEntrypoint() (string, string)
- func GetMultiAddr(addr string) (multiaddr.Multiaddr, error)
- func GetNodeConfig(nodeConf *NodeConfig, cmConf *cmcfg.Config)
- func TranslateAddresses(conf *NodeConfig) error
- func WriteTomlConfig(config TomlConfig) error
- type BlockManagerConfig
- type ChainTomlConfig
- type HeaderConfig
- type NodeConfig
- type P2PConfig
- type RPCConfig
- type TomlConfig
Constants ¶
const ( // FlagAggregator is a flag for running node in aggregator mode FlagAggregator = "rollkit.aggregator" // FlagDAAddress is a flag for specifying the data availability layer address FlagDAAddress = "rollkit.da_address" // FlagDAAuthToken is a flag for specifying the data availability layer auth token FlagDAAuthToken = "rollkit.da_auth_token" // #nosec G101 // FlagBlockTime is a flag for specifying the block time FlagBlockTime = "rollkit.block_time" // FlagDABlockTime is a flag for specifying the data availability layer block time FlagDABlockTime = "rollkit.da_block_time" // FlagDAGasPrice is a flag for specifying the data availability layer gas price FlagDAGasPrice = "rollkit.da_gas_price" // FlagDAGasMultiplier is a flag for specifying the data availability layer gas price retry multiplier FlagDAGasMultiplier = "rollkit.da_gas_multiplier" // FlagDAStartHeight is a flag for specifying the data availability layer start height FlagDAStartHeight = "rollkit.da_start_height" // FlagDANamespace is a flag for specifying the DA namespace ID FlagDANamespace = "rollkit.da_namespace" // FlagLight is a flag for running the node in light mode FlagLight = "rollkit.light" // FlagTrustedHash is a flag for specifying the trusted hash FlagTrustedHash = "rollkit.trusted_hash" // FlagLazyAggregator is a flag for enabling lazy aggregation FlagLazyAggregator = "rollkit.lazy_aggregator" // FlagMaxPendingBlocks is a flag to pause aggregator in case of large number of blocks pending DA submission FlagMaxPendingBlocks = "rollkit.max_pending_blocks" // FlagDAMempoolTTL is a flag for specifying the DA mempool TTL FlagDAMempoolTTL = "rollkit.da_mempool_ttl" // FlagLazyBlockTime is a flag for specifying the block time in lazy mode FlagLazyBlockTime = "rollkit.lazy_block_time" // FlagLazyBufferTime is a flag for specifying the additional time to wait to accumulate transactions in lazy mode FlagLazyBufferTime = "rollkit.lazy_buffer_time" )
const ( // DefaultListenAddress is a default listen address for P2P client. DefaultListenAddress = "/ip4/0.0.0.0/tcp/7676" // Version is the current rollkit version // Please keep updated with each new release Version = "0.38.5" )
const RollkitToml = "rollkit.toml"
RollkitToml is the filename for the rollkit configuration file.
Variables ¶
var DefaultNodeConfig = NodeConfig{ P2P: P2PConfig{ ListenAddress: DefaultListenAddress, Seeds: "", }, Aggregator: false, BlockManagerConfig: BlockManagerConfig{ BlockTime: 1 * time.Second, DABlockTime: 15 * time.Second, LazyAggregator: false, LazyBlockTime: 60 * time.Second, LazyBufferTime: 1 * time.Second, }, DAAddress: "http://localhost:26658", DAGasPrice: -1, DAGasMultiplier: 0, Light: false, HeaderConfig: HeaderConfig{ TrustedHash: "", }, Instrumentation: config.DefaultInstrumentationConfig(), }
DefaultNodeConfig keeps default values of NodeConfig
var ErrReadToml = fmt.Errorf("Reading %s", RollkitToml)
ErrReadToml is the error returned when reading the rollkit.toml file fails.
Functions ¶
func AddFlags ¶
AddFlags adds Rollkit specific configuration options to cobra Command.
This function is called in cosmos-sdk.
func FindConfigDir ¶ added in v0.13.4
FindConfigDir checks if there is a ~/.{dir} directory and returns the full path to it or an empty string. This is used to find the default config directory for cosmos-sdk chains.
func FindEntrypoint ¶ added in v0.13.4
FindEntrypoint searches for a main.go file in the current directory and its subdirectories. It returns the directory name of the main.go file and the full path to the main.go file.
func GetMultiAddr ¶ added in v0.10.5
GetMultiAddr converts single Cosmos-style network address into Multiaddr. Input format: [protocol://][<NODE_ID>@]<IPv4>:<PORT>
func GetNodeConfig ¶ added in v0.10.5
func GetNodeConfig(nodeConf *NodeConfig, cmConf *cmcfg.Config)
GetNodeConfig translates Tendermint's configuration into Rollkit configuration.
This method only translates configuration, and doesn't verify it. If some option is missing in Tendermint's config, it's skipped during translation.
func TranslateAddresses ¶ added in v0.10.5
func TranslateAddresses(conf *NodeConfig) error
TranslateAddresses updates conf by changing Cosmos-style addresses to Multiaddr format.
func WriteTomlConfig ¶ added in v0.13.4
func WriteTomlConfig(config TomlConfig) error
WriteTomlConfig writes the given TomlConfig to the rollkit.toml file in the current directory.
Types ¶
type BlockManagerConfig ¶
type BlockManagerConfig struct {
// BlockTime defines how often new blocks are produced
BlockTime time.Duration `mapstructure:"block_time"`
// DABlockTime informs about block time of underlying data availability layer
DABlockTime time.Duration `mapstructure:"da_block_time"`
// DAStartHeight allows skipping first DAStartHeight-1 blocks when querying for blocks.
DAStartHeight uint64 `mapstructure:"da_start_height"`
// DAMempoolTTL is the number of DA blocks until transaction is dropped from the mempool.
DAMempoolTTL uint64 `mapstructure:"da_mempool_ttl"`
// MaxPendingBlocks defines limit of blocks pending DA submission. 0 means no limit.
// When limit is reached, aggregator pauses block production.
MaxPendingBlocks uint64 `mapstructure:"max_pending_blocks"`
// LazyAggregator defines whether new blocks are produced in lazy mode
LazyAggregator bool `mapstructure:"lazy_aggregator"`
// LazyBlockTime defines how often new blocks are produced in lazy mode
// even if there are no transactions
LazyBlockTime time.Duration `mapstructure:"lazy_block_time"`
// LazyBufferTime defines the additional time to wait to accumulate
// transactions in lazy mode
LazyBufferTime time.Duration `mapstructure:"lazy_buffer_time"`
}
BlockManagerConfig consists of all parameters required by BlockManagerConfig
type ChainTomlConfig ¶ added in v0.13.4
type ChainTomlConfig struct {
ConfigDir string `toml:"config_dir"`
}
ChainTomlConfig is the configuration for the chain section of rollkit.toml
type HeaderConfig ¶ added in v0.7.0
type HeaderConfig struct {
TrustedHash string `mapstructure:"trusted_hash"`
}
HeaderConfig allows node to pass the initial trusted header hash to start the header exchange service
type NodeConfig ¶
type NodeConfig struct {
// parameters below are translated from existing config
RootDir string
DBPath string
P2P P2PConfig
RPC RPCConfig
// parameters below are Rollkit specific and read from config
Aggregator bool `mapstructure:"aggregator"`
BlockManagerConfig `mapstructure:",squash"`
DAAddress string `mapstructure:"da_address"`
DAAuthToken string `mapstructure:"da_auth_token"`
Light bool `mapstructure:"light"`
HeaderConfig `mapstructure:",squash"`
Instrumentation *cmcfg.InstrumentationConfig `mapstructure:"instrumentation"`
DAGasPrice float64 `mapstructure:"da_gas_price"`
DAGasMultiplier float64 `mapstructure:"da_gas_multiplier"`
// CLI flags
DANamespace string `mapstructure:"da_namespace"`
}
NodeConfig stores Rollkit node configuration.
func (*NodeConfig) GetViperConfig ¶
func (nc *NodeConfig) GetViperConfig(v *viper.Viper) error
GetViperConfig reads configuration parameters from Viper instance.
This method is called in cosmos-sdk.
type P2PConfig ¶
type P2PConfig struct {
ListenAddress string // Address to listen for incoming connections
Seeds string // Comma separated list of seed nodes to connect to
BlockedPeers string // Comma separated list of nodes to ignore
AllowedPeers string // Comma separated list of nodes to whitelist
}
P2PConfig stores configuration related to peer-to-peer networking.
type RPCConfig ¶
type RPCConfig struct {
ListenAddress string
// Cross Origin Resource Sharing settings
CORSAllowedOrigins []string
CORSAllowedMethods []string
CORSAllowedHeaders []string
// Maximum number of simultaneous connections (including WebSocket).
// Does not include gRPC connections. See grpc-max-open-connections
// If you want to accept a larger number than the default, make sure
// you increase your OS limits.
// 0 - unlimited.
// Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files}
// 1024 - 40 - 10 - 50 = 924 = ~900
MaxOpenConnections int
// The path to a file containing certificate that is used to create the HTTPS server.
// Might be either absolute path or path related to Tendermint's config directory.
//
// If the certificate is signed by a certificate authority,
// the certFile should be the concatenation of the server's certificate, any intermediates,
// and the CA's certificate.
//
// NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server.
// Otherwise, HTTP server is run.
TLSCertFile string `mapstructure:"tls-cert-file"`
// The path to a file containing matching private key that is used to create the HTTPS server.
// Might be either absolute path or path related to tendermint's config directory.
//
// NOTE: both tls-cert-file and tls-key-file must be present for Tendermint to create HTTPS server.
// Otherwise, HTTP server is run.
TLSKeyFile string `mapstructure:"tls-key-file"`
}
RPCConfig holds RPC configuration params.
type TomlConfig ¶ added in v0.13.4
type TomlConfig struct {
Entrypoint string `toml:"entrypoint"`
Chain ChainTomlConfig `toml:"chain"`
RootDir string `toml:"-"`
}
TomlConfig is the configuration read from rollkit.toml
func ReadToml ¶ added in v0.13.4
func ReadToml() (config TomlConfig, err error)
ReadToml reads the TOML configuration from the rollkit.toml file and returns the parsed TomlConfig.