This PR contains a collection of additional changes that were required to support snap syncing.
They are:
Handling celo block receipts - celo-blockchain would add an extra block receipt to the end of the receipts in a block containing any logs generated from system calls executed in that block. So we need to handle that quirk here, in order to support handling migrated legacy data.
Ensuring non nil difficulty in pre-gingerbread blocks. Before the gingerbread hardfork celo blocks did not have a difficulty field. While the obvious choice to represent this is nil, the go-ethereum codebase assumes non nil difficulties, and so rather than try to catch all locations which try to access difficulty it is simpler to set a zero valued difficulty on pre gingerbread blocks.
Skip the downloader uncle hash check for pre-gingerbread blocks. Pre-gingerbread blocks lacked an uncleHash field (and uncles), but as the field is a non pointer hash in the op-geth structure, when decoding pre-gingerbread blocks the uncleHash is a zero valued hash. go-ethereum expects a block that lacks uncles to have a hash of the empty list which is not a zero valued hash, so in order to allow the downloader to process pre gingerbread blocks we skip this check for pre-gingerbread blocks.
Handle the base fee calculation for the transition block. The EIP-1559 implementation provides a method to calculate the base fee for a block based on the parent block, this is used in block construction and validation. We set the london hardfork activation block to the the "l2 genesis" and when validating the first EIP-1559 block (I.E the current block is on the london hardfork and the parent is not) the method considers the base fee to be params.InitialBaseFee which is a hardcoded value. That doesn't work in our case because we probably want to set the base fee to match that defined at the transition point which can vary, so instead we take the value of the parent block, and if that is missing fall back to the base fee.
This PR contains a collection of additional changes that were required to support snap syncing.
They are:
params.InitialBaseFee
which is a hardcoded value. That doesn't work in our case because we probably want to set the base fee to match that defined at the transition point which can vary, so instead we take the value of the parent block, and if that is missing fall back to the base fee.