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

Fix compilation errors #408

Merged
merged 5 commits into from
Jul 5, 2023
Merged

Fix compilation errors #408

merged 5 commits into from
Jul 5, 2023

Conversation

Zetazzz
Copy link
Collaborator

@Zetazzz Zetazzz commented Jul 4, 2023

Fixed compilation errors

  1. BigInt: BigInt(object.revision_number || "0", true)
  2. .Registry
  3. it's type in AnyAmino, not type_url.
  4. fromAmino and toAmino of Timestamp
  5. fromAmino and toAmino of duration
  6. handling amino timestamp and date converting
  7. handling enum

Errors still not handled:

  1. InterfaceDecoder (currently set interface.enable to false)
  2. ibc/core/types/v1/genesis.ts (ts-disabled)
// alias of types like GenesisState1 can't be handled correctly in later generated code.
export interface GenesisState {
  /** ICS002 - Clients genesis state */
  clientGenesis: GenesisState1;
  /** ICS003 - Connections genesis state */
  connectionGenesis: GenesisState2;
  /** ICS004 - Channel genesis state */
  channelGenesis: GenesisState3;
}
  1. ibc/applications/interchain_accounts/genesis/v1/genesis.ts (ts-disabled)
function createBaseControllerGenesisState(): ControllerGenesisState {
  return {
    activeChannels: [],
    interchainAccounts: [],
    ports: [],
    // like the issue above, Params should be Params2 here
    params: Params.fromPartial({})
  };
}
  1. cosmos/staking/v1beta1/staking.ts (ts-disabled)
    // decodeBech32Pubkey(message.consensusPubkey).value can't compile, don't what should be correct logic here.
    obj.consensus_pubkey = message.consensusPubkey ? {
      typeUrl: "/cosmos.crypto.secp256k1.PubKey",
      value: fromBase64(decodeBech32Pubkey(message.consensusPubkey).value)
    } : undefined;
  1. cosmos/staking/v1beta1/tx.ts (ts-disabled)
// similar problem like above
    obj.pubkey = message.pubkey ? {
      typeUrl: "/cosmos.crypto.secp256k1.PubKey",
      value: fromBase64(decodeBech32Pubkey(message.pubkey).value)
    } : undefined;
  1. cosmos/tx/signing/v1beta1/signing.ts (ts-disabled)
function createBaseSignatureDescriptor(): SignatureDescriptor {
  return {
    publicKey: undefined,
    // Data has no reference here, where does is come from?
    data: Data.fromPartial({}),
    sequence: BigInt(0)
  };
}

@Zetazzz
Copy link
Collaborator Author

Zetazzz commented Jul 5, 2023

a possible fix for #396

@Zetazzz Zetazzz merged commit 1abd480 into main Jul 5, 2023
@dillu24
Copy link

dillu24 commented Jul 15, 2023

FYI this did not fix #396. We tried it out and it still generated compilation errors.

@Zetazzz
Copy link
Collaborator Author

Zetazzz commented Jul 18, 2023

@dillu24 Hi, could you please share me a repo so that I can check those errors with upgraded telescope. Thx so much!

Even the latest telescope can't solve every compilations indeed, so I used these work around:

  1. to use tsDisable options like you've already did. You can add more files like I mentioned above, and I did like this:
      patterns: ['**/tx.registry.ts'],
      files: [
        'ibc/core/types/v1/genesis.ts',
        'ibc/applications/interchain_accounts/genesis/v1/genesis.ts',
        'cosmos/tx/signing/v1beta1/signing.ts',
        'cosmos/staking/v1beta1/tx.ts',
        'cosmos/staking/v1beta1/staking.ts',

        'cosmos/authz/v1beta1/tx.amino.ts',
        'cosmos/staking/v1beta1/tx.amino.ts'
      ]
  1. not to use strict in tsconfig.json, since it will enable strict null check.

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.

2 participants