Merge pull request #714 from cosmos/onsolete-pubkey-check

Remove unnecessary pubkey check
This commit is contained in:
Will Clark 2021-03-18 10:35:21 +01:00 committed by GitHub
commit 8763d2b57c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 14 deletions

View File

@ -344,17 +344,13 @@ export class SigningCosmWasmClient extends CosmWasmClient {
if (!accountFromSigner) {
throw new Error("Failed to retrieve account from signer");
}
const pubkey = encodeSecp256k1Pubkey(accountFromSigner.pubkey);
const pubkey = encodePubkey(encodeSecp256k1Pubkey(accountFromSigner.pubkey));
const accountFromChain = await this.getAccount(signerAddress);
if (!accountFromChain) {
throw new Error("Account not found");
}
const { accountNumber, sequence } = accountFromChain;
if (!pubkey) {
throw new Error("Pubkey not known");
}
const chainId = await this.getChainId();
const pubkeyAny = encodePubkey(pubkey);
const txBody = {
messages: messages,
memo: memo,
@ -366,7 +362,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const gasLimit = Int53.fromString(fee.gas).toNumber();
if (isOfflineDirectSigner(this.signer)) {
const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence);
const authInfoBytes = makeAuthInfoBytes([pubkey], fee.amount, gasLimit, sequence);
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc);
const txRaw = TxRaw.fromPartial({
@ -394,7 +390,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
const signedSequence = Int53.fromString(signed.sequence).toNumber();
const signedAuthInfoBytes = makeAuthInfoBytes(
[pubkeyAny],
[pubkey],
signed.fee.amount,
signedGasLimit,
signedSequence,

View File

@ -138,17 +138,13 @@ export class SigningStargateClient extends StargateClient {
if (!accountFromSigner) {
throw new Error("Failed to retrieve account from signer");
}
const pubkey = encodeSecp256k1Pubkey(accountFromSigner.pubkey);
const pubkey = encodePubkey(encodeSecp256k1Pubkey(accountFromSigner.pubkey));
const accountFromChain = await this.getAccountUnverified(signerAddress);
if (!accountFromChain) {
throw new Error("Account not found");
}
const { accountNumber, sequence } = accountFromChain;
if (!pubkey) {
throw new Error("Pubkey not known");
}
const chainId = await this.getChainId();
const pubkeyAny = encodePubkey(pubkey);
const txBody = {
messages: messages,
memo: memo,
@ -160,7 +156,7 @@ export class SigningStargateClient extends StargateClient {
const gasLimit = Int53.fromString(fee.gas).toNumber();
if (isOfflineDirectSigner(this.signer)) {
const authInfoBytes = makeAuthInfoBytes([pubkeyAny], fee.amount, gasLimit, sequence);
const authInfoBytes = makeAuthInfoBytes([pubkey], fee.amount, gasLimit, sequence);
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
const { signature, signed } = await this.signer.signDirect(signerAddress, signDoc);
const txRaw = TxRaw.fromPartial({
@ -188,7 +184,7 @@ export class SigningStargateClient extends StargateClient {
const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
const signedSequence = Int53.fromString(signed.sequence).toNumber();
const signedAuthInfoBytes = makeAuthInfoBytes(
[pubkeyAny],
[pubkey],
signed.fee.amount,
signedGasLimit,
signedSequence,