config

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: LGPL-3.0 Imports: 11 Imported by: 171

Documentation

Index

Constants

View Source
const (
	DEFAULT_CONFIG_FILE_NAME = "./config.json"
	DEFAULT_WALLET_FILE_NAME = "./wallet.dat"
	MIN_GEN_BLOCK_TIME       = 2
	DEFAULT_GEN_BLOCK_TIME   = 6
	DBFT_MIN_NODE_NUM        = 4 //min node number of dbft consensus
	SOLO_MIN_NODE_NUM        = 1 //min node number of solo consensus
	VBFT_MIN_NODE_NUM        = 4 //min node number of vbft consensus

	CONSENSUS_TYPE_DBFT = "dbft"
	CONSENSUS_TYPE_SOLO = "solo"
	CONSENSUS_TYPE_VBFT = "vbft"

	DEFAULT_LOG_LEVEL                       = log.InfoLog
	DEFAULT_ETH_RPC_PORT                    = 20339
	DEFAULT_NODE_PORT                       = 20338
	DEFAULT_RPC_PORT                        = 20336
	DEFAULT_RPC_LOCAL_PORT                  = 20337
	DEFAULT_GRAPHQL_PORT                    = 20333
	DEFAULT_REST_PORT                       = 20334
	DEFAULT_WS_PORT                         = 20335
	DEFAULT_HTTP_MAX_CONN                   = 1024
	DEFAULT_MAX_CONN_IN_BOUND               = 1024
	DEFAULT_MAX_CONN_OUT_BOUND              = 1024
	DEFAULT_MAX_CONN_IN_BOUND_FOR_SINGLE_IP = 16
	DEFAULT_HTTP_INFO_PORT                  = 0
	DEFAULT_MAX_TX_IN_BLOCK                 = 60000
	DEFAULT_MAX_SYNC_HEADER                 = 500
	DEFAULT_ENABLE_EVENT_LOG                = true
	DEFAULT_CLI_RPC_PORT                    = uint(20000)
	DEFUALT_CLI_RPC_ADDRESS                 = "127.0.0.1"
	DEFAULT_MIN_GAS_LIMIT                   = 20000
	DEFAULT_GAS_PRICE                       = 500
	DEFAULT_WASM_GAS_FACTOR                 = uint64(10)
	DEFAULT_WASM_MAX_STEPCOUNT              = uint64(8000000)

	DEFAULT_DATA_DIR      = "./Chain"
	DEFAULT_RESERVED_FILE = "./peers.rsv"

	//DEFAULT_ETH_BLOCK_GAS_LIMIT = 800000000
	DEFAULT_ETH_TX_MAX_GAS_LIMIT = 6000000
)
View Source
const (
	NETWORK_ID_MAIN_NET      = 1
	NETWORK_ID_POLARIS_NET   = 2
	NETWORK_ID_SOLO_NET      = 3
	NETWORK_NAME_MAIN_NET    = "ontology"
	NETWORK_NAME_POLARIS_NET = "polaris"
	NETWORK_NAME_SOLO_NET    = "testmode"
)
View Source
const (
	WASM_GAS_FACTOR = "WASM_GAS_FACTOR"
)

Variables

View Source
var DefConfig = NewOntologyConfig()
View Source
var MainNetConfig = &GenesisConfig{
	SeedList: []string{
		"seed1.ont.io:20338",
		"seed2.ont.io:20338",
		"seed3.ont.io:20338",
		"seed4.ont.io:20338",
		"seed5.ont.io:20338"},
	ConsensusType: CONSENSUS_TYPE_VBFT,
	VBFT: &VBFTConfig{
		N:                    7,
		C:                    2,
		K:                    7,
		L:                    112,
		BlockMsgDelay:        10000,
		HashMsgDelay:         10000,
		PeerHandshakeTimeout: 10,
		MaxBlockChangeView:   120000,
		AdminOntID:           "did:ont:AdjfcJgwru2FD8kotCPvLDXYzRjqFjc9Tb",
		MinInitStake:         100000,
		VrfValue:             "1c9810aa9822e511d5804a9c4db9dd08497c31087b0daafa34d768a3253441fa20515e2f30f81741102af0ca3cefc4818fef16adb825fbaa8cad78647f3afb590e",
		VrfProof:             "c57741f934042cb8d8b087b44b161db56fc3ffd4ffb675d36cd09f83935be853d8729f3f5298d12d6fd28d45dde515a4b9d7f67682d182ba5118abf451ff1988",
		Peers: []*VBFTPeerStakeInfo{
			{
				Index:      1,
				PeerPubkey: "03348c8fe64e1defb408676b6e320038bd2e592c802e27c3d7e88e68270076c2f7",
				Address:    "AZavFr7sQ4em2NmqWDjLMY34tHMQzATWgx",
			},
			{
				Index:      2,
				PeerPubkey: "03afd920a3b4ce2e7175a32c0d092153d1a11ef5e0dcc14e71c85101b95518d5d7",
				Address:    "AM9jHMV7xY4HWH2dWmzyxrtnbi6ErNt7oL",
			},
			{
				Index:      3,
				PeerPubkey: "03e818b65a66d983a99497e06c6552ee5067229e85ba1cec60c5477dc3d568ed43",
				Address:    "ATECwFPNRZFydFR1yUjb6RTLfVcKGKWRmp",
			},
			{
				Index:      4,
				PeerPubkey: "02375e44e500f9cfe8bd2f4afa4a016a8a902567996c919b9d1ce4f5d4f930f145",
				Address:    "AKMxTuHQtt5YspXNPwkQNP5ZY66c4LY5BR",
			},
			{
				Index:      5,
				PeerPubkey: "03af040c09af5e06cf966f73fc99e8f4372f1510fe6e4376824452a99b85695a9c",
				Address:    "AT4fXp36Ui22Lbh5ZJUCRBFDJ7axkLyUFM",
			},
			{
				Index:      6,
				PeerPubkey: "034ee2a4368e999fc7c04e7e3a9073162d47712382f1690d6a67e7e1c475cd0ff3",
				Address:    "ANLRokqieUtrUMave66FcNy2cxV7Whf4UN",
			},
			{
				Index:      7,
				PeerPubkey: "0327f9e0fb3b894027c52caf3d31d9ac5f676d3cf892c933ac107ed7447fb6e65b",
				Address:    "AVRD9QmkYNq8n8DXc9AqpZnUEYhjg1aq5L",
			},
		},
	},
	DBFT: &DBFTConfig{},
	SOLO: &SOLOConfig{},
}
View Source
var PolarisConfig = &GenesisConfig{
	SeedList: []string{
		"polaris1.ont.io:20338",
		"polaris2.ont.io:20338",
		"polaris3.ont.io:20338",
		"polaris4.ont.io:20338"},
	ConsensusType: CONSENSUS_TYPE_VBFT,
	VBFT: &VBFTConfig{
		N:                    7,
		C:                    2,
		K:                    7,
		L:                    112,
		BlockMsgDelay:        10000,
		HashMsgDelay:         10000,
		PeerHandshakeTimeout: 10,
		MaxBlockChangeView:   3000,
		AdminOntID:           "did:ont:AZYsUWrzNYoXKjUNmMNwRZFHgdFceepDY8",
		MinInitStake:         10000,
		VrfValue:             "1c9810aa9822e511d5804a9c4db9dd08497c31087b0daafa34d768a3253441fa20515e2f30f81741102af0ca3cefc4818fef16adb825fbaa8cad78647f3afb590e",
		VrfProof:             "c57741f934042cb8d8b087b44b161db56fc3ffd4ffb675d36cd09f83935be853d8729f3f5298d12d6fd28d45dde515a4b9d7f67682d182ba5118abf451ff1988",
		Peers: []*VBFTPeerStakeInfo{
			{
				Index:      1,
				PeerPubkey: "02991768dafcdc1fbd3a29fda0ba78ea52da8df118eceecbdc7c4520979b01f85f",
				Address:    "AUtkbiCdZZudV9PpBCCnFnCVMzxHGwdgJG",
			}, {
				Index:      2,
				PeerPubkey: "022ae5cb71715f259f37181e2b5106a3f6cfc3f418856e98bea4170455eb60fb13",
				Address:    "ANWGV5vY6G699cepY5QdfXhiVJPeE2YUVB",
			}, {
				Index:      3,
				PeerPubkey: "03ec62d87cb127f53da20ec0dd28170c67a967a09ff90678698060bf58ea791929",
				Address:    "AWuBPBHGVNYyh9GsymGydjgmFdc4gTaqsH",
			}, {
				Index:      4,
				PeerPubkey: "0237313c1fc4dd3a7b83ac98293d813d5c5ae5f4f2c8ec0595fb99468d0a89af77",
				Address:    "AXWUiHwtXhrgsZBiN7G92VfdyKjxtV9mKk",
			}, {
				Index:      5,
				PeerPubkey: "02712034342b182c61ab7f278defeacb0e5f986935559eb11a972e35eb11801801",
				Address:    "ARqsMoZgQwin9qRQz1qM7WzDXvcYHsxf55",
			}, {
				Index:      6,
				PeerPubkey: "03625c32d7d69d1ec9c7be2ad2d51a6832df0cab06415e3a5c943d6781ad566a55",
				Address:    "AT4K1UQiGkNTs7akaggsqEai7uJoe86Ap1",
			}, {
				Index:      7,
				PeerPubkey: "035f52e2c1eff549e01d153eaf3a1da8a587c30c03ea3b3b1de049d051aeeac948",
				Address:    "AdQ9SfUYcqwyv9YpBsodPeHnLe572UAH9k",
			},
		},
	},
	DBFT: &DBFTConfig{},
	SOLO: &SOLOConfig{},
}
View Source
var Version = "v2.0.0" //Set value when build project

Functions

func GetAddDecimalsHeight added in v1.14.1

func GetAddDecimalsHeight() uint32

func GetContractApiDeprecateHeight added in v1.10.0

func GetContractApiDeprecateHeight() uint32

func GetCrossChainHeight added in v1.11.0

func GetCrossChainHeight() uint32

func GetEip155ChainID added in v1.14.1

func GetEip155ChainID(id uint32) uint32

func GetGasRoundTuneHeight added in v1.9.0

func GetGasRoundTuneHeight(id uint32) uint32

func GetGovUnboundDeadline added in v1.11.0

func GetGovUnboundDeadline() (uint32, uint64)

the end of unbound timestamp offset from genesis block's timestamp

func GetNetworkMagic added in v0.9.2

func GetNetworkMagic(id uint32) uint32

func GetNetworkName added in v0.9.2

func GetNetworkName(id uint32) string

func GetNewOntIdHeight added in v1.10.0

func GetNewOntIdHeight() uint32

func GetNewPeerCostHeight added in v1.12.0

func GetNewPeerCostHeight() uint32

func GetOntFsHeight added in v1.11.0

func GetOntFsHeight() uint32

func GetOntHolderUnboundDeadline added in v1.11.0

func GetOntHolderUnboundDeadline() uint32

func GetOpcodeUpdateCheckHeight added in v1.7.0

func GetOpcodeUpdateCheckHeight(id uint32) uint32

func GetSelfGovRegisterHeight added in v1.10.0

func GetSelfGovRegisterHeight() uint32

func GetStateHashCheckHeight added in v1.6.0

func GetStateHashCheckHeight(id uint32) uint32

func GetTrackDestroyedContractHeight added in v1.13.0

func GetTrackDestroyedContractHeight() uint32

func GetUint64WrappingHeight added in v1.17.0

func GetUint64WrappingHeight() uint32

func GetUserFeeSplitHeight added in v1.17.0

func GetUserFeeSplitHeight() uint32

Types

type CommonConfig

type CommonConfig struct {
	LogLevel       uint
	NodeType       string
	EnableEventLog bool
	SystemFee      map[string]int64
	MinGasLimit    uint64
	GasPrice       uint64
	DataDir        string
	ETHTxGasLimit  uint64
	//NGasLimit        uint64
	WasmVerifyMethod VerifyMethod
	TraceTxPool      bool
}

type ConsensusConfig

type ConsensusConfig struct {
	EnableConsensus bool
	MaxTxInBlock    uint
}

type DBFTConfig

type DBFTConfig struct {
	GenBlockTime uint
	Bookkeepers  []string
}

type GenesisConfig

type GenesisConfig struct {
	SeedList      []string
	ConsensusType string
	VBFT          *VBFTConfig
	DBFT          *DBFTConfig
	SOLO          *SOLOConfig
}

func NewGenesisConfig

func NewGenesisConfig() *GenesisConfig

type GraphQLConfig added in v1.13.0

type GraphQLConfig struct {
	EnableGraphQL  bool
	GraphQLPort    uint
	MaxConnections uint
}

type OntologyConfig

type OntologyConfig struct {
	Genesis   *GenesisConfig
	Common    *CommonConfig
	Consensus *ConsensusConfig
	P2PNode   *P2PNodeConfig
	Rpc       *RpcConfig
	Restful   *RestfulConfig
	GraphQL   *GraphQLConfig
	Ws        *WebSocketConfig
}

func NewOntologyConfig

func NewOntologyConfig() *OntologyConfig

func (*OntologyConfig) GetBookkeepers

func (this *OntologyConfig) GetBookkeepers() ([]keypair.PublicKey, error)

func (*OntologyConfig) GetDefaultNetworkId added in v1.0.1

func (this *OntologyConfig) GetDefaultNetworkId() (uint32, error)

type P2PNodeConfig

type P2PNodeConfig struct {
	ReservedPeersOnly         bool
	ReservedCfg               *P2PRsvConfig
	NetworkMagic              uint32
	NetworkId                 uint32
	NetworkName               string
	NodePort                  uint16
	IsTLS                     bool
	CertPath                  string
	KeyPath                   string
	CAPath                    string
	HttpInfoPort              uint16
	MaxHdrSyncReqs            uint
	MaxConnInBound            uint
	MaxConnOutBound           uint
	MaxConnInBoundForSingleIP uint
	EVMChainId                uint32
}

type P2PRsvConfig added in v0.9.2

type P2PRsvConfig struct {
	ReservedPeers []string `json:"reserved"`
	MaskPeers     []string `json:"mask"`
}

type RestfulConfig

type RestfulConfig struct {
	EnableHttpRestful  bool
	HttpRestPort       uint
	HttpMaxConnections uint
	HttpCertPath       string
	HttpKeyPath        string
}

type RpcConfig

type RpcConfig struct {
	EnableHttpJsonRpc bool
	HttpJsonPort      uint
	HttpLocalPort     uint
	EthJsonPort       uint
}

type SOLOConfig

type SOLOConfig struct {
	GenBlockTime uint
	Bookkeepers  []string
}

type VBFTConfig

type VBFTConfig struct {
	N                    uint32               `json:"n"` // network size
	C                    uint32               `json:"c"` // consensus quorum
	K                    uint32               `json:"k"`
	L                    uint32               `json:"l"`
	BlockMsgDelay        uint32               `json:"block_msg_delay"`
	HashMsgDelay         uint32               `json:"hash_msg_delay"`
	PeerHandshakeTimeout uint32               `json:"peer_handshake_timeout"`
	MaxBlockChangeView   uint32               `json:"max_block_change_view"`
	MinInitStake         uint32               `json:"min_init_stake"`
	AdminOntID           string               `json:"admin_ont_id"`
	VrfValue             string               `json:"vrf_value"`
	VrfProof             string               `json:"vrf_proof"`
	Peers                []*VBFTPeerStakeInfo `json:"peers"`
}

VBFT genesis config, from local config file

func (*VBFTConfig) Deserialization added in v1.8.1

func (this *VBFTConfig) Deserialization(source *common.ZeroCopySource) error

func (*VBFTConfig) Serialization added in v1.8.1

func (self *VBFTConfig) Serialization(sink *common.ZeroCopySink) error

type VBFTPeerStakeInfo

type VBFTPeerStakeInfo struct {
	Index      uint32 `json:"index"`
	PeerPubkey string `json:"peerPubkey"`
	Address    string `json:"address"`
	InitPos    uint64 `json:"initPos"`
}

func (*VBFTPeerStakeInfo) Deserialization added in v1.8.1

func (this *VBFTPeerStakeInfo) Deserialization(source *common.ZeroCopySource) error

func (*VBFTPeerStakeInfo) Serialization added in v1.8.1

func (this *VBFTPeerStakeInfo) Serialization(sink *common.ZeroCopySink) error

type VerifyMethod added in v1.9.0

type VerifyMethod int
const (
	InterpVerifyMethod VerifyMethod = iota
	JitVerifyMethod
	NoneVerifyMethod
)

type WebSocketConfig

type WebSocketConfig struct {
	EnableHttpWs bool
	HttpWsPort   uint
	HttpCertPath string
	HttpKeyPath  string
}

Jump to

Keyboard shortcuts

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