params

package
v0.0.0-...-15e8d78 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: GPL-3.0, GPL-3.0 Imports: 10 Imported by: 0

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

	// CHTFrequency is the block frequency for creating CHTs
	CHTFrequency = 1080

	// 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 = 128

	// HelperTrieProcessConfirmations is the number of confirmations before a HelperTrie
	// is generated
	HelperTrieProcessConfirmations = 16

	// 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
)
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

	SstoreSentryGasEIP2200   uint64 = 2300  // Minimum gas required to be present for an SSTORE call, not consumed
	SstoreNoopGasEIP2200     uint64 = 800   // Once per SSTORE operation if the value doesn't change.
	SstoreDirtyGasEIP2200    uint64 = 800   // Once per SSTORE operation if a dirty value is changed.
	SstoreInitGasEIP2200     uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero
	SstoreInitRefundEIP2200  uint64 = 19200 // Once per SSTORE operation for resetting to the original zero value
	SstoreCleanGasEIP2200    uint64 = 5000  // Once per SSTORE operation from clean non-zero to something else
	SstoreCleanRefundEIP2200 uint64 = 4200  // Once per SSTORE operation for resetting to the original non-zero value
	SstoreClearRefundEIP2200 uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot

	JumpdestGas   uint64 = 1     // Once per JUMPDEST operation.
	EpochDuration uint64 = 30000 // Duration between proof-of-work epochs.		EpochDuration uint64 = 30000 // Duration between proof-of-work epochs.

	CreateDataGas         uint64 = 200   //		CreateDataGas         uint64 = 200   //
	CallCreateDepth       uint64 = 1024  // Maximum depth of call/create stack.		CallCreateDepth       uint64 = 1024  // Maximum depth of call/create stack.
	ExpGas                uint64 = 10    // Once per EXP instruction		ExpGas                uint64 = 10    // Once per EXP instruction
	LogGas                uint64 = 375   // Per LOG* operation.		LogGas                uint64 = 375   // Per LOG* operation.
	CopyGas               uint64 = 3     //		CopyGas               uint64 = 3     //
	StackLimit            uint64 = 1024  // Maximum size of VM stack allowed.		StackLimit            uint64 = 1024  // Maximum size of VM stack allowed.
	TierStepGas           uint64 = 0     // Once per operation, for a selection of them.		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.		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.		CreateGas             uint64 = 32000 // Once per CREATE operation & contract-creation transaction.
	Create2Gas            uint64 = 32000 // Once per CREATE2 operation		Create2Gas            uint64 = 32000 // Once per CREATE2 operation
	SelfdestructRefundGas uint64 = 24000 // Refunded following a suicide operation.		SelfdestructRefundGas uint64 = 24000 // Refunded following a selfdestruct 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.		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.		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.

	// These have been changed during the course of the chain
	CallGas               uint64 = 40  // Once per CALL operation & message call transaction.
	CallGasEIP150         uint64 = 700 // Static portion of gas for CALL-derivates after EIP 150 (Tangerine)
	BalanceGas            uint64 = 20  // The cost of a BALANCE operation
	BalanceGasEIP150      uint64 = 400 // The cost of a BALANCE operation after Tangerine
	BalanceGasEIP1884     uint64 = 700
	ExtcodeSizeGas        uint64 = 20  // Cost of EXTCODESIZE before EIP 150 (Tangerine)
	ExtcodeSizeGasEIP150  uint64 = 700 // Cost of EXTCODESIZE after EIP 150 (Tangerine)
	SloadGasEIP150        uint64 = 200
	SloadGasEIP1884       uint64 = 800  // Cost of SLOAD after EIP 1884 (part of Istanbul)
	SloadGasEIP2200       uint64 = 800  // Cost of SLOAD after EIP 2200 (part of Istanbul)
	ExtcodeHashGas        uint64 = 400  // Cost of EXTCODEHASH (introduced in Constantinople)
	ExtcodeHashGasEIP1884 uint64 = 700  // Cost of EXTCODEHASH (introduced in Constantinople)
	SelfdestructGasEIP150 uint64 = 5000 // Cost of SELFDESTRUCT post EIP 150 (Tangerine)

	// EXP has a dynamic portion depending on the size of the exponent
	ExpByteEIP158 uint64 = 50 // was raised to 50 during Eip158 (Spurious Dragon)

	// Extcodecopy has a dynamic AND a static cost. This represents only the
	// static portion of the gas. It was changed during EIP 150 (Tangerine)
	ExtcodeCopyBase       uint64 = 20
	ExtcodeCopyBaseEIP150 uint64 = 700

	// CreateBySelfdestructGas is used when the refunded account is one that does
	// not exist. This logic is similar to call.
	// Introduced in Tangerine Whistle (Eip 150)
	CreateBySelfdestructGas uint64 = 25000

	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
	Bn256AddGasIstanbul             uint64 = 150    // Gas needed for an elliptic curve addition
	Bn256ScalarMulGas               uint64 = 40000  // Gas needed for an elliptic curve scalar multiplication
	Bn256ScalarMulGasIstanbul       uint64 = 6000   // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGas             uint64 = 100000 // Base price for an elliptic curve pairing check
	Bn256PairingBaseGasIstanbul     uint64 = 45000  // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGas         uint64 = 80000  // Per-point price for an elliptic curve pairing check
	Bn256PairingPerPointGasIstanbul uint64 = 34000  // Per-point price for an elliptic curve pairing check

	Bls12381G1AddGas          uint64 = 600    // Price for BLS12-381 elliptic curve G1 point addition
	Bls12381G1MulGas          uint64 = 12000  // Price for BLS12-381 elliptic curve G1 point scalar multiplication
	Bls12381G2AddGas          uint64 = 4500   // Price for BLS12-381 elliptic curve G2 point addition
	Bls12381G2MulGas          uint64 = 55000  // Price for BLS12-381 elliptic curve G2 point scalar multiplication
	Bls12381PairingBaseGas    uint64 = 115000 // Base gas price for BLS12-381 elliptic curve pairing check
	Bls12381PairingPerPairGas uint64 = 23000  // Per-point pair gas price for BLS12-381 elliptic curve pairing check
	Bls12381MapG1Gas          uint64 = 5500   // Gas price for BLS12-381 mapping field element to G1 operation
	Bls12381MapG2Gas          uint64 = 110000 // Gas price for BLS12-381 mapping field element to G2 operation
)
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 = 3          // Major version component of the current release
	VersionMinor = 1          // 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("0x7815e4b9d8424c222d004e09ba42b98c50675f5b97333cf1abc1e09ec131652e")
	MainnetSnailGenesisHash = common.HexToHash("0xa8e3aa3eedb4a8264773ee5f68ba90c5b260f8e0baa0f78a5cebb594a3d6dc81")

	TestnetGenesisHash      = common.HexToHash("0x5dbb2f3e7700de01bf3236a1d18df429771fcf737ffc7c04f9f224cf62a995ff")
	TestnetSnailGenesisHash = common.HexToHash("0x4da60af319dd178c440c33f230f54b9c2537b9ff43d0ac051bc503ee773f223b")

	DevnetSnailGenesisHash = common.HexToHash("0xfd5f70dd4b70763c0fe9d5238d6ce1c5e86712813775fe6b1654ce0f8129587f")
	// the hash of block number LesProtocolGenesisBlock
	MainnetGenesisHashForLes = common.HexToHash("0x7d6610099712bead931d1cf1a4f316f79974a79d6ccf0094da3053dc4122b763")
)

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(179),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(3000000),
			MinimumFruitDifficulty: big.NewInt(10000),
			DurationLimit:          big.NewInt(600),
		}),
		TIP3: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP5: &BlockConfig{SnailNumber: big.NewInt(0)},
		TIP7: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP8: &BlockConfig{FastNumber: big.NewInt(0), CID: big.NewInt(0)},
		TIP9: &BlockConfig{FastNumber: big.NewInt(8742700), SnailNumber: big.NewInt(73000)},
	}

	// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
	MainnetTrustedCheckpoint = &TrustedCheckpoint{
		SectionIndex: 227,
		SectionHead:  common.HexToHash("0xa2e0b25d72c2fc6e35a7f853cdacb193b4b4f95c606accf7f8fa8415283582c7"),
		CHTRoot:      common.HexToHash("0xf69bdd4053b95b61a27b106a0e86103d791edd8574950dc96aa351ab9b9f1aa0"),
		BloomRoot:    common.HexToHash("0xec1b454d4c6322c78ccedf76ac922a8698c3cac4d98748a84af4995b7bd3d744"),
	}

	// MainnetCheckpointOracle contains a set of configs for the main network oracle.
	MainnetCheckpointOracle = &CheckpointOracleConfig{
		Address: common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"),
		Signers: []common.Address{
			common.HexToAddress("0x1b2C260efc720BE89101890E4Db589b44E950527"),
			common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"),
			common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"),
			common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"),
			common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"),
		},
		Threshold: 2,
	}

	// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
	TestnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(178),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(60000),
			MinimumFruitDifficulty: big.NewInt(200),
			DurationLimit:          big.NewInt(600),
		}),
		TIP3: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP5: &BlockConfig{SnailNumber: big.NewInt(0)},
		TIP7: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP8: &BlockConfig{FastNumber: big.NewInt(0), CID: big.NewInt(0)},
		TIP9: &BlockConfig{FastNumber: big.NewInt(2660000), SnailNumber: big.NewInt(21400)},
	}

	// TestnetTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network.
	TestnetTrustedCheckpoint = &TrustedCheckpoint{
		SectionIndex: 161,
		SectionHead:  common.HexToHash("0x5378afa734e1feafb34bcca1534c4d96952b754579b96a4afb23d5301ecececc"),
		CHTRoot:      common.HexToHash("0x1cf2b071e7443a62914362486b613ff30f60cea0d9c268ed8c545f876a3ee60c"),
		BloomRoot:    common.HexToHash("0x5ac25c84bd18a9cbe878d4609a80220f57f85037a112644532412ba0d498a31b"),
	}

	// TestnetCheckpointOracle contains a set of configs for the Ropsten test network oracle.
	TestnetCheckpointOracle = &CheckpointOracleConfig{
		Address: common.HexToAddress("0xEF79475013f154E6A65b54cB2742867791bf0B84"),
		Signers: []common.Address{
			common.HexToAddress("0x32162F3581E88a5f62e8A61892B42C46E2c18f7b"),
			common.HexToAddress("0x78d1aD571A1A09D60D9BBf25894b44e4C8859595"),
			common.HexToAddress("0x286834935f4A8Cfb4FF4C77D5770C2775aE2b0E7"),
			common.HexToAddress("0xb86e2B0Ab5A4B1373e40c51A7C712c70Ba2f9f8E"),
			common.HexToAddress("0x0DF8fa387C602AE62559cC4aFa4972A7045d6707"),
		},
		Threshold: 2,
	}

	// DevnetChainConfig contains the chain parameters to run a node on the Ropsten test network.
	DevnetChainConfig = &ChainConfig{
		ChainID: big.NewInt(17700),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(3000),
			MinimumFruitDifficulty: big.NewInt(20),
			DurationLimit:          big.NewInt(150),
		}),
		TIP3: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP5: &BlockConfig{SnailNumber: big.NewInt(0)},
		TIP7: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP8: &BlockConfig{FastNumber: big.NewInt(0), CID: big.NewInt(0)},
		TIP9: &BlockConfig{FastNumber: big.NewInt(50000), SnailNumber: big.NewInt(50)},
	}

	SingleNodeChainConfig = &ChainConfig{
		ChainID: big.NewInt(176),
		Minerva: &(MinervaConfig{
			MinimumDifficulty:      big.NewInt(200),
			MinimumFruitDifficulty: big.NewInt(2),
			DurationLimit:          big.NewInt(120),
		}),
		TIP3: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP5: &BlockConfig{SnailNumber: big.NewInt(0)},
		TIP7: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP8: &BlockConfig{FastNumber: big.NewInt(0), CID: big.NewInt(-1)},
		TIP9: &BlockConfig{FastNumber: big.NewInt(0), SnailNumber: big.NewInt(0)},
	}

	// TestnetTrustedCheckpoint contains the light client trusted checkpoint for the Ropsten test network.
	DevnetTrustedCheckpoint = &TrustedCheckpoint{
		SectionIndex:  12,
		SectionHead:   common.HexToHash("0xa672246bf631e2ea05977c8720a7c318564e4f2251436a5edd9ea6a0ea31e423"),
		CHTRoot:       common.HexToHash("0x4f234caa182b92a792929fe6ff9aa85fe30c81b8525a1c8f73f044de1b31b2cf"),
		SectionBIndex: 34,
		SectionBHead:  common.HexToHash("0xd455c656df21d60886b45b16f28ee017bd9e48ba7d8df0997ebf282c703aca9c"),
		BloomRoot:     common.HexToHash("0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421"),
		DSRoot:        common.HexToHash("0x4f234caa182b92a792929fe6ff9aa85fe30c81b8525a1c8f73f044de1b31b2cf"),
	}

	// 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{ChainID: chainId, Minerva: new(MinervaConfig), TIP3: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP5: nil, TIP7: nil, TIP8: nil, TIP9: nil,
	}

	TestChainConfig = &ChainConfig{ChainID: chainId, Minerva: &MinervaConfig{MinimumDifficulty, MinimumFruitDifficulty, DurationLimit}, TIP3: &BlockConfig{FastNumber: big.NewInt(0)},
		TIP5: nil, TIP7: nil, TIP8: nil, TIP9: nil,
	}
)
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

	MinTimeGap = big.NewInt(359)
)
View Source
var (
	SnailConfirmInterval = big.NewInt(12)

	SnailRewardInterval = big.NewInt(14)

	SnailMaximumRewardInterval = big.NewInt(20)

	FastToFruitSpace = big.NewInt(1500)

	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  = 4
	StopSnailMiner          = big.NewInt(2000000)
	// set 250 epochs(epoch in one year),250*25000*4 = 25000000
	BlocksInFourYear = big.NewInt(25000000)
	// 29959200 abey of one year, about 1.5 day of one epoch
	// 29959200/250 = 119836.8
	InitReward = new(big.Int).Mul(big.NewInt(1198368), big.NewInt(1e17))
)
View Source
var (
	CountInEpoch                      = 20
	MaxRedeemHeight            uint64 = 250000 // about 15 days
	NewEpochLength             uint64 = 25000  // about 1.5 days
	ElectionPoint              uint64 = 200
	FirstNewEpochID            uint64 = 1
	DposForkPoint              uint64 = 0
	ElectionMinLimitForStaking        = new(big.Int).Mul(big.NewInt(200000), big.NewInt(1e18))
)
View Source
var (
	//
	EmptyAddress = common.Address{}
	EmptyHash    = common.Hash{}
)
View Source
var Bls12381MultiExpDiscountTable = [128]uint64{} /* 128 elements not displayed */

Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations

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://e8e1af516589b5b49d0110bf52dcbc8c4fe592697cfd94eb01fdc302e2b4f1f9c7d3667ca4be64d094a15635204195681219dc59febe17c7c83f3b71b6258454@18.138.171.105:30313",
	"enode://8b1af471dd393f2f228cefd663e3176963592adcd452e69b868ffb2cbb2f7b67ca44f60269e031952a00ba708799c8c1c2a41c279df80461e9b4d384ea49f9fc@18.140.45.222:30313",
	"enode://1554bd2e50456dbf1e5b94aabf88fc7eb1f274d39ae52067541d46e2b8043cb102bffffecb0ba42657c8904aec6bde4f1728110107f27f50616c18ede4af983c@52.220.163.103:30313",
	"enode://d3b5fb4283424e6011d6ad1bcad7e3890fc94db4e6d221571a61985b1f48b6ed26733b9871debb18924cb299600611b683f08e1be08e9a320ffba44494388d1f@54.151.132.19:30313",
}

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

View Source
var DiscoveryV5Bootnodes = []string{
	"enode://ebb007b1efeea668d888157df36cf8fe49aa3f6fd63a0a67c45e4745dc081feea031f49de87fa8524ca29343a21a249d5f656e6daeda55cbe5800d973b75e061@39.98.171.41:30315",
	"enode://b5062c25dc78f8d2a8a216cebd23658f170a8f6595df16a63adfabbbc76b81b849569145a2629a65fe50bfd034e38821880f93697648991ba786021cb65fb2ec@39.98.43.179:30312",
}

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

View Source
var (
	// 361 epoch begin=9000001,end=9025000
	LesProtocolGenesisBlock uint64 = 9000001
)
View Source
var MainnetBootnodes = []string{
	"enode://ddeb1ebc489fe85b37586dc4b38052b7186f2e166d07d3127757afd3698240cc197cc5712bf82c0fbe13c6ab2d4c9a6ba012a057735d3f33b9fffc1c1e878c45@107.22.156.116:30313",
	"enode://ca456572021ad267b0e833c20d707ab7ed5faf908829505d04d85e593cd849e3ece94eb8522aef400574788db54591c8a076671c17a2595ee3cf57d0fed4f21a@13.57.236.253:30313",
	"enode://031569aae8f6ab0bb19fc0feb719b5312fffcee3f703e8719aeca6cc1ae338889e23f85d6d4f92926dbf62aa2c8d7f40637e9202b34e0cfdb6910184cc5f0a39@3.66.27.8:30313",
	"enode://49c2cd85519592bb9094007ae55b46588ca478c3208cad64c33af8d538ad2537cdc7951063ca3b5f6d6f4d4b4247b98e037100b1c9f9e9dfd07f1b113496d324@13.250.40.243:30313",
}

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

View Source
var (
	// TargetGasLimit is the artificial target
	TargetGasLimit = GenesisGasLimit
)
View Source
var TestnetBootnodes = []string{
	"enode://46e412e3e95e5d3782a53c2689dd02c65f3966bcc4b2e952ca177e6a75b0a138e68571716d4f1ff6036803eb97d1aa4c19451c2bb9f4bf00e0f3bed7487a6f4b@18.140.93.104:30313",
}

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

TrustedCheckpoints associates each known checkpoint with the genesis hash of the chain it belongs to.

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, gitDate 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 abeychain node

func DefaultBaseConfig

func DefaultBaseConfig() BaseConfig

DefaultBaseConfig returns a default base configuration for a abeychain node

func TestBaseConfig

func TestBaseConfig() BaseConfig

TestBaseConfig returns a base configuration for testing a abeychain node

type BlockConfig

type BlockConfig struct {
	FastNumber  *big.Int
	SnailNumber *big.Int
	CID         *big.Int
}

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"`

	TIP3 *BlockConfig `json:"tip3"`

	TIP5 *BlockConfig `json:"tip5"`
	TIP7 *BlockConfig `json:"tip7"`
	TIP8 *BlockConfig `json:"tip8"`
	TIP9 *BlockConfig `json:"tip9"`

	TIPStake *BlockConfig `json:"tipstake"`
}

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) IsTIP3

func (c *ChainConfig) IsTIP3(num *big.Int) bool

IsTIP3 returns whether num is either equal to the IsTIP3 fork block or greater.

func (*ChainConfig) IsTIP5

func (c *ChainConfig) IsTIP5(num *big.Int) bool

IsTIP5 returns whether num is either equal to the IsTIP5 fork block or greater.

func (*ChainConfig) IsTIP7

func (c *ChainConfig) IsTIP7(num *big.Int) bool

func (*ChainConfig) IsTIP8

func (c *ChainConfig) IsTIP8(cid, num *big.Int) bool

func (*ChainConfig) IsTIP9

func (c *ChainConfig) IsTIP9(num *big.Int) bool

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 CheckpointOracleConfig

type CheckpointOracleConfig struct {
	Address   common.Address   `json:"address"`
	Signers   []common.Address `json:"signers"`
	Threshold uint64           `json:"threshold"`
}

CheckpointOracleConfig represents a set of checkpoint contract(which acts as an oracle) config which used for light client checkpoint syncing.

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 abeychain 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 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 abeychain 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
	IsTIP3, IsTIP7 bool
}

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 abeychain node

func DefaultConfig

func DefaultConfig() *TbftConfig

DefaultConfig returns a default configuration for a abeychain 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

type TrustedCheckpoint

type TrustedCheckpoint struct {
	SectionIndex  uint64      `json:"sectionIndex"`
	SectionHead   common.Hash `json:"sectionHead"`
	CHTRoot       common.Hash `json:"chtRoot"`
	SectionBIndex uint64      `json:"sectionBIndex"`
	SectionBHead  common.Hash `json:"sectionBHead"`
	BloomRoot     common.Hash `json:"bloomRoot"`
	DSRoot        common.Hash `json:"datasetRoot"`
}

TrustedCheckpoint represents a set of post-processed trie roots (CHT and BloomTrie) associated with the appropriate section index and head hash. It is used to start light syncing from this checkpoint and avoid downloading the entire header chain while still being able to securely access old headers/logs.

func (*TrustedCheckpoint) Empty

func (c *TrustedCheckpoint) Empty() bool

Empty returns an indicator whether the checkpoint is regarded as empty.

func (*TrustedCheckpoint) Hash

func (c *TrustedCheckpoint) Hash() common.Hash

Hash returns the hash of checkpoint's four key fields(index, sectionHead, chtRoot and bloomTrieRoot).

func (*TrustedCheckpoint) HashEqual

func (c *TrustedCheckpoint) HashEqual(hash common.Hash) bool

HashEqual returns an indicator comparing the itself hash with given one.

Jump to

Keyboard shortcuts

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