-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Fix confusing blockmax{size,weight} options, dont default to throwing away money #11100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
NACK, these are not sensible. If anything, they should be reduced. |
Please, not again, no more defaults fighting... |
ACK. The current settings are reprehensible: They result in guaranteed income reduction for anyone who follows them for almost no measurable benefit-- because as we see almost everyone maxes them out regardless. The losses are also not trivial, but are often about 5% of mining income-- which wasn't the case when they were last discussed but is now. Luke's argument rests on an unlikely and now conclusively disproven theory that miners will individually act against their own short term economic best interests to preserve the usability of the network. This is demonstratively false and even if it were true, setting an economically rational default wouldn't change it. (these hypothetical altruistic miners would simply lower their defaults, if they existed) To the limited extent that anyone does mine with these defaults (not much) they also make fee estimates less reliable by adding additional variance to the capacity of the network. A few blocks showing up underfilled is doing no one any favors-- it doesn't meaningfully reduce the initial synchronization time. All it does is lower the revenue of those who do it. To the extent that any of that is driven by a genuine desire to aid the network (rather than just misconfiguration)-- do we really want people who want to help to be less successful (and thus less able to add hashpower and increase their influence) Setting the defaults in a way which virtually no one will use also has the problem of causing people to change the default and then when the way the options works needs to change their outdated settings can cause unexpected behavior. For example, there are many miners who have set the max size to a million bytes to override these broken defaults. And then with segwit they'll be producing undersized blocks unintentionally. They may even be paying enough attention to realize they need to change them, only to set them to 2 million bytes and still produce undefilled blocks. Setting a reduced default against the traffic in the network today violates the principle the software should act in the interest of the people using it and in doing so shows disrespect where none is intended, it violates the principle that absent significant harm to it users it should act in the public interest (by making fee estimation less reliable). IMO if it isn't reduced it should be removed completely. At least there is a strong argument that miners producing blocks which fail to confirm all transactions is harmful to the public interest, and improvements in block propagation have largely eliminated size based considerations as legitimate reasons to choose to produce a smaller block. (Moreover if one was for some reason still concerned about size impacts on propagation the received time sensitive framework from Suhas would be the right way to go about it, not simply reducing the maximum size.) |
Previous discussion was here (possibly more, but these I could find in a quick search):
As we know all miners will override the defaults, and for other users the value doesn't matter, I think this is a pointless waste of energy, creating angry discussions unnecessarily. I'm unsubscribing from this thread. |
Hi, |
@honzik666 Right, the correct settings are to remove any mention of blockmaxsize from your configuration and set only blockmaxweight=4000000. Blockmaxsize is a legacy option that wasn't even existent at first in the segwit settings. It doesn't make sense to use it, setting it (at least to anything other than the maximum of 4 million) will just lower your income. |
Pushed a new commit to hopefully help address the confusion that a few people have had on these options, which also fixes a bug or two in the process. |
src/policy/policy.h
Outdated
@@ -17,9 +17,9 @@ class CCoinsViewCache; | |||
class CTxOut; | |||
|
|||
/** Default for -blockmaxsize, which controls the maximum size of block the mining code will create **/ | |||
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = 750000; | |||
static const unsigned int DEFAULT_BLOCK_MAX_SIZE = MAX_BLOCK_SERIALIZED_SIZE - 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
8893ed7
to
10d21dc
Compare
Concept ACK as discussed in meeting |
src/miner.cpp
Outdated
if (!fWeightSet) { | ||
options.nBlockMaxWeight = options.nBlockMaxSize * WITNESS_SCALE_FACTOR; | ||
options.nBlockMaxWeight = gArgs.GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_WEIGHT / WITNESS_SCALE_FACTOR) * WITNESS_SCALE_FACTOR; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an else
branch here that gives an error "-blockmaxsize and -blockmaxweight cannot be set simultaneously".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Concept ACK |
Miners have in recent years maxed out 1 MB. That is completely different from 4 MB, and does not prove they will increase to 4 MB immediately in any sense.
It has not been disproven. Miners have been given bad advice.
Only in the case that the default doesn't matter. In which case, the argument to change the default falls apart completely.
If they want 1 MB, then their configuration of 1 MB should get them 1 MB. There is no such thing as undersized blocks.
No such principle has been established. Defaults should within reason be what is best for Bitcoin as a whole.
Fee estimation is an unrelated matter. If it can't handle a variety of block sizes, that's a bug in the estimation logic.
No, they haven't. Block propagation has been "solved" by centralised relay networks (FIBRE) and SPV mining, both of which are harmful to the network and not real solutions. Additionally, the most bandwidth-contrained users run in Again, NACK. (Maybe #3229 can be reopened?) |
ACK
Even without FIBRE or SPV mining it makes individual economic sense for miners to mine max weight blocks due to relatively high transaction fees and compact blocks having a significant improvement on propagation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, left a couple comments, plus I agree with @sipa's comment about preventing use of both -blockmaxweight and -blockmaxsize.
src/miner.cpp
Outdated
@@ -241,19 +230,11 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOpsCost | |||
// - serialized size (in case -blockmaxsize is in use) | |||
bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package) | |||
{ | |||
uint64_t nPotentialBlockSize = nBlockSize; // only used with fNeedSizeAccounting |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above needs to be updated to remove reference to serialized size.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
/** Default for -blockmaxweight, which controls the range of block weights the mining code will create **/ | ||
static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = 3000000; | ||
static const unsigned int DEFAULT_BLOCK_MAX_WEIGHT = MAX_BLOCK_WEIGHT - 4000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the - 4000
unnecessary here? We already separately reserve space for the coinbase in CreateNewBlock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've always had it and I'm skeptical of just removing it...I could absolutely see people accidentally building invalid blocks if we just remove it and they dont notice (which, given how much people appear to read release notes.......)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT_BLOCK_MAX_WEIGHT is used to initialise the nBlockMaxWeight field in BlockAssembler::Options, but that's then used as BlockAssembler::nBlockMaxWeight = max(4000, min(MAX_BLOCK_WEIGHT-4000, options.nBlockMaxWeight)) in the BlockAssembler constructor, so it will already be trimmed.
So I think the "- 4000" here is a no op since min(MBW-4000,MBW) = min(MBW-4000,MBW-4000) = MBW-4000...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see your point. Still, it feels misleading to print in the help text that the default value is 4000000 if thats outside the acceptable range.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah actually what I meant was that we also start off our block counter at a weight of 4000, so limiting to MAX_BLOCK_WEIGHT-4000 (both here and in BlockAssembler::BlockAssembler()
) causes us to limit block sizes more than we probably intend. But not necessary to change here.
There are real use-cases to set both blockmaxsize and blockmaxweight: one might want to mine a block that has at most a weight of 3M, but never more than 1 MB for example. |
10d21dc
to
21e1f07
Compare
As commented on IRC blockmaxsize doesn't make sense after segwit activation. I wouldn't even bother with the deprecation step, I would go straight to removal and just document it in the release notes once.
I will treat any arguments regarding defaults as if they were arguments for a lower value for DEFAULT_BLOCK_MAX_WEIGHT, not as arguments for the removal/deprecation of blockmaxsize in itself. Concept ACK |
Concept ACK. Will review soon. |
src/miner.cpp
Outdated
if (!fWeightSet) { | ||
options.nBlockMaxWeight = options.nBlockMaxSize * WITNESS_SCALE_FACTOR; | ||
options.nBlockMaxWeight = gArgs.GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_WEIGHT / WITNESS_SCALE_FACTOR) * WITNESS_SCALE_FACTOR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add warn about deprecation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. A deprecation warning here would be helpful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to not add more garbage to init, if possible (and printing every time a BlockAssembler is created also sucks, though it will do that now if you set both :( ). I think its fine, and since we're changing the defaults to something reasonable, removing the option a release later likely won't break anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then add the LogPrintf()
s to InitParameterInteraction()
in init.cpp instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, fine.
@@ -214,7 +214,6 @@ UniValue getmininginfo(const JSONRPCRequest& request) | |||
|
|||
UniValue obj(UniValue::VOBJ); | |||
obj.push_back(Pair("blocks", (int)chainActive.Height())); | |||
obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change, needs release note.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this should be included in release notes.
Also, please remove currentblocksize
from help text (currently L198)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK. A couple of nits inline.
I think the second commit is good, but needs to be very explicitly communicated to users. Defaults changing unexpectedly under users' feet is a bad experience, even if the new default is better.
Deprecation of blockmaxsize
should be swiftly followed by removal in the next release.
Side note: how does this not break any tests?! Do we not have any testing for mining size/weight accounting?
@@ -214,7 +214,6 @@ UniValue getmininginfo(const JSONRPCRequest& request) | |||
|
|||
UniValue obj(UniValue::VOBJ); | |||
obj.push_back(Pair("blocks", (int)chainActive.Height())); | |||
obj.push_back(Pair("currentblocksize", (uint64_t)nLastBlockSize)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this should be included in release notes.
Also, please remove currentblocksize
from help text (currently L198)
@@ -175,7 +167,6 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc | |||
int64_t nTime1 = GetTimeMicros(); | |||
|
|||
nLastBlockTx = nBlockTx; | |||
nLastBlockSize = nBlockSize; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a call below to GetSerializeSize()
for logging the block size. We should remove that potentially expensive call and update the log to not print size as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
src/miner.cpp
Outdated
if (!fWeightSet) { | ||
options.nBlockMaxWeight = options.nBlockMaxSize * WITNESS_SCALE_FACTOR; | ||
options.nBlockMaxWeight = gArgs.GetArg("-blockmaxsize", DEFAULT_BLOCK_MAX_WEIGHT / WITNESS_SCALE_FACTOR) * WITNESS_SCALE_FACTOR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. A deprecation warning here would be helpful.
9bf4197
to
2fada8c
Compare
doc/release-notes.md
Outdated
implied blockmaxweight, instead of limiting block size directly. Any miners who wish | ||
to limit their blocks by size, instead of by weight, will have to do so manually by | ||
removing transactions from their block template directly. The "currentblocksize" value | ||
in getmininginfo has been removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good, but I think the removal of currentblocksize
in getmininginfo
should [also?] go in a Low-level RPC changes section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
2fada8c
to
faeafe2
Compare
utACK faeafe2. Looks great. |
utACK faeafe2 |
Again, hard NACK for all the unrefuted reasons already given. |
@TheBlueMatt |
* This removes block-size-limiting code in favor of GBT clients doing the limiting themselves (if at all). * -blockmaxsize is deprecated and only used to calculate an implied blockmaxweight, addressing confusion from multiple users. * getmininginfo's currentblocksize return value was returning garbage values, and has been removed, also removing a GetSerializeSize call in some block generation inner loops and potentially addressing some performance edge cases.
No sensible user will ever keep the default settings here, so not having sensible defaults only serves to screw users who are paying less attention, which makes for terrible defaults.
faeafe2
to
6f703e9
Compare
Rebased and fixed conflict. |
…lt to throwing away money 6f703e9 Add release notes describing blockmaxweight deprecation (Matt Corallo) 3dc263c Use a sensible default for blockmaxweight (Matt Corallo) ba206d2 Deprecate confusing blockmaxsize, fix getmininginfo output (Matt Corallo) Pull request description: No sensible user will ever keep the default settings here, so not having sensible defaults only serves to screw users who are paying less attention, which makes for terrible defaults. Additionally, support for block-size-limiting directly has been removed: * This removes block-size-limiting code in favor of GBT clients doing the limiting themselves (if at all). * -blockmaxsize is deprecated and only used to calculate an implied blockmaxweight, addressing confusion from multiple users. * getmininginfo's currentblocksize return value was returning garbage values, and has been removed, also removing a GetSerializeSize call in some block generation inner loops and potentially addressing some performance edge cases. Tree-SHA512: 33010540faf5d6225ad575488b804e180a8d53a41be484ca2932a0485595e28da62f0ade4b279a6bf1c947c7ce389f51fde8651b2ba25deb25e766e0813b993c
That assumes everyone sets it to the absolute no-op maximum. There is no evidence of this. This PR is contentious, should not have been merged, and should be reverted. |
I think this should be tagged for backport. |
ACK for backport. |
Moved to 0.15.0.2 milestone for the convenience of miners. |
* This removes block-size-limiting code in favor of GBT clients doing the limiting themselves (if at all). * -blockmaxsize is deprecated and only used to calculate an implied blockmaxweight, addressing confusion from multiple users. * getmininginfo's currentblocksize return value was returning garbage values, and has been removed, also removing a GetSerializeSize call in some block generation inner loops and potentially addressing some performance edge cases. Github-Pull: bitcoin#11100 Rebased-From: ba206d2
No sensible user will ever keep the default settings here, so not having sensible defaults only serves to screw users who are paying less attention, which makes for terrible defaults. Github-Pull: bitcoin#11100 Rebased-From: 3dc263c
Github-Pull: bitcoin#11100 Rebased-From: 6f703e9
No sensible user will ever keep the default settings here, so not
having sensible defaults only serves to screw users who are
paying less attention, which makes for terrible defaults.
Additionally, support for block-size-limiting directly has been removed:
doing the limiting themselves (if at all).
blockmaxweight, addressing confusion from multiple users.
garbage values, and has been removed, also removing a
GetSerializeSize call in some block generation inner loops and
potentially addressing some performance edge cases.