Skip to content

Commit 5febc12

Browse files
authored
dgb(test): pin pool/share-layer params to p2pool-dgb-scrypt oracle (#161)
Phase B conformance: audited the DGB pool/share constant + tracker score-period layer against the frstrtr/p2pool-dgb-scrypt oracle (networks/digibyte.py + bitcoin/networks/digibyte.py) and confirmed full conformance. Lock the previously-unguarded params against drift in share_test.cpp (target already in both build.yml allowlists): SPREAD=24, TARGET_LOOKBEHIND=100, REAL_CHAIN_LENGTH=2880, BLOCK_MAX_SIZE=32000000, BLOCK_MAX_WEIGHT=128000000, CoinParams::BLOCK_PERIOD=75 (PARENT.BLOCK_PERIOD, tracker score() denom), MAX_TARGET = 2**256//2**20 - 1 = 2^236-1. Test-only, single-coin, strictly inside src/impl/dgb/test/. No shared base / bitcoin_family / src/core touched. dgb_share_test 6/6 PASS. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
1 parent 57109ce commit 5febc12

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/impl/dgb/test/share_test.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,27 @@ TEST(DGB_share_test, OracleConsensusParams)
3636
EXPECT_EQ(dgb::PoolConfig::CHAIN_LENGTH, 2880u);
3737
}
3838

39+
// Pool/share layer timing + bound params — audited CONFORM to the DGB oracle
40+
// this slice (networks/digibyte.py + bitcoin/networks/digibyte.py). These drive
41+
// PPLNS weighting (SPREAD), retarget lookbehind, chain pruning (REAL_CHAIN_LENGTH),
42+
// block-template caps, and the tracker score() denominator (PARENT.BLOCK_PERIOD).
43+
TEST(DGB_share_test, OraclePoolShareLayer)
44+
{
45+
EXPECT_EQ(dgb::PoolConfig::SPREAD, 24u); // networks/digibyte.py SPREAD
46+
EXPECT_EQ(dgb::PoolConfig::TARGET_LOOKBEHIND, 100u); // TARGET_LOOKBEHIND
47+
EXPECT_EQ(dgb::PoolConfig::REAL_CHAIN_LENGTH, 2880u); // REAL_CHAIN_LENGTH = 12*60*60//15
48+
EXPECT_EQ(dgb::PoolConfig::BLOCK_MAX_SIZE, 32000000u); // BLOCK_MAX_SIZE
49+
EXPECT_EQ(dgb::PoolConfig::BLOCK_MAX_WEIGHT, 128000000u); // BLOCK_MAX_WEIGHT
50+
51+
// tracker score() denominator: work / ((1 - block_rel_height) * BLOCK_PERIOD).
52+
// PARENT.BLOCK_PERIOD = 75 (Scrypt-algo period), bitcoin/networks/digibyte.py.
53+
EXPECT_EQ(dgb::CoinParams::BLOCK_PERIOD, 75u);
54+
55+
// MAX_TARGET = 2**256//2**20 - 1 = 2^236 - 1 (top 20 bits zero, rest ones).
56+
EXPECT_EQ(dgb::PoolConfig::max_target().GetHex(),
57+
"00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
58+
}
59+
3960
// v35 donation = forrestv P2PK (4104ffd0…ac, 65-byte pubkey push + CHECKSIG).
4061
// v36 donation = combined P2SH (23-byte). get_donation_script() switches on
4162
// share_version at the SEGWIT/merged boundary.

0 commit comments

Comments
 (0)