Near-One / rainbow-bridge

🌈🌈🌈 NEAR <> Ethereum Decentralized Bridge
GNU General Public License v3.0
327 stars 100 forks source link

[BUG] Eth RPC Client indexing into headers failing #874

Closed tbraun96 closed 1 year ago

tbraun96 commented 1 year ago

Consider this function: https://github.com/aurora-is-near/rainbow-bridge/blob/aef936406ce3a03c551d91df901761931e57e255/eth2near/eth_rpc_client/src/beacon_rpc_client.rs#L355-L362

As we see, we are indexing into the data via v["data"][0]["attested_header"]. However, on our fork, this does not work.

We must instead index as such: https://github.com/webb-tools/pallet-eth2-light-client/blob/c78e558a795816a2068aba54886915d83ffddd49/crates/eth_rpc_client/src/beacon_rpc_client.rs#L352

We also have to adjust the indexing elsewhere in the code to first index into the 0th element of the array, then the rest of the keys: v[0]["data"]["attested_header"]["beacon"]

We are testing on Goerli testnet.

karim-en commented 1 year ago

The light client api is not standardized so it depends on the version of the lodestar node. So it is not a bug, but missing support for the last/some version of lodestar API.

@olga24912 FYI

tbraun96 commented 1 year ago

Which beacon chain and eth1 endpoints should we use? Also, which Beacon RPC version should be used?