Closed fmrmf closed 1 year ago
Good catch! Feel free to open a PR with either approach. 2 requests is not a big deal here I don't think.
Sounds good! Believe this also applies to ape-hardhat
for the same function. Will make a PR there too if that works.
Environment information
ape
and plugin versions:What went wrong?
Looking to use the provider
reset_fork(block_number: Optional[int])
function to programmatically reset the forked chain to a specified block number (i.e. not by specifying fork block number inape-config.yaml
).When attempting to do this as in backtest_ape/base.py#L181, found the
block.base_fee
for the next mined block will be set as the base fee from the initial fork block number specified in theape-config.yaml
file, instead of the base fee for the newblock_number
looking to reset to.This can lead to transactions that would have been included in the first block after the reset fork number not being re-included post fork with the error
From console:
How can it be fixed?
The bug can be fixed by calling the
setNextBlockBaseFeePerGas
endpoint using the base fee fetched from the newchain.blocks.head
post-reset as done here.There's likely a way to avoid two calls by passing in a new value for the
initialBaseFeePerGas
param to theanvil_reset
endpoint, but wasn't able to get that to work properly.