foundry
foundry copied to clipboard
Have auto and interval mining at the same time
Component
Anvil
Describe the feature you would like
Use case: Have fast transactions (= fast CI pipelines and tests) with automated software that reacts on events, like bots, indexers, etc
At the moment anvil allows either one mining mode or the other - auto, or interval. This is specifically signaled by the interval mining mode, that warns that auto is disabled.
Additional context
No response
this should be possible to support by adding a new variant that combines both of these:
https://github.com/foundry-rs/foundry/blob/d7eac74cfd786447cec9650048e2d2fac63fba0c/crates/anvil/src/eth/miner.rs#L102-L108
@mattsse is this high priority? I would like to work on it but it's my first time interacting with foundry so it will take some time to get this done
not high priority, the task here would be to add a new variant that is
Mixed {
auto: ReadyTransactionMiner,
fixed: FixedBlockTimeMiner
}
and then polls both
oh looks simple enough, thanks!
@mattsse hey, I created a draft pr with the new variant + it's pooling but I'm wondering if I should also add RPC handler for setting the mixed mining mode and besides that I'm not sure how to test this feature, when you have some time can you take a look? Thank you
Hi @caiquejjx thanks for picking this up, draft is looking good!
I think it makes sense to add RPC methods for this (anvil_setMixedmine(bool)
, anvil_getMixedmine(bool)
matching anvil_setAutomine(bool)
/ anvil_getAutomine(bool)
).
cc @mattsse
thanks @zerosnacks, I'll follow up with the RPC methods implementation then
Marking as resolved
by https://github.com/foundry-rs/foundry/pull/8280
Thanks for your PR @caiquejjx!