Research/Bitcoin Dev Archive / SegWit2x list
MAX_BLOCK_WEIGHT increase?
3 messages, Jun 14 to 15, 2017. Started by Oliver Petruzel.
Oliver Petruzel (3)
Great work so far!
Q: Are you planning to add code in the alpha build that modifies (raises) the value of the MAX_BLOCK_WEIGHT variable in the hardfork?
In my opinion, that value should be increased to somewhere between 6M and 8M in the hardfork.
Leaving it at 4M in the hardfork will artificially limit the max potential throughput for the larger SegWit blocks, whereas increasing it to 8M would maintain the same ratio that exists in the softfork version of SegWit, and also allow for max potential throughput.
Testing of BIP141 on Core 0.14 resulted in blocks that were ~2 to 2.1MB with normal transaction behavior. The increase of Base Size to 2,000,000 bytes should therefore result in blocks ~4 to 4.2MB with normal transaction behavior.
Shouldn't the MAX_BLOCK_WEIGHT be increased to allow for those potential results and throughput?
Thoughts?
Oliver Petruzel Owner, Procryptic Inc.
Ok, on a related note, I had a chance to dig into the latest *consensus.h* and *validation.cpp *some more.
If the *MAX_BLOCK_WEIGHT* is not increased in the hardfork, will we encounter any issues with the test at line 3096 in *validation.cpp*?
Where exactly is the code that hard limits all blocks to less than 4M bytes? (the static value of MAX_BLOCK_WEIGHT both before and after the hardfork).
Greg Maxwell had this to say about it:
*"A block with 2,000,000 bytes of legacy transactions would have a weight of 8,000,000 (weight = 3x witness-stripped-size + size). So it would have too much weight and will fail the weight test, regardless of what other tests have been added"*
Is he correct? Or, is there a hard limit enforcement somewhere in the new code that I missed?
*Relevant code from validation.cpp, beginning at line 3096*:
*if (GetBlockWeight(block) > MAX_BLOCK_WEIGHT) {* * return state.DoS(100, false, REJECT_INVALID, "bad-blk-weight", false, strprintf("%s : weight limit failed", __func__));* * }* *return true;*
Thinking about it some more, I don't think Greg was correct about legacy transactions, because the witnesses aren't actually stripped from legacy tx, are they?
2M bytes of legacy tx would simply result in a full block that is 2MB in size, correct?
However, could his statement become true with 2,000,000 bytes of non-witness data for a block with all SegWit transactions? Would the total weight then be 8M and subsequently fail the weight limit test?
I know I've been talking to myself here, but I'm really trying to game this. Any help would be much appreciated!
Oliver
On Jun 15, 2017 5:26 PM, "Oliver Petruzel" <opetruzel at gmail.com> wrote:
Quoted text (28 lines)
> Ok, on a related note, I had a chance to dig into the latest *consensus.h*
> and *validation.cpp *some more.
>
> If the *MAX_BLOCK_WEIGHT* is not increased in the hardfork, will we
> encounter any issues with the test at line 3096 in *validation.cpp*?
>
> Where exactly is the code that hard limits all blocks to less than 4M
> bytes? (the static value of MAX_BLOCK_WEIGHT both before and after the
> hardfork).
>
> Greg Maxwell had this to say about it:
>
> *"A block with 2,000,000 bytes of legacy transactions would have a weight
> of 8,000,000 (weight = 3x witness-stripped-size + size). So it would have
> too much weight and will fail the weight test, regardless of what other
> tests have been added"*
>
> Is he correct? Or, is there a hard limit enforcement somewhere in the new
> code that I missed?
>
> *Relevant code from validation.cpp, beginning at line 3096*:
>
> *if (GetBlockWeight(block) > MAX_BLOCK_WEIGHT) {*
> * return state.DoS(100, false, REJECT_INVALID, "bad-blk-weight",
> false, strprintf("%s : weight limit failed", __func__));*
> * }*
> *return true;*
>