mirror of
https://github.com/luxfi/chains.git
synced 2026-09-24 00:26:00 +00:00
VM consolidation (one module, one place only):
- Removed per-VM go.mod/go.sum/VERSION from {aivm,bridgevm,dexvm,evm,
graphvm,identityvm,keyvm,oraclevm,quantumvm,relayvm,thresholdvm,zkvm}
- All VMs now compile under github.com/luxfi/chains root module
- aivm/, dexvm/, identityvm/, keyvm/, oraclevm/ factory.go + vm.go updated
for AccelHost wiring
cevm Go-side (evm/cevm/):
- cevm.go, cevm_cgo.go, cevm_nocgo.go: ExecuteBlockV4(backend, threads,
txs, ctx, state) with StateAccount snapshot
- cevm_secp256k1.go: BatchRecoverSenders Metal LDFLAGS
- cevm_secp256k1_metal_anchor_darwin.{c,go}: anchor to keep linker from
dropping libsecp256k1_metal.a
- cevm_secp256k1_nocgo.go: stub for non-cgo builds
- plugin.go, fetch-luxcpp.sh, luxcpp-SHA256SUMS, LUXCPP_VERSION:
pinned luxcpp consumption
- evm/cevm/parallel/parallel.go: BlockExecutor adapter calls
cevm.ExecuteBlockV4 with state snapshot built from txs+statedb
Quantum/ZK witness:
- quantumvm/quasar_witness.go, zkvm/zwitness.go
go.mod: removed dead `replace github.com/ethereum/go-ethereum => luxfi/geth`
directive (caused dual-path conflict after math semver bump; no remaining
ethereum/go-ethereum imports in source). go mod tidy clean.
Tests: TestBatchRecoverSenders PASS through Metal anchor (cevm package).
59 lines
1.8 KiB
Go
59 lines
1.8 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
// Package dexvm implements a high-performance decentralized exchange VM
|
|
// for the Lux blockchain network.
|
|
//
|
|
// The DEX VM provides:
|
|
// - Central Limit Order Book (CLOB) trading with nanosecond price updates
|
|
// - Automated Market Maker (AMM) liquidity pools
|
|
// - Cross-chain atomic swaps via Warp messaging
|
|
// - 200ms block times for high-frequency trading
|
|
// - LX-First arbitrage strategy support
|
|
//
|
|
// Architecture:
|
|
// - Uses Quasar consensus (BLS + Corona + ML-DSA) for finality
|
|
// - Integrates with Warp 1.5 for cross-chain messaging
|
|
// - Supports both spot and perpetual trading
|
|
// - Designed for institutional-grade performance
|
|
package dexvm
|
|
|
|
import (
|
|
"github.com/luxfi/accel"
|
|
"github.com/luxfi/chains/dexvm/config"
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/log"
|
|
"github.com/luxfi/node/vms"
|
|
)
|
|
|
|
var (
|
|
// VMID is the unique identifier for the DEX VM
|
|
VMID = ids.ID{'d', 'e', 'x', 'v', 'm'}
|
|
|
|
_ vms.Factory = (*Factory)(nil)
|
|
)
|
|
|
|
// Factory creates new DEX VM instances.
|
|
type Factory struct {
|
|
config.Config
|
|
}
|
|
|
|
// New implements vms.Factory interface.
|
|
// It creates a new DEX ChainVM instance with the factory's configuration.
|
|
// The ChainVM wrapper implements block.ChainVM for integration with the chains manager.
|
|
// Allocates a per-VM GPU session at PriorityHigh because the DEX hot path
|
|
// is latency-critical (1ms block times).
|
|
func (f *Factory) New(logger log.Logger) (interface{}, error) {
|
|
sess, err := accel.NewVMSession("dexvm", accel.WithPriority(accel.PriorityHigh))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
// Create the ChainVM wrapper which implements block.ChainVM
|
|
chainVM := NewChainVM(logger)
|
|
// Apply factory config to inner VM
|
|
chainVM.inner.Config = f.Config
|
|
chainVM.inner.accel = sess
|
|
return chainVM, nil
|
|
}
|