Documentation
¶
Index ¶
- Constants
- Variables
- func GetExtra(c *ChainConfig) *extras.ChainConfig
- func GetRulesExtra(r Rules) *extras.Rules
- func RegisterExtras()
- func SetEthUpgrades(c *ChainConfig) error
- func SetNetworkUpgradeDefaults(c *ChainConfig)
- func VersionWithCommit(gitCommit, gitDate string) string
- func WithTempRegisteredExtras(lock libevm.ExtrasLock, fn func() error) error
- type ChainConfig
- type ChainConfigWithUpgradesJSON
- type Rules
- type RulesExtra
- func (r 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 InvalidateDelegateUnix = 1754107200
invalidateDelegateTime is the Unix timestamp for August 2nd, 2025, midnight Eastern Time (August 2nd, 2025, 04:00 UTC)
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 ( SubnetEVMDefaultChainConfig, TestChainConfig, TestPreSubnetEVMChainConfig, TestSubnetEVMChainConfig, TestDurangoChainConfig, TestEtnaChainConfig, TestFortunaChainConfig, TestGraniteChainConfig *ChainConfig TestRules Rules )
var ( DefaultChainID = big.NewInt(43214) DefaultFeeConfig = extras.DefaultFeeConfig )
var P256VerifyAddress = common.BytesToAddress([]byte{0x1, 0x00})
P256VerifyAddress is the address of the p256 signature verification precompile
var PrecompiledContractsGranite = map[common.Address]vm.PrecompiledContract{ P256VerifyAddress: &vm.P256Verify{}, }
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 RegisterExtras ¶ added in v0.8.0
func RegisterExtras()
RegisterExtras registers hooks and payloads with libevm. It MUST NOT be called more than once and therefore is only allowed to be used in tests and `package main`, to avoid polluting other packages that transitively depend on this one but don't need registration.
Without a call to RegisterExtras, much of the functionality of this package will work, and most will simply panic.
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
func WithTempRegisteredExtras ¶ added in v0.8.0
func WithTempRegisteredExtras(lock libevm.ExtrasLock, fn func() error) error
WithTempRegisteredExtras runs `fn` with temporary registration otherwise equivalent to a call to RegisterExtras, but limited to the life of `fn`.
This function is not intended for direct use. Use `evm.WithTempRegisteredLibEVMExtras()` instead as it calls this along with all other temporary-registration functions.
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 (r 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)