op-program: Store created blocks to avoid needing to re-execute them#12382
op-program: Store created blocks to avoid needing to re-execute them#12382
Conversation
Since op-program always creates a new block via engine_forkChoiceUpdated/engine_getPayload and then immediately sends the same block back to engine_newPayload to be imported, store the created block to the database without updating the chain head, so the engine_newPayload method is a no-op instead of having to execute the transactions again.
|
Test is a good callout. I had originally enforced in in the compiler but then looked at it and wondered why I had those unnecessary changes and undid them so seems like having a test is going to be a better idea. 😆 |
|
And yes, that's the if statement we're targeting. |
|
@Inphi that test got much more interesting that I first expected. Have put up a stacked PR to make it easier to review: #12402 |
…12402) Also fixes differences in block hash for created payloads when using non-op stack chains.
…thereum-optimism#12382) * op-program: Store created blocks to avoid needing to re-execute them. Since op-program always creates a new block via engine_forkChoiceUpdated/engine_getPayload and then immediately sends the same block back to engine_newPayload to be imported, store the created block to the database without updating the chain head, so the engine_newPayload method is a no-op instead of having to execute the transactions again. * op-program: Add test that created block is not reprocessed on import (ethereum-optimism#12402) Also fixes differences in block hash for created payloads when using non-op stack chains.
Description
Since op-program always creates a new block via engine_forkChoiceUpdated/engine_getPayload and then immediately sends the same block back to engine_newPayload to be imported, store the created block to the database without updating the chain head, so the engine_newPayload method is a no-op instead of having to execute the transactions again.
The engine is also used in e2e tests so the block caching is optional depending on the provided backend.