mirror of
https://github.com/luxfi/evm.git
synced 2026-09-24 00:27:44 +00:00
style: gofmt the tracked EVM tree
Co-authored-by: Hanzo Dev <[email protected]>
This commit is contained in:
@@ -43,10 +43,10 @@ func (c *cevmExecutor) Backend() EVMBackend { return CppEVM }
|
||||
// wired. The cgo bridge at github.com/luxfi/chains/evm/cevm exposes
|
||||
// ExecuteBlock([]Transaction) — a block-batch interface — but
|
||||
// TransactionExecutor is per-tx. To complete the wiring requires:
|
||||
// * an accumulator that buffers per-tx work and submits at block close
|
||||
// * receipt reconstruction from the BlockResult ordered output
|
||||
// * EIP-2929 warm-set seeding from the StateDB
|
||||
// * parity test against Go EVM Block-STM
|
||||
// - an accumulator that buffers per-tx work and submits at block close
|
||||
// - receipt reconstruction from the BlockResult ordered output
|
||||
// - EIP-2929 warm-set seeding from the StateDB
|
||||
// - parity test against Go EVM Block-STM
|
||||
//
|
||||
// Until that adapter lands, ExecuteTransaction returns (nil, nil)
|
||||
// — the documented "this backend declines; use Go EVM" contract that
|
||||
|
||||
@@ -32,8 +32,8 @@ const cevmCkptHeightKey = "cevm-ckpt-height"
|
||||
|
||||
var (
|
||||
cevmStoreMu sync.Mutex
|
||||
cevmStateStore database.Database // registered by the VM; nil => disk-backed residency off
|
||||
cevmCkptInterval uint64 = 4096 // checkpoint every N blocks (0 disables checkpointing)
|
||||
cevmStateStore database.Database // registered by the VM; nil => disk-backed residency off
|
||||
cevmCkptInterval uint64 = 4096 // checkpoint every N blocks (0 disables checkpointing)
|
||||
)
|
||||
|
||||
// SetCevmResidentStore registers the durable KV the cevm resident StateDB persists
|
||||
|
||||
@@ -395,7 +395,7 @@ func shadowApply(
|
||||
atomic.AddUint64(&cevmApplied, 1)
|
||||
atomic.AddUint64(&cevmResidentApplied, 1)
|
||||
rs.synced = true
|
||||
rs.height = number // resident verified at height N
|
||||
rs.height = number // resident verified at height N
|
||||
persistCheckpoint(rs) // durable, bounded-cadence checkpoint (no-op unless a store is registered)
|
||||
return receipts
|
||||
}
|
||||
|
||||
@@ -77,9 +77,9 @@ func TestCevmShadowVerifiesRealBlocks(t *testing.T) {
|
||||
// (InsertChain -> Process -> parallel.DefaultExecutor().ExecuteBlock), so
|
||||
// this is genuine block execution, not a synthetic fixture.
|
||||
const (
|
||||
nBlocks = 256
|
||||
txper = 3
|
||||
startBal = 1000
|
||||
nBlocks = 256
|
||||
txper = 3
|
||||
startBal = 1000
|
||||
)
|
||||
var nonce uint64
|
||||
blocks, _, err := core.GenerateChain(gspec.Config, chain.Genesis(), engine, db, nBlocks, 10, func(i int, b *core.BlockGen) {
|
||||
|
||||
@@ -15,9 +15,9 @@ package parallel
|
||||
import (
|
||||
"math/big"
|
||||
|
||||
"github.com/luxfi/crypto/secp256k1"
|
||||
"github.com/luxfi/geth/common"
|
||||
"github.com/luxfi/geth/core/types"
|
||||
"github.com/luxfi/crypto/secp256k1"
|
||||
luxgpu "github.com/luxfi/gpu"
|
||||
)
|
||||
|
||||
|
||||
@@ -13,9 +13,9 @@ import (
|
||||
// TestRecoverV_LegacyValid verifies valid legacy V values (27, 28).
|
||||
func TestRecoverV_LegacyValid(t *testing.T) {
|
||||
tests := []struct {
|
||||
v uint64
|
||||
wantID uint8
|
||||
wantOK bool
|
||||
v uint64
|
||||
wantID uint8
|
||||
wantOK bool
|
||||
}{
|
||||
{27, 0, true},
|
||||
{28, 1, true},
|
||||
|
||||
@@ -201,8 +201,8 @@ func TestDexSettle_PrecompileOverride_GatedByActivation(t *testing.T) {
|
||||
func TestDexSettle_PrecompileOverride_NoGlobalRace(t *testing.T) {
|
||||
cfg := params.WithExtra(¶ms.ChainConfig{}, &extras.ChainConfig{})
|
||||
|
||||
a := &LuxPrecompileOverrider{chainConfig: cfg, timestamp: activation} // activation-block replay
|
||||
b := &LuxPrecompileOverrider{chainConfig: cfg, timestamp: activation + 1 << 30} // later block / eth_call
|
||||
a := &LuxPrecompileOverrider{chainConfig: cfg, timestamp: activation} // activation-block replay
|
||||
b := &LuxPrecompileOverrider{chainConfig: cfg, timestamp: activation + 1<<30} // later block / eth_call
|
||||
|
||||
const iters = 2000
|
||||
done := make(chan struct{})
|
||||
|
||||
@@ -100,6 +100,7 @@ func ApplyPrecompileActivations(c *params.ChainConfig, parentTimestamp *uint64,
|
||||
// - later block (parentTimestamp != nil): crossed iff
|
||||
// *parentTimestamp < ActivationTime <= blockTimestamp — the single transition where
|
||||
// the precompile turns on during history replay.
|
||||
//
|
||||
// The marker is therefore written exactly once, deterministically, on every node. An
|
||||
// AlwaysOn module's Configurator is NOT invoked (a system precompile has no activating
|
||||
// config; all params resolve at runtime from the consensus context) — only the marker.
|
||||
|
||||
@@ -37,7 +37,7 @@ func (b *consensusCtxBackend) Engine() consensus.Engine { return nil }
|
||||
func (b *consensusCtxBackend) HeaderByNumber(context.Context, rpc.BlockNumber) (*types.Header, error) {
|
||||
return nil, nil
|
||||
}
|
||||
func (b *consensusCtxBackend) ChainConfig() *params.ChainConfig { return params.TestChainConfig }
|
||||
func (b *consensusCtxBackend) ChainConfig() *params.ChainConfig { return params.TestChainConfig }
|
||||
func (b *consensusCtxBackend) ConsensusContext() context.Context { return b.consensusCtx }
|
||||
|
||||
// bareCtxBackend implements ChainContextBackend but does NOT expose a consensus
|
||||
@@ -54,8 +54,8 @@ func (bareCtxBackend) ChainConfig() *params.ChainConfig { return params.TestChai
|
||||
func TestChainContextConsensusContextReturnsBackendRuntime(t *testing.T) {
|
||||
rt := &runtime.Runtime{
|
||||
NetworkID: 1337,
|
||||
ChainID: ids.ID{0x42},
|
||||
CChainID: ids.ID{0x42},
|
||||
ChainID: ids.ID{0x42},
|
||||
CChainID: ids.ID{0x42},
|
||||
}
|
||||
backendCtx := runtime.WithContext(context.Background(), rt)
|
||||
// A DISTINCT request context with no runtime — the value the buggy path returned.
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ type worker struct {
|
||||
|
||||
// Subscriptions
|
||||
mux *event.TypeMux
|
||||
mu sync.RWMutex // The lock used to protect the coinbase and extra fields
|
||||
mu sync.RWMutex // The lock used to protect the coinbase and extra fields
|
||||
coinbase common.Address
|
||||
clock *mockable.Clock // Allows us mock the clock for testing
|
||||
beaconRoot *common.Hash // Retained for upstream compatibility; set to nil (unused by Lux)
|
||||
|
||||
@@ -18,7 +18,7 @@ func getTestFujiUpgrades() NetworkUpgrades {
|
||||
return NetworkUpgrades{
|
||||
EVMTimestamp: utils.NewUint64(0),
|
||||
DurangoTimestamp: utils.NewUint64(0),
|
||||
QuasarTimestamp: utils.NewUint64(100), // Set for testing
|
||||
QuasarTimestamp: utils.NewUint64(100), // Set for testing
|
||||
FortunaTimestamp: utils.NewUint64(1000),
|
||||
GraniteTimestamp: nil,
|
||||
}
|
||||
@@ -233,7 +233,7 @@ func TestVerifyNetworkUpgrades(t *testing.T) {
|
||||
upgrades: &NetworkUpgrades{
|
||||
EVMTimestamp: utils.NewUint64(0),
|
||||
DurangoTimestamp: utils.NewUint64(0), // Must be 0 since default is 0
|
||||
QuasarTimestamp: utils.NewUint64(0), // Must be 0 for Latest
|
||||
QuasarTimestamp: utils.NewUint64(0), // Must be 0 for Latest
|
||||
FortunaTimestamp: utils.NewUint64(0), // Must be 0 for Latest
|
||||
GraniteTimestamp: utils.NewUint64(0), // Must be 0 for Latest
|
||||
},
|
||||
@@ -300,7 +300,7 @@ func TestVerifyNetworkUpgrades(t *testing.T) {
|
||||
upgrades: &NetworkUpgrades{
|
||||
EVMTimestamp: utils.NewUint64(0),
|
||||
DurangoTimestamp: utils.NewUint64(100),
|
||||
QuasarTimestamp: utils.NewUint64(99),
|
||||
QuasarTimestamp: utils.NewUint64(99),
|
||||
},
|
||||
luxdUpgrades: getTestMainnetConfig(),
|
||||
valid: false,
|
||||
@@ -310,7 +310,7 @@ func TestVerifyNetworkUpgrades(t *testing.T) {
|
||||
upgrades: &NetworkUpgrades{
|
||||
EVMTimestamp: utils.NewUint64(0),
|
||||
DurangoTimestamp: utils.NewUint64(0), // Genesis
|
||||
QuasarTimestamp: utils.NewUint64(500), // Test timestamp
|
||||
QuasarTimestamp: utils.NewUint64(500), // Test timestamp
|
||||
FortunaTimestamp: nil,
|
||||
},
|
||||
luxdUpgrades: getTestFujiConfig(),
|
||||
|
||||
@@ -96,7 +96,7 @@ func TestUpstreamParamsValues(t *testing.T) {
|
||||
"DefaultBaseFeeChangeDenominator": {param: ethparams.DefaultBaseFeeChangeDenominator, want: 8},
|
||||
"DefaultElasticityMultiplier": {param: ethparams.DefaultElasticityMultiplier, want: 2},
|
||||
"InitialBaseFee": {param: ethparams.InitialBaseFee, want: 1000000000},
|
||||
"MaxCodeSize": {param: ethparams.MaxCodeSize, want: 65536}, // Lux raises code size to 64KB (Ethereum: 24576)
|
||||
"MaxCodeSize": {param: ethparams.MaxCodeSize, want: 65536}, // Lux raises code size to 64KB (Ethereum: 24576)
|
||||
"MaxInitCodeSize": {param: ethparams.MaxInitCodeSize, want: 2 * 65536}, // 2x MaxCodeSize
|
||||
"EcrecoverGas": {param: ethparams.EcrecoverGas, want: uint64(3000)},
|
||||
"Sha256BaseGas": {param: ethparams.Sha256BaseGas, want: uint64(60)},
|
||||
|
||||
@@ -36,11 +36,11 @@ const (
|
||||
// u16 version does not equal [Version]. Preserved as an exported sentinel
|
||||
// for callers that switch on it.
|
||||
var (
|
||||
ErrUnknownVersion = errors.New("unknown wire version")
|
||||
ErrCantUnpackVersion = errors.New("couldn't unpack version")
|
||||
ErrCantPackVersion = errors.New("couldn't pack version")
|
||||
ErrUnsupportedType = errors.New("unsupported message type")
|
||||
ErrMaxSliceLenExceeded = errors.New("max message size exceeded")
|
||||
ErrUnknownVersion = errors.New("unknown wire version")
|
||||
ErrCantUnpackVersion = errors.New("couldn't unpack version")
|
||||
ErrCantPackVersion = errors.New("couldn't pack version")
|
||||
ErrUnsupportedType = errors.New("unsupported message type")
|
||||
ErrMaxSliceLenExceeded = errors.New("max message size exceeded")
|
||||
)
|
||||
|
||||
// Manager is the surface every wire-touching peer of this package needs.
|
||||
|
||||
@@ -19,14 +19,14 @@ import (
|
||||
// ============================================
|
||||
// LP-4200 Unified PQCrypto Block (0x012201..0x012208)
|
||||
// ============================================
|
||||
_ "github.com/luxfi/precompile/mlkem" // 0x012201 ML-KEM key encapsulation (FIPS 203)
|
||||
_ "github.com/luxfi/precompile/mldsa" // 0x012202 ML-DSA signature verification (FIPS 204)
|
||||
_ "github.com/luxfi/precompile/slhdsa" // 0x012203 SLH-DSA stateless hash signatures (FIPS 205)
|
||||
_ "github.com/luxfi/precompile/mldsa" // 0x012202 ML-DSA signature verification (FIPS 204)
|
||||
_ "github.com/luxfi/precompile/mlkem" // 0x012201 ML-KEM key encapsulation (FIPS 203)
|
||||
_ "github.com/luxfi/precompile/slhdsa" // 0x012203 SLH-DSA stateless hash signatures (FIPS 205)
|
||||
// 0x012204 Pulsar (Module-LWE threshold FIPS 204) imported below under Threshold
|
||||
_ "github.com/luxfi/precompile/p3q" // 0x012205 P3Q — LP-218 Post-Quantum Pulsar Proof — Solidity-callable Pulsar verifier
|
||||
_ "github.com/luxfi/precompile/p3q" // 0x012205 P3Q — LP-218 Post-Quantum Pulsar Proof — Solidity-callable Pulsar verifier
|
||||
// 0x012206 Corona (Ring-LWE threshold) imported below under Threshold
|
||||
_ "github.com/luxfi/precompile/magnetar" // 0x012207 Magnetar (public-DKG MPC threshold SLH-DSA, FIPS 205 byte-equal)
|
||||
_ "github.com/luxfi/precompile/hqc" // 0x012208 HQC (code-based KEM, family-disjoint backup)
|
||||
_ "github.com/luxfi/precompile/magnetar" // 0x012207 Magnetar (public-DKG MPC threshold SLH-DSA, FIPS 205 byte-equal)
|
||||
_ "github.com/luxfi/precompile/starkfri" // 0x012220 STARK-FRI strict-PQ STARK verifier (formerly misnamed P3Q at 0x012205)
|
||||
|
||||
// ============================================
|
||||
@@ -42,8 +42,8 @@ import (
|
||||
// Threshold Signatures (0x0800-0x08FF)
|
||||
// ============================================
|
||||
_ "github.com/luxfi/precompile/cggmp21" // CGGMP21 threshold ECDSA
|
||||
_ "github.com/luxfi/precompile/frost" // FROST threshold Schnorr
|
||||
_ "github.com/luxfi/precompile/corona" // 0x012206 Corona (Ring-LWE threshold, FIPS-equivalent)
|
||||
_ "github.com/luxfi/precompile/frost" // FROST threshold Schnorr
|
||||
_ "github.com/luxfi/precompile/pulsar" // 0x012204 Pulsar (Module-LWE threshold FIPS 204)
|
||||
|
||||
// ============================================
|
||||
@@ -61,8 +61,8 @@ import (
|
||||
// AI Mining (0x0300-0x03FF)
|
||||
// ============================================
|
||||
_ "github.com/luxfi/precompile/ai" // AI mining + atomic cross-chain mint (0x0300..00)
|
||||
_ "github.com/luxfi/precompile/modelregistry" // Versioned model-commitment registry (0x0300..02)
|
||||
_ "github.com/luxfi/precompile/inference" // Deterministic on-chain int8 inference (0x0300..03)
|
||||
_ "github.com/luxfi/precompile/modelregistry" // Versioned model-commitment registry (0x0300..02)
|
||||
|
||||
// ============================================
|
||||
// DEX (LP-9xxx) - QuantumSwap Native DEX
|
||||
@@ -92,22 +92,22 @@ import (
|
||||
// upgrade.json — without this the parser rejects the activation with
|
||||
// "unknown precompile config".
|
||||
// ============================================
|
||||
_ "github.com/luxfi/precompile/attestation" // attestationConfig
|
||||
_ "github.com/luxfi/precompile/babyjubjub" // babyjubjubConfig
|
||||
_ "github.com/luxfi/precompile/bls12381" // bls12381{G1,G2}{Add,Mul,MSM}Config + bls12381PairingConfig
|
||||
_ "github.com/luxfi/precompile/bridge" // bridgeRegistrarConfig
|
||||
_ "github.com/luxfi/precompile/compute" // computeMarketConfig
|
||||
_ "github.com/luxfi/precompile/curve25519" // curve25519Config
|
||||
_ "github.com/luxfi/precompile/ed25519" // ed25519Config
|
||||
_ "github.com/luxfi/precompile/math" // fixedPointMathConfig
|
||||
_ "github.com/luxfi/precompile/pasta" // pastaConfig
|
||||
_ "github.com/luxfi/precompile/pedersen" // pedersenConfig
|
||||
_ "github.com/luxfi/precompile/poseidon" // poseidonConfig
|
||||
_ "github.com/luxfi/precompile/sr25519" // sr25519Verify
|
||||
_ "github.com/luxfi/precompile/stableswap" // stableSwapConfig
|
||||
_ "github.com/luxfi/precompile/vrf" // vrfConfig
|
||||
_ "github.com/luxfi/precompile/x25519" // x25519Config
|
||||
_ "github.com/luxfi/precompile/xwing" // xwingConfig
|
||||
_ "github.com/luxfi/precompile/attestation" // attestationConfig
|
||||
_ "github.com/luxfi/precompile/babyjubjub" // babyjubjubConfig
|
||||
_ "github.com/luxfi/precompile/bls12381" // bls12381{G1,G2}{Add,Mul,MSM}Config + bls12381PairingConfig
|
||||
_ "github.com/luxfi/precompile/bridge" // bridgeRegistrarConfig
|
||||
_ "github.com/luxfi/precompile/compute" // computeMarketConfig
|
||||
_ "github.com/luxfi/precompile/curve25519" // curve25519Config
|
||||
_ "github.com/luxfi/precompile/ed25519" // ed25519Config
|
||||
_ "github.com/luxfi/precompile/math" // fixedPointMathConfig
|
||||
_ "github.com/luxfi/precompile/pasta" // pastaConfig
|
||||
_ "github.com/luxfi/precompile/pedersen" // pedersenConfig
|
||||
_ "github.com/luxfi/precompile/poseidon" // poseidonConfig
|
||||
_ "github.com/luxfi/precompile/sr25519" // sr25519Verify
|
||||
_ "github.com/luxfi/precompile/stableswap" // stableSwapConfig
|
||||
_ "github.com/luxfi/precompile/vrf" // vrfConfig
|
||||
_ "github.com/luxfi/precompile/x25519" // x25519Config
|
||||
_ "github.com/luxfi/precompile/xwing" // xwingConfig
|
||||
)
|
||||
|
||||
// LP-ALIGNED ADDRESSING (LP-9015):
|
||||
|
||||
@@ -25,9 +25,9 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
errShortBuffer = errors.New("predicate: short buffer")
|
||||
errBadVersion = errors.New("predicate: invalid version")
|
||||
errTooLarge = errors.New("predicate: results exceed MaxResultsSize")
|
||||
errShortBuffer = errors.New("predicate: short buffer")
|
||||
errBadVersion = errors.New("predicate: invalid version")
|
||||
errTooLarge = errors.New("predicate: results exceed MaxResultsSize")
|
||||
)
|
||||
|
||||
// TxResults is a map of results for each precompile address to the resulting byte array.
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
|
||||
"github.com/holiman/uint256"
|
||||
"github.com/luxfi/evm/utils/utilstest"
|
||||
"github.com/luxfi/utils/wrappers"
|
||||
"github.com/luxfi/geth/core/types"
|
||||
"github.com/luxfi/geth/trie"
|
||||
"github.com/luxfi/geth/trie/trienode"
|
||||
"github.com/luxfi/geth/triedb"
|
||||
"github.com/luxfi/utils/wrappers"
|
||||
|
||||
"github.com/luxfi/geth/common"
|
||||
"github.com/luxfi/geth/ethdb"
|
||||
|
||||
@@ -13,12 +13,12 @@ import (
|
||||
"github.com/luxfi/evm/plugin/evm/customrawdb"
|
||||
syncclient "github.com/luxfi/evm/sync/client"
|
||||
"github.com/luxfi/evm/utils"
|
||||
"github.com/luxfi/utils/wrappers"
|
||||
"github.com/luxfi/geth/common"
|
||||
"github.com/luxfi/geth/core/rawdb"
|
||||
"github.com/luxfi/geth/ethdb"
|
||||
"github.com/luxfi/geth/trie"
|
||||
log "github.com/luxfi/log"
|
||||
"github.com/luxfi/utils/wrappers"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user