config

package
v0.0.0-...-ef73a9a Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: LGPL-3.0 Imports: 11 Imported by: 0

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_NODE_PORT                       = 20338
	DEFAULT_RPC_PORT                        = 20336
	DEFAULT_RPC_LOCAL_PORT                  = 20337
	DEFAULT_REST_PORT                       = 20334
	DEFAULT_WS_PORT                         = 20335
	DEFAULT_REST_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_GAS_LIMIT                       = 20000
	DEFAULT_MIN_ONG_LIMIT                   = 100000000
	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"
)
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:AMAx993nE6NEqZjwBssUfopxnnvTdob9ij",
		MinInitStake:         10000,
		VrfValue:             "1c9810aa9822e511d5804a9c4db9dd08497c31087b0daafa34d768a3253441fa20515e2f30f81741102af0ca3cefc4818fef16adb825fbaa8cad78647f3afb590e",
		VrfProof:             "c57741f934042cb8d8b087b44b161db56fc3ffd4ffb675d36cd09f83935be853d8729f3f5298d12d6fd28d45dde515a4b9d7f67682d182ba5118abf451ff1988",
		Peers: []*VBFTPeerStakeInfo{
			{
				Index:      1,
				PeerPubkey: "037c9e6c6a446b6b296f89b722cbf686b81e0a122444ef05f0f87096777663284b",
				Address:    "AXmQDzzvpEtPkNwBEFsREzApTTDZFW6frD",
				InitPos:    10000,
			},
			{
				Index:      2,
				PeerPubkey: "03dff4c63267ae5e23da44ace1bc47d0da1eb8d36fd71181dcccf0e872cb7b31fa",
				Address:    "AY5W6p4jHeZG2jjW6nS1p4KDUhcqLkU6jz",
				InitPos:    20000,
			},
			{
				Index:      3,
				PeerPubkey: "0205bc592aa9121428c4144fcd669ece1fa73fee440616c75624967f83fb881050",
				Address:    "ALZVrZrFqoSvqyi38n7mpPoeDp7DMtZ9b6",
				InitPos:    30000,
			},
			{
				Index:      4,
				PeerPubkey: "030a34dcb075d144df1f65757b85acaf053395bb47b019970607d2d1cdd222525c",
				Address:    "AMogjmLf2QohTcGST7niV75ekZfj44SKme",
				InitPos:    40000,
			},
			{
				Index:      5,
				PeerPubkey: "021844159f97d81da71da52f84e8451ee573c83b296ff2446387b292e44fba5c98",
				Address:    "AZzQTkZvjy7ih9gjvwU8KYiZZyNoy6jE9p",
				InitPos:    30000,
			},
			{
				Index:      6,
				PeerPubkey: "020cc76feb375d6ea8ec9ff653bab18b6bbc815610cecc76e702b43d356f885835",
				Address:    "AKEqQKmxCsjWJz8LPGryXzb6nN5fkK1WDY",
				InitPos:    20000,
			},
			{
				Index:      7,
				PeerPubkey: "03aa4d52b200fd91ca12deff46505c4608a0f66d28d9ae68a342c8a8c1266de0f9",
				Address:    "AQNpGWz4oHHFBejtBbakeR43DHfen7cm8L",
				InitPos:    10000,
			},
		},
	},
	DBFT: &DBFTConfig{},
	SOLO: &SOLOConfig{},
}
View Source
var Version = "v2.0.0" //Set value when build project

Functions

func GetContractApiDeprecateHeight

func GetContractApiDeprecateHeight() uint32

func GetCrossChainHeight

func GetCrossChainHeight() uint32

func GetGasRoundTuneHeight

func GetGasRoundTuneHeight(id uint32) uint32

func GetGovUnboundDeadline

func GetGovUnboundDeadline() (uint32, uint64)

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

func GetNetworkMagic

func GetNetworkMagic(id uint32) uint32

func GetNetworkName

func GetNetworkName(id uint32) string

func GetNewOntIdHeight

func GetNewOntIdHeight() uint32

func GetOntFsHeight

func GetOntFsHeight() uint32

func GetOntHolderUnboundDeadline

func GetOntHolderUnboundDeadline() uint32

func GetOpcodeUpdateCheckHeight

func GetOpcodeUpdateCheckHeight(id uint32) uint32

func GetSelfGovRegisterHeight

func GetSelfGovRegisterHeight() uint32

func GetStateHashCheckHeight

func GetStateHashCheckHeight(id uint32) uint32

Types

type CommonConfig

type CommonConfig struct {
	LogLevel         uint
	NodeType         string
	EnableEventLog   bool
	SystemFee        map[string]int64
	GasLimit         uint64
	GasPrice         uint64
	MinOngLimit      uint64
	DataDir          string
	WasmVerifyMethod VerifyMethod
}

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 OntologyConfig

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

func NewOntologyConfig

func NewOntologyConfig() *OntologyConfig

func (*OntologyConfig) GetBookkeepers

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

func (*OntologyConfig) GetDefaultNetworkId

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
}

type P2PRsvConfig

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
}

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

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

func (*VBFTConfig) Serialization

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

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

func (*VBFTPeerStakeInfo) Serialization

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

type VerifyMethod

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