Documentation ¶
Index ¶
- Constants
- Variables
- func ArchiveVersion(gitCommit string) string
- func InitVersion()
- func PrimeEntropyTarget(expansionNum uint8) *big.Int
- func RegionEntropyTarget(expansionNum uint8) *big.Int
- func VersionWithCommit(gitCommit, gitDate string) string
- type Blake3powConfig
- type CachedVersion
- type ChainConfig
- type ConfigCompatError
- type ProgpowConfig
- type Rules
Constants ¶
const ( ColosseumName = "colosseum" GardenName = "garden" OrchardName = "orchard" LighthouseName = "lighthouse" LocalName = "local" DevName = "dev" )
Different Network names
const ( Wei = 1 GWei = 1e9 Ether = 1e18 )
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))
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 // FullImmutabilityThreshold 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 threshold. FullImmutabilityThreshold = 90000 // LightImmutabilityThreshold is the number of blocks after which a header chain // segment is considered immutable for light client(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 light pruner as the pruning validity guarantee. LightImmutabilityThreshold = 30000 )
const ( GasLimitBoundDivisor uint64 = 1024 // The bound divisor of the gas limit, used in update calculations. PercentGasUsedThreshold uint64 = 50 // Percent Gas used threshold at which the gas limit adjusts GasLimitStepOneBlockThreshold uint64 = 150000 GasLimitStepTwoBlockThreshold uint64 = 300000 GasLimitStepThreeBlockThreshold uint64 = 450000 MinGasLimit uint64 = 40000000 // Minimum the gas limit may ever be. GenesisGasLimit uint64 = 5000000 // 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. 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. LogDataGas uint64 = 8 // Per byte in a LOG* operation's data. CallStipend uint64 = 2300 // Free gas given at beginning of call. ETXGas uint64 = 21000 // Per ETX generated by opETX or normal cross-chain transfer. // The etx fractions should be based on the current expansion number ETXRegionMaxFraction int = 1 // The maximum fraction of transactions for cross-region ETXs ETXPrimeMaxFraction int = 1 // The maximum fraction of transactions for cross-prime ETXs ETXRLimitMin int = 10 // Minimum possible cross-region ETX limit ETXPLimitMin int = 10 // Minimum possible cross-prime ETX limit EtxExpirationAge uint64 = 100 // Number of blocks an ETX may wait for inclusion at the destination Sha3Gas uint64 = 30 // Once per SHA3 operation. Sha3WordGas uint64 = 6 // Once per word of the SHA3 operation's data. 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 SstoreSentryGas uint64 = 2300 // Minimum gas required to be present for an SSTORE call, not consumed SstoreSetGas uint64 = 20000 // Once per SSTORE operation from clean zero to non-zero SstoreResetGas uint64 = 5000 // Once per SSTORE operation from clean non-zero to something else ColdAccountAccessCost = uint64(2600) // COLD_ACCOUNT_ACCESS_COST ColdSloadCost = uint64(2100) // COLD_SLOAD_COST WarmStorageReadCost = uint64(100) // WARM_STORAGE_READ_COST // SSTORE_CLEARS_SCHEDULE is defined as SSTORE_RESET_GAS + ACCESS_LIST_STORAGE_KEY_COST // Which becomes: 5000 - 2100 + 1900 = 4800 SstoreClearsScheduleRefund uint64 = SstoreResetGas - ColdSloadCost + TxAccessListStorageKeyGas // 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. CreateDataGas uint64 = 200 // CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack. ExpGas uint64 = 10 // Once per EXP instruction LogGas uint64 = 375 // Per LOG* operation. CopyGas uint64 = 3 // StackLimit uint64 = 1024 // Maximum size of VM stack allowed. TierStepGas uint64 = 0 // Once per operation, for a selection of them. LogTopicGas uint64 = 375 // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas. CreateGas uint64 = 32000 // Once per CREATE operation & contract-creation transaction. Create2Gas uint64 = 32000 // Once per CREATE2 operation 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. TxDataNonZeroGas uint64 = 16 // Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions. TxAccessListAddressGas uint64 = 2400 // Per address specified in access list TxAccessListStorageKeyGas uint64 = 1900 // Per storage key specified in access list // These have been changed during the course of the chain CallGas uint64 = 700 // Static portion of gas for CALL-derivates BalanceGas uint64 = 700 // The cost of a BALANCE operation ExtcodeSizeGas uint64 = 700 // Cost of EXTCODESIZE SloadGas uint64 = 800 ExtcodeHashGas uint64 = 700 // Cost of EXTCODEHASH SelfdestructGas 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 gas. ExtcodeCopyBase uint64 = 700 // CreateBySelfdestructGas is used when the refunded account is one that does // not exist. This logic is similar to call. CreateBySelfdestructGas uint64 = 25000 BaseFeeChangeDenominator = 8 // Bounds the amount the base fee can change between blocks. ElasticityMultiplier = 2 // Bounds the maximum gas limit a block may have. InitialBaseFee = 1 * GWei // Initial base fee for blocks. MaxBaseFee = 100 * GWei // Maximum base fee for blocks. 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 Bn256AddGas uint64 = 150 // Gas needed for an elliptic curve addition Bn256ScalarMulGas uint64 = 6000 // Gas needed for an elliptic curve scalar multiplication Bn256PairingBaseGas uint64 = 45000 // Base price for an elliptic curve pairing check Bn256PairingPerPointGas uint64 = 34000 // Per-point price for an elliptic curve pairing check // The Refund Quotient is the cap on how much of the used gas can be refunded RefundQuotient uint64 = 5 MaxAddressGrindAttempts int = 1000 // Maximum number of attempts to grind an address to a valid one MinimumEtxGasDivisor = 5 // The divisor for the minimum gas for inbound ETXs (Block gas limit / MinimumEtxGasDivisor) MaximumEtxGasMultiplier = 2 // Multiplied with the minimum ETX gas for inbound ETXs (Block gas limit / MinimumEtxGasDivisor) * MaximumEtxGasMultiplier // This is the threshold (range 0-100) above which the // score will begin the tree expansion decision process. This threshold should be // chosen high enough to not be easily triggered by minor changes in node // operating behavior, but not so high that the security efficiency becomes // unacceptably low. TREE_EXPANSION_THRESHOLD uint16 = 15 // This is the smoothing factor (range 0-10) used by each zone in its low-pass // filter to gather a long running average of the zone's security efficiency // score. Choosing a larger will make the filter less responsive; the tree // expansion algorithm will be less susceptible to short term variations in the // efficiency score, but will take longer to decide to trigger an expansion when // one becomes necessary. TREE_EXPANSION_FILTER_ALPHA uint16 = 9 // Once all chains have confirmed above TREE_EXPANSION_THRESHOLD, this is // the number of consecutive prime blocks that must remain above the // threshold to confirm the decision to expand the tree. TREE_EXPANSION_TRIGGER_WINDOW uint16 = 144 // Once the network has confirmed the decision to expand the tree, this is // the number of prime blocks to wait until the expansion is activated. This // should be chosen to give node operators some time to adjust their // infrastructure, if needed, to account for the upcoming network change. TREE_EXPANSION_WAIT_COUNT = 1024 ConversionLockPeriod int64 = 10 // The number of zone blocks that a conversion output is locked for MinQiConversionDenomination = 1 ConversionConfirmationContext = common.PRIME_CTX // A conversion requires a single coincident Dom confirmation )
Variables ¶
var ( // Progpow GenesisHashes ProgpowColosseumGenesisHash = common.HexToHash("0xcc53f5d24ac623ef8cb065eb8fbbc0897aa23f57e488c220478aa612405a135b") ProgpowGardenGenesisHash = common.HexToHash("0x5ca1bf6655522837f6d8c7a9481cba2d49a28b69c698c5f41a7377ede382e700") ProgpowOrchardGenesisHash = common.HexToHash("0x5ca1bf6655522837f6d8c7a9481cba2d49a28b69c698c5f41a7377ede382e700") ProgpowLocalGenesisHash = common.HexToHash("0xfa015af438af2a7a4c2af2aa8d982da52fb879288338d4e44464cae3723daf85") ProgpowLighthouseGenesisHash = common.HexToHash("0x5ca1bf6655522837f6d8c7a9481cba2d49a28b69c698c5f41a7377ede382e700") // Blake3GenesisHashes Blake3PowColosseumGenesisHash = common.HexToHash("0x9d5a5146ba57f1230118bddc23e99bcc193c780fc3766d58d9e14f096481c215") Blake3PowGardenGenesisHash = common.HexToHash("0x3b601eef673695756d2c594bd0ae116c3e9c429fb02d33eb211382ef54b52f84") Blake3PowOrchardGenesisHash = common.HexToHash("0x52a455d5d8f7fe0d82de512f18555790da0d15ae93bc405d4566eb7d105f5a4d") Blake3PowLocalGenesisHash = common.HexToHash("0x4c7611e9684bd82f1e33ad7712fbdc05b6f355fd3df2a0d0b18f9013e905cabd") Blake3PowLighthouseGenesisHash = common.HexToHash("0xe331738ff2837c5a5cb189ad61c78f12e6482de51c7a1227e54357c92a0591bb") )
Genesis hashes to enforce below configs on.
var ( // ColosseumChainConfig is the chain parameters to run a node on the Colosseum network. ProgpowColosseumChainConfig = &ChainConfig{ ChainID: big.NewInt(9000), Progpow: new(ProgpowConfig), } Blake3PowColosseumChainConfig = &ChainConfig{ ChainID: big.NewInt(9000), Blake3Pow: new(Blake3powConfig), } // GardenChainConfig contains the chain parameters to run a node on the Garden test network. ProgpowGardenChainConfig = &ChainConfig{ ChainID: big.NewInt(12000), Progpow: new(ProgpowConfig), } Blake3PowGardenChainConfig = &ChainConfig{ ChainID: big.NewInt(12000), Blake3Pow: new(Blake3powConfig), } // OrchardChainConfig contains the chain parameters to run a node on the Orchard test network. ProgpowOrchardChainConfig = &ChainConfig{ ChainID: big.NewInt(15000), Progpow: new(ProgpowConfig), } Blake3PowOrchardChainConfig = &ChainConfig{ ChainID: big.NewInt(15000), Blake3Pow: new(Blake3powConfig), } // LighthouseChainConfig contains the chain parameters to run a node on the Lighthouse test network. ProgpowLighthouseChainConfig = &ChainConfig{ ChainID: big.NewInt(17000), Blake3Pow: new(Blake3powConfig), Progpow: new(ProgpowConfig), } Blake3PowLighthouseChainConfig = &ChainConfig{ ChainID: big.NewInt(17000), Blake3Pow: new(Blake3powConfig), } // LocalChainConfig contains the chain parameters to run a node on the Local test network. ProgpowLocalChainConfig = &ChainConfig{ ChainID: big.NewInt(1337), Progpow: new(ProgpowConfig), } Blake3PowLocalChainConfig = &ChainConfig{ ChainID: big.NewInt(1337), Blake3Pow: new(Blake3powConfig), } // AllProgpowProtocolChanges contains every protocol change introduced // and accepted by the Quai core developers into the Progpow consensus. // // This configuration is intentionally not using keyed fields to force anyone // adding flags to the config to also have to set these fields. AllProgpowProtocolChanges = &ChainConfig{big.NewInt(1337), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Location{}, common.Hash{}, false} TestChainConfig = &ChainConfig{big.NewInt(1), "progpow", new(Blake3powConfig), new(ProgpowConfig), common.Location{}, common.Hash{}, false} TestRules = TestChainConfig.Rules(new(big.Int)) )
var ( GasCeil uint64 = 20000000 ColosseumGasCeil uint64 = 70000000 GardenGasCeil uint64 = 160000000 OrchardGasCeil uint64 = 50000000 LighthouseGasCeil uint64 = 160000000 LocalGasCeil uint64 = 20000000 DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in the update calculations. ZoneMinDifficulty = big.NewInt(1000) // The minimum difficulty in a zone. Prime & regions should be multiples of this value MinimumDifficulty = ZoneMinDifficulty // The minimum that the difficulty may ever be. GenesisDifficulty = ZoneMinDifficulty // Difficulty of the Genesis block. DurationLimit = big.NewInt(12) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. GardenDurationLimit = big.NewInt(7) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. OrchardDurationLimit = big.NewInt(12) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. LighthouseDurationLimit = big.NewInt(7) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. LocalDurationLimit = big.NewInt(2) // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not. TimeToStartTx uint64 = 0 * BlocksPerDay BlocksPerDay uint64 = new(big.Int).Div(big.NewInt(86400), DurationLimit).Uint64() // BlocksPerDay is the number of blocks per day assuming 12 second block time DifficultyAdjustmentPeriod = big.NewInt(360) // This is the number of blocks over which the average has to be taken DifficultyAdjustmentFactor int64 = 40 // This is the factor that divides the log of the change in the difficulty MinQuaiConversionAmount = new(big.Int).Mul(big.NewInt(1), big.NewInt(GWei)) // 0.000000001 Quai )
Functions ¶
func ArchiveVersion ¶
ArchiveVersion holds the textual version string used for Quai archives. e.g. "1.8.11-dea1ce05" for stable releases, or
"1.8.13-unstable-21c059b6" for unstable releases
func InitVersion ¶ added in v0.30.0
func InitVersion()
func PrimeEntropyTarget ¶
This is TimeFactor*TimeFactor*common.NumZonesInRegion*common.NumRegionsInPrime
func RegionEntropyTarget ¶
This is TimeFactor*common.NumZonesInRegion
func VersionWithCommit ¶
Types ¶
type Blake3powConfig ¶
type Blake3powConfig struct{}
Blake3powConfig is the consensus engine configs for proof-of-work based sealing.
func (*Blake3powConfig) String ¶
func (c *Blake3powConfig) String() string
String implements the stringer interface, returning the consensus engine details.
type CachedVersion ¶
type CachedVersion struct {
// contains filtered or unexported fields
}
Version contains software version data parsed from the VERSION file
var Version CachedVersion
func (*CachedVersion) Full ¶
func (v *CachedVersion) Full() string
Full loads the cached full version string, or reads it from a file
func (*CachedVersion) Major ¶
func (v *CachedVersion) Major() int
Major loads the cached major version, or reads it from a file
func (*CachedVersion) Meta ¶
func (v *CachedVersion) Meta() string
Meta loads the cached version metadata, or reads it from a file Metadata may be empty if no metadata was provided
func (*CachedVersion) Minor ¶
func (v *CachedVersion) Minor() int
Minor loads the cached minor version, or reads it from a file
func (*CachedVersion) Patch ¶
func (v *CachedVersion) Patch() int
Patch loads the cached patch version, or reads it from a file
func (*CachedVersion) Short ¶
func (v *CachedVersion) Short() string
Full loads the cached full version string, or reads it from a file
type ChainConfig ¶
type ChainConfig struct { ChainID *big.Int `json:"chainId"` // chainId identifies the current chain and is used for replay protection // Various consensus engines ConsensusEngine string Blake3Pow *Blake3powConfig `json:"blake3pow,omitempty"` Progpow *ProgpowConfig `json:"progpow,omitempty"` Location common.Location DefaultGenesisHash common.Hash IndexAddressUtxos bool }
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) Rules ¶
func (c *ChainConfig) Rules(num *big.Int) Rules
Rules ensures c's ChainID is not nil.
func (*ChainConfig) SetLocation ¶
func (cfg *ChainConfig) SetLocation(location common.Location)
SetLocation sets the location on the chain config
func (*ChainConfig) String ¶
func (c *ChainConfig) String() string
String implements the fmt.Stringer interface.
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 ProgpowConfig ¶
type ProgpowConfig struct{}
ProgpowConfig is the consensus engine configs for proof-of-work based sealing.
func (*ProgpowConfig) String ¶
func (c *ProgpowConfig) String() string
String implements the stringer interface, returning the consensus engine details.