a16z / helios

A fast, secure, and portable multichain light client for Ethereum
MIT License
1.88k stars 297 forks source link

feat: support retries when execution rpc fails in wasm #407

Open ncitron opened 1 month ago

ncitron commented 1 month ago

We had to disable Alloy's rate limit retry mechanism when compiling to wasm in core/execution/rpc/http_rpc.rs because it doesn't seem to compile properly. This means if the external RPC fails the whole helios request will error, which we don't want. Implement some sort of retry mechanism that works in wasm or find out how to make Alloy's work properly (using alloy's is the preference). We should also be intelligent about only retrying things that we think might be resolved (rate limits, connection errors) as opposed to something else.

eshaan7 commented 2 weeks ago

I think this may be due to being on quite an old version of alloy 0.2.1 while the current latest is 0.6.2.

For example, the below diff in the file that defines RetryBackoffLayer makes me think the newer version supports Wasm:

#[cfg(target_arch = "wasm32")]
use wasmtimer::tokio::sleep;

#[cfg(not(target_arch = "wasm32"))]
use tokio::time::sleep;

-- link

However, not able to confirm this because updating to latest version of alloy breaks a lot of things elsewhere in the codebase.