Skip to content
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: added a poc relayer implementation #123

Merged
merged 77 commits into from
Nov 28, 2024
Merged

Conversation

srdtrk
Copy link
Member

@srdtrk srdtrk commented Nov 27, 2024

Description

closes: #122


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.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@srdtrk srdtrk linked an issue Nov 27, 2024 that may be closed by this pull request
20 tasks
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.89%. Comparing base (71d82b4) to head (407711e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #123   +/-   ##
=======================================
  Coverage   93.89%   93.89%           
=======================================
  Files           9        9           
  Lines         311      311           
=======================================
  Hits          292      292           
  Misses         19       19           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@srdtrk srdtrk removed a link to an issue Nov 27, 2024
20 tasks
Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some minor comments, but have questions on some of the scope as it seems to do more things than I anticipated?

Cargo.toml Outdated Show resolved Hide resolved
Cargo.toml Outdated Show resolved Hide resolved
e2e/interchaintestv8/relayer/config.go Outdated Show resolved Hide resolved
e2e/interchaintestv8/relayer/config.go Outdated Show resolved Hide resolved
buf.gen.yaml Outdated Show resolved Hide resolved
// IbcEurekaTestSuite is a suite of tests that wraps TestSuite
// and can provide additional functionality
type RelayerTestSuite struct {
IbcEurekaTestSuite
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I assume we will merge this into the same TestSuite eventually? Because having this kind of inheritance-like structure does not feel great.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to keep them separate. We already use inheritance for IbcEurekaTestSuite.

I think inheritance is totally fine since these are just tests and it makes our lives simpler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but 2 levels of inheritance is starting to get a bit crazy :) That said, maybe the fact that we would want to inherit from the IbcEurekaTestSuite just means that we should put all of that into the base level TestSuite. Why keep multiple levels if we always just need the same stuff. But we don't have to deal with that in this PR ofc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's deal with it in another PR. I actually have another PR coming up which doesn't inherit from IbcEurekaTestSuite but inherits from TestSuite because it only deploys the sp1-ics07 client.

You should inherit IbcEurekaTestSuite if you need to deploy all the IbcEureka contracts. The relayer test suite needs this, so it inherits it. But other test suites might want to test other contracts/features in isolation

e2e/interchaintestv8/relayer_test.go Outdated Show resolved Hide resolved
e2e/interchaintestv8/relayer_test.go Outdated Show resolved Hide resolved
packages/relayer-lib/src/submitter/eth_eureka.rs Outdated Show resolved Hide resolved
/// The `ChainListener` listens for events on the Cosmos SDK chain.
pub struct ChainListener(HttpClient);

impl ChainListener {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a listener? It seems to be more a of query service, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on how you interpret the word. I'd say it is not an event-source. But it does fetch txs, blocks, and parses events. So I feel ok calling it a listener, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typically, a listener does not actively fetch information, they listen for events. So, if this was an event sink that would be fed events from the chain, it could be a listener. But this one just fetches by itself, so I don't think I would use the listener term here.

@gjermundgaraba
Copy link
Contributor

This is an impressive piece of work! Really well done! I will probably need to spend some time in the code more closely to see how everything fits together as this is quite a lot to review 😅

Copy link
Contributor

@gjermundgaraba gjermundgaraba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good! Left a couple of questions. I also think I will want review the whole structure again later when more changes are coming, but for now we are almost good to go.

I still would like both the submitter and the listener to change names as it confused me to what they really do (which is build transactions and query for events)

provider: P,
tm_client: HttpClient,
proof_type: SupportedProofType,
sp1_private_key: Option<String>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is going to be an env var anyway, maybe we could avoid having to deal with sending this around and storing it in config files. Keeping private keys in config files seems like something we might want to avoid.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relayer should not use env variables. Sp1 should switch to api keys perhaps. I view this as an API key anyway. So this is fine


let tm_listener = cosmos_sdk::ChainListener::new(tm_client.clone());

let wallet = EthereumWallet::from(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't need to sign anything, this seems unnecessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is unnecessary. But I think nothing wrong with keeping it for now, I can remove it in the subsequent PR where we add actual relaying.

@srdtrk srdtrk merged commit cea5f92 into main Nov 28, 2024
24 of 25 checks passed
@srdtrk srdtrk deleted the serdar/xxx-rust-project branch November 28, 2024 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a relayer RPC server that only returns the chain info
2 participants