Fix some more tests for 0.46

This commit is contained in:
Simon Warta 2022-08-03 15:35:28 +02:00
parent 2f3033b5cb
commit cad4352775
7 changed files with 21 additions and 9 deletions

View File

@ -92,7 +92,7 @@ describe("SigningCosmWasmClient", () => {
const memo = "Go go go";
const gasUsed = await client.simulate(alice.address0, [executeContractMsg], memo);
expect(gasUsed).toBeGreaterThanOrEqual(101_000);
expect(gasUsed).toBeLessThanOrEqual(150_000);
expect(gasUsed).toBeLessThanOrEqual(200_000);
client.disconnect();
});
});

View File

@ -47,7 +47,7 @@ async function createTransport(): Promise<Transport> {
describe("LedgerSigner", () => {
const defaultChainId = "testing";
const defaultFee = calculateFee(80_000, "0.025ucosm");
const defaultFee = calculateFee(100_000, "0.025ucosm");
const defaultMemo = "Some memo";
const defaultSequence = "0";
const defaultAccountNumber = "42";

View File

@ -14,6 +14,7 @@ import {
pendingWithoutSimapp44Or46,
simapp,
simapp44Enabled,
simapp46Enabled,
} from "../../testutils.spec";
import { AuthzExtension, setupAuthzExtension } from "./queries";
@ -35,7 +36,7 @@ describe("AuthzExtension", () => {
const grantedMsg = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward";
beforeAll(async () => {
if (simapp44Enabled()) {
if (simapp44Enabled() || simapp46Enabled()) {
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(faucet.mnemonic, {
// Use address 1 and 2 instead of 0 to avoid conflicts with other delegation tests
// This must match `voterAddress` above.

View File

@ -397,7 +397,7 @@ describe("GovExtension", () => {
Vote.fromPartial({
voter: voter1Address,
proposalId: longify(proposalId),
option: VoteOption.VOTE_OPTION_YES,
option: simapp44Enabled() ? VoteOption.VOTE_OPTION_YES : VoteOption.VOTE_OPTION_UNSPECIFIED,
options: [
WeightedVoteOption.fromPartial({
option: VoteOption.VOTE_OPTION_YES,

View File

@ -4,7 +4,7 @@ import { assertDefined, sleep } from "@cosmjs/utils";
import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
import Long from "long";
import { longify, QueryClient } from "../../queryclient";
import { QueryClient } from "../../queryclient";
import { defaultRegistryTypes, SigningStargateClient } from "../../signingstargateclient";
import { assertIsDeliverTxSuccess, StargateClient } from "../../stargateclient";
import {
@ -13,6 +13,8 @@ import {
makeRandomAddress,
pendingWithoutSimapp,
simapp,
simapp42Enabled,
simapp44Enabled,
simappEnabled,
validator,
} from "../../testutils.spec";
@ -94,8 +96,11 @@ describe("TxExtension", () => {
const { sequence } = await sequenceClient.getSequence(faucet.address0);
const response = await client.tx.simulate([msgAny], "foo", faucet.pubkey0, sequence);
expect(response.gasInfo?.gasUsed.toNumber()).toBeGreaterThanOrEqual(101_000);
expect(response.gasInfo?.gasUsed.toNumber()).toBeLessThanOrEqual(150_000);
expect(response.gasInfo?.gasWanted).toEqual(longify(Long.UZERO));
expect(response.gasInfo?.gasUsed.toNumber()).toBeLessThanOrEqual(200_000);
expect(response.gasInfo?.gasWanted).toEqual(
// Some dummy value. Value does not matter for regular users.
simapp42Enabled() || simapp44Enabled() ? Long.UZERO : Long.MAX_UNSIGNED_VALUE,
);
tmClient.disconnect();
});

View File

@ -63,7 +63,7 @@ describe("SigningStargateClient", () => {
const memo = "Use your power wisely";
const gasUsed = await client.simulate(faucet.address0, [msgAny], memo);
expect(gasUsed).toBeGreaterThanOrEqual(101_000);
expect(gasUsed).toBeLessThanOrEqual(150_000);
expect(gasUsed).toBeLessThanOrEqual(200_000);
client.disconnect();
});

View File

@ -28,6 +28,8 @@ import {
pendingWithoutSimapp,
pendingWithoutSlowSimapp,
simapp,
simapp42Enabled,
simapp44Enabled,
slowSimapp,
tendermintIdMatcher,
unused,
@ -431,7 +433,11 @@ describe("StargateClient", () => {
});
const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish());
await expectAsync(client.broadcastTx(txRawBytes)).toBeRejectedWithError(/invalid recipient address/i);
await expectAsync(client.broadcastTx(txRawBytes)).toBeRejectedWithError(
simapp42Enabled() || simapp44Enabled()
? /invalid recipient address/i
: /Broadcasting transaction failed with code 7/i,
);
client.disconnect();
});