Skip to content

Conversation

jtimon
Copy link
Contributor

@jtimon jtimon commented Sep 2, 2015

This is a replacement for #6526 with my nits integrated in the commits where they were more relevant.
It has a smaller diff (138 additions and 65 deletions VS +116 −95) is more amenable to any block size change proposal (many of them will need a function), to #6382 (adding new test chains for block size tests) and to libconsenusus-related #6591 (which is also part of the process of making chainparams less global #5970).
I will rebase #6382, #6591 and #5970 on top of this. Please, @theuni close #6526 in favor of this if it passes your review.

Blocking:

@dcousens
Copy link
Contributor

dcousens commented Sep 3, 2015

is more amenable to any block size change proposal

@jtimon can you summarize why? #6526 was relatively concise already, and manually diffing that against this doesn't sound like a great use of time.

@jtimon
Copy link
Contributor Author

jtimon commented Sep 3, 2015

@jtimon can you summarize why? #6526 was relatively concise already, and manually diffing that against this doesn't sound like a great use of time.

In summary, this doesn't destroy consensus/consensus.h (doesn't undo costly refactor work #5970), this doesn't s/Params().GetConsensus()/consensusParams/ when it's not necessary (because the function depends on CChainParams, see #XXXX), and it goes further in relation to facilitate implementations of consensus block size changes by creating MaxBlockSize() and MaxBlockSigops() (which is diff-free when you're replacing MAX_BLOCK_SIZE with consensusParams.nMaxBlockSize anyway).

@jtimon
Copy link
Contributor Author

jtimon commented Sep 4, 2015

Force pushed with a fix in diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp (for those who found the time to fetch a). CBaseChainParams::REGTEST was being used more than once in src/test/test_bitcoin.cpp and that caused problems in #6382 .

if (block.vtx.empty() || block.vtx.size() > MAX_BLOCK_SIZE || ::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION) > MAX_BLOCK_SIZE)
uint64_t nMaxBlockSize = MaxBlockSize(consensusParams);
uint64_t nMaxBlockSigops = MaxBlockSigops(consensusParams);
uint64_t nMaxTxSize = consensusParams.nMaxTxSize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this pulled out as a variable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason, ask @theuni

@dcousens
Copy link
Contributor

dcousens commented Sep 5, 2015

utACK

@jtimon
Copy link
Contributor Author

jtimon commented Sep 6, 2015

Added a squashme commit that should solve @dcousens' nits (ie Consensus::CheckTx() gets const Consensus::Params& consensusParams instead of uint64_t nMaxTxSize).
EDIT: Here's the squashed version: 0cac6d2 (also declaring Consensus::CheckTxInputs in consensus.h and adding some documentation to the function).

@jtimon
Copy link
Contributor Author

jtimon commented Sep 12, 2015

Updated with the squashed version.

@jtimon
Copy link
Contributor Author

jtimon commented Sep 14, 2015

Closing in favor of #6672.

@jtimon jtimon closed this Sep 14, 2015
@jtimon jtimon reopened this Oct 20, 2015
@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch from 0cac6d2 to dc23326 Compare October 20, 2015 16:01
@jtimon
Copy link
Contributor Author

jtimon commented Oct 20, 2015

Rebased and reopened.

@dcousens
Copy link
Contributor

re-ACK, but the constant shifting of code to different [but almost the same] PRs is getting insane.
I'd rather not have to ACK this again.

@@ -484,7 +486,7 @@ void CTxMemPool::removeCoinbaseSpends(const CCoinsViewCache *pcoins, unsigned in
continue;
const CCoins *coins = pcoins->AccessCoins(txin.prevout.hash);
if (fSanityCheck) assert(coins);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtimon Needs trivial rebase due to e06c14f.

@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch from dc23326 to f45ede4 Compare November 3, 2015 13:52
@jtimon
Copy link
Contributor Author

jtimon commented Nov 3, 2015

@MarcoFalke Thanks, rebased.

@jtimon
Copy link
Contributor Author

jtimon commented Nov 3, 2015

New uses of MAX_BLOCK_SIZE/MaxBlockSize() were introduced in #6622.

@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch from a2f24e0 to b89e8bb Compare November 11, 2015 14:42
@jtimon
Copy link
Contributor Author

jtimon commented Nov 11, 2015

Rebased with a tiny fix that would have break the build (if this has been merged without the fix).
I haven't squashed the new commits (from what was contained and reviewed in #6672) to facilitate re-review.

@jtimon
Copy link
Contributor Author

jtimon commented Nov 17, 2015

Great, I was thinking about leaving CheckTransaction/Consensus::CheckTx declared in main.h if we were going for the 2/3 commits option and that was a problem.

@btcdrak
Copy link
Contributor

btcdrak commented Nov 17, 2015

I agree with @sipa, it doesn't look too disruptive as-is.

@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch from 20ceb05 to 82b2443 Compare November 27, 2015 13:28
@jtimon
Copy link
Contributor Author

jtimon commented Nov 27, 2015

Needed trivial rebase.

@maflcko
Copy link
Member

maflcko commented Nov 28, 2015

utACK 82b2443

@btcdrak
Copy link
Contributor

btcdrak commented Nov 28, 2015

utACK

@jtimon
Copy link
Contributor Author

jtimon commented Dec 1, 2015

Rebased(6)

@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch 2 times, most recently from e9a9115 to e66e102 Compare December 1, 2015 22:13
@dcousens
Copy link
Contributor

dcousens commented Dec 2, 2015

Re-ACK, @laanwj anything holding this back?

@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch from e66e102 to 4334ace Compare December 3, 2015 11:52
@jtimon
Copy link
Contributor Author

jtimon commented Dec 3, 2015

Rebased(7)
Like I said the only disruptive commit is the last one and is the one that is requiring rebase all the time. Prediction: Next time this PR requires rebase, it will probably be due to the last commit and master...jtimon:incomplete-consensus-blocksize-0.12.99 will remain without conflicts. The third commit is somewhat disruptive too, so I may be wrong, but if I am right, I will just drop the last commit, sorry @theuni

…tion number

This is a no-op change. For now, everything passes MAX_BLOCK_SIZE / 60, so the
result matches what it would've before.

Tests use a number equal to the number of transactions where necessary,
to ensure that they're never rejected when blocksizesize isn't being tested.
This is a no-op change.

Tests use a value of std::numeric_limits<uint64_t>::max() where necessary, to ensure that they're never
rejected when size isn't being tested.
…sus.h (as functions)

The following are now tied to a chain rather than being defined as global
constants. Their values have not changed.

nMinTxSize
nMaxBlockSize
nMaxTxSize
nMaxBlockSigops
nCoinbaseMaturity

Also, for free (diff-wise):

Blocksize: Turn MAX_BLOCK_SIZE (nMaxBlockSize) and MAX_BLOCK_SIGOPS (nMaxBlockSigops) into functions

...which take Consensus::Params as parameter
This will be convenient to reduce the diff of any proposal that changes the blocksize as a hardfork
@jtimon jtimon force-pushed the consensus-blocksize-0.12.99 branch from 4334ace to 6111e5b Compare December 3, 2015 13:48
@jtimon
Copy link
Contributor Author

jtimon commented Dec 8, 2015

@gmaxwell

Bitcoin will be able to move forward with these increases when improvements and understanding render their risks widely acceptable relative to the risks of not deploying them. In Bitcoin Core we should keep patches ready to implement them as the need and the will arises, to keep the basic software engineering from being the limiting factor.

This would make it much easier to maintain those ready "patches" (even the simple bip102 has rapidly bitrot). If ithad been merged for 0.12 like was supposed to be the plan (according to sipa and btcdrak comments), that would have also make those pat hes easier to backport to 0.12.
Many people including you reviewed this as part of the closed #6672 , only a few small changes required for rebase has been added.
I'm sorry if I sound repetitive but I can't really understand what is holding this for so, so long.

@dcousens
Copy link
Contributor

dcousens commented Dec 9, 2015

This was ACK'd for 0.12 a while ago, it should still be able to make it in right?

@maflcko
Copy link
Member

maflcko commented Dec 9, 2015

Yes, if this get's merged in master, at least the first three commits should be backported (can be merged as is).

@devrandom
Copy link

ACK

@jtimon jtimon closed this Dec 18, 2015
@jgarzik
Copy link
Contributor

jgarzik commented Dec 18, 2015

Structure seems reasonable, with the caveat that MaxBlockSize() and MaxBlockSigOps() will inevitably be modified depending on what state they examine.

@jtimon
Copy link
Contributor Author

jtimon commented Dec 18, 2015

Yeah, when I changed the variable in the Consensus::Params struct (what @cfields had initially) to a function I wasn't sure on whether to use block.nHeight or header.mediaTime(), certainly not header.nTime. If we can finally agree on that somewhere I don't mind to change it.

@jgarzik
Copy link
Contributor

jgarzik commented Dec 18, 2015

ut ACK, for the record

@jtimon
Copy link
Contributor Author

jtimon commented Dec 21, 2015

Replaced by #7238 (a subset of this) with @rustyrussell 's nit fixed.

@jtimon jtimon closed this Dec 21, 2015
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants