cartesi / rollups-node

Reference implementation of the Cartesi Rollups Node
Apache License 2.0
23 stars 64 forks source link

[EVM Reader] Check Inputbox contract on Startup #530

Open fmoura opened 4 months ago

fmoura commented 4 months ago

📚 Context

EVM Reader reads inputs from a InputBox contract. But it do not verify if the contract is actually deployed or it is at the specified block. It should check and fail if the contract is absent or the informed inputBoxDeplymentBlockNumber is actually different from the actual one

✔️ Solution

Add a check at Evm Reader Service start

fmoura commented 3 months ago

A complete check is not feasible using current Devnet, as Anvil has a bug related to eth_getCode when Anvil starts with--load-state. I opened a issue on Foundry Github repo

This bug prevents checking a contract on a specific block that is part of the loaded state

tuler commented 3 months ago

You don't need to specify the block to getCode (even if you can). Only getCode is a "complete" check.

fmoura commented 3 months ago

We actually wants to check two things:

for the latter we need to check the code at the specified block.