Files
dex/pkg/dchain/poolid_helper_test.go
zeekay 6c088ef199 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.
2026-06-25 15:10:07 -07:00

23 lines
1.0 KiB
Go

// 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
}