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

Upgrade cosmos and thorchain to use 0.42.14 cosmos-client #436

Closed
wants to merge 31 commits into from

Conversation

mikewyszinski
Copy link
Collaborator

No description provided.

@mikewyszinski mikewyszinski linked an issue Sep 9, 2021 that may be closed by this pull request
@mikewyszinski mikewyszinski changed the title interim commit Upgrade cosmos and thorchain to use 0.42.14 cosmos-client Sep 10, 2021
@mikewyszinski mikewyszinski marked this pull request as ready for review September 24, 2021 03:21
@mikewyszinski mikewyszinski linked an issue Sep 24, 2021 that may be closed by this pull request
README.md Outdated Show resolved Hide resolved
__integration_tests__/cosmos-client.integration.ts Outdated Show resolved Hide resolved
__integration_tests__/cosmos-client.integration.ts Outdated Show resolved Hide resolved
__integration_tests__/thorchain-client.integration.ts Outdated Show resolved Hide resolved
__integration_tests__/thorchain-client.integration.ts Outdated Show resolved Hide resolved
packages/xchain-thorchain/src/client.ts Outdated Show resolved Hide resolved
packages/xchain-thorchain/src/types/messages.ts Outdated Show resolved Hide resolved
packages/xchain-thorchain/src/types/messages.ts Outdated Show resolved Hide resolved
packages/xchain-thorchain/src/util.ts Outdated Show resolved Hide resolved
@mikewyszinski mikewyszinski linked an issue Sep 30, 2021 that may be closed by this pull request
Copy link
Collaborator

@veado veado left a comment

Choose a reason for hiding this comment

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

Could we bump / publish xchain-cosmos|thorchain packages as an alpha version first? A lot of changes comes with this PR and it would be worth to see it in a "real" environment (for example in ASGARDEX desktop).

  • xchain-thorchain@0.20.0-alpha1
  • xchain-cosmos@0.14.0-alpha1

@@ -26,7 +27,7 @@ export type TransferParams = {
amount: BigSource
asset: string
memo?: string
fee?: string
gasLimit?: BaseAmount
Copy link
Collaborator

Choose a reason for hiding this comment

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

gasLimit?: BaseAmount` -> `gasLimit?: BigNumber

(Sorry, I was wrong with a previous review comment it needs to be a BaseAmount, but still a BigNumber and not a string)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok i ended up going with this, which is what other clients use for amount/gasLimit

export type TransferParams = {
  privkey: proto.cosmos.crypto.secp256k1.PrivKey
  from: string
  to: string
  amount: BaseAmount
  asset: string
  memo?: string
  gasLimit?: BigNumber
}

packages/xchain-cosmos/src/util.ts Outdated Show resolved Hide resolved
packages/xchain-thorchain/src/client.ts Outdated Show resolved Hide resolved
Comment on lines +72 to +75
1. `git clone https://gitlab.com/thorchain/thornode`
2. run the following (adjust the paths acordingly) to generate a typecript file for MsgDeposit
```bash
yarn run pbjs -w commonjs -t static-module <path to repo>/thornode/proto/thorchain/v1/x/thorchain/types/msg_deposit.proto <path to repo>/thornode/proto/thorchain/v1/common/common.proto -o src/types/MsgDeposit.js
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about to add a bash script for doing all these steps (clone repo, run pbjs, copy types, remove cloned repo) to make sure, an user can do it easily by running yarn generate:msg. cosmos-client-ts does it similar (:eyes: see gen-proto.sh). Not needed with this PR - pls create an issue for it.

const privKey = this.getPrivateKey(walletIndex)
const from = this.getAddress(walletIndex)
const signer = privKey.pubKey()
const accAddress = cosmosclient.AccAddress.fromString(from)
Copy link

Choose a reason for hiding this comment

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

This returns address with wrong prefix - cosmos19kacmmyuf2ysyvq3t9nrl9495l5cvktj5c4eh4 instead of thor19kacmmyuf2ysyvq3t9nrl9495l5cvktj5c4eh4.

Potential solution would be to override address prefixes with:

cosmosclient.config.setBech32Prefix({
      accAddr: 'tthor',
      accPub: 'tthorpub',
      valAddr: 'tthorv',
      valPub: 'tthorvpub',
      consAddr: 'tthorc',
      consPub: 'tthorcpub'
    })

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kustrun Good find! Could you push all your suggestions / fixes into this PR, pls? You have been added to xchain-* as a collaborator to have write access, just check your email - thx!

const authInfo = new proto.cosmos.tx.v1beta1.AuthInfo({
signer_infos: [
{
public_key: cosmosclient.codec.packAny(signer),
Copy link

Choose a reason for hiding this comment

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

Function call fails because PubKey is not registered.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@kustrun Any suggestion to fix it? Feel free to push it into this PR (see prev. message)

this.prefix + 'valcons',
this.prefix + 'valconspub',
)
setBech32Prefix({
Copy link
Contributor

@Alex99y Alex99y Dec 30, 2021

Choose a reason for hiding this comment

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

Could this set affect other packages like xchain-thorchain as well if they are in the same project?. That is because you are changing/replacing global parameters

veado pushed a commit that referenced this pull request Mar 19, 2022
…K upgrade (#501)

- This PR is a continuation of #436, which was originally opened by @mikewyszinski 
- A new PR was started as the upstream conflicts were extensive and it had been several months since the PR was touched
- This PR prepares XChainJS for the hard-fork and upgrade to Cosmos v0.45:

Steps taken:
- Upgrade to @cosmos-client/core (new naming of same package): v0.44.4
@mikewyszinski
Copy link
Collaborator Author

closing since this was completed in a diff branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants