a16z / helios

A fast, secure, and portable light client for Ethereum
MIT License
1.76k stars 269 forks source link

invalid: cannot get environment variable when run example/call #307

Closed hsyodyssey closed 6 months ago

hsyodyssey commented 7 months ago

Hi team, There may be a potential issue here as MAINNET_EXECUTION_RPC is not in the system environment. So when I run 'cargo run --package helios --example call', it introduces the following error.

(base) ➜  helios git:(master) cargo run --package helios --example call
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `target/debug/examples/call`
Error: environment variable not found

Location:
    examples/call.rs:29:23

An easily fix is to use a dotenv library so that you can read the .env files in the local project, I'll submit a PR later, FYI. (of course it's also possible to just hard-code the option to not use environment variables.)

Update: Fixed this issue locally via this PR