modules

package
v1.104.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2026 License: GPL-3.0, LGPL-3.0, LGPL-3.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllGenesisPrecompiles added in v0.8.33

func AllGenesisPrecompiles() map[string]interface{}

AllGenesisPrecompiles returns a map of all registered precompile configs configured for genesis activation (timestamp = 0). This is used to populate the genesisPrecompiles field in ChainConfig for deterministic genesis hash.

func RegisterBridgedModule added in v0.8.38

func RegisterBridgedModule(stm Module) error

RegisterBridgedModule registers a module bridged from the external precompile registry. It skips the reserved address range check because external precompiles use their own address scheme (LP-aligned, burn addresses, etc.).

func RegisterModule

func RegisterModule(stm Module) error

RegisterModule registers a stateful precompile module

func ReservedAddress

func ReservedAddress(addr common.Address) bool

ReservedAddress returns true if [addr] is in a reserved range for custom precompiles

Types

type Module

type Module struct {
	// ConfigKey is the key used in json config files to specify this precompile config.
	ConfigKey string
	// Address returns the address where the stateful precompile is accessible.
	Address common.Address
	// Contract returns a thread-safe singleton that can be used as the StatefulPrecompiledContract when
	// this config is enabled.
	Contract contract.StatefulPrecompiledContract
	// Configurator is used to configure the stateful precompile when the config is enabled.
	contract.Configurator
	// AlwaysOn marks a precompile that is a SYSTEM precompile activated by the Lux
	// protocol on every chain with NO per-network config entry (neither a genesis-inlined
	// precompile nor a precompileUpgrades timestamp). It takes no per-network parameters
	// and resolves everything from the runtime (consensus context / atomic state). The DEX
	// settlement precompile (0x9999) is the canonical case. An always-on module's
	// Configurator is never invoked (no activating config); the host installs its
	// EXTCODESIZE marker and dispatches Run. Bridged from
	// github.com/luxfi/precompile/modules.Module.AlwaysOn.
	AlwaysOn bool
	// ActivationTime is the protocol timestamp at which an AlwaysOn system precompile
	// becomes present (EXTCODESIZE marker installed + Run dispatched) on every Lux chain.
	// It is NOT per-network config — it is a protocol constant, the analog of a fork
	// timestamp, applied uniformly. The zero value means "present from genesis" (the
	// historical always-on behavior). A non-zero value means the precompile is ABSENT
	// before that timestamp and activates at the block transition crossing it — exactly
	// like a dated fork — so a chain whose genesis predates ActivationTime does NOT carry
	// the precompile in its genesis state (preserving that chain's original genesis hash),
	// and the precompile activates later during history replay at the crossing block.
	// Ignored unless AlwaysOn is set. Set by the registry bridge, not the JSON config.
	ActivationTime uint64
}

func AlwaysOnModules added in v1.99.32

func AlwaysOnModules() []Module

AlwaysOnModules returns the registered modules marked AlwaysOn — system precompiles activated by the Lux protocol on every chain with NO config entry (independent of genesisPrecompiles / precompileUpgrades). The host activates each at its Module.ActivationTime — installing the EXTCODESIZE marker on the block transition that crosses it (genesis iff ActivationTime <= the genesis timestamp) and dispatching Run only at/after it — so a chain born before ActivationTime keeps its original genesis. Deterministic address order.

func GetPrecompileModule

func GetPrecompileModule(key string) (Module, bool)

func GetPrecompileModuleByAddress

func GetPrecompileModuleByAddress(address common.Address) (Module, bool)

func RegisteredModules

func RegisteredModules() []Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL