Documentation
¶
Index ¶
- Constants
- Variables
- func GetExtra(c *ChainConfig) *extras.ChainConfig
- func GetRulesExtra(r Rules) *extras.Rules
- func SetEthUpgrades(c *ChainConfig) error
- func SetNetworkUpgradeDefaults(c *ChainConfig)
- func VersionWithCommit(gitCommit, gitDate string) string
- type ChainConfig
- type ChainConfigWithUpgradesJSON
- type Rules
- type RulesExtra
- func (RulesExtra) ActivePrecompiles(existing []common.Address) []common.Address
- func (r RulesExtra) CanCreateContract(ac *libevm.AddressContext, gas uint64, state libevm.StateReader) (uint64, error)
- func (RulesExtra) CanExecuteTransaction(common.Address, *common.Address, libevm.StateReader) error
- func (RulesExtra) MinimumGasConsumption(x uint64) uint64
- func (r RulesExtra) PrecompileOverride(addr common.Address) (libevm.PrecompiledContract, bool)
Constants ¶
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 // CheckpointFrequency is the block frequency for creating checkpoint CheckpointFrequency = 32768 // CheckpointProcessConfirmations is the number before a checkpoint is generated CheckpointProcessConfirmations = 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 and by clique as the snapshot trust limit. 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 ( VersionMajor = 1 // Major version component of the current release VersionMinor = 13 // Minor version component of the current release VersionPatch = 14 // Patch version component of the current release VersionMeta = "stable" // Version metadata to append to the version string )
const ( // TODO: Value to pass to geth's Rules by default where the appropriate // context is not available in the avalanche code. (similar to context.TODO()) IsMergeTODO = true )
Variables ¶
var ( // SubnetEVMDefaultConfig is the default configuration // without any network upgrades. SubnetEVMDefaultChainConfig = WithExtra( &ChainConfig{ ChainID: DefaultChainID, HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), }, extras.SubnetEVMDefaultChainConfig, ) TestChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), ShanghaiTime: utils.NewUint64(0), CancunTime: utils.NewUint64(0), }, extras.TestChainConfig, ) TestPreSubnetEVMChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), }, extras.TestPreSubnetEVMChainConfig, ) TestSubnetEVMChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), }, extras.TestSubnetEVMChainConfig, ) TestDurangoChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), ShanghaiTime: utils.NewUint64(0), }, extras.TestDurangoChainConfig, ) TestEtnaChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), ShanghaiTime: utils.NewUint64(0), CancunTime: utils.NewUint64(0), }, extras.TestEtnaChainConfig, ) TestFortunaChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), ShanghaiTime: utils.NewUint64(0), CancunTime: utils.NewUint64(0), }, extras.TestFortunaChainConfig, ) TestGraniteChainConfig = WithExtra( &ChainConfig{ ChainID: big.NewInt(1), HomesteadBlock: big.NewInt(0), EIP150Block: big.NewInt(0), 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), ShanghaiTime: utils.NewUint64(0), CancunTime: utils.NewUint64(0), }, extras.TestGraniteChainConfig, ) TestRules = TestChainConfig.Rules(new(big.Int), IsMergeTODO, 0) )
var ( DefaultChainID = big.NewInt(43214) DefaultFeeConfig = extras.DefaultFeeConfig )
var Version = func() string { return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch) }()
Version holds the textual version string.
var VersionWithMeta = func() string { v := Version if VersionMeta != "" { v += "-" + VersionMeta } return v }()
VersionWithMeta holds the textual version string including the metadata.
Functions ¶
func GetExtra ¶ added in v0.7.4
func GetExtra(c *ChainConfig) *extras.ChainConfig
func GetRulesExtra ¶ added in v0.7.4
func SetEthUpgrades ¶ added in v0.7.4
func SetEthUpgrades(c *ChainConfig) error
SetEthUpgrades enables Ethereum network upgrades using the same time as the Avalanche network upgrade that enables them.
TODO: Prior to Cancun, Avalanche upgrades are referenced inline in the code in place of their Ethereum counterparts. The original Ethereum names should be restored for maintainability.
func SetNetworkUpgradeDefaults ¶ added in v0.7.4
func SetNetworkUpgradeDefaults(c *ChainConfig)
func VersionWithCommit ¶ added in v0.2.5
Types ¶
type ChainConfig ¶
type ChainConfig = ethparams.ChainConfig
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 Copy ¶ added in v0.7.4
func Copy(c *ChainConfig) ChainConfig
func WithExtra ¶ added in v0.7.4
func WithExtra(c *ChainConfig, extra *extras.ChainConfig) *ChainConfig
WithExtra sets the extra payload on `c` and returns the modified argument.
type ChainConfigWithUpgradesJSON ¶ added in v0.4.12
type ChainConfigWithUpgradesJSON struct { ChainConfig UpgradeConfig extras.UpgradeConfig `json:"upgrades,omitempty"` }
func ToWithUpgradesJSON ¶ added in v0.7.4
func ToWithUpgradesJSON(c *ChainConfig) *ChainConfigWithUpgradesJSON
ToWithUpgradesJSON converts the ChainConfig to ChainConfigWithUpgradesJSON with upgrades explicitly displayed. ChainConfig does not include upgrades in its JSON output. This is a workaround for showing upgrades in the JSON output.
func (ChainConfigWithUpgradesJSON) MarshalJSON ¶ added in v0.4.12
func (cu ChainConfigWithUpgradesJSON) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler. This is a workaround for the fact that the embedded ChainConfig struct has a MarshalJSON method, which prevents the default JSON marshalling from working for UpgradeConfig. TODO: consider removing this method by allowing external tag for the embedded ChainConfig struct.
func (*ChainConfigWithUpgradesJSON) UnmarshalJSON ¶ added in v0.4.12
func (cu *ChainConfigWithUpgradesJSON) UnmarshalJSON(input []byte) error
type Rules ¶
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 RulesExtra ¶ added in v0.7.4
func (RulesExtra) ActivePrecompiles ¶ added in v0.7.4
func (RulesExtra) ActivePrecompiles(existing []common.Address) []common.Address
func (RulesExtra) CanCreateContract ¶ added in v0.7.4
func (r RulesExtra) CanCreateContract(ac *libevm.AddressContext, gas uint64, state libevm.StateReader) (uint64, error)
func (RulesExtra) CanExecuteTransaction ¶ added in v0.7.4
func (RulesExtra) CanExecuteTransaction(common.Address, *common.Address, libevm.StateReader) error
func (RulesExtra) MinimumGasConsumption ¶ added in v0.7.5
func (RulesExtra) MinimumGasConsumption(x uint64) uint64
MinimumGasConsumption is a no-op.
func (RulesExtra) PrecompileOverride ¶ added in v0.7.4
func (r RulesExtra) PrecompileOverride(addr common.Address) (libevm.PrecompiledContract, bool)