Skip to content

Commit

Permalink
Merge bitcoin#28591: kernel: chainparams updates for 26.x
Browse files Browse the repository at this point in the history
bd71f03 doc: update example pulls in release-process.md (fanquake)
b2ede22 headerssync: update params for 26.x (fanquake)
f12f92b kernel: update m_assumed_* chain params for 26.x (fanquake)
a8c2e5e kernel: update chainTxData for 26.x (fanquake)
a9d070a kernel: update nMinimumChainWork & defaultAssumeValid for 26.x (fanquake)

Pull request description:

  Update chainparams pre `26.x` branch off.

  Note: Remember that some variance is expected in the m_assumed_* sizes.

  Closes bitcoin#28572.

ACKs for top commit:
  Sjors:
    re-ACK bd71f03
  ajtowns:
    reACK bd71f03
  darosior:
    re-ACK bd71f03 for assumevalid and minchainwork params.

Tree-SHA512: c586b82711477bfc1fd9ac4c9c1130ccde29f75d652492c66ef5730f4a49b7da822a3ad2d9090468ea0c9f0e77d00c25f6a800600c81878d8141ce2ffb3724af
  • Loading branch information
fanquake committed Oct 9, 2023
2 parents f467444 + bd71f03 commit 3003861
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
4 changes: 2 additions & 2 deletions contrib/devtools/headerssync-params.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
# Parameters:

# Aim for still working fine at some point in the future. [datetime]
TIME = datetime(2026, 5, 25)
TIME = datetime(2026, 10, 5)

# Expected block interval. [timedelta]
BLOCK_INTERVAL = timedelta(seconds=600)

# The number of headers corresponding to the minchainwork parameter. [headers]
MINCHAINWORK_HEADERS = 784000
MINCHAINWORK_HEADERS = 804000

# Combined processing bandwidth from all attackers to one victim. [bit/s]
# 6 Gbit/s is approximately the speed at which a single thread of a Ryzen 5950X CPU thread can hash
Expand Down
6 changes: 3 additions & 3 deletions doc/release-process.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ Release Process

#### Before branch-off

* Update hardcoded [seeds](/contrib/seeds/README.md), see [this pull request](https://github.com/bitcoin/bitcoin/pull/7415) for an example.
* Update hardcoded [seeds](/contrib/seeds/README.md), see [this pull request](https://github.com/bitcoin/bitcoin/pull/27488) for an example.
* Update the following variables in [`src/kernel/chainparams.cpp`](/src/kernel/chainparams.cpp) for mainnet, testnet, and signet:
- `m_assumed_blockchain_size` and `m_assumed_chain_state_size` with the current size plus some overhead (see
[this](#how-to-calculate-assumed-blockchain-and-chain-state-size) for information on how to calculate them).
- The following updates should be reviewed with `reindex-chainstate` and `assumevalid=0` to catch any defect
that causes rejection of blocks in the past history.
- `chainTxData` with statistics about the transaction count and rate. Use the output of the `getchaintxstats` RPC with an
`nBlocks` of 4096 (28 days) and a `bestblockhash` of RPC `getbestblockhash`; see
[this pull request](https://github.com/bitcoin/bitcoin/pull/20263) for an example. Reviewers can verify the results by running
[this pull request](https://github.com/bitcoin/bitcoin/pull/28591) for an example. Reviewers can verify the results by running
`getchaintxstats <window_block_count> <window_final_block_hash>` with the `window_block_count` and `window_final_block_hash` from your output.
- `defaultAssumeValid` with the output of RPC `getblockhash` using the `height` of `window_final_block_height` above
(and update the block height comment with that height), taking into account the following:
Expand All @@ -45,7 +45,7 @@ Release Process
- `nMinimumChainWork` with the "chainwork" value of RPC `getblockheader` using the same height as that selected for the previous step.
* Consider updating the headers synchronization tuning parameters to account for the chainparams updates.
The optimal values change very slowly, so this isn't strictly necessary every release, but doing so doesn't hurt.
- Update configuration variables in [`contrib/devtools/headerssync-params.py`](contrib/devtools/headerssync-params.py):
- Update configuration variables in [`contrib/devtools/headerssync-params.py`](/contrib/devtools/headerssync-params.py):
- Set `TIME` to the software's expected supported lifetime -- after this time, its ability to defend against a high bandwidth timewarp attacker will begin to degrade.
- Set `MINCHAINWORK_HEADERS` to the height used for the `nMinimumChainWork` calculation above.
- Check that the other variables still look reasonable.
Expand Down
4 changes: 2 additions & 2 deletions src/headerssync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
// contrib/devtools/headerssync-params.py.

//! Store one header commitment per HEADER_COMMITMENT_PERIOD blocks.
constexpr size_t HEADER_COMMITMENT_PERIOD{600};
constexpr size_t HEADER_COMMITMENT_PERIOD{606};

//! Only feed headers to validation once this many headers on top have been
//! received and validated against commitments.
constexpr size_t REDOWNLOAD_BUFFER_SIZE{14308}; // 14308/600 = ~23.8 commitments
constexpr size_t REDOWNLOAD_BUFFER_SIZE{14441}; // 14441/606 = ~23.8 commitments

// Our memory analysis assumes 48 bytes for a CompressedHeader (so we should
// re-calculate parameters if we compress further)
Expand Down
40 changes: 20 additions & 20 deletions src/kernel/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ class CMainParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 709632; // Approximately November 12th, 2021

consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000044a50fe819c39ad624021859");
consensus.defaultAssumeValid = uint256S("0x000000000000000000035c3f0d31e71a5ee24c5aaf3354689f65bd7b07dee632"); // 784000
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000052b2559353df4117b7348b64");
consensus.defaultAssumeValid = uint256S("0x00000000000000000001a0a448d6cf2546b06801389cc030b2b18c6491266815"); // 804000

/**
* The message start string is designed to be unlikely to occur in normal data.
Expand All @@ -118,8 +118,8 @@ class CMainParams : public CChainParams {
pchMessageStart[3] = 0xd9;
nDefaultPort = 8333;
nPruneAfterHeight = 100000;
m_assumed_blockchain_size = 540;
m_assumed_chain_state_size = 7;
m_assumed_blockchain_size = 590;
m_assumed_chain_state_size = 9;

genesis = CreateGenesisBlock(1231006505, 2083236893, 0x1d00ffff, 1, 50 * COIN);
consensus.hashGenesisBlock = genesis.GetHash();
Expand Down Expand Up @@ -177,10 +177,10 @@ class CMainParams : public CChainParams {
};

chainTxData = ChainTxData{
// Data from RPC: getchaintxstats 4096 000000000000000000035c3f0d31e71a5ee24c5aaf3354689f65bd7b07dee632
.nTime = 1680665245,
.nTxCount = 820876044,
.dTxRate = 3.672283614033389,
// Data from RPC: getchaintxstats 4096 00000000000000000001a0a448d6cf2546b06801389cc030b2b18c6491266815
.nTime = 1692502494,
.nTxCount = 881818374,
.dTxRate = 5.521964628130412,
};
}
};
Expand Down Expand Up @@ -222,8 +222,8 @@ class CTestNetParams : public CChainParams {
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].nTimeout = 1628640000; // August 11th, 2021
consensus.vDeployments[Consensus::DEPLOYMENT_TAPROOT].min_activation_height = 0; // No activation delay

consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000977edb0244170858d07");
consensus.defaultAssumeValid = uint256S("0x0000000000000021bc50a89cde4870d4a81ffe0153b3c8de77b435a2fd3f6761"); // 2429000
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000b6a51f415a67c0da307");
consensus.defaultAssumeValid = uint256S("0x0000000000000093bcb68c03a9a168ae252572d348a2eaeba2cdf9231d73206f"); // 2500000

pchMessageStart[0] = 0x0b;
pchMessageStart[1] = 0x11;
Expand Down Expand Up @@ -276,10 +276,10 @@ class CTestNetParams : public CChainParams {
};

chainTxData = ChainTxData{
// Data from RPC: getchaintxstats 4096 0000000000000021bc50a89cde4870d4a81ffe0153b3c8de77b435a2fd3f6761
.nTime = 1681542696,
.nTxCount = 65345929,
.dTxRate = 0.09855282814711661,
// Data from RPC: getchaintxstats 4096 0000000000000093bcb68c03a9a168ae252572d348a2eaeba2cdf9231d73206f
.nTime = 1694733634,
.nTxCount = 66484552,
.dTxRate = 0.1804908356632494,
};
}
};
Expand All @@ -302,15 +302,15 @@ class SigNetParams : public CChainParams {
vSeeds.emplace_back("178.128.221.177");
vSeeds.emplace_back("v7ajjeirttkbnt32wpy3c6w3emwnfr3fkla7hpxcfokr3ysd3kqtzmqd.onion:38333");

consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000001899d8142b0");
consensus.defaultAssumeValid = uint256S("0x0000004429ef154f7e00b4f6b46bfbe2d2678ecd351d95bbfca437ab9a5b84ec"); // 138000
consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000000000001ad46be4862");
consensus.defaultAssumeValid = uint256S("0x0000013d778ba3f914530f11f6b69869c9fab54acff85acd7b8201d111f19b7f"); // 150000
m_assumed_blockchain_size = 1;
m_assumed_chain_state_size = 0;
chainTxData = ChainTxData{
// Data from RPC: getchaintxstats 4096 0000004429ef154f7e00b4f6b46bfbe2d2678ecd351d95bbfca437ab9a5b84ec
.nTime = 1681127428,
.nTxCount = 2226359,
.dTxRate = 0.006424463050600656,
// Data from RPC: getchaintxstats 4096 0000013d778ba3f914530f11f6b69869c9fab54acff85acd7b8201d111f19b7f
.nTime = 1688366339,
.nTxCount = 2262750,
.dTxRate = 0.003414084572046456,
};
} else {
bin = *options.challenge;
Expand Down

0 comments on commit 3003861

Please sign in to comment.