mirror of
https://github.com/luxfi/dex.git
synced 2026-10-30 14:45:46 +00:00
NEW pkg/zapwire: pure-Go leaf holding the frozen CLOB ZAP frame (Submit=66/Place=65/ Cancel=40/EnsureMarket=32/Ack=24, FillWireSize=17, float64 codec) so the public precompile imports the wire format without the cgo/GPU engine. SubmitMarketable (IOC taker): removed time.Now()+atomic.AddUint64 from the consensus path; trade ts derives from block-derived order ts; fills carry maker+taker identity. zap_server.go docstring demoted authority-> gateway. nocgo: verifyOrdersCPU returns nil for empty. Verified pkg/zapwire 6/6, full ./... green.
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build !cgo
|
|
|
|
// dexvm_gpu_nocgo.go — nocgo stub for the GPU plugin bridge.
|
|
//
|
|
// When CGO_ENABLED=0 the dlopen path in dexvm_gpu.go is unreachable,
|
|
// so every public method returns ErrGPUNotAvailable and AutoBackend()
|
|
// reports GPUBackendNone. The package surface is identical to the
|
|
// cgo build — consumers compile unconditionally and branch on
|
|
// AutoBackend() at runtime.
|
|
|
|
package lxgpu
|
|
|
|
// AutoBackend reports GPUBackendNone under !cgo — dlopen is unreachable.
|
|
func AutoBackend() GPUBackend { return GPUBackendNone }
|
|
|
|
// GPUPluginPath returns "" under !cgo — no plugin was loaded.
|
|
func GPUPluginPath() string { return "" }
|
|
|
|
// CLOBArena is a zero-sized opaque type so the package surface
|
|
// compiles uniformly under both build tags. The nocgo build never
|
|
// returns a non-nil arena from ArenaCreate.
|
|
type CLOBArena struct{}
|
|
|
|
// AMMSwap returns ErrGPUNotAvailable under !cgo.
|
|
func AMMSwap(reserves []LuxAmmReservePair, amounts []uint64) ([]uint64, error) {
|
|
_ = reserves
|
|
_ = amounts
|
|
return nil, ErrGPUNotAvailable
|
|
}
|
|
|
|
// ArenaCreate returns ErrGPUNotAvailable under !cgo.
|
|
func ArenaCreate() (*CLOBArena, error) {
|
|
return nil, ErrGPUNotAvailable
|
|
}
|
|
|
|
// ArenaDestroy returns ErrGPUNotAvailable under !cgo. A nil arena is
|
|
// still a no-op for symmetry with the cgo build.
|
|
func ArenaDestroy(a *CLOBArena) error {
|
|
if a == nil {
|
|
return nil
|
|
}
|
|
return ErrGPUNotAvailable
|
|
}
|
|
|
|
// CLOBMatch returns ErrGPUNotAvailable under !cgo.
|
|
func CLOBMatch(a *CLOBArena, calldata []byte) (out [LuxCLOBOutLen]byte, numFills uint32, err error) {
|
|
_ = a
|
|
_ = calldata
|
|
return out, 0, ErrGPUNotAvailable
|
|
}
|