params

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Ore         = 1
	Wav         = 1e3
	Grav        = 1e6
	Nucle       = 1e9
	Atom        = 1e12
	Moli        = 1e15
	Core        = 1e18
	Aer         = 1e21
	Orb         = 1e24
	Plano       = 1e27
	Terra       = 1e30
	Sola        = 1e33
	Galx        = 1e36
	Cluster     = 1e39
	Supermatter = 1e42
)

These are the multipliers for core denominations. Example: To get the ore value of an amount in 'nucle', use

new(big.Int).Mul(value, big.NewInt(params.Nucle))
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 = 32768

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

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

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

	// CheckpointFrequency is the block frequency for creating checkpoint
	CheckpointFrequency = 32768

	// CheckpointProcessConfirmations is the number before a checkpoint is generated
	CheckpointProcessConfirmations = 256

	// ImmutabilityThreshold is the number of blocks after which a chain segment is
	// considered immutable (i.e. soft finality). It is used by the downloader as a
	// hard limit against deep ancestors, by the blockchain against deep reorgs, by
	// the freezer as the cutoff treshold and by clique as the snapshot trust limit.
	ImmutabilityThreshold = 90000
)
View Source
const (
	EnergyLimitBoundDivisor uint64 = 1024    // The bound divisor of the energy limit, used in update calculations.
	MinEnergyLimit          uint64 = 5000    // Minimum the energy limit may ever be.
	GenesisEnergyLimit      uint64 = 4712388 // Energy limit of the Genesis block.

	MaximumExtraDataSize     uint64 = 32    // Maximum size extra data may be after Genesis.
	CallValueTransferEnergy  uint64 = 9000  // Paid for CALL when the value transfer is non-zero.
	CallNewAccountEnergy     uint64 = 25000 // Paid for CALL when the destination address didn't exist prior.
	TxEnergy                 uint64 = 21000 // Per transaction not creating a contract. NOTE: Not payable on data of calls between transactions.
	TxEnergyContractCreation uint64 = 53000 // Per transaction that creates a contract. NOTE: Not payable on data of calls between transactions.
	TxDataZeroEnergy         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.
	LogDataEnergy            uint64 = 8     // Per byte in a LOG* operation's data.
	CallStipend              uint64 = 2300  // Free energy given at beginning of call.

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

	SstoreSentryEnergy uint64 = 2300  // Minimum energy required to be present for an SSTORE call, not consumed
	SstoreNoopEnergy   uint64 = 800   // Once per SSTORE operation if the value doesn't change.
	SstoreDirtyEnergy  uint64 = 800   // Once per SSTORE operation if a dirty value is changed.
	SstoreInitEnergy   uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero
	SstoreInitRefund   uint64 = 19200 // Once per SSTORE operation for resetting to the original zero value
	SstoreCleanEnergy  uint64 = 5000  // Once per SSTORE operation from clean non-zero to something else
	SstoreCleanRefund  uint64 = 4200  // Once per SSTORE operation for resetting to the original non-zero value
	SstoreClearRefund  uint64 = 15000 // Once per SSTORE operation for clearing an originally existing storage slot

	JumpdestEnergy uint64 = 1 // Once per JUMPDEST operation.

	CreateDataEnergy         uint64 = 200   //
	CallCreateDepth          uint64 = 1024  // Maximum depth of call/create stack.
	ExpEnergy                uint64 = 10    // Once per EXP instruction
	LogEnergy                uint64 = 375   // Per LOG* operation.
	CopyEnergy               uint64 = 3     //
	StackLimit               uint64 = 1024  // Maximum size of VM stack allowed.
	LogTopicEnergy           uint64 = 375   // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicEnergy, LOG4 incurs 4 * c_txLogTopicEnergy.
	CreateEnergy             uint64 = 32000 // Once per CREATE operation & contract-creation transaction.
	Create2Energy            uint64 = 32000 // Once per CREATE2 operation
	SelfdestructRefundEnergy uint64 = 24000 // Refunded following a selfdestruct operation.
	MemoryEnergy             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.
	TxDataNonZeroEnergy      uint64 = 16    // Per byte of non zero data attached to a transaction

	// These have been changed during the course of the chain
	CallEnergy         uint64 = 700  // Static portion of energy for CALL-derivates
	BalanceEnergy      uint64 = 700  // The cost of a BALANCE operation
	ExtcodeSizeEnergy  uint64 = 700  // Cost of EXTCODESIZE
	SloadEnergy        uint64 = 800  // Cost of SLOAD
	ExtcodeHashEnergy  uint64 = 700  // Cost of EXTCODEHASH
	SelfdestructEnergy uint64 = 5000 // Cost of SELFDESTRUCT

	// EXP has a dynamic portion depending on the size of the exponent
	ExpByte uint64 = 50 // was raised to 50

	// Extcodecopy has a dynamic AND a static cost. This represents only the
	// static portion of the energy.
	ExtcodeCopyBase uint64 = 700

	// CreateBySelfdestructEnergy is used when the refunded account is one that does
	// not exist. This logic is similar to call.
	CreateBySelfdestructEnergy uint64 = 25000

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

	EcrecoverEnergy        uint64 = 3000 // Elliptic curve sender recovery energy price
	Sha256BaseEnergy       uint64 = 60   // Base price for a SHA256 operation
	Sha256PerWordEnergy    uint64 = 12   // Per-word price for a SHA256 operation
	Ripemd160BaseEnergy    uint64 = 600  // Base price for a RIPEMD160 operation
	Ripemd160PerWordEnergy uint64 = 120  // Per-word price for a RIPEMD160 operation
	IdentityBaseEnergy     uint64 = 15   // Base price for a data copy operation
	IdentityPerWordEnergy  uint64 = 3    // Per-work price for a data copy operation
	ModExpQuadCoeffDiv     uint64 = 20   // Divisor for the quadratic particle of the big int modular exponentiation

	Bn256AddEnergy             uint64 = 150   // Energy needed for an elliptic curve addition
	Bn256ScalarMulEnergy       uint64 = 6000  // Energy needed for an elliptic curve scalar multiplication
	Bn256PairingBaseEnergy     uint64 = 45000 // Base price for an elliptic curve pairing check
	Bn256PairingPerPointEnergy uint64 = 34000 // Per-point price for an elliptic curve pairing check
)
View Source
const (
	VersionMajor = 1        // Major version component of the current release
	VersionMinor = 9        // Minor version component of the current release
	VersionPatch = 12       // Patch version component of the current release
	VersionMeta  = "stable" // Version metadata to append to the version string
)

Variables

View Source
var (
	MainnetGenesisHash = common.HexToHash("0x0fd2fd2988c27b96b2c75c0ba5352bd03ef7542c8e15c803ecace50cb782936e")
	DevinGenesisHash   = common.HexToHash("0xe9489866bb033ab58297fb48f6b4fc1955d792072794b9149b1a7800c03fcf41")
	KolibaGenesisHash  = common.HexToHash("0xbf7e331f7f7c1dd2e05159666b3bf8bc7a8a3a9eb1d518969eab529dd9b88c1a")
)

Genesis hashes to enforce below configs on.

View Source
var (
	// MainnetChainConfig is the chain parameters to run a node on the main network.
	MainnetChainConfig = &ChainConfig{
		ChainID:  big.NewInt(1),
		Cryptore: new(CryptoreConfig),
	}

	// MainnetTrustedCheckpoint contains the light client trusted checkpoint for the main network.
	MainnetTrustedCheckpoint = &TrustedCheckpoint{
		SectionIndex: 289,
		SectionHead:  common.HexToHash("0x5a95eed1a6e01d58b59f86c754cda88e8d6bede65428530eb0bec03267cda6a9"),
		CHTRoot:      common.HexToHash("0x6d4abf2b0f3c015952e6a3cbd5cc9885aacc29b8e55d4de662d29783c74a62bf"),
		BloomRoot:    common.HexToHash("0x1af2a8abbaca8048136b02f782cb6476ab546313186a1d1bd2b02df88ea48e7e"),
	}

	// MainnetCheckpointOracle contains a set of configs for the main network oracle.
	MainnetCheckpointOracle = &CheckpointOracleConfig{
		Address:   common.Address{},
		Signers:   []common.Address{},
		Threshold: 2,
	}

	// DevinChainConfig contains the chain parameters to run a node on the Devin test network.
	DevinChainConfig = &ChainConfig{
		ChainID:  big.NewInt(3),
		Cryptore: new(CryptoreConfig),
	}

	// DevinTrustedCheckpoint contains the light client trusted checkpoint for the Devin test network.
	DevinTrustedCheckpoint = &TrustedCheckpoint{
		SectionIndex: 223,
		SectionHead:  common.HexToHash("0x9aa51ca383f5075f816e0b8ce7125075cd562b918839ee286c03770722147661"),
		CHTRoot:      common.HexToHash("0x755c6a5931b7bd36e55e47f3f1e81fa79c930ae15c55682d3a85931eedaf8cf2"),
		BloomRoot:    common.HexToHash("0xabc37762d11b29dc7dde11b89846e2308ba681eeb015b6a202ef5e242bc107e8"),
	}

	// DevinCheckpointOracle contains a set of configs for the Devin test network oracle.
	DevinCheckpointOracle = &CheckpointOracleConfig{
		Address:   common.Address{},
		Signers:   []common.Address{},
		Threshold: 2,
	}

	// KolibaChainConfig contains the chain parameters to run a node on the Koliba test network.
	KolibaChainConfig = &ChainConfig{
		ChainID: big.NewInt(4),
		Clique: &CliqueConfig{
			Period: 15,
			Epoch:  30000,
		},
	}

	// KolibaTrustedCheckpoint contains the light client trusted checkpoint for the Koliba test network.
	KolibaTrustedCheckpoint = &TrustedCheckpoint{
		SectionIndex: 66,
		SectionHead:  common.HexToHash("0xeea3a7b2cb275956f3049dd27e6cdacd8a6ef86738d593d556efee5361019475"),
		CHTRoot:      common.HexToHash("0x11712af50b4083dc5910e452ca69fbfc0f2940770b9846200a573f87a0af94e6"),
		BloomRoot:    common.HexToHash("0x331b7a7b273e81daeac8cafb9952a16669d7facc7be3b0ebd3a792b4d8b95cc5"),
	}

	// KolibaCheckpointOracle contains a set of configs for the Koliba test network oracle.
	KolibaCheckpointOracle = &CheckpointOracleConfig{
		Address:   common.Address{},
		Signers:   []common.Address{},
		Threshold: 2,
	}

	// AllCryptoreProtocolChanges contains every protocol change (CIPs) introduced
	// and accepted by the Core core developers into the Cryptore consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllCryptoreProtocolChanges = &ChainConfig{big.NewInt(1), nil, new(CryptoreConfig), nil}

	// AllCliqueProtocolChanges contains every protocol change (CIPs) introduced
	// and accepted by the Core core developers into the Clique consensus.
	//
	// This configuration is intentionally not using keyed fields to force anyone
	// adding flags to the config to also have to set these fields.
	AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1), nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}}

	TestChainConfig = &ChainConfig{big.NewInt(2), nil, new(CryptoreConfig), nil}
	TestRules       = TestChainConfig.Rules(new(big.Int))
)
View Source
var (
	DifficultyBoundDivisor = big.NewInt(2)    // The bound divisor of the difficulty, used in the update calculations.
	GenesisDifficulty      = big.NewInt(32)   // Difficulty of the Genesis block.
	MinimumDifficulty      = big.NewInt(0x20) // The minimum that the difficulty may ever be.
	DurationLimit          = big.NewInt(6)    // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
)

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

View Source
var DevinBootnodes = []string{
	"enode://7081d1a8a52a9d0b8bdc0247cb7fd04277a8e76a30f85ce8a9daf41a4e8e1f79902d4959416a663a779cd28390b10a881f56d73469deb695@51.75.247.236:30303",
}

DevinBootnodes are the enode URLs of the P2P bootstrap nodes running on the Devin test network.

View Source
var DiscoveryV5Bootnodes = []string{}

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

View Source
var KnownDNSNetworks = map[common.Hash]string{
	MainnetGenesisHash: dnsPrefix + "all.mainnet.xccdisco.net",
	DevinGenesisHash:   dnsPrefix + "all.devin.xccdisco.net",
	KolibaGenesisHash:  dnsPrefix + "all.koliba.xccdisco.net",
}

These DNS names provide bootstrap connectivity for public devins and the mainnet. See https://github.com/core-coin/discv4-dns-lists for more information.

View Source
var KolibaBootnodes = []string{

	"enode://7081d1a8a52a9d0b8bdc0247cb7fd04277a8e76a30f85ce8a9daf41a4e8e1f79902d4959416a663a779cd28390b10a881f56d73469deb695@51.75.247.236:30303",
}

KolibaBootnodes are the enode URLs of the P2P bootstrap nodes running on the Koliba test network.

View Source
var MainnetBootnodes = []string{

	"enode://7081d1a8a52a9d0b8bdc0247cb7fd04277a8e76a30f85ce8a9daf41a4e8e1f79902d4959416a663a779cd28390b10a881f56d73469deb695@51.75.247.236:30303",
}

MainnetBootnodes are the enode URLs of the P2P bootstrap nodes running on the main Core 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 Gcore 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 ChainConfig

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

	EWASMBlock *big.Int `json:"ewasmBlock,omitempty"` // EWASM switch block (nil = no fork, 0 = already activated)

	// Various consensus engines
	Cryptore *CryptoreConfig `json:"cryptore,omitempty"`
	Clique   *CliqueConfig   `json:"clique,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

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

func (c *ChainConfig) CheckConfigForkOrder() error

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

func (*ChainConfig) IsEWASM

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

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

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.

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 CliqueConfig

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

func (c *CliqueConfig) String() string

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

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 CryptoreConfig

type CryptoreConfig struct{}

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

func (*CryptoreConfig) String

func (c *CryptoreConfig) String() string

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

type Rules

type Rules struct {
	ChainID *big.Int
}

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 TrustedCheckpoint

type TrustedCheckpoint struct {
	SectionIndex uint64      `json:"sectionIndex"`
	SectionHead  common.Hash `json:"sectionHead"`
	CHTRoot      common.Hash `json:"chtRoot"`
	BloomRoot    common.Hash `json:"bloomRoot"`
}

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