mirror of
https://github.com/luxfi/dex.git
synced 2026-09-24 00:26:31 +00:00
test(dchain): fix CGO-on test build + sync canonical zap go.sum
poolIDForSymbol was defined only in localnet_e2e_test.go (//go:build !cgo) but read_test.go (no build tag) used it, so the package test binary failed to compile under CGO_ENABLED=1 (undefined: poolIDForSymbol). Move the helper to an untagged poolid_helper_test.go — it is pure-Go (a byte copy) and belongs in both test binaries. Both CGO_ENABLED=1 (read/purity) and CGO_ENABLED=0 (venue/4-path/ ingest/conservation) suites now compile and pass. go.sum: luxfi/zap v0.8.10 content hash updated to the canonical registry hash (h1:QKNTAsenkke+...) after an upstream re-tag; 'go mod verify' = all modules verified. Regenerated, not bypassed.
This commit is contained in:
@@ -286,7 +286,7 @@ github.com/luxfi/vm v1.2.5 h1:L1etY/gh68f9tns1BtyDUpZcBVqc3Ng1mqU3n38GyLo=
|
||||
github.com/luxfi/vm v1.2.5/go.mod h1:TCCg4lDcQFCjxaxfXnxPIrpRSVAyyf2ucT4A4w654Hg=
|
||||
github.com/luxfi/warp v1.19.5 h1:vigIDV4JxLz8bLxQ97dOIcZVM9FAXHmrKdmIh+/WWvk=
|
||||
github.com/luxfi/warp v1.19.5/go.mod h1:t5upY5vhKvjapImmUsgPUlW8C8LZhvQpQg5WzAitQs0=
|
||||
github.com/luxfi/zap v0.8.10 h1:z3tvD+2XnGJ6NhYTuZwvA9UdsUbDpXn8qbeAcoRSXXs=
|
||||
github.com/luxfi/zap v0.8.10 h1:QKNTAsenkke+qQw/QGHVdVZdV48bzbPkoXq5SDCPhs0=
|
||||
github.com/luxfi/zap v0.8.10/go.mod h1:JfqII8VtVQYLLTX6obU1DP9sjGqf9L24vfug5ifh0b8=
|
||||
github.com/luxfi/zapcodec v1.0.1 h1:pRxLxCOi6uihQMg8A8riDjNjefU2cXZxfRVZ+obeuL8=
|
||||
github.com/luxfi/zapcodec v1.0.1/go.mod h1:txrRt2JK4O76ssTxlXIwoNVsgzyZVL0ES4mlXqGNogs=
|
||||
|
||||
@@ -57,18 +57,9 @@ import (
|
||||
"github.com/luxfi/rpc"
|
||||
)
|
||||
|
||||
// poolIDForSymbol derives a deterministic 32-byte poolId from a market symbol.
|
||||
// The real V4 poolId is keccak256(PoolKey); for the venue e2e any stable,
|
||||
// collision-free 32-byte identity is sufficient (the d-chain keys markets by the
|
||||
// raw 32 bytes). We embed the ASCII symbol so logs are human-readable and two
|
||||
// distinct symbols map to two distinct books.
|
||||
func poolIDForSymbol(sym string) [32]byte {
|
||||
var p [32]byte
|
||||
copy(p[:], sym)
|
||||
// Tag the high byte so an all-symbol-prefix pool can't collide with a zero id.
|
||||
p[31] = 0xD0
|
||||
return p
|
||||
}
|
||||
// poolIDForSymbol lives in poolid_helper_test.go (untagged): it is shared with
|
||||
// the always-built read RPC tests and is pure-Go, so it must compile in both the
|
||||
// cgo and !cgo test binaries.
|
||||
|
||||
// venue is a booted standalone D-Chain venue: an on-disk VM + real ZAP socket +
|
||||
// auto-sealer, plus the dial address. dir is the zapdb path so a restart can
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
||||
// See the file LICENSE for licensing terms.
|
||||
|
||||
// No build tag: this helper is shared by both the !cgo venue e2e
|
||||
// (localnet_e2e_test.go, fourpath_e2e_test.go) AND the always-built read RPC
|
||||
// tests (read_test.go). It is pure-Go (a byte copy), so it belongs in the
|
||||
// package's default test binary — keeping it in a !cgo-only file made the
|
||||
// untagged read_test.go fail to compile under CGO_ENABLED=1.
|
||||
package dchain
|
||||
|
||||
// poolIDForSymbol derives a deterministic 32-byte poolId from a market symbol.
|
||||
// The real V4 poolId is keccak256(PoolKey); for tests any stable, collision-free
|
||||
// 32-byte identity is sufficient (the d-chain keys markets by the raw 32 bytes).
|
||||
// We embed the ASCII symbol so logs are human-readable and two distinct symbols
|
||||
// map to two distinct books; the high byte is tagged so an all-symbol-prefix pool
|
||||
// can't collide with a zero id.
|
||||
func poolIDForSymbol(sym string) [32]byte {
|
||||
var p [32]byte
|
||||
copy(p[:], sym)
|
||||
p[31] = 0xD0
|
||||
return p
|
||||
}
|
||||
Reference in New Issue
Block a user