Documentation
¶
Index ¶
- Variables
- func IsForkTransition(fork *uint64, parent *uint64, current uint64) bool
- type ChainConfig
- func (c *ChainConfig) CheckConfigCompatible(newcfg_ *ethparams.ChainConfig, headNumber *big.Int, headTimestamp uint64) *ethparams.ConfigCompatError
- func (c *ChainConfig) CheckConfigForkOrder() error
- func (c *ChainConfig) Description() string
- func (c *ChainConfig) EnabledStatefulPrecompiles(blockTimestamp uint64) Precompiles
- func (c *ChainConfig) GetActivatingPrecompileConfigs(address common.Address, from *uint64, to uint64, upgrades []PrecompileUpgrade) []precompileconfig.Config
- func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, timestamp uint64) precompileconfig.Config
- func (c *ChainConfig) IsPrecompileEnabled(address common.Address, timestamp uint64) bool
- func (c *ChainConfig) MarshalJSON() ([]byte, error)
- func (c *ChainConfig) UnmarshalJSON(data []byte) error
- func (c *ChainConfig) Verify() error
- type LuxContext
- type LuxRules
- type NetworkUpgrades
- func (n *NetworkUpgrades) CheckNetworkUpgradesCompatible(newcfg *NetworkUpgrades, time uint64) *ethparams.ConfigCompatError
- func (n NetworkUpgrades) Description() string
- func (n *NetworkUpgrades) Equal(other *NetworkUpgrades) bool
- func (n *NetworkUpgrades) GetLuxRules(timestamp uint64) LuxRules
- func (n NetworkUpgrades) IsApricotPhase1(time uint64) bool
- func (n NetworkUpgrades) IsApricotPhase2(time uint64) bool
- func (n *NetworkUpgrades) IsApricotPhase3(time uint64) bool
- func (n NetworkUpgrades) IsApricotPhase4(time uint64) bool
- func (n NetworkUpgrades) IsApricotPhase5(time uint64) bool
- func (n NetworkUpgrades) IsApricotPhase6(time uint64) bool
- func (n NetworkUpgrades) IsApricotPhasePost6(time uint64) bool
- func (n NetworkUpgrades) IsApricotPhasePre6(time uint64) bool
- func (n NetworkUpgrades) IsBanff(time uint64) bool
- func (n NetworkUpgrades) IsCortina(time uint64) bool
- func (n NetworkUpgrades) IsDurango(time uint64) bool
- func (n NetworkUpgrades) IsEtna(time uint64) bool
- func (n *NetworkUpgrades) IsFortuna(time uint64) bool
- func (n *NetworkUpgrades) IsGranite(time uint64) bool
- type PrecompileUpgrade
- type Precompiles
- type Rules
- type UpgradeConfig
Constants ¶
This section is empty.
Variables ¶
var ( // TestChainConfig is the default test configuration with all upgrades active. // This represents mainnet behavior where all legacy upgrades are active. TestChainConfig = &ChainConfig{ NetworkUpgrades: NetworkUpgrades{ BanffBlockTimestamp: utils.NewUint64(0), CortinaBlockTimestamp: utils.NewUint64(0), DurangoBlockTimestamp: utils.NewUint64(0), EtnaTimestamp: utils.NewUint64(0), FortunaTimestamp: utils.NewUint64(0), GraniteTimestamp: utils.NewUint64(0), }, } // GenesisChainConfig is for testing genesis block behavior. // Only has Banff+ upgrades scheduled at future timestamps. GenesisChainConfig = &ChainConfig{ NetworkUpgrades: NetworkUpgrades{ BanffBlockTimestamp: utils.NewUint64(1000), CortinaBlockTimestamp: utils.NewUint64(2000), DurangoBlockTimestamp: utils.NewUint64(3000), EtnaTimestamp: utils.NewUint64(4000), FortunaTimestamp: utils.NewUint64(5000), GraniteTimestamp: utils.NewUint64(6000), }, } // MainnetChainConfig represents Lux mainnet configuration. // All legacy upgrades are active, with modern upgrades scheduled. MainnetChainConfig = TestChainConfig // Legacy test configs - all point to TestChainConfig for backward compatibility // These are kept for tests that still reference them. TestBanffChainConfig = TestChainConfig TestCortinaChainConfig = TestChainConfig TestDurangoChainConfig = TestChainConfig TestEtnaChainConfig = TestChainConfig TestFortunaChainConfig = TestChainConfig TestGraniteChainConfig = TestChainConfig )
Functions ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct {
NetworkUpgrades // Config for timestamps that enable network upgrades.
LuxContext `json:"-"` // Lux specific context set during VM initialization. Not serialized.
UpgradeConfig `json:"-"` // Config specified in upgradeBytes (lux network upgrades or enable/disabling precompiles). Not serialized.
}
func (*ChainConfig) CheckConfigCompatible ¶
func (c *ChainConfig) CheckConfigCompatible(newcfg_ *ethparams.ChainConfig, headNumber *big.Int, headTimestamp uint64) *ethparams.ConfigCompatError
func (*ChainConfig) CheckConfigForkOrder ¶
func (c *ChainConfig) CheckConfigForkOrder() error
func (*ChainConfig) Description ¶
func (c *ChainConfig) Description() string
func (*ChainConfig) EnabledStatefulPrecompiles ¶
func (c *ChainConfig) EnabledStatefulPrecompiles(blockTimestamp uint64) Precompiles
EnabledStatefulPrecompiles returns current stateful precompile configs that are enabled at [blockTimestamp].
func (*ChainConfig) GetActivatingPrecompileConfigs ¶
func (c *ChainConfig) GetActivatingPrecompileConfigs(address common.Address, from *uint64, to uint64, upgrades []PrecompileUpgrade) []precompileconfig.Config
GetActivatingPrecompileConfigs returns all precompile upgrades configured to activate during the state transition from a block with timestamp [from] to a block with timestamp [to].
func (*ChainConfig) GetActivePrecompileConfig ¶
func (c *ChainConfig) GetActivePrecompileConfig(address common.Address, timestamp uint64) precompileconfig.Config
GetActivePrecompileConfig returns the most recent precompile config corresponding to [address]. If none have occurred, returns nil.
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) MarshalJSON ¶
func (c *ChainConfig) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of c.
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.
type LuxContext ¶
type LuxContext struct {
ConsensusCtx *consensusctx.Context
}
LuxContext provides Lux specific context directly into the EVM.
type LuxRules ¶
type LuxRules struct {
// Legacy flags - always true for mainnet
IsApricotPhase1, IsApricotPhase2, IsApricotPhase3, IsApricotPhase4, IsApricotPhase5 bool
IsApricotPhasePre6, IsApricotPhase6, IsApricotPhasePost6 bool
// Active upgrade flags
IsBanff bool
IsCortina bool
IsDurango bool
IsEtna bool
IsFortuna bool
IsGranite bool
// IsGenesis is set to true when processing historic Lux mainnet blocks
// that were created with the original EVM (before network upgrades).
// Genesis blocks have dynamic fees (base fee in header) but special handling.
// This flag is set dynamically based on block context, not from config.
IsGenesis bool
}
LuxRules contains the chain rules for a given block.
type NetworkUpgrades ¶
type NetworkUpgrades struct {
// Banff restricts import/export transactions to LUX.
BanffBlockTimestamp *uint64 `json:"banffBlockTimestamp,omitempty"`
// Cortina increases the block gas limit to 15M.
CortinaBlockTimestamp *uint64 `json:"cortinaBlockTimestamp,omitempty"`
// Durango activates Lux Warp Messaging and the Shanghai Execution
// Spec Upgrade.
DurangoBlockTimestamp *uint64 `json:"durangoBlockTimestamp,omitempty"`
// Etna activates Cancun and reduces the min base fee.
EtnaTimestamp *uint64 `json:"etnaTimestamp,omitempty"`
// Fortuna modifies the gas price mechanism based on ACP-176
FortunaTimestamp *uint64 `json:"fortunaTimestamp,omitempty"`
// Granite is a placeholder for the next upgrade.
GraniteTimestamp *uint64 `json:"graniteTimestamp,omitempty"`
}
NetworkUpgrades tracks the timestamps of Lux network upgrades.
For Lux mainnet, all upgrades through Durango are already active. Only Etna, Fortuna, and Granite may be scheduled for future activation.
Legacy Apricot phases (1-4) are always considered active. For each upgrade, a nil value means the fork hasn't happened and is not scheduled. A pointer to 0 means the fork has already activated.
func GetNetworkUpgrades ¶
func GetNetworkUpgrades(agoUpgrade upgrade.Config) NetworkUpgrades
GetNetworkUpgrades converts an upgrade.Config to NetworkUpgrades.
func (*NetworkUpgrades) CheckNetworkUpgradesCompatible ¶
func (n *NetworkUpgrades) CheckNetworkUpgradesCompatible(newcfg *NetworkUpgrades, time uint64) *ethparams.ConfigCompatError
func (NetworkUpgrades) Description ¶
func (n NetworkUpgrades) Description() string
func (*NetworkUpgrades) Equal ¶
func (n *NetworkUpgrades) Equal(other *NetworkUpgrades) bool
func (*NetworkUpgrades) GetLuxRules ¶
func (n *NetworkUpgrades) GetLuxRules(timestamp uint64) LuxRules
func (NetworkUpgrades) IsApricotPhase1 ¶
func (n NetworkUpgrades) IsApricotPhase1(time uint64) bool
func (NetworkUpgrades) IsApricotPhase2 ¶
func (n NetworkUpgrades) IsApricotPhase2(time uint64) bool
func (*NetworkUpgrades) IsApricotPhase3 ¶
func (n *NetworkUpgrades) IsApricotPhase3(time uint64) bool
func (NetworkUpgrades) IsApricotPhase4 ¶
func (n NetworkUpgrades) IsApricotPhase4(time uint64) bool
func (NetworkUpgrades) IsApricotPhase5 ¶
func (n NetworkUpgrades) IsApricotPhase5(time uint64) bool
func (NetworkUpgrades) IsApricotPhase6 ¶
func (n NetworkUpgrades) IsApricotPhase6(time uint64) bool
func (NetworkUpgrades) IsApricotPhasePost6 ¶
func (n NetworkUpgrades) IsApricotPhasePost6(time uint64) bool
func (NetworkUpgrades) IsApricotPhasePre6 ¶
func (n NetworkUpgrades) IsApricotPhasePre6(time uint64) bool
func (NetworkUpgrades) IsBanff ¶
func (n NetworkUpgrades) IsBanff(time uint64) bool
IsBanff returns whether time represents a block with a timestamp after the Banff upgrade time.
func (NetworkUpgrades) IsCortina ¶
func (n NetworkUpgrades) IsCortina(time uint64) bool
IsCortina returns whether time represents a block with a timestamp after the Cortina upgrade time.
func (NetworkUpgrades) IsDurango ¶
func (n NetworkUpgrades) IsDurango(time uint64) bool
IsDurango returns whether time represents a block with a timestamp after the Durango upgrade time.
func (NetworkUpgrades) IsEtna ¶
func (n NetworkUpgrades) IsEtna(time uint64) bool
IsEtna returns whether time represents a block with a timestamp after the Etna upgrade time.
type PrecompileUpgrade ¶
type PrecompileUpgrade struct {
precompileconfig.Config
}
PrecompileUpgrade is a helper struct embedded in UpgradeConfig. It is used to unmarshal the json into the correct precompile config type based on the key. Keys are defined in each precompile module, and registered in precompile/registry/registry.go.
func (*PrecompileUpgrade) MarshalJSON ¶
func (u *PrecompileUpgrade) MarshalJSON() ([]byte, error)
MarshalJSON marshal the precompile config into json based on the precompile key. Ex: {"feeManagerConfig": {...}} where "feeManagerConfig" is the key
func (*PrecompileUpgrade) UnmarshalJSON ¶
func (u *PrecompileUpgrade) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals the json into the correct precompile config type based on the key. Keys are defined in each precompile module, and registered in precompile/registry/registry.go. Ex: {"feeManagerConfig": {...}} where "feeManagerConfig" is the key
type Precompiles ¶
type Precompiles map[string]precompileconfig.Config
func (*Precompiles) UnmarshalJSON ¶
func (ccp *Precompiles) UnmarshalJSON(data []byte) error
UnmarshalJSON parses the JSON-encoded data into the ChainConfigPrecompiles. ChainConfigPrecompiles is a map of precompile module keys to their configuration.
type Rules ¶
type Rules struct {
// Rules for Lux releases
LuxRules
// Precompiles 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.
Precompiles 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 map addresses to stateful precompile accepter functions
// that are enabled for this rule set.
AccepterPrecompiles map[common.Address]precompileconfig.Accepter
}
func (*Rules) IsPrecompileEnabled ¶
IsPrecompileEnabled returns true if the precompile at `addr` is enabled for this rule set.
func (*Rules) PredicatersExist ¶
type UpgradeConfig ¶
type UpgradeConfig struct {
// Config for enabling and disabling precompiles as network upgrades.
PrecompileUpgrades []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.