-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ethereum to cosmos relayer module #190
base: main
Are you sure you want to change the base?
feat: add ethereum to cosmos relayer module #190
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #190 +/- ##
=======================================
Coverage 96.97% 96.97%
=======================================
Files 11 11
Lines 562 562
=======================================
Hits 545 545
Misses 17 17 ☔ View full report in Codecov by Sentry. |
@@ -27,6 +27,8 @@ broadcast/*/31337/ | |||
target | |||
elf | |||
artifacts | |||
bacon.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit unrelated, but added these since I am experimenting with running bacon-ls as a wrapper for rust-analyzer to improve incremental compilation.
@@ -82,13 +86,17 @@ ibc-core-commitment-types = { version = "0.56", default-features = false } | |||
ibc-core-handler-types = { version = "0.56", default-features = false } | |||
ibc-client-tendermint-types = { version = "0.56", default-features = false } | |||
|
|||
alloy = { version = "0.8", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can discuss this, but I just felt it was a bit much to depend on the whole thing, when we can just pick and choose the bits we need.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not being used on contracts or on chain logic. So, here, readability is more important than picking an choosing. Many of the example codes from alloy also doesn't pick and choose.
So I'd prefer if we only picked and chose in wasm contracts or sp1-programs.
|
||
// TODO: Remove when we have removed manual relaying and moved to | ||
// common relaying methods that can choose the correct methods | ||
func (s *TestSuite) SkipIfEthTestnetType(testnetType string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all the e2e relaying tests work with both pow and pos, so added this for now.
I think it might make sense to get rid of the manual relaying in go and switch to the relayer now, but we can still have the relayer calls behind some functions that can handle the different testnet types - and then we can remove this method.
If we agree on this, I'll create an issue to remove the manual relaying and consolidate relaying in the e2e tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add a mock
option in the relayer config so that we don't need to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think consolidation the tests would be useful, because I don't want to maintain the manual relayer and a bunch of extra tests if we don't have to. If we can just test everything together it would mean quite a bit less code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I do like the mock option a lot! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good. I think you should be very familiar with the relayer now. I have a couple suggestions and questions, so I will approve once those are resolved. And I have a few requests as well:
- Can you update
config.example.json
with the new module. - Can you update the README.md for the relayer.
@@ -82,13 +86,17 @@ ibc-core-commitment-types = { version = "0.56", default-features = false } | |||
ibc-core-handler-types = { version = "0.56", default-features = false } | |||
ibc-client-tendermint-types = { version = "0.56", default-features = false } | |||
|
|||
alloy = { version = "0.8", default-features = false } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not being used on contracts or on chain logic. So, here, readability is more important than picking an choosing. Many of the example codes from alloy also doesn't pick and choose.
So I'd prefer if we only picked and chose in wasm contracts or sp1-programs.
|
||
// TODO: Remove when we have removed manual relaying and moved to | ||
// common relaying methods that can choose the correct methods | ||
func (s *TestSuite) SkipIfEthTestnetType(testnetType string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add a mock
option in the relayer config so that we don't need to do this.
"os" | ||
"text/template" | ||
) | ||
|
||
// EthToCosmosConfigInfo is a struct that holds the configuration information for the Ethereum to Cosmos config template | ||
type EthToCosmosConfigInfo struct { | ||
type EthCosmosConfigInfo struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to support mock wasm contract, perhaps we can add a new field?
e2e/interchaintestv8/relayer_test.go
Outdated
beaconAPI := "" | ||
if eth.BeaconAPIClient != nil { | ||
beaconAPI = eth.BeaconAPIClient.GetBeaconAPIURL() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is here because of the pow vs. pos tests right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct. I'll add comment.
@@ -299,6 +331,7 @@ func (s *RelayerTestSuite) Test_5_BatchedAckPacketToEth_Plonk() { | |||
func (s *RelayerTestSuite) ICS20TransferERC20TokenBatchedAckTest( | |||
ctx context.Context, proofType operator.SupportedProofType, numOfTransfers int, | |||
) { | |||
s.SkipIfEthTestnetType(testvalues.EthTestnetTypePoS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create an issue to remove these? I think we can do this my adding a hidden mock option to the relayer module?
It would be good to do this in this PR but I understand if you want to create a separate issue for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I did want to get rid of them, I'll create a placeholder issue for it and with needs-discussion
until we decide on the approach. A mock option seems like a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an issue. I also realized we don't actually have to consolidate the e2e tests at the same time as we fix this, so that issue should be ready to go: #192
let mut headers = vec![]; | ||
let mut trusted_slot = ethereum_consensus_state.slot; | ||
let mut prev_pub_agg_key = BlsPublicKey::default(); | ||
for update in &light_client_updates { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this for loop can be done with futures fold instead but this looks good for now
alloy = { workspace = true, features = ["full", "node-bindings"] } | ||
alloy-network = { workspace = true } | ||
alloy-signer-local = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine since this is a util library
alloy = { workspace = true, features = ["full", "node-bindings"] } | ||
alloy-primitives = { workspace = true } | ||
alloy-provider = { workspace = true, features = ["reqwest"] } | ||
alloy-network = { workspace = true } | ||
alloy-transport = { workspace = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed since this compiles to an executable anyway (no on chain logic).
tracing::info!("Got {} source_tx_ids", inner_req.source_tx_ids.len()); | ||
tracing::info!("Got {} timeout_tx_ids", inner_req.timeout_tx_ids.len()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this format match our logs in other relayer modules? It would be nice to use the same format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More or less, but the other ones didn't have this logging, so changing them a little and adding it to those as well for consistency.
/// The configuration for the Cosmos to Cosmos relayer module. | ||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] | ||
#[allow(clippy::module_name_repetitions)] | ||
pub struct EthToCosmosConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add a mock field here (which we allow to be absent in the actual config file and defaults to false)
Co-authored-by: srdtrk <[email protected]>
Description
closes: #152
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.