dexvm: dexcore → dex rename (dex/pkg/dexcore → dex/pkg/dex)

This commit is contained in:
2026-06-25 23:15:44 -07:00
parent f5e958cc95
commit e44493230e
+6 -6
View File
@@ -12,20 +12,20 @@ import (
// asset_golden_test.go is the registry side of the CANONICAL cross-home golden KAT
// (MED-1). It asserts that registry.DeriveAssetID reproduces the EXACT 32-byte AssetID
// bytes that dexcore.DeriveAssetID asserts in luxfi/dex pkg/dexcore (assetid_test.go,
// bytes that dex.DeriveAssetID asserts in luxfi/dex pkg/dex (assetid_test.go,
// AssetIDGoldenVectors). The two homes derive the SAME id from the SAME fields by sharing
// the byte-identical preimage discipline (domain tag "lux:dex:asset:v1", length-prefixed
// SHA-256 fold, wire-pinned kind bytes). Pinning the IDENTICAL expected bytes in BOTH
// suites locks the resolve<->register equivalence the DEX value path depends on: a
// registered AssetID (here) and a swap-derived AssetID (dexcore, via the 0x9999 resolver)
// registered AssetID (here) and a swap-derived AssetID (dex, via the 0x9999 resolver)
// name the SAME asset by the SAME id. If either home's discipline drifts, BOTH KATs fail —
// a real consensus-identity divergence caught in CI, never in prod.
//
// These vectors are BYTE-FOR-BYTE the dexcore vectors: networkID=2, source chain id all
// These vectors are BYTE-FOR-BYTE the dex vectors: networkID=2, source chain id all
// 0x11, the three kinds. Do NOT edit a vector to make a test pass — a changed id is a fork.
// goldenChainAllOnes is the fixed 32-byte source chain id (every byte 0x11) the golden
// vectors are generated against — identical to dexcore's chainAllOnes().
// vectors are generated against — identical to dex's chainAllOnes().
func goldenChainAllOnes() ids.ID {
var c ids.ID
for i := range c {
@@ -46,7 +46,7 @@ func TestAssetID_GoldenKAT_MatchesDexcore(t *testing.T) {
name string
kind AssetKind
ref []byte
want string // BYTE-IDENTICAL to dexcore.AssetIDGoldenVectors
want string // BYTE-IDENTICAL to dex.AssetIDGoldenVectors
}{
{"ERC20/addr..01", AssetKindERC20, erc20, "dc392784b1b0764f885a2b24786850dae0a221fe7eaa218065ac1497473fa868"},
{"EVM_NATIVE/marker", AssetKindEVMNative, EVMNativeMarker, "5941ecf871f909bac11b9b3d34fff1d05c7a0182f3a1c5b905ee6059dbb6dc72"},
@@ -59,7 +59,7 @@ func TestAssetID_GoldenKAT_MatchesDexcore(t *testing.T) {
t.Fatalf("%s: derive: %v", v.name, err)
}
if h := hex.EncodeToString(got[:]); h != v.want {
t.Fatalf("%s: registry AssetID diverged from the dexcore golden KAT:\n got %s\n want %s", v.name, h, v.want)
t.Fatalf("%s: registry AssetID diverged from the dex golden KAT:\n got %s\n want %s", v.name, h, v.want)
}
}
}