mirror of
https://github.com/luxfi/coreth.git
synced 2026-10-30 17:00:51 +00:00
- Add post-quantum signature verification precompiles: - ML-DSA (FIPS 204) at address 0x0f - SLH-DSA (FIPS 205) at address 0x10 - Falcon at address 0x11 - ML-KEM key encapsulation at address 0x12 - Add api_lux.go with Lux-specific API extensions - Add precompile infrastructure from SubnetEVM: - allowlist module - contract interfaces - precompile config and modules - Update crypto dependency to v1.17.9 (with VerifySignature API) - Remove local replace directives for CI compatibility - Update import paths across 230+ files to use luxfi/crypto
59 lines
2.5 KiB
Go
59 lines
2.5 KiB
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
// Defines the stateless interface for unmarshalling an arbitrary config of a precompile
|
|
package precompileconfig
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/luxfi/geth/common"
|
|
)
|
|
|
|
// StatefulPrecompileConfig defines the interface for a stateful precompile to
|
|
// be enabled via a network upgrade.
|
|
type Config interface {
|
|
// Key returns the unique key for the stateful precompile.
|
|
Key() string
|
|
// Timestamp returns the timestamp at which this stateful precompile should be enabled.
|
|
// 1) 0 indicates that the precompile should be enabled from genesis.
|
|
// 2) n indicates that the precompile should be enabled in the first block with timestamp >= [n].
|
|
// 3) nil indicates that the precompile is never enabled.
|
|
Timestamp() *uint64
|
|
// IsDisabled returns true if this network upgrade should disable the precompile.
|
|
IsDisabled() bool
|
|
// Equal returns true if the provided argument configures the same precompile with the same parameters.
|
|
Equal(Config) bool
|
|
// Verify is called on startup and an error is treated as fatal. Configure can assume the Config has passed verification.
|
|
Verify(ChainConfig) error
|
|
}
|
|
|
|
// ChainContext defines an interface that provides information to a stateful precompile
|
|
// about the chain configuration. The precompile can access this information to initialize
|
|
// its state.
|
|
type ChainConfig interface {
|
|
// GetFeeConfig returns the original FeeConfig that was set in the genesis.
|
|
GetFeeConfig() FeeConfig
|
|
// AllowedFeeRecipients returns true if fee recipients are allowed in the genesis.
|
|
AllowedFeeRecipients() bool
|
|
// IsDurango returns true if the time is after Durango.
|
|
IsDurango(time uint64) bool
|
|
}
|
|
|
|
// FeeConfig specifies the fee parameters for a chain
|
|
type FeeConfig struct {
|
|
GasLimit *big.Int `json:"gasLimit"`
|
|
TargetBlockRate uint64 `json:"targetBlockRate"`
|
|
MinBaseFee *big.Int `json:"minBaseFee"`
|
|
TargetGas *big.Int `json:"targetGas"`
|
|
BaseFeeChangeDenominator *big.Int `json:"baseFeeChangeDenominator"`
|
|
MinBlockGasCost *big.Int `json:"minBlockGasCost"`
|
|
MaxBlockGasCost *big.Int `json:"maxBlockGasCost"`
|
|
BlockGasCostStep *big.Int `json:"blockGasCostStep"`
|
|
}
|
|
|
|
// Accepter is an optional interface for StatefulPrecompiledContracts to implement.
|
|
// If implemented, Accept will be called for every log with the address of the precompile when the block is accepted.
|
|
type Accepter interface {
|
|
Accept(blockHash common.Hash, blockNumber uint64, txHash common.Hash, logIndex int, topics []common.Hash, logData []byte) error
|
|
} |