osmojs
osmojs copied to clipboard
Osmosis testnet was upgraded to Cosmos SDK 0.47 which is incompatible with Tendermint34Client
@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
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
@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
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.
ok — so this clearly may be the isssue @webmaster128
https://github.com/osmosis-labs/osmojs/blob/d4a3defc14c09d66c9201511a42b655f0d6aad47/packages/osmojs/src/codegen/cosmos/rpc.query.ts#L8
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
Hi, Hoang's almost got this PR done: https://github.com/cosmology-tech/telescope/pull/503
We're working on getting this PR merged, hopefully we'll publish soon
Yes, confirming that https://github.com/cosmology-tech/telescope/pull/503 is the right solution
I merged my PR. This should be okay now.
@cosmology/[email protected] published useConnectComet option will be deprecated and made the logic default after a trial period.
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,
});
}
Closed with 2 solutions
@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?
we're on it!
In the meanwhile, do you recommend using package.json resolutions to temporarily resolve all @cosmjs packages to the latest versions?