params

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2019 License: GPL-3.0 Imports: 8 Imported by: 47

Documentation

Index

Constants

View Source
const (
	Wei      = 1
	Ada      = 1e3
	Babbage  = 1e6
	Shannon  = 1e9
	GWei     = 1e9
	Szabo    = 1e12
	Finney   = 1e15
	Ether    = 1e18
	Einstein = 1e21
	Douglas  = 1e42
)

These are the multipliers for ether denominations. Example: To get the wei value of an amount in 'gwei', use

new(big.Int).Mul(value, big.NewInt(params.GWei))
View Source
const (
	// BloomBitsBlocks is the number of blocks a single bloom bit section vector
	// contains on the server side.
	BloomBitsBlocks uint64 = 4096

	// BloomBitsBlocksClient is the number of blocks a single bloom bit section vector
	// contains on the light client side
	BloomBitsBlocksClient uint64 = 32768

	// BloomConfirms is the number of confirmation blocks before a bloom section is
	// considered probably final and its rotated bits are calculated.
	BloomConfirms = 256

	// CHTFrequencyClient is the block frequency for creating CHTs on the client side.
	CHTFrequencyClient = 32768

	// CHTFrequencyServer is the block frequency for creating CHTs on the server side.
	// Eventually this can be merged back with the client version, but that requires a
	// full database upgrade, so that should be left for a suitable moment.
	CHTFrequencyServer = 4096

	// BloomTrieFrequency is the block frequency for creating BloomTrie on both
	// server/client sides.
	BloomTrieFrequency = 32768

	// HelperTrieConfirmations is the number of confirmations before a client is expected
	// to have the given HelperTrie available.
	HelperTrieConfirmations = 2048

	// HelperTrieProcessConfirmations is the number of confirmations before a HelperTrie
	// is generated
	HelperTrieProcessConfirmations = 256
)
View Source
const (
	//GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations.
	GasLimitBoundDivisor uint64 = 100  // The bound divisor of the gas limit, used in update calculations.
	MinGasLimit          uint64 = 5000 // Minimum the gas limit may ever be.
	//GenesisGasLimit      uint64 = 4712388 // Gas limit of the Genesis block.
	GenesisGasLimit uint64 = 10000000 // Gas limit of the Genesis block.

	MaximumExtraDataSize  uint64 = 32    // Maximum size extra data may be after Genesis.
	ExpByteGas            uint64 = 10    // Times ceil(log256(exponent)) for the EXP instruction.
	SloadGas              uint64 = 50    // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added.
	CallValueTransferGas  uint64 = 9000  // Paid for CALL when the value transfer is non-zero.
	CallNewAccountGas     uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.
	TxGas                 uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
	TxGasContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
	TxDataZeroGas         uint64 = 4     // Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions.
	QuadCoeffDiv          uint64 = 512   // Divisor for the quadratic particle of the memory cost equation.
	SstoreSetGas          uint64 = 20000 // Once per SLOAD operation.
	LogDataGas            uint64 = 8     // Per byte in a LOG* operation's data.
	CallStipend           uint64 = 2300  // Free gas given at beginning of call.

	Sha3Gas     uint64 = 30 // Once per SHA3 operation.
	Sha3WordGas uint64 = 6  // Once per word of the SHA3 operation's data.

	SstoreResetGas  uint64 = 5000  // Once per SSTORE operation if the zeroness changes from zero.
	SstoreClearGas  uint64 = 5000  // Once per SSTORE operation if the zeroness doesn't change.
	SstoreRefundGas uint64 = 15000 // Once per SSTORE operation if the zeroness changes to zero.

	NetSstoreNoopGas  uint64 = 200   // Once per SSTORE operation if the value doesn't change.
	NetSstoreInitGas  uint64 = 20000 // Once per SSTORE operation from clean zero.
	NetSstoreCleanGas uint64 = 5000  // Once per SSTORE operation from clean non-zero.
	NetSstoreDirtyGas uint64 = 200   // Once per SSTORE operation from dirty.

	NetSstoreClearRefund      uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot
	NetSstoreResetRefund      uint64 = 4800  // Once per SSTORE operation for resetting to the original non-zero value
	NetSstoreResetClearRefund uint64 = 19800 // Once per SSTORE operation for resetting to the original zero value

	JumpdestGas      uint64 = 1     // Refunded gas, once per SSTORE operation if the zeroness changes to zero.
	EpochDuration    uint64 = 30000 // Duration between proof-of-work epochs.
	CallGas          uint64 = 40    // Once per CALL operation & message call transaction.
	CreateDataGas    uint64 = 200   //
	CallCreateDepth  uint64 = 1024  // Maximum depth of call/create stack.
	ExpGas           uint64 = 10    // Once per EXP instruction
	LogGas           uint64 = 375   // Per LOG* operation.
	CopyGas          uint64 = 3     //
	StackLimit       uint64 = 1024  // Maximum size of VM stack allowed.
	TierStepGas      uint64 = 0     // Once per operation, for a selection of them.
	LogTopicGas      uint64 = 375   // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas.
	CreateGas        uint64 = 32000 // Once per CREATE operation & contract-creation transaction.
	Create2Gas       uint64 = 32000 // Once per CREATE2 operation
	SuicideRefundGas uint64 = 24000 // Refunded following a suicide operation.
	MemoryGas        uint64 = 3     // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL.
	TxDataNonZeroGas uint64 = 68    // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions.

	MaxCodeSize = 24576 // Maximum bytecode to permit for a contract

	EcrecoverGas            uint64 = 3000   // Elliptic curve sender recovery gas price
	Sha256BaseGas           uint64 = 60     // Base price for a SHA256 operation
	Sha256PerWordGas        uint64 = 12     // Per-word price for a SHA256 operation
	Ripemd160BaseGas        uint64 = 600    // Base price for a RIPEMD160 operation
	Ripemd160PerWordGas     uint64 = 120    // Per-word price for a RIPEMD160 operation
	IdentityBaseGas         uint64 = 15     // Base price for a data copy operation
	IdentityPerWordGas      uint64 = 3      // Per-work price for a data copy operation
	ModExpQuadCoeffDiv      uint64 = 20     // Divisor for the quadratic particle of the big int modular exponentiation
	Bn256AddGas             uint64 = 500    // Gas needed for an elliptic curve addition
	Bn256ScalarMulGas       uint64 = 40000  // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGas     uint64 = 100000 // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGas uint64 = 80000  // Per-point price for an elliptic curve pairing check
)
View Source
const (
	// FuzzModeDrop is a mode in which we randomly drop reads/writes, connections or sleep
	FuzzModeDrop = iota
	// FuzzModeDelay is a mode in which we randomly sleep
	FuzzModeDelay
)
View Source
const (
	VersionMajor = 0          // Major version component of the current release
	VersionMinor = 10         // Minor version component of the current release
	VersionPatch = 0          // Patch version component of the current release
	VersionMeta  = "unstable" // Version metadata to append to the version string
)

Variables

View Source
var (
	MainnetGenesisHash      = common.HexToHash("0x4c698115c8ff468038c471885d7082be4a9ee96be738d3ee20abc1a1d0e21e89")
	TestnetGenesisHash      = common.HexToHash("0x290144fdb8893d0a0e3788cbc626109e616044e62a023a56909e55ba9c8b1b55")
	MainnetSnailGenesisHash = common.HexToHash("0x044db0d284a7ce0038f3573116bb20b0cbd0fc7c7fd39e86e191731867147e3e")
	TestnetSnailGenesisHash = common.HexToHash("0x9e0e83d9ef3600159bbe3c1f11faa407902146ac76e22f1ab73792f070451f03")

	TestnetGenesisFHash = common.HexToHash("0xcf49d73c99b1c47340b7f302c952f6457f1c0de1fd5b3252bd4707399827134f")
	TestnetGenesisSHash = common.HexToHash("0x00bffb8790c8e80c3b6ca76ab6986d30fdd28f67cc4a9dff2cc054e9cb1a1b09")
)

Genesis hashes to enforce below configs on.

View Source
var (
	// MainnetChainConfig is the chain parameters to run a node on the main network.
	MainnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(1),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(2000000),
			MinimumFruitDifficulty: big.NewInt(2000),
			DurationLimit:          big.NewInt(600),
		}),
	}

	// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
	TestnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(18928),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(2000000),
			MinimumFruitDifficulty: big.NewInt(2000),
			DurationLimit:          big.NewInt(600),
		}),
	}

	// DevnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
	DevnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(10),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(10000),
			MinimumFruitDifficulty: big.NewInt(100),
			DurationLimit:          big.NewInt(150),
		}),
	}

	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllMinervaProtocolChanges = &ChainConfig{big.NewInt(1337), new(MinervaConfig)}

	TestChainConfig = &ChainConfig{big.NewInt(1), &MinervaConfig{MinimumDifficulty, MinimumFruitDifficulty, DurationLimit}}
)
View Source
var (
	// GasTableHomestead contain the gas prices for
	// the homestead phase.
	GasTableHomestead = GasTable{
		ExtcodeSize: 20,
		ExtcodeCopy: 20,
		Balance:     20,
		SLoad:       50,
		Calls:       40,
		Suicide:     0,
		ExpByte:     10,
	}

	// GasTableEIP150 contain the gas re-prices for
	// the EIP150 phase.
	GasTableEIP150 = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     10,

		CreateBySuicide: 25000,
	}
	// GasTableEIP158 contain the gas re-prices for
	// the EIP155/EIP158 phase.
	GasTableEIP158 = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     50,

		CreateBySuicide: 25000,
	}
	// GasTableConstantinople contain the gas re-prices for
	// the constantinople phase.
	GasTableConstantinople = GasTable{
		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		ExtcodeHash: 400,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		Suicide:     5000,
		ExpByte:     50,

		CreateBySuicide: 25000,
	}
)

Variables containing gas prices for different ethereum phases.

View Source
var (
	DifficultyBoundDivisor = big.NewInt(2)       // The bound divisor of the difficulty, used in the update calculations.
	GenesisDifficulty      = big.NewInt(6000000) // Difficulty of the Genesis block.
	MinimumDifficulty      = big.NewInt(2000000) // The minimum that the difficulty may ever be.
	MinimumFruitDifficulty = big.NewInt(2000)
	DurationLimit          = big.NewInt(600) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.

	DifficultyPeriod = big.NewInt(144) //

	FruitBlockRatio = big.NewInt(600) // difficulty ratio between fruit and snail block

	FruitFreshness = big.NewInt(17) // fruit freshness

	MinimumFruits int = 60
	MaximumFruits int = 600
)
View Source
var (
	SnailConfirmInterval = big.NewInt(12)

	FastToFruitSpace = big.NewInt(1200)

	ElectionPeriodNumber     = big.NewInt(180) // snail block period number
	ElectionSwitchoverNumber = big.NewInt(9600)

	ElectionFruitsThreshold uint64 = 100 // fruit size threshold for committee election

	MaximumCommitteeNumber  = big.NewInt(50)
	ProposalCommitteeNumber = 20
	MinimumCommitteeNumber  = 7
)
View Source
var (
	//
	EmptyAddress = common.Address{}
	EmptyHash    = common.Hash{}
)
View Source
var (
	DefaultTBFTDir = ".tbft"
)

NOTE: Most of the structs & relevant comments + the default configuration options were used to manually generate the config.toml. Please reflect any changes made here in the defaultConfigTemplate constant in config/toml.go NOTE: tmlibs/cli must know to look in the config dir!

View Source
var DevnetBootnodes = []string{

	"enode://5b1e518049e36c975095efc54af7d351f8e7cc9a6f81a4db4ec87b105e4a5f6754dc7e417d61ff57732254b18a15000e8844bef6533a00f49442357f01423506@172.26.214.13:30313",
	"enode://28d7353497c2bdc9d7fd5a3a1ff08a684cc6a9ef8f3553b6e48a6e49001fabfb7f0ff33b152deebe99d0017b3577b6e844f25e7dd6973cb933dae41fe449596b@172.26.214.9:30313",
}

DevnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the dev Truechain network.

View Source
var DiscoveryV5Bootnodes = []string{
	"enode://06051a5573c81934c9554ef2898eb13b33a34b94cf36b202b69fde139ca17a85051979867720d4bdae4323d4943ddf9aeeb6643633aa656e0be843659795007a@35.177.226.168:30303",
	"enode://0cc5f5ffb5d9098c8b8c62325f3797f56509bff942704687b6530992ac706e2cb946b90a34f1f19548cd3c7baccbcaea354531e5983c7d1bc0dee16ce4b6440b@40.118.3.223:30304",
	"enode://1c7a64d76c0334b0418c004af2f67c50e36a3be60b5e4790bdac0439d21603469a85fad36f2473c9a80eb043ae60936df905fa28f1ff614c3e5dc34f15dcd2dc@40.118.3.223:30306",
	"enode://85c85d7143ae8bb96924f2b54f1b3e70d8c4d367af305325d30a61385a432f247d2c75c45c6b4a60335060d072d7f5b35dd1d4c45f76941f62a4f83b6e75daaf@40.118.3.223:30307",
}

DiscoveryV5Bootnodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 topic-discovery network.

View Source
var MainnetBootnodes = []string{

	"enode://da41547432c75c4686506117570f7437f3b368bc5b282605c57cfabe91d09c87e2667a45a198a2c07faa748ad6a1b1d83b64a886d86daf082d1ac7433db2d9b3@172.26.214.22:9215",
	"enode://d36f7b5934900767d72e17e12529f194f1b9ac2040614a4b4c2f0ec46c3bbf8cca4a6c4cb817e14bd6f615c770bf3a79ff64e667ee1f9ddea04c364a0c9e18a0@172.26.214.20:9215",
	"enode://69ced64d9b2972a8cd028b76811272bf64f0cf384a63a5a7b9dce83f558438b5780dbd4bf2dbc3acb1beacf67d1f460a73b621d44765cfc2967459a7c4f03810@172.26.214.19:9215",
	"enode://51056c7ddde0c42bc97c4f804afd0445a74f33a2b34bd800b80d27266d913361d72df525aed5b089288f754e2a3d8e6bf0554c5900af0d2ec7dfacae8e8d8b7f@172.26.214.21:9215",
}

MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Truechain network.

View Source
var (
	// TargetGasLimit is the artificial target
	TargetGasLimit = GenesisGasLimit
)
View Source
var TestnetBootnodes = []string{

	"enode://0101e8580b1ee53617395fe57279f8ca1514e233e58d5866d21cd868e1959d5f807eeddc926e5863d210ff1eb1838d03f2c5769c3822040be74eeeeb6ac13c15@47.92.4.244:30313",
	"enode://77047a2cd053c2b237f9218f5843eb28b1b3e879665c41f8decf5dde3809b9d81abc5677c9b54d6ae343087fadbe4c13a6c3a78366e6b39a628951db1f76931c@47.92.164.30:30313",
	"enode://ac3370e61fcf5c51e720512136310a47e06473e52c365661aaf4bb79818d5c31f96ac88043d882681e2eb940961590a585abc30fe9683fbed00bcd14b33d7091@47.92.212.44:30313",
	"enode://49780796e4b91b6e0705d78ecf7e49e1c7e5d8900ba20e3c3c7da27126743c6e96e8bb900771c1aec25154ccb0492341aff17e79ad97cb12d897d42b598f83d7@62.234.100.41:30313",
	"enode://953aa613bba8de0efbbd3ca7a7d8d33085f4555ff2ce548c8e8b963842a5a74642d217ee5f31fb6ecb28ec71e1ff69bd1690d273643660b915eba9c99fda6710@192.144.186.214:30313",
	"enode://7256e562a1078ea2eddd77887e62b414cfae5bb1c8efccc05191c4ea7ee9f258aaf202def4c060eed8151676f9b192a64aa8b336068582abbbc2edc86cf61b09@192.144.199.133:30313",
}

TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the Ropsten test network.

View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

ArchiveVersion holds the textual version string used for Geth archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func VersionWithCommit

func VersionWithCommit(gitCommit string) string

Types

type BaseConfig

type BaseConfig struct {
	// A custom human readable name for this node
	Moniker string `mapstructure:"moniker"`

	// If true, query the ABCI app on connecting to a new peer
	// so the app can decide if we should keep the connection or not
	FilterPeers bool `mapstructure:"filter_peers"` // false
}

BaseConfig defines the base configuration for a truechain node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns a default base configuration for a truechain node

func TestBaseConfig

func TestBaseConfig() BaseConfig

TestBaseConfig returns a base configuration for testing a truechain node

type ChainConfig

type ChainConfig struct {
	ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection

	// Various consensus engines
	Minerva *MinervaConfig `json:"minerva"`
}

ChainConfig is the core config which determines the blockchain settings.

ChainConfig is stored in the database on a per block basis. This means that any network, identified by its genesis block, can have its own set of configuration options.

func (*ChainConfig) CheckCompatible

func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64) *ConfigCompatError

CheckCompatible checks whether scheduled fork transitions have been imported with a mismatching chain configuration.

func (*ChainConfig) GasTable

func (c *ChainConfig) GasTable(num *big.Int) GasTable

GasTable returns the gas table corresponding to the current phase (homestead or homestead reprice).

The returned GasTable's fields shouldn't, under any circumstances, be changed.

func (*ChainConfig) Rules

func (c *ChainConfig) Rules(num *big.Int) Rules

Rules ensures c's ChainID is not nil.

func (*ChainConfig) String

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface.

func (*ChainConfig) UnmarshalJSON

func (c *ChainConfig) UnmarshalJSON(input []byte) error

type ConfigCompatError

type ConfigCompatError struct {
	What string
	// block numbers of the stored and new configurations
	StoredConfig, NewConfig *big.Int
	// the block number to which the local chain must be rewound to correct the error
	RewindTo uint64
}

ConfigCompatError is raised if the locally-stored blockchain is initialised with a ChainConfig that would alter the past.

func (*ConfigCompatError) Error

func (err *ConfigCompatError) Error() string

type ConsensusConfig

type ConsensusConfig struct {
	RootDir string `mapstructure:"home"`
	WalPath string `mapstructure:"wal_file"`

	// All timeouts are in milliseconds
	TimeoutPropose        int `mapstructure:"timeout_propose"`
	TimeoutProposeDelta   int `mapstructure:"timeout_propose_delta"`
	TimeoutPrevote        int `mapstructure:"timeout_prevote"`
	TimeoutPrevoteDelta   int `mapstructure:"timeout_prevote_delta"`
	TimeoutPrecommit      int `mapstructure:"timeout_precommit"`
	TimeoutPrecommitDelta int `mapstructure:"timeout_precommit_delta"`
	TimeoutCommit         int `mapstructure:"timeout_commit"`
	TimeoutCatchup        int `mapstructure:"timeout_consensus"`

	// Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
	SkipTimeoutCommit bool `mapstructure:"skip_timeout_commit"`

	// EmptyBlocks mode and possible interval between empty blocks in seconds
	CreateEmptyBlocks         bool `mapstructure:"create_empty_blocks"`
	CreateEmptyBlocksInterval int  `mapstructure:"create_empty_blocks_interval"`

	// Reactor sleep duration parameters are in milliseconds
	PeerGossipSleepDuration     int `mapstructure:"peer_gossip_sleep_duration"`
	PeerQueryMaj23SleepDuration int `mapstructure:"peer_query_maj23_sleep_duration"`
	// contains filtered or unexported fields
}

ConsensusConfig defines the configuration for the truechain consensus service, including timeouts and details about the WAL and the block structure.

func DefaultConsensusConfig

func DefaultConsensusConfig() *ConsensusConfig

DefaultConsensusConfig returns a default configuration for the consensus service

func TestConsensusConfig

func TestConsensusConfig() *ConsensusConfig

TestConsensusConfig returns a configuration for testing the consensus service

func (*ConsensusConfig) CatchupTime

func (cfg *ConsensusConfig) CatchupTime(t time.Time) time.Time

CatchupTime catch up same consensus for peer

func (*ConsensusConfig) Commit

func (cfg *ConsensusConfig) Commit(t time.Time) time.Time

Commit returns the amount of time to wait for straggler votes after receiving +2/3 precommits for a single block (ie. a commit).

func (*ConsensusConfig) EmptyBlocksInterval

func (cfg *ConsensusConfig) EmptyBlocksInterval() time.Duration

EmptyBlocksInterval returns the amount of time to wait before proposing an empty block or starting the propose timer if there are no txs available

func (*ConsensusConfig) EmptyBlocksIntervalForPer

func (cfg *ConsensusConfig) EmptyBlocksIntervalForPer(times int) time.Duration

EmptyBlocksIntervalForPer rerutns time Duration that how long it wait for per times

func (*ConsensusConfig) PeerGossipSleep

func (cfg *ConsensusConfig) PeerGossipSleep() time.Duration

PeerGossipSleep returns the amount of time to sleep if there is nothing to send from the ConsensusReactor

func (*ConsensusConfig) PeerQueryMaj23Sleep

func (cfg *ConsensusConfig) PeerQueryMaj23Sleep() time.Duration

PeerQueryMaj23Sleep returns the amount of time to sleep after each VoteSetMaj23Message is sent in the ConsensusReactor

func (*ConsensusConfig) Precommit

func (cfg *ConsensusConfig) Precommit(round int) time.Duration

Precommit returns the amount of time to wait for straggler votes after receiving any +2/3 precommits

func (*ConsensusConfig) Prevote

func (cfg *ConsensusConfig) Prevote(round int) time.Duration

Prevote returns the amount of time to wait for straggler votes after receiving any +2/3 prevotes

func (*ConsensusConfig) Propose

func (cfg *ConsensusConfig) Propose(round int) time.Duration

Propose returns the amount of time to wait for a proposal

func (*ConsensusConfig) SetWalFile

func (cfg *ConsensusConfig) SetWalFile(walFile string)

SetWalFile sets the path to the write-ahead log file

func (*ConsensusConfig) WaitForEmptyBlocks

func (cfg *ConsensusConfig) WaitForEmptyBlocks(times int) bool

WaitForEmptyBlocks rerutns true if the consensus should wait for transactions before entering the propose step

func (*ConsensusConfig) WaitForTxs

func (cfg *ConsensusConfig) WaitForTxs() bool

WaitForTxs returns true if the consensus should wait for transactions before entering the propose step

func (*ConsensusConfig) WalFile

func (cfg *ConsensusConfig) WalFile() string

WalFile returns the full path to the write-ahead log file

type FuzzConnConfig

type FuzzConnConfig struct {
	Mode         int
	MaxDelay     time.Duration
	ProbDropRW   float64
	ProbDropConn float64
	ProbSleep    float64
}

FuzzConnConfig is a FuzzedConnection configuration.

func DefaultFuzzConnConfig

func DefaultFuzzConnConfig() *FuzzConnConfig

DefaultFuzzConnConfig returns the default config.

type GasTable

type GasTable struct {
	ExtcodeSize uint64
	ExtcodeCopy uint64
	ExtcodeHash uint64
	Balance     uint64
	SLoad       uint64
	Calls       uint64
	Suicide     uint64

	ExpByte uint64

	// CreateBySuicide occurs when the
	// refunded account is one that does
	// not exist. This logic is similar
	// to call. May be left nil. Nil means
	// not charged.
	CreateBySuicide uint64
}

GasTable organizes gas prices for different ethereum phases.

type MinervaConfig

type MinervaConfig struct {
	MinimumDifficulty      *big.Int `json:"minimumDifficulty"`
	MinimumFruitDifficulty *big.Int `json:"minimumFruitDifficulty"`
	DurationLimit          *big.Int `json:"durationLimit"`
}

MinervaConfig is the consensus engine configs for proof-of-work based sealing.

func (MinervaConfig) MarshalJSON

func (c MinervaConfig) MarshalJSON() ([]byte, error)

func (*MinervaConfig) String

func (c *MinervaConfig) String() string

String implements the stringer interface, returning the consensus engine details.

func (*MinervaConfig) UnmarshalJSON

func (c *MinervaConfig) UnmarshalJSON(input []byte) error

type P2PConfig

type P2PConfig struct {
	RootDir string `mapstructure:"home"`

	// Address to listen for incoming connections
	ListenAddress1 string `mapstructure:"laddr"`
	ListenAddress2 string `mapstructure:"laddr"`

	// Address to advertise to peers for them to dial
	ExternalAddress string `mapstructure:"external_address"`

	// UPNP port forwarding
	UPNP bool `mapstructure:"upnp"`

	// Path to address book
	AddrBook string `mapstructure:"addr_book_file"`

	// Set true for strict address routability rules
	AddrBookStrict bool `mapstructure:"addr_book_strict"`

	// Maximum number of peers to connect to
	MaxNumPeers int `mapstructure:"max_num_peers"`

	// Time to wait before flushing messages out on the connection, in ms
	FlushThrottleTimeout int `mapstructure:"flush_throttle_timeout"`

	// Maximum size of a message packet payload, in bytes
	MaxPacketMsgPayloadSize int `mapstructure:"max_packet_msg_payload_size"`

	// Rate at which packets can be sent, in bytes/second
	SendRate int64 `mapstructure:"send_rate"`

	// Rate at which packets can be received, in bytes/second
	RecvRate int64 `mapstructure:"recv_rate"`

	// Comma separated list of peer IDs to keep private (will not be gossiped to
	// other peers)
	PrivatePeerIDs string `mapstructure:"private_peer_ids"`

	// Toggle to disable guard against peers connecting from the same ip.
	AllowDuplicateIP bool `mapstructure:"allow_duplicate_ip"`

	// Peer connection configuration.
	HandshakeTimeout time.Duration `mapstructure:"handshake_timeout"`
	DialTimeout      time.Duration `mapstructure:"dial_timeout"`

	// Testing params.
	// Force dial to fail
	TestDialFail bool `mapstructure:"test_dial_fail"`
	// FUzz connection
	TestFuzz       bool            `mapstructure:"test_fuzz"`
	TestFuzzConfig *FuzzConnConfig `mapstructure:"test_fuzz_config"`
}

P2PConfig defines the configuration options for the truechain peer-to-peer networking layer

func DefaultP2PConfig

func DefaultP2PConfig() *P2PConfig

DefaultP2PConfig returns a default configuration for the peer-to-peer layer

func TestP2PConfig

func TestP2PConfig() *P2PConfig

TestP2PConfig returns a configuration for testing the peer-to-peer layer

func (*P2PConfig) AddrBookFile

func (cfg *P2PConfig) AddrBookFile() string

AddrBookFile returns the full path to the address book

type Rules

type Rules struct {
	ChainID *big.Int
}

Rules wraps ChainConfig and is merely syntatic sugar or can be used for functions that do not have or require information about the block.

Rules is a one time interface meaning that it shouldn't be used in between transition phases.

type TbftConfig

type TbftConfig struct {
	// Top level options use an anonymous struct
	BaseConfig `mapstructure:",squash"`
	// Options for services
	P2P       *P2PConfig       `mapstructure:"p2p"`
	Consensus *ConsensusConfig `mapstructure:"consensus"`
}

Config defines the top level configuration for a truechain node

func DefaultConfig

func DefaultConfig() *TbftConfig

DefaultConfig returns a default configuration for a truechain node

func TestConfig

func TestConfig() *TbftConfig

TestConfig returns a configuration that can be used for testing

func (*TbftConfig) SetRoot

func (cfg *TbftConfig) SetRoot(root string) *TbftConfig

SetRoot sets the RootDir for all Config structs

Jump to

Keyboard shortcuts

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