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

chore: remove cosmos/relayer dependency #429

Merged
merged 22 commits into from
Jan 23, 2025
Merged

Conversation

Lazar955
Copy link
Member

@Lazar955 Lazar955 commented Jan 21, 2025

  • Migrates the minimal amount of code needed from the relayer repo
  • Removes dependency for cosmos/relayer
  • Removes dependency for strangelove-ventures/cometbft-client

Todo:

  • As this is modified code from the relayer, what license if any should we include in the header of those files? I've also modified them (deleted a bunch of stuff, and added more code quality improvements)
  • Is feegrant.go needed, feels like it can be removed and other parts related to it
  • Future PRs can remove references to strangelove cometbft client, tho we do have to satisfy the CometRPC interface, ABCIClient interface etc. (not sure if it's worth the extra effort)
  • Decide on the name of the relayer package, the clients would currently use relayerclient.Whatever

Closes

@Lazar955 Lazar955 marked this pull request as ready for review January 21, 2025 14:45
@RafilxTenfen
Copy link
Contributor

are we going to have our own relayer?

@KonradStaniec
Copy link
Collaborator

are we going to have our own relayer?

Not really.

Main goal of this task is to make our programs to not depend on libraries which are no longer maintained (in this case github.com/strangelove-ventures/cometbft-client ) and this requires as to ditch dependency on go-relayer

@KonradStaniec
Copy link
Collaborator

KonradStaniec commented Jan 21, 2025

Decide on the name of the relayer package, the clients would currently use relayerclient.Whatever

tbh I would name it babylonclient or cosmosclient

As this is modified code from the relayer, what license if any should we include in the header of those files? I've also modified them (deleted a bunch of stuff, and added more code quality improvements)

Something like that - https://law.stackexchange.com/questions/59999/can-i-copy-pieces-of-apache-licensed-source-code-if-i-attribute ? (though I am not a license expert)

Future PRs can remove references to strangelove cometbft client, tho we do have to satisfy the CometRPC interface, ABCIClient interface etc. (not sure if it's worth the extra effort)

I think one of the goals of this is to, remove dependency on strangelove cometbft client , so maybe lets:

  • create feature branch with feat/ prefix for the whole feature
  • make this pr to the feature branch
  • then create next pr removing dependency on strangelove cometbft clien
  • then create pr from feature branch to main

Or maybe remove strangelove cometbft client directly in this pr. wdyt ?

@Lazar955
Copy link
Member Author

@KonradStaniec

Or maybe remove strangelove cometbft client directly in this pr. wdyt ?

Removed it in this PR, it wasn't a big effort, commit

@RafilxTenfen
Copy link
Contributor

The package relayerclient could be in a separate repository in my opinion

@Lazar955
Copy link
Member Author

The package relayerclient could be in a separate repository in my opinion
@RafilxTenfen
For now, I would keep it within the Babylon repo. The only "issue" I personally see is that updating client code would mean that we have to release a new version of Babylon, I don't see this as something that should happen often (as up to this point it wasn't the case), as the only real dependencies of that new package are cometbft and cosmos SDK. If we start updating the client often and as a consequence we have to release new version of Babylon, I'm down for splitting this into it's own repo.

@RafilxTenfen
Copy link
Contributor

The package relayerclient could be in a separate repository in my opinion
@RafilxTenfen
For now, I would keep it within the Babylon repo. The only "issue" I personally see is that updating client code would mean that we have to release a new version of Babylon, I don't see this as something that should happen often (as up to this point it wasn't the case), as the only real dependencies of that new package are cometbft and cosmos SDK. If we start updating the client often and as a consequence we have to release new version of Babylon, I'm down for splitting this into it's own repo.

Yeah, but also like we are constantly getting babylon node code checked and this is basically not a part of it, just a consumer
Anyway, if we intend to maintain this code in the Babylon repo, the PR looks good to me ^^

Copy link
Contributor

@RafilxTenfen RafilxTenfen left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@KonradStaniec KonradStaniec left a comment

Choose a reason for hiding this comment

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

LGTM!

One question, did you test this branch with some service (like use this version in staker and run e2e tests) to see whether change is really not breaking ?

Also, lets merge this one after - #402

@Lazar955
Copy link
Member Author

LGTM!

One question, did you test this branch with some service (like use this version in staker and run e2e tests) to see whether change is really not breaking ?

Also, lets merge this one after - #402

I've tested it with Vigilante e2e tests

"github.com/cosmos/cosmos-sdk/codec/types"
)

type Codec struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems the same as our EncodingConfig

Can we use that?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, nice spot

"go.uber.org/zap"
)

type Client struct {
*query.QueryClient

provider *cosmos.CosmosProvider
provider *babylonclient.CosmosProvider
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make this public?

Suggested change
provider *babylonclient.CosmosProvider
Provider *babylonclient.CosmosProvider

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 we can add a getter func


// GetAccountNumberSequence returns sequence and account number for the given address.
// It returns an error if the account couldn't be retrieved from the state.
func (cc *CosmosProvider) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we make a function that increases the account sequence also in the WalletState

// This method will return once the transaction has entered the mempool.
// In an async goroutine, will wait for the tx to be included in the block unless asyncCtx exits.
// If there is no error broadcasting, the asyncCallback will be called with success/failure of the wait for block inclusion.
func (cc *CosmosProvider) SendMessagesToMempool(
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add another option here to specify the sequence in the msg and if it is specified the PrepareFactory would not load from the account sequence

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm it's going to be a bit much returning and passing account sequence to build messages, maybe we a separate SendMessagesToMempool?

Copy link
Contributor

Choose a reason for hiding this comment

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

could be as well ;D

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe all this is a bit out of the scope of this PR, comparing what's needed in cov emulator PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

it could be done in another PR, but just adding the account sequence would help to reduce a lot the code copy in covd

@RafilxTenfen
Copy link
Contributor

Added a new comments here #429 due to comment in babylonlabs-io/covenant-emulator#98 (comment)

@RafilxTenfen RafilxTenfen self-requested a review January 23, 2025 11:37
@Lazar955 Lazar955 merged commit 2b8c528 into main Jan 23, 2025
24 checks passed
@Lazar955 Lazar955 deleted the lazar/remove-relayer-dep branch January 23, 2025 15:37
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.

3 participants