Documentation
¶
Index ¶
- Constants
- Variables
- func CalcBaseFee(config *DynamicFeeConfig, parent BaseFeeCalculator) *big.Int
- func GetExtra(c *ChainConfig) *extras.ChainConfig
- func GetRulesExtra(rules Rules) *extras.Rules
- func SetEthUpgrades(c *ChainConfig, luxUpgrades extras.NetworkUpgrades)
- func SetNetworkUpgradeDefaults(c *ChainConfig)
- func VersionWithCommit(gitCommit, gitDate string) string
- type BaseFeeCalculator
- type ChainConfig
- func (c *ChainConfig) AllowedFeeRecipients() bool
- func (c *ChainConfig) AsGeth() interface{}
- func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time uint64) *ConfigCompatError
- func (c *ChainConfig) CheckConfigForkOrder() error
- func (c *ChainConfig) CheckMandatoryCompatible(newcfg *MandatoryNetworkUpgrades, time uint64) error
- func (c *ChainConfig) CheckPrecompilesCompatible(precompileUpgrades []extras.PrecompileUpgrade, time uint64) error
- func (c *ChainConfig) CheckStateUpgradesCompatible(stateUpgrades []extras.StateUpgrade, time uint64) error
- func (c *ChainConfig) Description() string
- func (c *ChainConfig) GenesisRules(blockNum *big.Int, timestamp uint64) iface.GenesisRules
- func (c *ChainConfig) GetBerlinBlock() *big.Int
- func (c *ChainConfig) GetByzantiumBlock() *big.Int
- func (c *ChainConfig) GetChainID() *big.Int
- func (c *ChainConfig) GetConstantinopleBlock() *big.Int
- func (c *ChainConfig) GetEIP150Block() *big.Int
- func (c *ChainConfig) GetEIP150Hash() common.Hash
- func (c *ChainConfig) GetEIP155Block() *big.Int
- func (c *ChainConfig) GetEIP158Block() *big.Int
- func (c *ChainConfig) GetFeeConfig() commontype.FeeConfig
- func (c *ChainConfig) GetIstanbulBlock() *big.Int
- func (c *ChainConfig) GetLondonBlock() *big.Int
- func (c *ChainConfig) GetMuirGlacierBlock() *big.Int
- func (c *ChainConfig) GetPetersburgBlock() *big.Int
- func (c *ChainConfig) IsBerlin(num *big.Int) bool
- func (c *ChainConfig) IsByzantium(num *big.Int) bool
- func (c *ChainConfig) IsCancun(time uint64) bool
- func (c *ChainConfig) IsConstantinople(num *big.Int) bool
- func (c *ChainConfig) IsDUpgrade(time uint64) bool
- func (c *ChainConfig) IsDurango(time uint64) bool
- func (c *ChainConfig) IsEIP150(num *big.Int) bool
- func (c *ChainConfig) IsEIP155(num *big.Int) bool
- func (c *ChainConfig) IsEIP158(num *big.Int) bool
- func (c *ChainConfig) IsEVM(time uint64) bool
- func (c *ChainConfig) IsFortuna(time uint64) bool
- func (c *ChainConfig) IsGenesis(time uint64) bool
- func (c *ChainConfig) IsHomestead(num *big.Int) bool
- func (c *ChainConfig) IsIstanbul(num *big.Int) bool
- func (c *ChainConfig) IsLondon(num *big.Int) bool
- func (c *ChainConfig) IsMuirGlacier(num *big.Int) bool
- func (c *ChainConfig) IsPetersburg(num *big.Int) bool
- func (c *ChainConfig) IsPrecompileEnabled(address common.Address, timestamp uint64) bool
- func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool
- func (c ChainConfig) MarshalJSON() ([]byte, error)
- func (c *ChainConfig) Rules(num *big.Int, timestamp uint64) Rules
- func (c *ChainConfig) ToEthChainConfig() *ethparams.ChainConfig
- func (c *ChainConfig) ToWithUpgradesJSON() *ChainConfigWithUpgradesJSON
- func (c *ChainConfig) UnmarshalJSON(data []byte) error
- func (c *ChainConfig) Verify() error
- type ChainConfigWithUpgradesJSON
- type ConfigCompatError
- type DynamicFeeConfig
- type LuxChainConfig
- type LuxContext
- type MandatoryNetworkUpgrades
- type OptionalNetworkUpgrades
- type Precompiles
- type Rules
- func (r *Rules) GetAccepterPrecompiles() map[common.Address]interface{}
- func (r *Rules) GetActivePrecompiles() map[common.Address]interface{}
- func (r *Rules) GetPredicaters() map[common.Address]interface{}
- func (r *Rules) IsEVM() bool
- func (r *Rules) IsFortuna() bool
- func (r *Rules) IsGenesis() bool
- func (r *Rules) IsGranite() bool
- func (r *Rules) IsPrecompileEnabled(addr common.Address) bool
- func (r *Rules) PredicaterExists(addr common.Address) bool
- func (r *Rules) PredicatersExist() bool
- type SimplifiedRules
- type UpgradeConfig
Constants ¶
const ( BlobTxBytesPerFieldElement = 32 // Size of each field element in bytes BlobTxFieldElementsPerBlob = 4096 // Number of field elements stored in a single data blob BlobTxBlobGasPerBlob = 1 << 17 // Gas consumption of a single data blob (== 131072) BlobTxMinBlobGasprice = 1 // Minimum gas price for data blobs BlobTxBlobGaspriceUpdateFraction = 3338477 // Controls the maximum rate of change for blob gas price BlobTxPointEvaluationPrecompileGas = 50000 // Gas price for the point evaluation precompile BlobTxTargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob // Target consumable blob gas for data blobs per block (for 1559-like pricing) MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block )
Blob gas constants - these values are defined by EIP-4844
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 ( // AssetBalanceApricot is the gas cost for querying native asset balance AssetBalanceApricot uint64 = 2474 // AssetCallApricot is the gas cost for calling native asset transfer AssetCallApricot uint64 = 9000 // TxGas is the base gas cost for a transaction TxGas uint64 = 21000 // EVM operation gas costs CallCreateDepth uint64 = 1024 // Maximum depth of call/create stack CallNewAccountGas uint64 = 25000 // Paid for CALL when the destination address didn't exist prior CreateDataGas uint64 = 200 // Per byte of data attached to a create MaxCodeSize = 24576 // Maximum bytecode to permit for a contract )
Lux-specific gas costs for precompiled contracts
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 lux code. (similar to context.TODO()) IsMergeTODO = true )
const WarpQuorumDenominator = 3
WarpQuorumDenominator is the denominator used to calculate the quorum for Warp messages. A quorum is achieved when the sum of the validators' weights that signed the message is greater than (total_weight * quorum_numerator) / WarpQuorumDenominator.
Variables ¶
var ( // MainnetNetworkUpgrades defines the network upgrade timestamps for mainnet // For v2.0.0, all upgrades are active at genesis (timestamp 0) MainnetNetworkUpgrades = extras.NetworkUpgrades{ GenesisTimestamp: utils.NewUint64(0), } EVMChainID = big.NewInt(43214) // For legacy tests MinGasPrice int64 = 225_000_000_000 TestInitialBaseFee int64 = 225_000_000_000 TestMaxBaseFee int64 = 225_000_000_000 DynamicFeeExtraDataSize = 80 RollupWindow uint64 = 10 DefaultFeeConfig = commontype.FeeConfig{ GasLimit: big.NewInt(8_000_000), TargetBlockRate: 2, MinBaseFee: big.NewInt(25_000_000_000), TargetGas: big.NewInt(15_000_000), BaseFeeChangeDenominator: big.NewInt(36), MinBlockGasCost: big.NewInt(0), MaxBlockGasCost: big.NewInt(1_000_000), BlockGasCostStep: big.NewInt(200_000), } )
var ( // EVMDefaultConfig is the default configuration // without any network upgrades. EVMDefaultChainConfig = &ChainConfig{ ChainConfig: ðparams.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), ShanghaiTime: new(uint64), CancunTime: new(uint64), }, FeeConfig: DefaultFeeConfig, MandatoryNetworkUpgrades: MainnetNetworkUpgrades, GenesisPrecompiles: Precompiles{}, } TestChainConfig = &ChainConfig{ ChainConfig: ðparams.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: new(uint64), CancunTime: new(uint64), }, LuxContext: LuxContext{testChainContext()}, FeeConfig: DefaultFeeConfig, AllowFeeRecipients: false, MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{ GenesisTimestamp: utils.NewUint64(0), }, } TestEVMConfig = &ChainConfig{ ChainConfig: ðparams.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: new(uint64), CancunTime: new(uint64), }, LuxContext: LuxContext{testChainContext()}, FeeConfig: DefaultFeeConfig, AllowFeeRecipients: false, MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{ GenesisTimestamp: utils.NewUint64(0), }, } TestPreEVMConfig = &ChainConfig{ ChainConfig: ðparams.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: new(uint64), CancunTime: new(uint64), }, LuxContext: LuxContext{testChainContext()}, FeeConfig: DefaultFeeConfig, AllowFeeRecipients: false, MandatoryNetworkUpgrades: MandatoryNetworkUpgrades{}, GenesisPrecompiles: Precompiles{}, UpgradeConfig: UpgradeConfig{}, } TestRules = TestChainConfig.GenesisRules(new(big.Int), 0) )
var (
DefaultChainID = big.NewInt(43214)
)
var ( // DefaultDynamicFeeConfig for Lux mainnet (Octane/ACP-176 style) DefaultDynamicFeeConfig = DynamicFeeConfig{ TargetGas: 50_000_000, BaseFeeChangeDenominator: 36, MinBaseFee: big.NewInt(25_000_000_000), TargetBlockRate: 2, BlockGasCostStep: big.NewInt(50_000), } )
var ( // LuxMainnetChainConfig is the chain config for Lux mainnet v1 // // Historical Note: Lux Network mainnet launched in 2025 with all Avalanche // upgrades (Apricot, Banff, Cortina, Durango, Etna) pre-activated. This was // done to simplify the codebase for developers who don't need to be familiarized // with 5 years of network upgrades from the Avalanche side. // // Our previous subnet EVM chain lacked C-Chain precompiles, so we upgraded our // core implementation and removed all Avalanche-specific upgrade flags to // accommodate our own upgrade path moving forward. LuxMainnetChainConfig = &LuxChainConfig{ ChainID: big.NewInt(96369), FeeConfig: commontype.FeeConfig{ GasLimit: big.NewInt(100_000_000), TargetGas: big.NewInt(50_000_000), BaseFeeChangeDenominator: big.NewInt(36), MinBaseFee: big.NewInt(25_000_000_000), TargetBlockRate: 2, MinBlockGasCost: big.NewInt(0), MaxBlockGasCost: big.NewInt(1_000_000), BlockGasCostStep: big.NewInt(50_000), }, AllowFeeRecipients: true, } )
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 CalcBaseFee ¶ added in v0.8.0
func CalcBaseFee(config *DynamicFeeConfig, parent BaseFeeCalculator) *big.Int
CalcBaseFee calculates the base fee for the next block based on parent
func GetExtra ¶
func GetExtra(c *ChainConfig) *extras.ChainConfig
func GetRulesExtra ¶ added in v0.5.5
GetRulesExtra returns the Lux-specific rules for the given Ethereum rules.
func SetEthUpgrades ¶
func SetEthUpgrades(c *ChainConfig, luxUpgrades extras.NetworkUpgrades)
SetEthUpgrades enables Ethereum network upgrades using the same time as the Lux network upgrade that enables them. For v2.0.0, all upgrades are active at genesis (timestamp 0).
func SetNetworkUpgradeDefaults ¶
func SetNetworkUpgradeDefaults(c *ChainConfig)
func VersionWithCommit ¶
Types ¶
type BaseFeeCalculator ¶ added in v0.8.3
BaseFeeCalculator is an interface for headers used in base fee calculation
type ChainConfig ¶
type ChainConfig struct {
*ethparams.ChainConfig // Embedded geth ChainConfig
LuxContext `json:"-"` // Lux specific context set during VM initialization. Not serialized.
// Lux-specific extensions
FeeConfig commontype.FeeConfig `json:"feeConfig"` // Set the configuration for the dynamic fee algorithm
AllowFeeRecipients bool `json:"allowFeeRecipients,omitempty"` // Allows fees to be collected by block builders.
MandatoryNetworkUpgrades // Config for timestamps that enable mandatory network upgrades. Skip encoding/decoding directly into ChainConfig.
OptionalNetworkUpgrades // Config for optional timestamps that enable network upgrades
GenesisPrecompiles Precompiles `json:"-"` // Config for enabling precompiles from genesis. JSON encode/decode will be handled by the custom marshaler/unmarshaler.
UpgradeConfig `json:"-"` // Config specified in upgradeBytes (lux network upgrades or enable/disabling precompiles). Skip encoding/decoding directly into 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 ¶
func Copy(c *ChainConfig) ChainConfig
func WithExtra ¶
func WithExtra(c *ChainConfig, extra *extras.ChainConfig) *ChainConfig
WithExtra sets the extra payload on `c` and returns the modified argument.
func (*ChainConfig) AllowedFeeRecipients ¶
func (c *ChainConfig) AllowedFeeRecipients() bool
AllowedFeeRecipients returns true if fee recipients are allowed Implements precompileconfig.ChainConfig interface.
func (*ChainConfig) AsGeth ¶ added in v0.8.0
func (c *ChainConfig) AsGeth() interface{}
AsGeth returns the embedded geth ChainConfig This is a convenience method for call sites that need the plain geth struct
func (*ChainConfig) CheckCompatible ¶
func (c *ChainConfig) CheckCompatible(newcfg *ChainConfig, height uint64, time 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, geth isn't pluggable enough to guarantee that forks can be implemented in a different order than on official networks
func (*ChainConfig) CheckMandatoryCompatible ¶
func (c *ChainConfig) CheckMandatoryCompatible(newcfg *MandatoryNetworkUpgrades, time uint64) error
CheckMandatoryCompatible checks if the mandatory network upgrades are compatible
func (*ChainConfig) CheckPrecompilesCompatible ¶
func (c *ChainConfig) CheckPrecompilesCompatible(precompileUpgrades []extras.PrecompileUpgrade, time uint64) error
CheckPrecompilesCompatible checks that precompiles are compatible
func (*ChainConfig) CheckStateUpgradesCompatible ¶
func (c *ChainConfig) CheckStateUpgradesCompatible(stateUpgrades []extras.StateUpgrade, time uint64) error
CheckStateUpgradesCompatible checks that state upgrades are compatible
func (*ChainConfig) Description ¶
func (c *ChainConfig) Description() string
Description returns a human-readable description of ChainConfig.
func (*ChainConfig) GenesisRules ¶ added in v0.8.1
func (c *ChainConfig) GenesisRules(blockNum *big.Int, timestamp uint64) iface.GenesisRules
GenesisRules returns the Genesis modified rules to support Genesis network upgrades
func (*ChainConfig) GetBerlinBlock ¶ added in v0.8.0
func (c *ChainConfig) GetBerlinBlock() *big.Int
func (*ChainConfig) GetByzantiumBlock ¶ added in v0.8.0
func (c *ChainConfig) GetByzantiumBlock() *big.Int
func (*ChainConfig) GetChainID ¶ added in v0.8.0
func (c *ChainConfig) GetChainID() *big.Int
GetChainID returns the chain ID
func (*ChainConfig) GetConstantinopleBlock ¶ added in v0.8.0
func (c *ChainConfig) GetConstantinopleBlock() *big.Int
func (*ChainConfig) GetEIP150Block ¶ added in v0.8.0
func (c *ChainConfig) GetEIP150Block() *big.Int
func (*ChainConfig) GetEIP150Hash ¶ added in v0.8.0
func (c *ChainConfig) GetEIP150Hash() common.Hash
func (*ChainConfig) GetEIP155Block ¶ added in v0.8.0
func (c *ChainConfig) GetEIP155Block() *big.Int
func (*ChainConfig) GetEIP158Block ¶ added in v0.8.0
func (c *ChainConfig) GetEIP158Block() *big.Int
func (*ChainConfig) GetFeeConfig ¶
func (c *ChainConfig) GetFeeConfig() commontype.FeeConfig
GetFeeConfig returns the original FeeConfig that was set in the genesis Implements precompileconfig.ChainConfig interface.
func (*ChainConfig) GetIstanbulBlock ¶ added in v0.8.0
func (c *ChainConfig) GetIstanbulBlock() *big.Int
func (*ChainConfig) GetLondonBlock ¶ added in v0.8.0
func (c *ChainConfig) GetLondonBlock() *big.Int
func (*ChainConfig) GetMuirGlacierBlock ¶ added in v0.8.0
func (c *ChainConfig) GetMuirGlacierBlock() *big.Int
func (*ChainConfig) GetPetersburgBlock ¶ added in v0.8.0
func (c *ChainConfig) GetPetersburgBlock() *big.Int
func (*ChainConfig) IsBerlin ¶ added in v0.5.5
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 ¶
func (c *ChainConfig) IsByzantium(num *big.Int) bool
IsByzantium returns whether num is either equal to the Byzantium fork block or greater.
func (*ChainConfig) IsCancun ¶
func (c *ChainConfig) IsCancun(time uint64) bool
IsCancun returns whether time represents a block with a timestamp after the Cancun upgrade time. For v2.0.0, this is always true since all upgrades are active at genesis.
func (*ChainConfig) IsConstantinople ¶
func (c *ChainConfig) IsConstantinople(num *big.Int) bool
IsConstantinople returns whether num is either equal to the Constantinople fork block or greater.
func (*ChainConfig) IsDUpgrade ¶
func (c *ChainConfig) IsDUpgrade(time uint64) bool
IsDUpgrade returns whether time represents a block with a timestamp after the DUpgrade upgrade time. For v2.0.0, this is always true since all upgrades are active at genesis.
func (*ChainConfig) IsDurango ¶ added in v0.8.0
func (c *ChainConfig) IsDurango(time uint64) bool
IsDurango returns whether time represents a block with a timestamp after the Durango upgrade time. Implements precompileconfig.ChainConfig interface. For v2.0.0, this is always true since all upgrades are active at genesis.
func (*ChainConfig) IsEIP150 ¶
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 ¶
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 ¶
func (c *ChainConfig) IsEIP158(num *big.Int) bool
IsEIP158 returns whether num is either equal to the EIP158 fork block or greater.
func (*ChainConfig) IsEVM ¶ added in v0.7.10
func (c *ChainConfig) IsEVM(time uint64) bool
IsEVM returns whether time represents a block with a timestamp after the EVM upgrade time. For v2.0.0, this is always true since all upgrades are active at genesis.
func (*ChainConfig) IsFortuna ¶ added in v0.8.0
func (c *ChainConfig) IsFortuna(time uint64) bool
IsFortuna returns whether time represents a block with a timestamp after the Fortuna upgrade time. For v2.0.0, this is always true since all upgrades are active at genesis.
func (*ChainConfig) IsGenesis ¶ added in v0.8.1
func (c *ChainConfig) IsGenesis(time uint64) bool
IsGenesis returns whether all network upgrades are active at genesis. For v2.0.0, this is always true since all upgrades are active at genesis.
func (*ChainConfig) IsHomestead ¶
func (c *ChainConfig) IsHomestead(num *big.Int) bool
IsHomestead returns whether num is either equal to the homestead block or greater.
func (*ChainConfig) IsIstanbul ¶
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.5.5
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 ¶
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 ¶
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) IsPrecompileEnabled ¶
func (c *ChainConfig) IsPrecompileEnabled(address common.Address, timestamp uint64) bool
IsPrecompileEnabled returns whether precompile with [address] is enabled at [timestamp].
func (*ChainConfig) IsShanghai ¶ added in v0.5.5
func (c *ChainConfig) IsShanghai(num *big.Int, time uint64) bool
IsShanghai returns whether time represents a block with a timestamp after the Shanghai upgrade time. For v2.0.0, this is always true since all upgrades are active at genesis.
func (ChainConfig) MarshalJSON ¶
func (c ChainConfig) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of c. This is a custom marshaler to handle the Precompiles field.
func (*ChainConfig) Rules ¶ added in v0.5.5
func (c *ChainConfig) Rules(num *big.Int, timestamp uint64) Rules
Rules returns the Ethereum chainrules to use for the given block number and timestamp.
func (*ChainConfig) ToEthChainConfig ¶ added in v0.7.8
func (c *ChainConfig) ToEthChainConfig() *ethparams.ChainConfig
ToEthChainConfig converts Lux ChainConfig to ethereum ChainConfig
func (*ChainConfig) ToWithUpgradesJSON ¶
func (c *ChainConfig) ToWithUpgradesJSON() *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 (*ChainConfig) UnmarshalJSON ¶
func (c *ChainConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON parses the JSON-encoded data and stores the result in the object pointed to by c. This is a custom unmarshaler to handle the Precompiles field. Precompiles was presented as an inline object in the JSON. This custom unmarshaler ensures backwards compatibility with the old format.
func (*ChainConfig) Verify ¶
func (c *ChainConfig) Verify() error
Verify verifies chain config and returns error
type ChainConfigWithUpgradesJSON ¶
type ChainConfigWithUpgradesJSON struct {
ChainConfig
UpgradeConfig UpgradeConfig `json:"upgrades,omitempty"`
}
func (ChainConfigWithUpgradesJSON) MarshalJSON ¶
func (cu ChainConfigWithUpgradesJSON) MarshalJSON() ([]byte, error)
MarshalJSON implements interfaces.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 ¶
func (cu *ChainConfigWithUpgradesJSON) UnmarshalJSON(input []byte) error
type ConfigCompatError ¶
type ConfigCompatError struct {
What string
// block numbers of the stored and new configurations if block based forking
StoredBlock, NewBlock *big.Int
// timestamps of the stored and new configurations if time based forking
StoredTime, NewTime *uint64
// the block number to which the local chain must be rewound to correct the error
RewindToBlock uint64
// the timestamp to which the local chain must be rewound to correct the error
RewindToTime 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 DynamicFeeConfig ¶ added in v0.8.0
type DynamicFeeConfig struct {
// TargetGas is the target gas usage per block (50% full)
TargetGas uint64 `json:"targetGas"`
// BaseFeeChangeDenominator controls fee adjustment rate
BaseFeeChangeDenominator uint64 `json:"baseFeeChangeDenominator"`
// MinBaseFee is the minimum base fee (25 gwei for Lux)
MinBaseFee *big.Int `json:"minBaseFee"`
// TargetBlockRate is the target time between blocks (2 seconds)
TargetBlockRate uint64 `json:"targetBlockRate"`
// BlockGasCostStep for base fee calculation
BlockGasCostStep *big.Int `json:"blockGasCostStep"`
}
DynamicFeeConfig implements Octane (ACP-176) style dynamic fees
func (*DynamicFeeConfig) Verify ¶ added in v0.8.0
func (f *DynamicFeeConfig) Verify() error
Verify validates the fee configuration
type LuxChainConfig ¶ added in v0.8.0
type LuxChainConfig struct {
ChainID *big.Int `json:"chainID"`
// FeeConfig is the dynamic fee configuration
FeeConfig commontype.FeeConfig `json:"feeConfig"`
// AllowFeeRecipients allows block builders to claim fees
AllowFeeRecipients bool `json:"allowFeeRecipients,omitempty"`
// Precompile upgrade configuration
UpgradeConfig *extras.UpgradeConfig `json:"upgrades,omitempty"`
}
LuxChainConfig is the simplified chain configuration for Lux mainnet All legacy upgrades are considered activated from genesis
func (*LuxChainConfig) AllowedFeeRecipients ¶ added in v0.8.0
func (c *LuxChainConfig) AllowedFeeRecipients() bool
AllowedFeeRecipients returns whether fee recipients are allowed
func (*LuxChainConfig) GetFeeConfig ¶ added in v0.8.0
func (c *LuxChainConfig) GetFeeConfig() commontype.FeeConfig
GetFeeConfig returns the fee configuration
func (*LuxChainConfig) GetRules ¶ added in v0.8.0
func (c *LuxChainConfig) GetRules() SimplifiedRules
GetRules returns the simplified rules - all upgrades active
type LuxContext ¶
type LuxContext struct {
ConsensusCtx *commontype.ChainContext
}
LuxContext provides Lux specific context directly into the EVM.
type MandatoryNetworkUpgrades ¶
type MandatoryNetworkUpgrades = extras.NetworkUpgrades
Type aliases for extras package types
type OptionalNetworkUpgrades ¶
type OptionalNetworkUpgrades = extras.NetworkUpgrades
Type aliases for extras package types
type Rules ¶
type Rules struct {
ChainID *big.Int
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
IsBerlin, IsLondon bool
IsShanghai, IsCancun bool
// Rules for Lux releases - all upgrades are always active
IsEVMEnabled bool
// ActivePrecompiles maps addresses to stateful precompiled contracts that are enabled
// for this rule set.
// Note: none of these addresses should conflict with the address space used by
// any existing precompiles.
ActivePrecompiles map[common.Address]precompileconfig.Config
// Predicaters maps addresses to stateful precompile Predicaters
// that are enabled for this rule set.
Predicaters map[common.Address]precompileconfig.Predicater
// AccepterPrecompiles maps addresses to stateful precompile accepter functions
// that are enabled for this rule set.
AccepterPrecompiles map[common.Address]precompileconfig.Accepter
}
Rules wraps ChainConfig and is merely syntactic sugar or can be used for functions that do not have or require information about the interfaces.
Rules is a one time interface meaning that it shouldn't be used in between transition phases.
func (*Rules) GetAccepterPrecompiles ¶ added in v0.8.0
GetAccepterPrecompiles returns the accepter precompiles as an interface map
func (*Rules) GetActivePrecompiles ¶ added in v0.8.0
GetActivePrecompiles returns the active precompiles as an interface map
func (*Rules) GetPredicaters ¶ added in v0.8.0
GetPredicaters returns the predicaters as an interface map
func (*Rules) IsPrecompileEnabled ¶
IsPrecompileEnabled returns true if the precompile at [addr] is enabled for this rule set.
func (*Rules) PredicatersExist ¶
type SimplifiedRules ¶ added in v0.8.0
type SimplifiedRules struct {
ChainID *big.Int
// All upgrades are active by default in Lux
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
IsBerlin, IsLondon bool
IsShanghai, IsCancun bool
// ActivePrecompiles maps addresses to stateful precompiled contracts
ActivePrecompiles map[common.Address]precompileconfig.Config
// Predicaters maps addresses to stateful precompile Predicaters
Predicaters map[common.Address]precompileconfig.Predicater
// AccepterPrecompiles maps addresses to stateful precompile accepter functions
AccepterPrecompiles map[common.Address]precompileconfig.Accepter
}
SimplifiedRules contains the rules for the Lux chain All legacy upgrades are always true
func (*SimplifiedRules) IsPrecompileEnabled ¶ added in v0.8.0
func (r *SimplifiedRules) IsPrecompileEnabled(addr common.Address) bool
IsPrecompileEnabled returns true if the precompile at [addr] is enabled
type UpgradeConfig ¶
type UpgradeConfig struct {
// Config for optional timestamps that enable network upgrades.
// Note: if OptionalUpgrades is specified in the JSON all previously activated
// forks must be present or upgradeBytes will be rejected.
OptionalNetworkUpgrades *extras.NetworkUpgrades `json:"networkUpgrades,omitempty"`
// Config for modifying state as a network interfaces.
StateUpgrades []extras.StateUpgrade `json:"stateUpgrades,omitempty"`
// Config for enabling and disabling precompiles as network upgrades.
PrecompileUpgrades []extras.PrecompileUpgrade `json:"precompileUpgrades,omitempty"`
}
UpgradeConfig includes the following configs that may be specified in upgradeBytes: - Timestamps that enable lux network upgrades, - Enabling or disabling precompiles as network upgrades.