Skip to content

Commit 15fb06b

Browse files
committed
btc/test: G0/G1 lock share-version additive to exactly v36 (version_gate SSOT)
Strengthen the G0/G1 share-format parity gate so an unsanctioned extra/ shifted share-version fails here, not only in the separate activation- boundary KAT. c2pool has no p2pool-style version array to compare element- wise, so the single sanctioned additive over the baseline [0,17,32,33,34,35] is locked against core::version_gate::V36_ACTIVATION_VERSION (==36) plus an exact-boundary check (36 active, 35 not). Baseline set transcribed from btc.g01.golden.json @ ece15b03fc23. Test-only, fenced to src/impl/btc/test.
1 parent bdf8153 commit 15fb06b

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

src/impl/btc/test/g01_share_format_parity_test.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <string>
44

55
#include <impl/btc/config_pool.hpp>
6+
#include <core/version_gate.hpp> // SSOT: V36_ACTIVATION_VERSION / is_v36_active
67

78
// G0/G1 — BTC share-format byte-parity against the BAKED p2pool baseline.
89
//
@@ -60,3 +61,33 @@ TEST(BTC_g01_share_format, ProtocolFloorIsForwardCompatibleRaise)
6061
EXPECT_GE(btc::PoolConfig::MINIMUM_PROTOCOL_VERSION, GOLDEN_MINIMUM_PROTOCOL_VERSION)
6162
<< "c2pool floor must not drop below the p2pool baseline";
6263
}
64+
65+
66+
// Share-version additive discipline (G1 bucket-2): the c2pool sharechain extends
67+
// the p2pool baseline version set by EXACTLY ONE sanctioned version -- 36 -- the
68+
// V36 share-format / consensus-revision boundary owned by the core::version_gate
69+
// SSOT. c2pool has no p2pool-style share-version array to compare element-wise,
70+
// so the additive is locked against the SSOT instead. The baseline set is
71+
// transcribed from the golden fixture (constants.share_versions @ ece15b03fc23).
72+
// This catches two drift modes the byte-parity TESTs above do not:
73+
// 1. boundary drift -- V36_ACTIVATION_VERSION moving off 36 (an unsanctioned /
74+
// shifted version) fails here;
75+
// 2. baseline-composition drift -- no baseline version may be treated as V36.
76+
TEST(BTC_g01_share_format, ShareVersionAdditiveIsExactlyV36)
77+
{
78+
// Transcribed from btc.g01.golden.json -> constants.share_versions.
79+
constexpr uint64_t GOLDEN_BASELINE_VERSIONS[] = {0, 17, 32, 33, 34, 35};
80+
81+
// The SINGLE sanctioned additive over the p2pool baseline is the V36 boundary.
82+
EXPECT_EQ(core::version_gate::V36_ACTIVATION_VERSION, 36u)
83+
<< "only sanctioned c2pool version added over the baseline is 36";
84+
85+
// No baseline version is on the V36 side of the gate -- all pre-revision.
86+
for (uint64_t v : GOLDEN_BASELINE_VERSIONS)
87+
EXPECT_FALSE(core::version_gate::is_v36_active(v))
88+
<< "baseline version " << v << " must remain pre-V36";
89+
90+
// Boundary is exact: 36 activates, 35 (max baseline) does not.
91+
EXPECT_TRUE (core::version_gate::is_v36_active(36));
92+
EXPECT_FALSE(core::version_gate::is_v36_active(35));
93+
}

0 commit comments

Comments
 (0)