params

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2021 License: GPL-3.0, GPL-3.0 Imports: 13 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 = 177
	TestNetChainID    uint64 = 212
	DevNetChainID     uint64 = 213
	SingleNodeChainID uint64 = 214
)
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
	MaxGasForDistributeEpochRewards                uint64 = 1 * million
	MaxGasForElectValidators                       uint64 = 50 * million
	MaxGasForElectNValidatorSigners                uint64 = 50 * million
	MaxGasForGetAddressFor                         uint64 = 100 * thousand
	MaxGasForGetElectableValidators                uint64 = 100 * thousand
	MaxGasForGetEligibleValidatorGroupsVoteTotals  uint64 = 1 * million
	MaxGasForGetGasPriceMinimum                    uint64 = 2 * million
	MaxGasForGetGroupEpochRewards                  uint64 = 500 * thousand
	MaxGasForGetMembershipInLastEpoch              uint64 = 1 * million
	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
	MaxGasForGetCarbonOffsettingPartner            uint64 = 20 * thousand
)
View Source
const (
	VersionMajor = 0        // 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  = "stable" // Version metadata to append to the version string
)
View Source
const HeaderStoreABIJSON = `` /* 1168-byte string literal not displayed */
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 (
	FbaseUnit          = new(big.Float).SetFloat64(float64(baseUnit.Int64()))
	Base               = new(big.Int).SetUint64(ethparams.InitialBaseFee)
	InvalidFee         = big.NewInt(65535)
	RelayerAddress     = common.BytesToAddress([]byte("RelayerAddress"))
	HeaderStoreAddress = common.BytesToAddress([]byte("headerstoreAddress"))
	TxVerifyAddress    = common.BytesToAddress([]byte("txVerifyAddress"))
)
View Source
var (
	CountInEpoch                       = 100
	MaxRedeemHeight             uint64 = 200
	NewEpochLength              uint64 = 200
	ElectionPoint               uint64 = 20
	FirstNewEpochID             uint64 = 1
	PowForkPoint                uint64 = 0
	ElectionMinLimitForRegister        = new(big.Int).Mul(big.NewInt(100000), big.NewInt(1e18))
	MinWorkEfficiency           uint64 = 1 //every relayer sync 1000 block at least
)
View Source
var (
	ErrInvalidParam      = errors.New("Invalid Param")
	ErrOverEpochID       = errors.New("Over epoch id")
	ErrNotSequential     = errors.New("epoch id not sequential")
	ErrInvalidEpochInfo  = errors.New("Invalid epoch info")
	ErrNotFoundEpoch     = errors.New("cann't found the epoch info")
	ErrInvalidRegister   = errors.New("Invalid register account")
	ErrMatchEpochID      = errors.New("wrong match epoch id in a reward block")
	ErrNotRegister       = errors.New("Not match the register account")
	ErrNotDelegation     = errors.New("Not match the account")
	ErrNotMatchEpochInfo = errors.New("the epoch info is not match with accounts")
	ErrNotElectionTime   = errors.New("not time to election the next relayer")
	ErrAmountOver        = errors.New("the amount more than register amount")
	ErrDelegationSelf    = errors.New("wrong")
	ErrRedeemAmount      = errors.New("wrong redeem amount")
	ErrForbidAddress     = errors.New("Forbidding Address")
)
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")
	FreezerRegistryId              = makeRegistryId("Freezer")
	GasPriceMinimumRegistryId      = makeRegistryId("GasPriceMinimum")
	GoldTokenRegistryId            = makeRegistryId("GoldToken")
	GovernanceRegistryId           = makeRegistryId("Governance")
	LockedGoldRegistryId           = makeRegistryId("LockedGold")
	RandomRegistryId               = makeRegistryId("Random")
	ReserveRegistryId              = makeRegistryId("Reserve")
	SortedOraclesRegistryId        = makeRegistryId("SortedOracles")
	StableTokenRegistryId          = makeRegistryId("StableToken")
	//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 (
	MainnetGenesisHash = common.HexToHash("0xf6285fd285d6c15aae581220e9b13f4d0ac75428ee90076e737f4e6125d31723")
	TestnetGenesisHash = common.HexToHash("0x63f425f4a8362103c2be5089223d8823cad0baf5827eeecd20ee4adbe7dec063")
	DevnetGenesisHash  = common.HexToHash("0x1c00a47a70d32300cf336207d290ccc2838d3ea03b2ba73c07bafdd6070ff23a")
)

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:          17280,
			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:          17280,
			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,
		},
	}
	MainnetNetWorkID uint64 = 177
	TestnetWorkID    uint64 = 212
	DevnetWorkID     uint64 = 213
	SingleWorkID     uint64 = 214
	//under params in cmd/node/defaults.go
	//DefaultHTTPPort    = 7445
	//DefaultWSPort      = 7446
	//ListenAddr         = 20201
	SingleChainID   = big.NewInt(214)
	SingleNetConfig = &ChainConfig{
		ChainID:             SingleChainID,
		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),
		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 CurrentVersionInfo = func() *VersionInfo {
	return &VersionInfo{VersionMajor, VersionMinor, VersionPatch}
}()
View Source
var MainnetBootnodes = []string{
	"enode://2880658365490c34e2a5069a8749aa95e45fae0bc1a237622b2385da946f556fb3499d4fc8f041250fec6cd96ce5c3e84fdb0c111220dd3bc9a4cb93d92006d3@13.67.79.15:21221",
	"enode://f57448354ce6869ac747735d5c584250a59ba590ec4a21f8f5c8d0f882cd4446444923d04890698758bf05ac2b569fc19cda6c5dd1b73e48df197abfcfad2b51@13.67.118.60:21221",
	"enode://67faad96fb84ae2bc9a7a64f1c80bcfd1010097ec8e8e88be1ac1236b867f15a483cfb6c2e116ec519dd7ff3c2e9296236872ee37b933f609d6c076a05e1f3dd@13.76.138.119:21221",
	"enode://b40b6ecac03ac1b8e754e6ac9012f6286a61a4b6f7a685b30e1451e2ee2d404e18c644e58e099ac20e16dab3c87414f210d85a18a616129161c44ed2c620af47@168.63.248.220:21221",
}

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

View Source
var RelayerGas = map[string]uint64{
	"getBalance":      450000,
	"register":        2400000,
	"append":          2400000,
	"withdraw":        2520000,
	"getPeriodHeight": 450000,
	"getRelayers":     450000,
}
View Source
var TestnetBootnodes = []string{
	"enode://1457e5fc1cc9a1584aacbc860922563d049a2efb9aa0fc73089c85769f1e39e53c3419984af0af75cd29177af1b62e90ac86912562c05583b6cd158fd532f0d5@20.205.187.105:36201",
	"enode://ec9e7dee840333b72addfb6d1b76020bd9a72f0cb113dbd18ff3f51d70e03d80b23c63e102fbeb4ecad36da03d2d4fb6afaa6178849d499ba653d2c55013497d@20.205.187.105:36202",
	"enode://b02d993aa6f81012e532f9b494d1ab3036cabbbd6401a40fb0c3133ed3997887e41f800de8e9da9f3a94665270a1b14c7346d9c13332397bca953bf65538e715@20.205.189.217:36203",
	"enode://dcbe8b57c5c265668a33e4f41214b1161860602d22d710a713e4cc2005a3cf2bc417be10a8a1d251ffe7e55e566319d368826103dba159d734b3ee4fa7c02c76@20.205.189.217:36204",
}

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 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 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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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