Open mynameisdaniil opened 8 months ago
State bridge file but without actual implementation is here right now: https://github.com/status-im/nimbus-eth1/blob/master/fluffy/tools/portal_bridge/portal_bridge_state.nim#L33 , see TODO there also.
I believe we can implement the state network bridge without pulling in the EVM or needing to read era1 files by simply calling these JSON-RPC endpoints:
trace_replayBlockTransactions is required to get the state diff for each block and eth_getBlockByNumber is needed to get the withdrawals after the merge. We will also need to calculate minor rewards for premerge separately. Erigon, reth and Besu support trace_replayBlockTransactions and so I believe we should also aim to implement it in Nimbus at some point.
We will want to use the 'stateDiff' option in the parameters. For example:
{
"jsonrpc": "2.0",
"method": "trace_replayBlockTransactions",
"id": 100,
"params": ["0xAAAAA", ["stateDiff"]]
}
The Fluffy state network bridge logic would look something like this:
Based on existing bridges in
fluffy/tools
implement state network bridge.To build the bridge:
make portal_bridge