-
Notifications
You must be signed in to change notification settings - Fork 990
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
Pool tx weight verification #2466
Pool tx weight verification #2466
Conversation
I think the approach makes a lot of sense (I was trying to find the issue where we were discussing this, over the possibility that someone could post a transaction with a fee and have no say over what other transactions they get lumped with). Just thinking through consensus issues. We're relaxing requirements for the block tx, and adding a constraint to individual transactions that wasn't there before. So an earlier client might have rejected a huge individual tx via the block (throwing out other transactions with it), whereas a new client would throw it out at the individual TX level. I'd guess the worst that can happen here is a brief fork? |
No - this does not change the tx or block validation logic. It just rewrites it to make it more flexible. The only thing we're affecting is the "can I add this valid tx to the txpool" logic. |
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.
Just minor comments but a great fix.
Haven't merged this yet but its good to go. |
I'm all good with that. |
So it turns out treating the txpool as "one big tx" for validation purposes meant we were verifying the max weight of the whole transaction pool and checking it did not exceed
MAX_BLOCK_WEIGHT
...This is clearly sub-optimal for a bunch of reasons.
Existing
verify_weight()
logic takes awith_reward
bool flag to allow txs and blocks to both be weight verified. A block will have an additional output and kernel to cover the coinbase reward, so txs have to be slightly less weighty to account for this.This PR introduces a
Weighting
enum and replaces thewith_reward
bool flag with the enum.So now we can robustly validate the contents of the txpool by treating it as "one big tx" after aggregation, but skipping the weight verification step.
This is all slightly confusing because we -
So in the context of weight we validate txs as if they were pretending to be blocks.
And blocks as if they were pretending to be txs pretending to be blocks.
We validate the txpool as if it was "one big tx", but for weight purposes we treat it as having no weight limit.