paradigmxyz / reth-exex-examples

Collection of ExEx examples built on Reth
https://reth.rs/developers/exex/exex.html
Apache License 2.0
119 stars 17 forks source link

End-to-end testing of the oracle example #32

Open SetarehGhorshi opened 3 weeks ago

SetarehGhorshi commented 3 weeks ago

Hello.

I have been trying to perform an end-to-end test of the oracle example. For this purpose, I tried running two instances of it on the same machine using the provided command but with different ports. My first issue was that the two instance were not discovering each other. I was able to fix it by manually sending a ping from one to the other in the discovery process. With this, the connection was established between the two nodes but the OracleConnection which listens to the messages passed between the nodes did not start (This poll did not start). Based on the logs, there is no Established event received from the _protoevents ( according to this part), which based on my understanding means that the _intoconnection() function has not been called (which is implemented here). And this seems to be the reason for OracleConnection not starting. I tried with different options for the chain such as mainnet and dev. Also tried with the --dev flag. But still was not able to perform a full test due to the mentioned issue. I am not sure where the issue comes from so I really appreciate it if there are any instructions for running an end-to-end test of the oracle example. Also, I was wondering if there is any way so we can run reth on the forked state of holesky for testing?

Thanks.

SetarehGhorshi commented 2 weeks ago

@loocapro I appreciate any help you can provide with this.

loocapro commented 2 weeks ago

Hi @SetarehGhorshi ,

It seems that your two nodes did not actually connect. When nodes successfully connect, they should emit an Established event.

Also, I was wondering if there is any way so we can run reth on the forked state of holesky for testing?

You can run it with this command:

cargo run --bin oracle node --chain holesky \
--debug.tip "0x4d2d4aca1d5d0a69b1a2c75e0e5d8b3185f62f247145aa85199195742966b1dc" \
--http --http.addr 0.0.0.0 --http.port 8545 --http.api eth

Don't forget to set the P2P ports and any other arguments you might need.

Then wait until it syncs to that block hash. It’s one of the first block hashes that actually contains transactions, but if you don’t specifically need it, you can use an earlier block. The sync should take around 10 minutes.

Thanks for this! It’s really useful, and I’ll also try it on my end.

By the way, if you're comfortable with it, you could point this repo to a local Reth workspace for easier debugging. You can achieve this by using Cargo’s local path dependencies, like so:

# In your Cargo.toml
[dependencies]
reth = { path = "../path/to/local/reth" }
# add other reth crates here

This way, you’ll be able to make and test changes locally in the Reth workspace without needing to push or publish them first.

Feel free to message me on Telegram with your findings — I’m curious! TG handle: loocapro