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

Osmosis testnet was upgraded to Cosmos SDK 0.47 which is incompatible with Tendermint34Client #71

Open
chasevoorhees opened this issue Dec 7, 2023 · 13 comments

Comments

@chasevoorhees
Copy link

@cosmjs/tendermint-rpc - I suddenly started getting an error after broadcastTx->decodeTx
"Error: Invalid string. Length must be a multiple of 4"

I opened an issue with cosmjs and they told me this:

Osmosis testnet was upgraded to Cosmos SDK 0.47 as far as I can tell. In that case, using the Tendermint34Client won't work anymore. You need the Tendermint37Client. Can you report this to osmojs where those things are defined?

It looks like we need to be able to specify whether we want to use Tendermint34Client or Tendermint37Client when calling getSigningOsmosisClient()

I'm looking into this personally to see if there's an easy fix but wanted to post this as it's a blocking issue for hummingbot's Osmosis connector

@webmaster128
Copy link

I assume this error happens because testnest is on SDK 0.47 (Tendermint 0.37) and mainnet is on 0.45 (Tendermint 0.34). In the latest version of CosmJS there is connectComet(endpoint) which does the auto-detectsion and returns a type CometClient = Tendermint34Client | Tendermint37Client | Comet38Client

@pyramation
Copy link
Collaborator

@webmaster128 do we need to do something in the config, or won't cosmjs detect it?

Maybe the devs can temporarily manage this by using resolutions in your package and including a newer version of cosmjs if we've baked an older version in

@webmaster128
Copy link

How do you currently create that client? Tendermint34Client is expected to not support SDK 0.47. Using connectComet is the recommended way to create the client if you are creating the Tendermint/Comet client manually. Otherwise the higher level StargateClient does the detection internally.

@pyramation
Copy link
Collaborator

pyramation commented Dec 12, 2023

ok — so this clearly may be the isssue @webmaster128

const tmClient = await Tendermint34Client.connect(rpcEndpoint);

can you provide a small snippet of what we should change this too? I think we went a little lower level and are using the client directly

cc @Zetazzz

@Zetazzz
Copy link
Collaborator

Zetazzz commented Dec 12, 2023

Hi, Hoang's almost got this PR done:
cosmology-tech/telescope#503

We're working on getting this PR merged, hopefully we'll publish soon

@webmaster128
Copy link

Yes, confirming that cosmology-tech/telescope#503 is the right solution

@hoangdv2429
Copy link

I merged my PR. This should be okay now.

@Zetazzz
Copy link
Collaborator

Zetazzz commented Dec 13, 2023

@cosmology/[email protected] published
useConnectComet option will be deprecated and made the logic default after a trial period.

@chasevoorhees
Copy link
Author

Sorry guys - here was my (well, mostly the Kujira connector dev's) solution to manually instantiate Osmosis with Tendermint37Client

const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [
  ...cosmosProtoRegistry,
  ...cosmwasmProtoRegistry,
  ...ibcProtoRegistry,
  ...osmosisProtoRegistry
];

const aminoConverters = {
  ...cosmosAminoConverters,
  ...cosmwasmAminoConverters,
  ...ibcAminoConverters,
  ...osmosisAminoConverters
};

const registry = new Registry(protoRegistry);
const aminoTypes = new AminoTypes(aminoConverters);

  private async osmosisGetSigningStargateClient(
    rpcEndpoint: string,
    signer: any,
  ){
    this.osmosisGetHttpBatchClient(rpcEndpoint);
    await this.osmosisGetTendermint37Client();

    const signingStargateClient = await SigningStargateClient.createWithSigner(this.tendermint37Client!, signer, {
      registry: registry,
      aminoTypes: aminoTypes
    });

    return signingStargateClient;
  }

  private async osmosisGetTendermint37Client() {
    this.tendermint37Client = await Tendermint37Client.create(
      this.httpBatchClient!
    );
  }

  private osmosisGetHttpBatchClient(rpcEndpoint: string) {
    this.httpBatchClient = new HttpBatchClient(rpcEndpoint, {
      dispatchInterval: 2000,
    });
  }

@chasevoorhees
Copy link
Author

Closed with 2 solutions

@haroondilshad
Copy link

@chasevoorhees while cosmology might have published a new version(which comes with it's own challenges) that does not fix this issue in the osmojs package unless someone explicitly regenerates the lib from telescope again. @pyramation is there any active working solution using osmojs?

@pyramation
Copy link
Collaborator

we're on it!

@haroondilshad
Copy link

In the meanwhile, do you recommend using package.json resolutions to temporarily resolve all @cosmjs packages to the latest versions?

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

No branches or pull requests

6 participants