consensus, core, eth/downloader: add 4844 excessDataGas validations#27340
consensus, core, eth/downloader: add 4844 excessDataGas validations#27340karalabe wants to merge 6 commits into
Conversation
holiman
left a comment
There was a problem hiding this comment.
Looks good, but we need to do a couple of syncs to verify that the changes in eth/downloader are ok
There was a problem hiding this comment.
It seems pretty rare this code path would actually be triggered, what is benefit of fast failing here?
There was a problem hiding this comment.
Interestingly, the downloader has an optimisation that it only requests block bodies if they are not empty. If they are empty, then the bodies aren't requested and just pre-filled to zero.
Buuut, 4844's excessDataGas field needs the bodies to be verified. Since the downloader just blindly fills teh transaction list as empty in those cases, we have two options:
- Have the excessDataGas already validated like all other header fields (what this check does)
- Introduce header validation pathways into the "fill empty block" mechanism of the downloader
The second thing seemed wonkier as it would need changes that touch a number of unintuitive spots in the code.
But in all honesty, this change is also not that intuitive, it just seemed nicer.
Alternatively we could do something akin to the "gasUsed" which is completely ignored during snap sync and just assumed to be correct whatever it is, but here we not only have "blobsUsed" but also "pricing" so it seemed more relevant to try and validate it.
TL;DR: These are all fallouts of that convoluted field.
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Marius van der Wijden <m.vanderwijden@live.de>
|
Superseded by #27382 according to ethereum/EIPs#7062 |
This PR implements validating the excessDataGas field of Cancun headers.
The validations are significantly more complex than previous header validations because the excessDataGas field combines two notions into one: the price for data blobs and the gas used by data blobs. To validate the combo field, we need access to both the parent's excessDataGas as well as the current block's transaction list (blob count). This makes validation more convoluted in both the chain's block processor as well as the downloader, which both needs to juggle two entities (parent header, current block) from now on.