params

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: GPL-3.0, GPL-3.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// StateRegisterOnce can be election only once
	StateRegisterOnce uint8 = 1 << iota
	// StateResgisterAuto can be election in every epoch
	StateResgisterAuto
	// StateUnregister can be redeem real time (after MaxRedeemHeight block)
	StateUnregister
	// StateUnregistered flag the asset which is unregistered in the height is redeemed
	StateUnregistered
)
View Source
const (
	OpQueryRegister uint8 = 1 << iota
	OpQueryLocked
	OpQueryUnlocking
	OpQueryReward
	OpQueryFine
)
View Source
const (
	StateUnusedFlag    = 0xa0
	StateUsedFlag      = 0xa1
	StateSwitchingFlag = 0xa2
	StateRemovedFlag   = 0xa3
	StateAppendFlag    = 0xa4
	// health enter type
	TypeFixed  = 0xa1
	TypeWorked = 0xa2
	TypeBack   = 0xa3
)
View Source
const (
	MainNetChainID uint64 = 214
	TestNetChainID uint64 = 212
	DevNetChainID  uint64 = 213
	Epoch          uint64 = 30000
)
View Source
const (
	MainnetNetWorkID = MainNetChainID
	TestnetWorkID    = TestNetChainID
	DevnetWorkID     = DevNetChainID
)

network id

View Source
const (
	DefaultGasLimit uint64 = 20000000 // Gas limit of the blocks before BlockchainParams contract is loaded.

	// Default intrinsic gas cost of transactions paying for gas in alternative currencies.
	// Calculated to estimate 1 balance read, 1 debit, and 4 credit transactions.
	IntrinsicGasForAlternativeFeeCurrency uint64 = 50 * thousand

	// Contract communication gas limits
	MaxGasForCalculateTargetEpochPaymentAndRewards uint64 = 2 * million
	MaxGasForCommitments                           uint64 = 2 * million
	MaxGasForComputeCommitment                     uint64 = 2 * million
	MaxGasForBlockRandomness                       uint64 = 2 * million
	MaxGasForDebitGasFeesTransactions              uint64 = 1 * million
	MaxGasForCreditGasFeesTransactions             uint64 = 1 * million
	MaxGasForDistributeEpochPayment                uint64 = 1 * million
	MaxGasForDistributeVoterEpochRewards           uint64 = 1 * million
	MaxGasForElectValidators                       uint64 = 50 * million
	MaxGasForElectNValidatorSigners                uint64 = 50 * million
	MaxGasForActiveAllPending                      uint64 = 50 * million
	MaxGasForGetAddressFor                         uint64 = 100 * thousand
	MaxGasForGetElectableValidators                uint64 = 100 * thousand
	MaxGasForGetEligibleValidatorsVoteTotals       uint64 = 1 * million
	MaxGasForGetGasPriceMinimum                    uint64 = 2 * million
	MaxGasForGetGroupEpochRewards                  uint64 = 500 * thousand
	MaxGasForGetPledgeMultiplierInReward           uint64 = 50 * thousand
	MaxGasForGetOrComputeTobinTax                  uint64 = 1 * million
	MaxGasForGetRegisteredValidators               uint64 = 2 * million
	MaxGasForGetValidator                          uint64 = 100 * thousand
	MaxGasForGetWhiteList                          uint64 = 200 * thousand
	MaxGasForGetTransferWhitelist                  uint64 = 2 * million
	MaxGasForIncreaseSupply                        uint64 = 50 * thousand
	MaxGasForIsFrozen                              uint64 = 20 * thousand
	MaxGasForMedianRate                            uint64 = 100 * thousand
	MaxGasForReadBlockchainParameter               uint64 = 40 * thousand // ad-hoc measurement is ~26k
	MaxGasForRevealAndCommit                       uint64 = 2 * million
	MaxGasForUpdateGasPriceMinimum                 uint64 = 2 * million
	MaxGasForUpdateTargetVotingYield               uint64 = 2 * million
	MaxGasForUpdateValidatorScore                  uint64 = 1 * million
	MaxGasForTotalSupply                           uint64 = 50 * thousand
	MaxGasForMintGas                               uint64 = 5 * million
	MaxGasToReadErc20Balance                       uint64 = 100 * thousand
	MaxGasForIsReserveLow                          uint64 = 1 * million
	MaxGasForGetCommunityPartnerSettingPartner     uint64 = 20 * thousand

	////////////////////////////////////////////////////////////////////////////////////////////////
	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.
	Sha3Gas              uint64 = 30    // Once per SHA3 operation.
	Sha3WordGas          uint64 = 6     // Once per word of the SHA3 operation's data.
	// Precompiled contract gas prices
	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

	Bn256AddGasByzantium             uint64 = 500    // Byzantium gas needed for an elliptic curve addition
	Bn256AddGasIstanbul              uint64 = 150    // Gas needed for an elliptic curve addition
	Bn256ScalarMulGasByzantium       uint64 = 40000  // Byzantium gas needed for an elliptic curve scalar multiplication
	Bn256ScalarMulGasIstanbul        uint64 = 6000   // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGasByzantium     uint64 = 100000 // Byzantium base price for an elliptic curve pairing check
	Bn256PairingBaseGasIstanbul      uint64 = 45000  // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGasByzantium uint64 = 80000  // Byzantium per-point price for an elliptic curve pairing check
	Bn256PairingPerPointGasIstanbul  uint64 = 34000  // Per-point price for an elliptic curve pairing check
	// Atlas precompiled contracts
	FractionMulExpGas           uint64 = 50     // Cost of performing multiplication and exponentiation of fractions to an exponent of up to 10^3.
	ProofOfPossessionGas        uint64 = 350000 // Cost of verifying a BLS proof of possession.
	GetValidatorGas             uint64 = 1000   // Cost of reading a validator's address.
	GetValidatorBLSGas          uint64 = 1000   // Cost of reading a validator's BLS public key.
	GetEpochSizeGas             uint64 = 10     // Cost of querying the number of blocks in an epoch.
	GetBlockNumberFromHeaderGas uint64 = 10     // Cost of decoding a block header.
	HashHeaderGas               uint64 = 10     // Cost of hashing a block header.
	GetParentSealBitmapGas      uint64 = 100    // Cost of reading the parent seal bitmap from the chain.
	// May take a bit more time with 100 validators, need to bench that
	GetVerifiedSealBitmapGas uint64 = 350000           // Cost of verifying the seal on a given RLP encoded header.
	Ed25519VerifyGas         uint64 = 1500             // Gas needed for and Ed25519 signature verification
	Sha2_512BaseGas          uint64 = Sha256BaseGas    // Base price for a Sha2-512 operation
	Sha2_512PerWordGas       uint64 = Sha256PerWordGas // Per-word price for a Sha2-512 operation

	Sha3_256BaseGas     uint64 = Sha3Gas     // Base price for a Sha3-256 operation
	Sha3_256PerWordGas  uint64 = Sha3WordGas // Per-word price for a sha3-256 operation
	Sha3_512BaseGas     uint64 = Sha3Gas     // Base price for a Sha3-512 operation
	Sha3_512PerWordGas  uint64 = Sha3WordGas // Per-word price for a Sha3-512 operation
	Keccak512BaseGas    uint64 = Sha3Gas     // Per-word price for a Keccak512 operation
	Keccak512PerWordGas uint64 = Sha3WordGas // Base price for a Keccak512 operation

	Blake2sBaseGas    uint64 = Sha256BaseGas    // Per-word price for a Blake2s operation
	Blake2sPerWordGas uint64 = Sha256PerWordGas // Base price for a Blake2s
	InvalidCip20Gas   uint64 = 200              // Price of attempting to access an unsupported CIP20 hash function

	Bls12377G1AddGas          uint64 = 600   // Price for BLS12-377 elliptic curve G1 point addition
	Bls12377G1MulGas          uint64 = 12000 // Price for BLS12-377 elliptic curve G1 point scalar multiplication
	Bls12377G2AddGas          uint64 = 4500  // Price for BLS12-377 elliptic curve G2 point addition
	Bls12377G2MulGas          uint64 = 55000 // Price for BLS12-377 elliptic curve G2 point scalar multiplication
	Bls12377PairingBaseGas    uint64 = 65000 // Base gas price for BLS12-377 elliptic curve pairing check
	Bls12377PairingPerPairGas uint64 = 55000 // Per-point pair gas price for BLS12-377 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 = 800   // Price for BLS12-381 elliptic curve G2 point addition
	Bls12381G2MulGas          uint64 = 45000 // Price for BLS12-381 elliptic curve G2 point scalar multiplication
	Bls12381PairingBaseGas    uint64 = 65000 // Base gas price for BLS12-381 elliptic curve pairing check
	Bls12381PairingPerPairGas uint64 = 43000 // 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 = 75000 // Gas price for BLS12-381 mapping field element to G2 operation

)
View Source
const (
	VersionMajor = 0        // Major version component of the current release
	VersionMinor = 3        // Minor version component of the current release
	VersionPatch = 4        // Patch version component of the current release
	VersionMeta  = "stable" // Version metadata to append to the version string
)
View Source
const HeaderStoreABIJSON = `` /* 1537-byte string literal not displayed */

HeaderStoreABIJSON header store abi json

contract HeaderStore {
    function save(uint256 from, uint256 to, bytes memory headers) public {}
    function currentNumberAndHash(uint256 chainID) public returns (uint256 number, bytes memory hash) {}
    function setRelayer(address relayer) public {}
    function getRelayer() public returns (address relayer) {}
    function reset(uint256 from, uint256 td, bytes memory header) public {}
}
View Source
const (
	MaximumExtraDataSize uint64 = 32 // Maximum size extra data may be after Genesis.
)
View Source
const RelayerABIJSON = `` /* 3382-byte string literal not displayed */
View Source
const TxVerifyABIJSON = `` /* 1145-byte string literal not displayed */

TxVerifyABIJSON tx verify abi json

contract TxVerify {
	function txVerify(address router, address coin, uint256 srcChain, uint256 dstChain, bytes memory txProve) public returns(bool success, string memory message){}
}

Variables

View Source
var (
	Base       = big.NewInt(1e8)
	MaxBaseFee = big.NewInt(5000 * ethparams.GWei)
	MinBaseFee = big.NewInt(1000 * ethparams.GWei)
)
View Source
var (
	NewRelayerAddress  = common.BytesToAddress([]byte("relayerAddress"))
	HeaderStoreAddress = common.BytesToAddress([]byte("headerstoreAddress"))
	TxVerifyAddress    = common.BytesToAddress([]byte("txVerifyAddress"))
)
View Source
var (
	ZeroAddress                  = BytesToAddress([]byte{})
	RegistrySmartContractAddress = common.HexToAddress("0x000000000000000000000000000000000000ce10")

	//AttestationsRegistryId         = makeRegistryId("Attestations")
	BlockchainParametersRegistryId = makeRegistryId("BlockchainParameters")
	ElectionRegistryId             = makeRegistryId("Election")
	EpochRewardsRegistryId         = makeRegistryId("EpochRewards")
	FeeCurrencyWhitelistRegistryId = makeRegistryId("FeeCurrencyWhitelist")
	GasPriceMinimumRegistryId      = makeRegistryId("GasPriceMinimum")
	GoldTokenRegistryId            = makeRegistryId("GoldToken")
	GovernanceRegistryId           = makeRegistryId("Governance")
	LockedGoldRegistryId           = makeRegistryId("LockedGold")
	RandomRegistryId               = makeRegistryId("Random")

	//TransferWhitelistRegistryId    = makeRegistryId("TransferWhitelist")
	ValidatorsRegistryId = makeRegistryId("Validators")

	// Function is "getOrComputeTobinTax()"
	// selector is first 4 bytes of keccak256 of "getOrComputeTobinTax()"
	// Source:
	// pip3 install pyethereum
	// python3 -c 'from ethereum.utils import sha3; print(sha3("getOrComputeTobinTax()")[0:4].hex())'
	TobinTaxFunctionSelector = hexutil.MustDecode("0x17f9a6f7")

	// Scale factor for the solidity fixidity library
	Fixidity1 = math.BigPow(10, 24)
)
View Source
var (
	RegistryProxyAddress      = common.HexToAddress("0xce10")
	ProxyOwnerStorageLocation = common.HexToHash("0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103")
)
View Source
var (
	MainnetGenesisHash = common.HexToHash("0x9a2c09dc9f15e67f86dbf339e148ba0b4d0170fbfb72e420e30eaae1604b6669")
	TestnetGenesisHash = common.HexToHash("0x9a2c09dc9f15e67f86dbf339e148ba0b4d0170fbfb72e420e30eaae1604b6669")
	DevnetGenesisHash  = common.HexToHash("0x9a2c09dc9f15e67f86dbf339e148ba0b4d0170fbfb72e420e30eaae1604b6669")
)

Genesis hashes to enforce below configs on.

View Source
var (
	MainnetChainConfig = &ChainConfig{
		ChainID:             big.NewInt(int64(MainNetChainID)),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        big.NewInt(0),
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		Istanbul: &IstanbulConfig{
			Epoch:          Epoch,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
	}

	TestnetConfig = &ChainConfig{
		ChainID:             big.NewInt(212),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		Istanbul: &IstanbulConfig{
			Epoch:          20000,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
	}

	DevnetConfig = &ChainConfig{
		ChainID:             big.NewInt(213),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      true,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		Istanbul: &IstanbulConfig{
			Epoch:          17280,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
	}

	AllEthashProtocolChanges = &ChainConfig{
		ChainID:             big.NewInt(213),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      false,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		DonutBlock:          nil,
		EWASMBlock:          nil,
		CatalystBlock:       nil,
		Istanbul: &IstanbulConfig{
			Epoch:          17280,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
		FullHeaderChainAvailable: true,
		Faker:                    true,
	}

	TestChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      false,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         big.NewInt(0),
		LondonBlock:         big.NewInt(0),
		DonutBlock:          nil,
		EWASMBlock:          nil,
		CatalystBlock:       nil,
		Istanbul: &IstanbulConfig{
			Epoch:          17280,
			ProposerPolicy: 2,
			BlockPeriod:    5,
			RequestTimeout: 3000,
			LookbackWindow: 12,
		},
		FullHeaderChainAvailable: true,
		Faker:                    true,
	}

	IstanbulTestChainConfig = &ChainConfig{
		ChainID:             big.NewInt(1337),
		HomesteadBlock:      big.NewInt(0),
		DAOForkBlock:        nil,
		DAOForkSupport:      false,
		EIP150Block:         big.NewInt(0),
		EIP150Hash:          common.Hash{},
		EIP155Block:         big.NewInt(0),
		EIP158Block:         big.NewInt(0),
		ByzantiumBlock:      big.NewInt(0),
		ConstantinopleBlock: big.NewInt(0),
		PetersburgBlock:     big.NewInt(0),
		IstanbulBlock:       big.NewInt(0),
		MuirGlacierBlock:    big.NewInt(0),
		BerlinBlock:         nil,
		LondonBlock:         nil,
		DonutBlock:          nil,
		EWASMBlock:          big.NewInt(0),
		CatalystBlock:       nil,
		Istanbul: &IstanbulConfig{
			Epoch:          300,
			ProposerPolicy: 0,
			RequestTimeout: 1000,
			BlockPeriod:    1,
		},
		FullHeaderChainAvailable: true,
		Faker:                    false,
	}
)
View Source
var (
	EthereumTestnetGenesisHeader = `` /* 1346-byte string literal not displayed */

	EthereumTestnetGenesisTD = big.NewInt(40060821605962080)
)
View Source
var CurrentVersionInfo = func() *VersionInfo {
	return &VersionInfo{VersionMajor, VersionMinor, VersionPatch}
}()
View Source
var MainnetBootnodes = []string{
	"enode://71ffdcb10afd3f105320f4c8e6e85d89c93c55d08723273282ad398570cbec7e2475a286ca491a7eedb4bca84ab587e17a801306671e9fba0e04e12ef64e71f9@13.251.42.33:28360",
	"enode://6aba005b149e0115489829d525ade140ad61a5b86c7517b287c47d9b0a89bc8ae3d335fe207cfa17710fce536f2e918a4ce3f0935ca1423cfc88833642fa1e27@13.214.132.40:28360",
	"enode://51961120e7f5ebc8ee6f559fc1a7f303ab0af6c8e019b8009b77b524e5eb6d53b3a24c1f92ad4b3c2a880e089ef011038041674b29b264c1b24fbde6b125d922@3.0.49.193:28360",
	"enode://6bc28d4c98a8e4af33c9350c699dc2560bbffd3cd4555dfdd100074a4d10c4603fd2d069d8e6abc22aa6d11b018ed251173a723d224452cc1ae95e7c22296292@18.138.231.32:28360",
}

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

View Source
var TestnetBootnodes = []string{
	"enode://478dace9ed069fdeb2170ca1bbc34314b13dbf2e7273fa15b7e40e63be036a684011bd627486e2d009771ed7e2ad435bb62b9026b87e339d470a1ffe5bd83034@20.205.187.105:36201",
	"enode://530d20cdf6552d9dc65c5abf7c40727254719a42d5e033d391b8c9f77d15ee35e4a43de40804b4649ffca95bf75b6902c65d418fab7c08b07b192ead0cda893d@20.205.189.217:36201",
	"enode://a5cbde4cd043a59dff200882f2663b35cabe753211ee372a1681a9159bdbccac5b08ede298d8681540d1cfaf9e79e1046608e3b61600479e49cb61c95dc842e0@13.67.79.15:25201",
	"enode://1ff54f4b794eba4081bf24da657621051d74edc4fb071c021f44dceb4e7628c030e3bbe6722ccc7902e93d40c018f9a03a99b14c7d7f2d6bfd8955193db46acd@13.67.118.60:25201",
}

TestnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the 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 Atlas archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func BytesToAddress added in v0.3.1

func BytesToAddress(b []byte) common.Address

BytesToAddress returns Address with value b. If b is larger than len(h), b will be cropped from the left.

func KnownDNSNetwork

func KnownDNSNetwork(genesis common.Hash, protocol string) string

KnownDNSNetwork returns the address of a public DNS-based node list for the given genesis hash and protocol. See https://github.com/ethereum/discv4-dns-lists for more information.

func MustBigInt added in v0.3.4

func MustBigInt(str string) *big.Int

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

Types

type CSVRecorder added in v0.3.1

type CSVRecorder struct {
	// contains filtered or unexported fields
}

A CSVRecorder enables easy writing of CSV data a specified writer. The header is written on creation. Writing is thread safe.

func NewCSVRecorder added in v0.3.1

func NewCSVRecorder(wc WriterCloser, fields ...string) *CSVRecorder

NewCSVRecorder creates a CSV recorder that writes to the supplied writer. The writer is retained and can be closed by calling CSVRecorder.Close() The header is immediately written upon construction.

func (*CSVRecorder) Close added in v0.3.1

func (c *CSVRecorder) Close() error

Close closes the writer. This is a no-op for a nil receiver.

func (*CSVRecorder) Write added in v0.3.1

func (c *CSVRecorder) Write(values ...interface{})

WriteRow writes out as csv row. Will convert the values to a string using "%v".

type ChainConfig added in v0.3.1

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

	HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead)

	DAOForkBlock   *big.Int `json:"daoForkBlock,omitempty"`   // TheDAO hard-fork switch block (nil = no fork)
	DAOForkSupport bool     `json:"daoForkSupport,omitempty"` // Whether the nodes supports or opposes the DAO hard-fork

	// EIP150 implements the Gas price changes (https://github.com/ethereum/EIPs/issues/150)
	EIP150Block *big.Int    `json:"eip150Block,omitempty"` // EIP150 HF block (nil = no fork)
	EIP150Hash  common.Hash `json:"eip150Hash,omitempty"`  // EIP150 HF hash (needed for header only clients as only gas pricing changed)

	EIP155Block *big.Int `json:"eip155Block,omitempty"` // EIP155 HF block
	EIP158Block *big.Int `json:"eip158Block,omitempty"` // EIP158 HF block

	ByzantiumBlock      *big.Int `json:"byzantiumBlock,omitempty"`      // Byzantium switch block (nil = no fork, 0 = already on byzantium)
	ConstantinopleBlock *big.Int `json:"constantinopleBlock,omitempty"` // Constantinople switch block (nil = no fork, 0 = already activated)
	PetersburgBlock     *big.Int `json:"petersburgBlock,omitempty"`     // Petersburg switch block (nil = same as Constantinople)
	IstanbulBlock       *big.Int `json:"istanbulBlock,omitempty"`       // Istanbul switch block (nil = no fork, 0 = already on istanbul)
	MuirGlacierBlock    *big.Int `json:"muirGlacierBlock,omitempty"`    // Eip-2384 (bomb delay) switch block (nil = no fork, 0 = already activated)
	BerlinBlock         *big.Int `json:"berlinBlock,omitempty"`         // Berlin switch block (nil = no fork, 0 = already on berlin)
	LondonBlock         *big.Int `json:"londonBlock,omitempty"`         // London switch block (nil = no fork, 0 = already on london)

	DonutBlock *big.Int `json:"donutBlock,omitempty"` // Donut switch block (nil = no fork, 0 = already activated)

	//YoloV3Block   *big.Int `json:"yoloV3Block,omitempty"`   // YOLO v3: Gas repricings TODO @holiman add EIP references
	EWASMBlock    *big.Int `json:"ewasmBlock,omitempty"`    // EWASM switch block (nil = no fork, 0 = already activated)
	CatalystBlock *big.Int `json:"catalystBlock,omitempty"` // Catalyst switch block (nil = no fork, 0 = already on catalyst)

	// Various consensus engines
	Istanbul *IstanbulConfig `json:"istanbul,omitempty"`

	// This does not belong here but passing it to every function is not possible since that breaks
	// some implemented interfaces and introduces churn across the geth codebase.
	FullHeaderChainAvailable bool // False for lightest Sync mode, true otherwise

	// Requests mock engine if true
	Faker bool `json:"faker,omitempty"`
}

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 added in v0.3.1

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) CheckConfigForkOrder added in v0.3.1

func (c *ChainConfig) CheckConfigForkOrder() error

CheckConfigForkOrder checks that we don't "skip" any forks, geth isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks

func (*ChainConfig) IsBerlin added in v0.3.1

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

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

func (*ChainConfig) IsByzantium added in v0.3.1

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

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

func (*ChainConfig) IsCatalyst added in v0.3.1

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

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

func (*ChainConfig) IsConstantinople added in v0.3.1

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

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

func (*ChainConfig) IsDAOFork added in v0.3.1

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

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

func (*ChainConfig) IsEIP150 added in v0.3.1

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

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

func (*ChainConfig) IsEIP155 added in v0.3.1

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

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

func (*ChainConfig) IsEIP158 added in v0.3.1

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

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

func (*ChainConfig) IsEWASM added in v0.3.1

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

IsEWASM returns whether num represents a block number after the EWASM fork

func (*ChainConfig) IsHomestead added in v0.3.1

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

IsHomestead returns whether num is either equal to the homestead block or greater.

func (*ChainConfig) IsIstanbul added in v0.3.1

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

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

func (*ChainConfig) IsLondon added in v0.3.1

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

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

func (*ChainConfig) IsMuirGlacier added in v0.3.1

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

IsMuirGlacier returns whether num is either equal to the Muir Glacier (EIP-2384) fork block or greater.

func (*ChainConfig) IsPetersburg added in v0.3.1

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

IsPetersburg returns whether num is either - equal to or greater than the PetersburgBlock fork block, - OR is nil, and Constantinople is active

func (*ChainConfig) Rules added in v0.3.1

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

Rules ensures c's ChainID is not nil.

func (*ChainConfig) String added in v0.3.1

func (c *ChainConfig) String() string

String implements the fmt.Stringer interface.

type CliqueConfig added in v0.3.1

type CliqueConfig struct {
	Period uint64 `json:"period"` // Number of seconds between blocks to enforce
	Epoch  uint64 `json:"epoch"`  // Epoch length to reset votes and checkpoint
}

CliqueConfig is the consensus engine configs for proof-of-authority based sealing.

func (*CliqueConfig) String added in v0.3.1

func (c *CliqueConfig) String() string

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

type ConfigCompatError added in v0.3.1

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 added in v0.3.1

func (err *ConfigCompatError) Error() string

type EthashConfig added in v0.3.1

type EthashConfig struct{}

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

func (*EthashConfig) String added in v0.3.1

func (c *EthashConfig) String() string

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

type IstanbulConfig added in v0.3.1

type IstanbulConfig struct {
	Epoch          uint64 `json:"epoch"`                 // Epoch length to reset votes and checkpoint
	ProposerPolicy uint64 `json:"policy"`                // The policy for proposer selection
	LookbackWindow uint64 `json:"lookbackwindow"`        // The number of blocks to look back when calculating uptime
	BlockPeriod    uint64 `json:"blockperiod,omitempty"` // Default minimum difference between two consecutive block's timestamps in second

	// The base timeout for each Istanbul round in milliseconds. The first
	// round will have a timeout of exactly this and subsequent rounds will
	// have timeouts of this + additional time that increases with round
	// number.
	RequestTimeout uint64 `json:"requesttimeout,omitempty"`
}

IstanbulConfig is the consensus engine configs for Istanbul based sealing.

func (*IstanbulConfig) String added in v0.3.1

func (c *IstanbulConfig) String() string

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

type NumberHash added in v0.4.1

type NumberHash struct {
	Number uint64
	Hash   common.Hash
}

NumberHash is just a container for a number and a hash, to represent a block

type RelayerMember

type RelayerMember struct {
	Coinbase    common.Address `json:"coinbase`
	RelayerBase common.Address `json:"relayerbase`
	Publickey   []byte
	Flag        uint32
	MType       uint32
}

func (*RelayerMember) Compared

func (c *RelayerMember) Compared(d *RelayerMember) bool

func (*RelayerMember) String

func (c *RelayerMember) String() string

func (*RelayerMember) UnmarshalJSON

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

type Rules added in v0.3.1

type Rules struct {
	ChainID                                                 *big.Int
	IsHomestead, IsEIP150, IsEIP155, IsEIP158               bool
	IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
	IsBerlin, IsLondon, IsCatalyst                          bool
}

Rules wraps ChainConfig and is merely syntactic 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 VersionInfo added in v0.3.1

type VersionInfo struct {
	Major uint64
	Minor uint64
	Patch uint64
}

func (*VersionInfo) Cmp added in v0.3.1

func (v *VersionInfo) Cmp(version *VersionInfo) int

type WriterCloser added in v0.3.1

type WriterCloser interface {
	io.Writer
	io.Closer
}

Jump to

Keyboard shortcuts

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