mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
Bumps luxfi/geth pin to v1.16.90 to pull in the PQ profile gate (refuse(Op) at every classical precompile) and the restored p3q + pulsar registrations. Transitively bumps luxfi/precompile to v0.5.16. Additional fixes: - core/genesis.go: skip WithdrawalsHash on genesis block to preserve the canonical Lux mainnet genesis hash (chain ID 96369) under Durango fork activation. - params/config_extra.go: surface SetEthUpgrades errors with os.Stderr context for boot diagnostics. - precompile/contracts/warp/module.go + precompile/modules/registerer.go: housekeeping. Removed stale .bak files.
64 lines
2.1 KiB
Go
64 lines
2.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package warp
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/luxfi/evm/precompile/contract"
|
|
"github.com/luxfi/evm/precompile/modules"
|
|
"github.com/luxfi/evm/precompile/precompileconfig"
|
|
|
|
"github.com/luxfi/geth/common"
|
|
)
|
|
|
|
var _ contract.Configurator = (*configurator)(nil)
|
|
|
|
// ConfigKey is the key used in json config files to specify this precompile config.
|
|
// must be unique across all precompiles.
|
|
const ConfigKey = "warpConfig"
|
|
|
|
// Canonical Lux Warp Messaging precompile address (legacy coreth-compatible).
|
|
// Must match the address used by historical mainnet genesis (chain ID 96369);
|
|
// changing this breaks genesis-hash compatibility for the canonical chain.
|
|
var ContractAddress = common.HexToAddress("0x0200000000000000000000000000000000000005")
|
|
|
|
// Module is the precompile module. It is used to register the precompile contract.
|
|
var Module = modules.Module{
|
|
ConfigKey: ConfigKey,
|
|
Address: ContractAddress,
|
|
Contract: WarpPrecompile,
|
|
Configurator: &configurator{},
|
|
}
|
|
|
|
type configurator struct{}
|
|
|
|
func init() {
|
|
// Register the precompile module.
|
|
// Each precompile contract registers itself through [RegisterModule] function.
|
|
if err := modules.RegisterModule(Module); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
// MakeConfig returns a new precompile config instance.
|
|
// This is required to Marshal/Unmarshal the precompile config.
|
|
func (*configurator) MakeConfig() precompileconfig.Config {
|
|
return new(Config)
|
|
}
|
|
|
|
// MakeGenesisConfig returns a precompile config for genesis activation (timestamp = 0).
|
|
func (*configurator) MakeGenesisConfig() precompileconfig.Config {
|
|
var zero uint64
|
|
return NewDefaultConfig(&zero)
|
|
}
|
|
|
|
// Configure is a no-op for warp since it does not need to store any information in the state
|
|
func (*configurator) Configure(chainConfig precompileconfig.ChainConfig, cfg precompileconfig.Config, state contract.StateDB, _ contract.ConfigurationBlockContext) error {
|
|
if _, ok := cfg.(*Config); !ok {
|
|
return fmt.Errorf("expected config type %T, got %T: %v", &Config{}, cfg, cfg)
|
|
}
|
|
return nil
|
|
}
|