Repository navigation
Testnet 5 (BIP95) - #35861
Testnet 5 (BIP95)#35861fjahr wants to merge 29 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible places where named args for integral literals may be used (e.g.
Possible places where comparison-specific test macros should replace generic comparisons:
2026-11-22 11:23:43 |
|
🚧 At least one of the CI tasks failed. HintsTry to run the tests locally, according to the documentation. However, a CI failure may still
Leave a comment here, if you need help tracking down a confusing failure. |
c83adca to
31ed5ba
Compare
| case ChainType::TESTNET5: | ||
| return std::make_unique<CBaseChainParams>("testnet5", 18334); |
There was a problem hiding this comment.
This clashes with testnet3's Tor port?
There was a problem hiding this comment.
Ugh, I thought I had taken everything into account but I guess I didn't look at T3 seriously enough. I moved T5 to 18352/18353/18354 (RPC/P2P/onion), so 183N3 scheme that keeps our existing pattern for RPC = P2P-1 and onion = P2P+1 and that testnet3 already follows with N=3. This means we need changes the P2P port in BIP95, so I'll push an update for that. I think the BIP change is fine since there is no other implementation yet and I think there is some value in keeping the pattern in place.
There was a problem hiding this comment.
Approach ACK
Can we use this PR to also add the bash completation? See bitcoin-cli.bash.
diff --git a/contrib/completions/bash/bitcoin-cli.bash b/contrib/completions/bash/bitcoin-cli.bash
index ff34ad9ff6..2559c5530a 100644
--- a/contrib/completions/bash/bitcoin-cli.bash
+++ b/contrib/completions/bash/bitcoin-cli.bash
@@ -9,7 +9,7 @@ _bitcoin_rpc() {
local rpcargs=()
for i in ${COMP_LINE}; do
case "$i" in
- -conf=*|-datadir=*|-regtest|-rpc*|-testnet|-testnet4)
+ -conf=*|-datadir=*|-regtest|-rpc*|-testnet|-testnet4|-testnet5)
rpcargs=( "${rpcargs[@]}" "$i" )
;;
esac
Should we add tests for the restored difficulty behavior?
Maybe also some activation unit tests? Maybe test that block1 has bip54 active?
diff --git a/src/test/versionbits_tests.cpp b/src/test/versionbits_tests.cpp
index 7dcc5c676c..361be3f3d6 100644
--- a/src/test/versionbits_tests.cpp
+++ b/src/test/versionbits_tests.cpp
@@ -5,6 +5,7 @@
#include <chain.h>
#include <chainparams.h>
#include <consensus/params.h>
+#include <deploymentstatus.h>
#include <test/util/random.h>
#include <test/util/common.h>
#include <test/util/setup_common.h>
@@ -492,4 +493,20 @@ BOOST_FIXTURE_TEST_CASE(versionbits_computeblockversion, BlockVersionTest)
}
}
+BOOST_AUTO_TEST_CASE(testnet5_consensuscleanup_activation)
+{
+ for (const auto chain_type : {ChainType::TESTNET4, ChainType::TESTNET5}) {
+ BOOST_TEST_CONTEXT(ChainTypeToString(chain_type)) {
+ const auto chain_params{CreateChainParams(ArgsManager{}, chain_type)};
+ // Evaluate block 1 with the default deployment parameters, without mining genesis.
+ CBlockIndex genesis{chain_params->GenesisBlock()};
+ genesis.nHeight = 0;
+ VersionBitsCache cache;
+ BOOST_CHECK_EQUAL(DeploymentActiveAfter(&genesis, chain_params->GetConsensus(),
+ Consensus::DEPLOYMENT_CONSENSUSCLEANUP, cache),
+ chain_type == ChainType::TESTNET5);
+ }
+ }
+}
31ed5ba to
a81e5c2
Compare
|
Rebased on v32.1 with the latest state of the BIP 54 pull.
Done
Added two cases: no 20-minute exception on testnet5, and the raised
Taken with small tweaks, thanks! |
… vectors) This adds tests exercising the bounds of the checks on the invalid transaction size, for various types of transactions (legacy, Segwit, bytes in input/output to get to 64 bytes) as well as sanity checking against some known historical violations. Thanks to Chris Stewart for digging up the historical violations to this rule.
The previously introduced unit tests extensively test the specific implementation of each mitigation. This functional test complements them by end-to-end testing all mitigations. For the added timestamp constraints, it mimicks how they would get exploited (by implementing pseudo timewarp and Murch-Zawy attacks) and demonstrates those exploits are not possible anymore after BIP54 activates.
Testnet 5 is specified in BIP95. It drops the 20-minute minimum-difficulty exception of Testnet 3/4 and raises the minimum difficulty to nBits 0x1a0fffff.
BIP95 enforces the BIP54 rules on Testnet 5 from block 1. This also covers timewarp, so BIP94 is not enforced.
987ddef to
ee50560
Compare
|
Rebased on the latest version of #35793 and added the genesis block from bitcoin/bips#2356. The node can now sync the current chain when you have a node to manually connect to and |
|
Achow is already running a seeder that we can commit here so users can relay on. $ git diff
diff --git a/contrib/seeds/README.md b/contrib/seeds/README.md
index 388ddd5453..5aa47b2477 100644
--- a/contrib/seeds/README.md
+++ b/contrib/seeds/README.md
@@ -20,6 +20,7 @@ curl https://mainnet.achownodes.xyz/seeds.txt.gz | gzip -dc >> seeds_main.txt
curl https://signet.achownodes.xyz/seeds.txt.gz | gzip -dc > seeds_signet.txt
curl https://testnet.achownodes.xyz/seeds.txt.gz | gzip -dc > seeds_test.txt
curl https://testnet4.achownodes.xyz/seeds.txt.gz | gzip -dc > seeds_testnet4.txt
+curl https://testnet5.achownodes.xyz/seeds.txt.gz | gzip -dc > seeds_testnet5.txt
curl https://raw.githubusercontent.com/asmap/asmap-data/main/latest_asmap.dat > asmap-filled.dat
python3 makeseeds.py -a asmap-filled.dat -s seeds_main.txt > nodes_main.txt
python3 makeseeds.py -a asmap-filled.dat -s seeds_signet.txt -m 266000 > nodes_signet.txt
diff --git a/contrib/seeds/generate-seeds.py b/contrib/seeds/generate-seeds.py
index ff2b4028f0..e3f3b1d786 100755
--- a/contrib/seeds/generate-seeds.py
+++ b/contrib/seeds/generate-seeds.py
@@ -5,13 +5,14 @@
'''
Script to generate list of seed nodes for kernel/chainparams.cpp.
-This script expects three text files in the directory that is passed as an
+This script expects five text files in the directory that is passed as an
argument:
nodes_main.txt
nodes_signet.txt
nodes_test.txt
nodes_testnet4.txt
+ nodes_testnet5.txt
These files must consist of lines in the format
@@ -22,7 +23,7 @@ These files must consist of lines in the format
The output will be several data structures with the peers in binary format:
- inline constexpr uint8_t chainparams_seed_{main,signet,test,testnet4}[]{
+ inline constexpr uint8_t chainparams_seed_{main,signet,test,testnet4,testnet5}[]{
...
};
@@ -182,6 +183,9 @@ def main():
g.write('\n')
with open(os.path.join(indir,'nodes_testnet4.txt'), 'r') as f:
process_nodes(g, f, 'chainparams_seed_testnet4')
+ g.write('\n')
+ with open(os.path.join(indir,'nodes_testnet5.txt'), 'r') as f:
+ process_nodes(g, f, 'chainparams_seed_testnet5')
g.write('#endif // BITCOIN_CHAINPARAMSSEEDS_H\n')
if __name__ == '__main__':
diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp
index f997be9372..189505662f 100644
--- a/src/kernel/chainparams.cpp
+++ b/src/kernel/chainparams.cpp
@@ -542,9 +542,10 @@ public:
assert(consensus.hashGenesisBlock == uint256{"00000000000008c1637e7d3252dc1c333d4546fd6fff6a474b200d674a91d497"});
assert(genesis.hashMerkleRoot == uint256{"8c5899b65c5b0834adb17af314e22a9bf067e7ed8144c37967b5ec56b5a6e28d"});
- // No DNS or fixed seeds defined for Testnet 5 yet.
vFixedSeeds.clear();
vSeeds.clear();
+ // nodes with support for servicebits filtering should be at the top
+ vSeeds.emplace_back("seed.testnet5.achownodes.xyz."); // Ava Chow
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
|
Bitcoin Core has no DNS or fixed seeds for testnet5 yet (bitcoin/bitcoin#35861), and every addnode line in the [testnet5] section is commented out, so a node started from this file finds no peers. Name two reachable testnet5 nodes. Remove them once the pinned Core build has seeds.
Backend config, nginx locations and upstreams, build and start lists, log rotation and cache warming for a testnet5 instance, following testnet4, with a [testnet5] section in bitcoin.conf, its cron lines and systemd unit, the install script, and TESTNET5_ENABLED in the site configs. Testnet5 is off in the install dialog unless ticked. The backend config uses "NETWORK": "testnet5". Ports: bitcoind RPC 18352 and P2P 18353 (Bitcoin Core's testnet5 defaults), ZMQ 18354 and 18355, mempool backend 8988, esplora fallback 3006. Testnet5 is in no Bitcoin Core release yet. Build bitcoin/bitcoin#35861 at ee505609676a10c389da5962b25a2c0080b9df57 into /usr/local/bitcoin-testnet5 and run the testnet5 node from there, so the other networks stay on the release. That build has no DNS or fixed seeds for testnet5, and the other addnode lines in the section are commented out, so name two reachable testnet5 nodes. Remove them once the pinned build has seeds. Two fixes to the install script come with it. `grep Testnet` also matched Testnet4 and Testnet5, so choosing either without Testnet still installed testnet3; it now matches the whole word, and LN-Testnet still enables testnet3 as before. The CKPool start script takes testnet3, not testnet, and reads the RPC credentials from /bitcoin/<network>.conf, which nothing created; the installer now passes testnet3 and links the file.
Co-authored-by: Pol Espinasa <[email protected]>
Co-authored-by: Pol Espinasa <[email protected]>
ee50560 to
f57b52a
Compare
Thanks! I added Ava's seeder in one commit and kept the changes to the fixed seeds script as a separate commit. The reason is the script change didn't work just like that. I opted for a complete fix to these issues in the second commit which adds 32.x to the filter, adds I was a bit unsure about this initially and kept it as a separate commit because the filter is usually updated in the seed update before each release and also the list is still extremely small. But the list can be refreshed once this moves closer to merge and I don't see any harm that could be caused by updating the filter now. But if I missed something the commit can also just be dropped for now. |
|
I think the PR description is a bit out of date now. The genesis block was already added ( bitcoin/bips#2356), there is a DNS seed and fixed seeds (49a4403) and the PR is no longer in draft. It could be nice to update . Thanks for working on this! I'm looking forward to finding some time to try mining on it with p2poolv2. |
Testnet5 (BIP95) is live with over 8,000 blocks, and its constants are
available on rust-bitcoin master: magic 0x46495645 ("FIVE") and P2P port
18353, matching the chainparams in bitcoin/bitcoin#35861.
Accept --chain testnet5 and require nodes to report a starting height of
at least 8000, just below the current tip of 8442, so lagging nodes are
not served. Raise this as the chain grows, as for the other networks.
Allow testnet5 in the NixOS module and document it.
|
🐙 This pull request conflicts with the target branch and needs rebase. |

Implements BIP 95 (Testnet 5). Relative to Testnet 4 it removes the 20-minute minimum-difficulty exception, raises the minimum difficulty, and enforces BIP 54 from block 1. The Genesis block has not been mined yet.
Based on #35793, only the top five commits belong to this PR.
Per the discussion in a recent IRC meeting: since BIP 95 activates BIP 54 from block 1, this depends on #35793 and won't make the v32 feature freeze. So we can review and settle the changes now, but leave this in draft until #35793 lands. Once reviewers are happy with the state of the draft here we can add the Genesis block and the network can get started without being included in a release. We can then ship a patched v32 release with Testnet 5 included. A solo-mining ckpool endpoint is likely being set up and will be advertised here. There are no DNS or fixed seeds yet.