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) GetLuxRules(timestamp uint64) LuxRules
- 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 PrecompileUpgrade
- type Precompiles
- type Rules
- type UpgradeConfig
Constants ¶
This section is empty.
Variables ¶
var ( // TestChainConfig is the canonical Lux C-Chain config with every upgrade // active from genesis. Under activate-all-implicitly there is no difference // between a "test" and a "main" config: callers that need a chain config // get this. TestChainConfig = &ChainConfig{} // MainnetChainConfig is an alias for TestChainConfig; the production // chain runs the same activate-all-implicitly rule set. MainnetChainConfig = TestChainConfig // GenesisChainConfig is retained as the same canonical config; the // activate-all-implicitly directive deletes the "blocks before fork X" // genesis flavor entirely. GenesisChainConfig = TestChainConfig )
Functions ¶
Types ¶
type ChainConfig ¶
type ChainConfig struct {
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
CheckConfigForkOrder is a no-op under activate-all-implicitly: there is no ordering to enforce because every upgrade is live from genesis.
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) GetLuxRules ¶ added in v1.22.1
func (c *ChainConfig) GetLuxRules(timestamp uint64) LuxRules
GetLuxRules returns the canonical Lux chain rules at the given block timestamp. The only runtime axis left is the genesis-block discriminator, used by historic-mainnet gas-accounting paths.
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 {
IsGenesis bool
}
LuxRules carries the only chain rule that still varies at runtime: whether the header is the genesis block. Every prior upgrade-gating field was deleted under the activate-all-implicitly directive — all upgrades are live from rule-set unconditionally.
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.