Documentation ¶
Index ¶
- Constants
- Variables
- func CheckWritable(dir string) error
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func GenesisEpochInfo(epochEnable bool) *rbft.EpochInfo
- func GetStoragePath(repoRoot string, subPath ...string) string
- func KeyString(key *ecdsa.PrivateKey) string
- func KeyToNodeID(sk *ecdsa.PrivateKey) (string, error)
- func Libp2pKeyFromECDSAKey(sk *ecdsa.PrivateKey) (libp2pcrypto.PrivKey, error)
- func LoadAccountKey(repoRoot string) (*ecdsa.PrivateKey, error)
- func LoadP2PKey(repoRoot string) (*ecdsa.PrivateKey, error)
- func LoadRepoRootFromEnv(repoRoot string) (string, error)
- func MarshalConfig(config any) (string, error)
- func ParseKey(keyBytes []byte) (*ecdsa.PrivateKey, error)
- func ReadKey(keyPath string) (*ecdsa.PrivateKey, error)
- func Register(consensusType string, isSupported bool)
- func RemovePID(rootPath string) error
- func StringToTimeDurationHookFunc() mapstructure.DecodeHookFunc
- func WriteKey(keyPath string, key *ecdsa.PrivateKey) error
- func WritePid(rootPath string) error
- type Access
- type Admin
- type Config
- type Consensus
- type ConsensusConfig
- type Duration
- type EVM
- type Executor
- type GenesisConfig
- type JLimiter
- type JsonRPC
- type Ledger
- type Log
- type LogModule
- type Monitor
- type NodeName
- type P2P
- type P2PPipe
- type P2PPipeGossipsub
- type P2PPipeSimpleBroadcast
- type PProf
- type Port
- type RBFT
- type RBFTTimeout
- type ReceiveMsgLimiter
- type Repo
- type Solo
- type Storage
- type Sync
- type TimedGenBlock
- type TxCache
- type TxPool
Constants ¶
View Source
const ( AppName = "AxiomLedger" // CfgFileName is the default config name CfgFileName = "config.toml" AccountKeyFileName = "account.key" LogsDirName = "logs" )
View Source
const ( ConsensusTypeSolo = "solo" ConsensusTypeRbft = "rbft" ConsensusTypeSoloDev = "solo_dev" ConsensusStorageTypeMinifile = "minifile" ConsensusStorageTypeRosedb = "rosedb" KVStorageTypeLeveldb = "leveldb" KVStorageTypePebble = "pebble" KVStorageCacheSize = 16 KVStorageSync = true P2PSecurityTLS = "tls" P2PSecurityNoise = "noise" PprofModeMem = "mem" PprofModeCpu = "cpu" PprofTypeHTTP = "http" PprofTypeRuntime = "runtime" P2PPipeBroadcastSimple = "simple" P2PPipeBroadcastGossip = "gossip" ExecTypeNative = "native" ExecTypeDev = "dev" // DefaultTxMaxSize is the maximum size a single transaction can have. This field has // non-trivial consequences: larger transactions are significantly harder and // more expensive to propagate; larger transactions also take more resources // to validate whether they fit into the pool or not. DefaultTxMaxSize = 4 * txSlotSize // 128KB )
View Source
const (
AriesTestnetName = "aries"
)
Variables ¶
View Source
var ( TestNetConfigBuilderMap = map[string]func() *Config{ AriesTestnetName: AriesConfig, } TestNetConsensusConfigBuilderMap = map[string]func() *ConsensusConfig{ AriesTestnetName: AriesConsensusConfig, } TestNetGenesisConfigBuilderMap = map[string]func() *GenesisConfig{ AriesTestnetName: AriesGenesisConfig, } )
View Source
var ( DefaultAdminNames = []string{ "S2luZw==", "UmVk", "QXBwbGU=", "Q2F0", } DefaultNodeNames = []string{ "S2luZw==", "UmVk", "QXBwbGU=", "Q2F0", "bm9kZTU=", "bm9kZTY=", "bm9kZTc=", "bm9kZTg=", } DefaultNodeKeys = []string{ "b6477143e17f889263044f6cf463dc37177ac4526c4c39a7a344198457024a2f", "05c3708d30c2c72c4b36314a41f30073ab18ea226cf8c6b9f566720bfe2e8631", "85a94dd51403590d4f149f9230b6f5de3a08e58899dcaf0f77768efb1825e854", "72efcf4bb0e8a300d3e47e6a10f630bcd540de933f01ed5380897fc5e10dc95d", "06bf783a69c860a2ab33fe2f99fed38d14bbdba7ef2295bbcb5a073e6c8847ec", "bfee1d369f1a98070f85b3b5b3508aaf071440fcdf7bdcb9c725fea835f17433", "508d3fd4ec16aff6443cc58bf3df44e55d5d384b1e56529bf52b0c25e8fcf8f7", "ffa932acb7c1099de1029070e7def812f8b2c9433adfb8a90b3cb132233a7690", } DefaultNodeAddrs = []string{ "0xc7F999b83Af6DF9e67d0a37Ee7e900bF38b3D013", "0x79a1215469FaB6f9c63c1816b45183AD3624bE34", "0x97c8B516D19edBf575D72a172Af7F418BE498C37", "0xc0Ff2e0b3189132D815b8eb325bE17285AC898f8", "0xd0091F6D0b39B9E9D2E9051fA46d13B63b8C7B18", "0xFd19030f51719D5601Bb079e5c5Be1eD07E01de2", "0xE4b988C0BEa762B8809a0E4D14F3ac3f922B41B3", "0x5FC85d64dE2125986b1581b4805a43Bfb3af5E52", } )
View Source
var ( // BuildCommit build git commit hash BuildCommit = "" // BuildBranch build git branch BuildBranch = "" // BuildVersion build project version BuildVersion = "0.0.0" // BuildDate compile date BuildDate = "" BuildVersionSecret = "Hangzhou" BuildNet = "" // GoVersion system go version GoVersion = runtime.Version() // Platform info Platform = fmt.Sprintf("%s/%s", runtime.GOOS, runtime.GOARCH) )
View Source
var SupportMultiNode = make(map[string]bool)
Functions ¶
func CheckWritable ¶
func GenesisEpochInfo ¶
func GetStoragePath ¶
func KeyString ¶
func KeyString(key *ecdsa.PrivateKey) string
func KeyToNodeID ¶
func KeyToNodeID(sk *ecdsa.PrivateKey) (string, error)
func Libp2pKeyFromECDSAKey ¶
func Libp2pKeyFromECDSAKey(sk *ecdsa.PrivateKey) (libp2pcrypto.PrivKey, error)
func LoadAccountKey ¶
func LoadAccountKey(repoRoot string) (*ecdsa.PrivateKey, error)
func LoadP2PKey ¶
func LoadP2PKey(repoRoot string) (*ecdsa.PrivateKey, error)
func LoadRepoRootFromEnv ¶
func MarshalConfig ¶
func StringToTimeDurationHookFunc ¶
func StringToTimeDurationHookFunc() mapstructure.DecodeHookFunc
Types ¶
type Access ¶
type Access struct {
EnableWhiteList bool `mapstructure:"enable_white_list" toml:"enable_white_list"`
}
type Config ¶
type Config struct { Ulimit uint64 `mapstructure:"ulimit" toml:"ulimit"` Port Port `mapstructure:"port" toml:"port"` JsonRPC JsonRPC `mapstructure:"jsonrpc" toml:"jsonrpc"` P2P P2P `mapstructure:"p2p" toml:"p2p"` Sync Sync `mapstructure:"sync" toml:"sync"` Consensus Consensus `mapstructure:"consensus" toml:"consensus"` Storage Storage `mapstructure:"storage" toml:"storage"` Ledger Ledger `mapstructure:"ledger" toml:"ledger"` Executor Executor `mapstructure:"executor" toml:"executor"` PProf PProf `mapstructure:"pprof" toml:"pprof"` Monitor Monitor `mapstructure:"monitor" toml:"monitor"` Log Log `mapstructure:"log" toml:"log"` Access Access `mapstructure:"access" toml:"access"` }
func AriesConfig ¶
func AriesConfig() *Config
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
type ConsensusConfig ¶
type ConsensusConfig struct { TimedGenBlock TimedGenBlock `mapstructure:"timed_gen_block" toml:"timed_gen_block"` Limit ReceiveMsgLimiter `mapstructure:"limit" toml:"limit"` TxPool TxPool `mapstructure:"tx_pool" toml:"tx_pool"` TxCache TxCache `mapstructure:"tx_cache" toml:"tx_cache"` Rbft RBFT `mapstructure:"rbft" toml:"rbft"` Solo Solo `mapstructure:"solo" toml:"solo"` }
func AriesConsensusConfig ¶
func AriesConsensusConfig() *ConsensusConfig
func DefaultConsensusConfig ¶
func DefaultConsensusConfig() *ConsensusConfig
func LoadConsensusConfig ¶
func LoadConsensusConfig(repoRoot string) (*ConsensusConfig, error)
type Duration ¶
func (*Duration) MarshalText ¶
func (*Duration) ToDuration ¶
func (*Duration) UnmarshalText ¶
type EVM ¶
type EVM struct {
DisableMaxCodeSizeLimit bool `mapstructure:"disable_max_code_size_limit" toml:"disable_max_code_size_limit"`
}
type GenesisConfig ¶
type GenesisConfig struct { ChainID uint64 `mapstructure:"chainid" toml:"chainid"` Balance string `mapstructure:"balance" toml:"balance"` Admins []*Admin `mapstructure:"admins" toml:"admins"` InitWhiteListProviders []string `mapstructure:"init_white_list_providers" toml:"init_white_list_providers"` Accounts []string `mapstructure:"accounts" toml:"accounts"` EpochInfo *rbft.EpochInfo `mapstructure:"epoch_info" toml:"epoch_info"` NodeNames []*NodeName `mapstructure:"node_names" toml:"node_names"` }
func AriesGenesisConfig ¶
func AriesGenesisConfig() *GenesisConfig
func DefaultGenesisConfig ¶
func DefaultGenesisConfig(epochEnable bool) *GenesisConfig
func LoadGenesisConfig ¶
func LoadGenesisConfig(repoRoot string) (*GenesisConfig, error)
type JsonRPC ¶
type JsonRPC struct { GasCap uint64 `mapstructure:"gas_cap" toml:"gas_cap"` EVMTimeout Duration `mapstructure:"evm_timeout" toml:"evm_timeout"` ReadLimiter JLimiter `mapstructure:"read_limiter" toml:"read_limiter"` WriteLimiter JLimiter `mapstructure:"write_limiter" toml:"write_limiter"` RejectTxsIfConsensusAbnormal bool `mapstructure:"reject_txs_if_consensus_abnormal" toml:"reject_txs_if_consensus_abnormal"` }
type Ledger ¶
type Ledger struct { ChainLedgerCacheSize int `mapstructure:"chain_ledger_cache_size" toml:"chain_ledger_cache_size"` StateLedgerCacheMegabytesLimit int `mapstructure:"state_ledger_cache_megabytes_limit" toml:"state_ledger_cache_megabytes_limit"` StateLedgerAccountCacheSize int `mapstructure:"state_ledger_account_cache_size" toml:"state_ledger_account_cache_size"` }
type Log ¶
type Log struct { Level string `mapstructure:"level" toml:"level"` Filename string `mapstructure:"filename" toml:"filename"` ReportCaller bool `mapstructure:"report_caller" toml:"report_caller"` EnableCompress bool `mapstructure:"enable_compress" toml:"enable_compress"` EnableColor bool `mapstructure:"enable_color" toml:"enable_color"` DisableTimestamp bool `mapstructure:"disable_timestamp" toml:"disable_timestamp"` // unit: day MaxAge uint `mapstructure:"max_age" toml:"max_age"` // unit: MB MaxSize uint `mapstructure:"max_size" toml:"max_size"` RotationTime Duration `mapstructure:"rotation_time" toml:"rotation_time"` Module LogModule `mapstructure:"module" toml:"module"` }
type LogModule ¶
type LogModule struct { P2P string `mapstructure:"p2p" toml:"p2p"` Consensus string `mapstructure:"consensus" toml:"consensus"` Executor string `mapstructure:"executor" toml:"executor"` Governance string `mapstructure:"governance" toml:"governance"` API string `mapstructure:"api" toml:"api"` APP string `mapstructure:"app" toml:"app"` CoreAPI string `mapstructure:"coreapi" toml:"coreapi"` Storage string `mapstructure:"storage" toml:"storage"` Profile string `mapstructure:"profile" toml:"profile"` Finance string `mapstructure:"finance" toml:"finance"` TxPool string `mapstructure:"txpool" toml:"txpool"` Access string `mapstructure:"access" toml:"access"` BlockSync string `mapstructure:"blocksync" toml:"blocksync"` Epoch string `mapstructure:"epoch" toml:"epoch"` }
type NodeName ¶
type NodeName struct { ID uint64 `mapstructure:"id" toml:"id"` Name string `mapstructure:"name" toml:"name"` }
func GenesisNodeNameInfo ¶
type P2P ¶
type P2P struct { BootstrapNodeAddresses []string `mapstructure:"bootstrap_node_addresses" toml:"bootstrap_node_addresses"` Security string `mapstructure:"security" toml:"security"` SendTimeout Duration `mapstructure:"send_timeout" toml:"send_timeout"` ReadTimeout Duration `mapstructure:"read_timeout" toml:"read_timeout"` Pipe P2PPipe `mapstructure:"pipe" toml:"pipe"` }
type P2PPipe ¶
type P2PPipe struct { ReceiveMsgCacheSize int `mapstructure:"receive_msg_cache_size" toml:"receive_msg_cache_size"` BroadcastType string `mapstructure:"broadcast_type" toml:"broadcast_type"` SimpleBroadcast P2PPipeSimpleBroadcast `mapstructure:"simple_broadcast" toml:"simple_broadcast"` Gossipsub P2PPipeGossipsub `mapstructure:"gossipsub" toml:"gossipsub"` UnicastReadTimeout Duration `mapstructure:"unicast_read_timeout" toml:"unicast_read_timeout"` UnicastSendRetryNumber int `mapstructure:"unicast_send_retry_number" toml:"unicast_send_retry_number"` UnicastSendRetryBaseTime Duration `mapstructure:"unicast_send_retry_base_time" toml:"unicast_send_retry_base_time"` FindPeerTimeout Duration `mapstructure:"find_peer_timeout" toml:"find_peer_timeout"` ConnectTimeout Duration `mapstructure:"connect_timeout" toml:"connect_timeout"` }
type P2PPipeGossipsub ¶
type P2PPipeGossipsub struct { DisableCustomMsgIDFn bool `mapstructure:"disable_custom_msg_id_fn" toml:"disable_custom_msg_id_fn"` SubBufferSize int `mapstructure:"sub_buffer_size" toml:"sub_buffer_size"` PeerOutboundBufferSize int `mapstructure:"peer_outbound_buffer_size" toml:"peer_outbound_buffer_size"` ValidateBufferSize int `mapstructure:"validate_buffer_size" toml:"validate_buffer_size"` SeenMessagesTTL Duration `mapstructure:"seen_messages_ttl" toml:"seen_messages_ttl"` EnableMetrics bool `mapstructure:"enable_metrics" toml:"enable_metrics"` }
type P2PPipeSimpleBroadcast ¶
type RBFT ¶
type RBFT struct { EnableMultiPipes bool `mapstructure:"enable_multi_pipes" toml:"enable_multi_pipes"` EnableMetrics bool `mapstructure:"enable_metrics" toml:"enable_metrics"` CommittedBlockCacheNumber uint64 `mapstructure:"committed_block_cache_number" toml:"committed_block_cache_number"` Timeout RBFTTimeout `mapstructure:"timeout" toml:"timeout"` }
type RBFTTimeout ¶
type RBFTTimeout struct { NullRequest Duration `mapstructure:"null_request" toml:"null_request"` Request Duration `mapstructure:"request" toml:"request"` ResendViewChange Duration `mapstructure:"resend_viewchange" toml:"resend_viewchange"` CleanViewChange Duration `mapstructure:"clean_viewchange" toml:"clean_viewchange"` NewView Duration `mapstructure:"new_view" toml:"new_view"` SyncState Duration `mapstructure:"sync_state" toml:"sync_state"` SyncStateRestart Duration `mapstructure:"sync_state_restart" toml:"sync_state_restart"` FetchCheckpoint Duration `mapstructure:"fetch_checkpoint" toml:"fetch_checkpoint"` FetchView Duration `mapstructure:"fetch_view" toml:"fetch_view"` BatchTimeout Duration `mapstructure:"batch_timeout" toml:"batch_timeout"` }
type ReceiveMsgLimiter ¶
type Repo ¶
type Repo struct { RepoRoot string Config *Config ConsensusConfig *ConsensusConfig GenesisConfig *GenesisConfig AccountKey *ecdsa.PrivateKey AccountAddress string P2PKey *ecdsa.PrivateKey P2PID string // TODO: Move to epoch manager service // Track current epoch info, will be updated bt executor EpochInfo *rbft.EpochInfo ReadonlyMode bool }
func DefaultWithNodeIndex ¶
func (*Repo) PrintNodeInfo ¶
func (r *Repo) PrintNodeInfo()
type TimedGenBlock ¶
type TimedGenBlock struct {
NoTxBatchTimeout Duration `mapstructure:"no_tx_batch_timeout" toml:"no_tx_batch_timeout"`
}
type TxPool ¶
type TxPool struct { PoolSize uint64 `mapstructure:"pool_size" toml:"pool_size"` ToleranceTime Duration `mapstructure:"tolerance_time" toml:"tolerance_time"` ToleranceRemoveTime Duration `mapstructure:"tolerance_remove_time" toml:"tolerance_remove_time"` CleanEmptyAccountTime Duration `mapstructure:"clean_empty_account_time" toml:"clean_empty_account_time"` ToleranceNonceGap uint64 `mapstructure:"tolerance_nonce_gap" toml:"tolerance_nonce_gap"` }
Click to show internal directories.
Click to hide internal directories.