Skip to content

Commit 5eaed7b

Browse files
authored
test(dgb): pin assembled sharechain isolation primitives vs oracle (#316)
make_coin_params() identifier_hex/prefix_hex (and active_*() selectors) are now KAT-pinned to the DGB oracle frstrtr/p2pool-dgb-scrypt on both nets. OracleSharechainIdentity already guards the PoolConfig constants; this guards the params.hpp assembly layer + selectors -- the regression where the constant is correct but the wiring drops/swaps it. 3-bucket: identifier_hex/prefix_hex are BUCKET-1 isolation primitives -- kept per-coin/per-instance in v36 AND v37, never standardized. The comment records the trap so a future cross-coin sweep cannot silently collapse DGB onto the LTC sharechain namespace. test-only, no prod change. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
1 parent ca7c7dc commit 5eaed7b

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

src/impl/dgb/test/share_test.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,35 @@ TEST(DGB_share_test, OracleAddressAndRelayParams)
280280
EXPECT_EQ(test.bech32_hrp, "dgbt");
281281
}
282282

283+
// -- Sharechain isolation-primitive SSOT KAT (assembled CoinParams) ----------
284+
// Pins the two network-namespacing values make_coin_params() hands the pool --
285+
// identifier_hex (sharechain IDENTIFIER) and prefix_hex (P2P message PREFIX) --
286+
// against the DGB oracle frstrtr/p2pool-dgb-scrypt, on BOTH nets. These are the
287+
// peer/sharechain namespacing + multi-instance isolation boundary.
288+
//
289+
// 3-bucket rule (v36 standardization): identifier_hex / prefix_hex are
290+
// BUCKET-1 ISOLATION PRIMITIVES. KEEP per-coin AND per-pool-instance, in v36
291+
// AND v37 -- the v37 unified multichain datastructure unifies the CODE, NOT
292+
// these namespaces (each ParentChainInstance keeps its own PREFIX/IDENTIFIER).
293+
// TRAP: never "standardize"/unify these toward a cross-coin value. A silent
294+
// drift to the LTC prefix/identifier (the LTC-borrowed-artifact failure mode)
295+
// would collapse DGB onto the LTC sharechain namespace -- this fails loud.
296+
// test-only, no prod change.
297+
TEST(DGB_share_test, OracleSharechainIsolationPrimitives)
298+
{
299+
const core::CoinParams p = dgb::make_coin_params(/*testnet=*/false);
300+
// mainnet + testnet carriers are assembled unconditionally (params.hpp)
301+
EXPECT_EQ(p.identifier_hex, "4b62545b1a631afe"); // oracle IDENTIFIER
302+
EXPECT_EQ(p.prefix_hex, "1c0553f23ebfcffe"); // oracle PREFIX
303+
EXPECT_EQ(p.testnet_identifier_hex, "4b62545b1a631afe"); // oracle (same on testnet)
304+
EXPECT_EQ(p.testnet_prefix_hex, "1c0553f23ebfcffe"); // oracle (same on testnet)
305+
306+
// active_*() selectors must resolve to the same isolation namespace.
307+
core::CoinParams m = p; m.is_testnet = false;
308+
EXPECT_EQ(m.active_identifier_hex(), "4b62545b1a631afe");
309+
EXPECT_EQ(m.active_prefix_hex(), "1c0553f23ebfcffe");
310+
}
311+
283312

284313
// ---------------------------------------------------------------------------
285314
// #82 external-daemon submit arm — digibyte.conf credential resolution.

0 commit comments

Comments
 (0)