diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts index 025cea9677..90f6c7a3a0 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts @@ -126,24 +126,75 @@ describe("SigningCosmWasmClient", () => { client.disconnect(); }); - it("works with legacy Amino signer access type", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutWasmd(); - pending("wasmd 0.50 does not work with Amino JSON signing"); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); - const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix }; - const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options); + const client = await SigningCosmWasmClient.connectWithSigner( + wasmd.endpoint, + wallet, + defaultSigningClientOptions, + ); + const wasm = getHackatom().data; + const { codeId, checksum, originalSize, compressedSize } = await client.upload( + alice.address0, + wasm, + defaultUploadFee, + ); + expect(checksum).toEqual(toHex(sha256(wasm))); + expect(originalSize).toEqual(wasm.length); + expect(compressedSize).toBeLessThan(wasm.length * 0.5); + expect(codeId).toBeGreaterThanOrEqual(1); + client.disconnect(); + }); + + it("works with Amino JSON signer (instantiatePermission set to one address)", async () => { + pending("Known issue: https://github.com/CosmWasm/wasmd/issues/1863"); + pendingWithoutWasmd(); + const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); + const client = await SigningCosmWasmClient.connectWithSigner( + wasmd.endpoint, + wallet, + defaultSigningClientOptions, + ); + const wasm = getHackatom().data; + const instantiatePermission = AccessConfig.fromPartial({ + permission: AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES, + addresses: [makeRandomAddress()], + }); + const { codeId, checksum, originalSize, compressedSize } = await client.upload( + alice.address0, + wasm, + defaultUploadFee, + "test memo", + instantiatePermission, + ); + expect(checksum).toEqual(toHex(sha256(wasm))); + expect(originalSize).toEqual(wasm.length); + expect(compressedSize).toBeLessThan(wasm.length * 0.5); + expect(codeId).toBeGreaterThanOrEqual(1); + client.disconnect(); + }); + + it("works with Amino JSON signer (instantiatePermission set to everybody)", async () => { + pending("Known issue: https://github.com/CosmWasm/wasmd/issues/1863"); + pendingWithoutWasmd(); + const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); + const client = await SigningCosmWasmClient.connectWithSigner( + wasmd.endpoint, + wallet, + defaultSigningClientOptions, + ); const wasm = getHackatom().data; - const accessConfig: AccessConfig = { + const instantiatePermission = AccessConfig.fromPartial({ permission: AccessType.ACCESS_TYPE_EVERYBODY, - address: "", addresses: [], - }; + }); const { codeId, checksum, originalSize, compressedSize } = await client.upload( alice.address0, wasm, defaultUploadFee, "test memo", - accessConfig, + instantiatePermission, ); expect(checksum).toEqual(toHex(sha256(wasm))); expect(originalSize).toEqual(wasm.length); @@ -262,17 +313,17 @@ describe("SigningCosmWasmClient", () => { client.disconnect(); }); - it("works with legacy Amino signer", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutWasmd(); - pending("wasmd 0.50 does not work with Amino JSON signing"); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); const client = await SigningCosmWasmClient.connectWithSigner( wasmd.endpoint, wallet, defaultSigningClientOptions, ); + const funds = [coin(1234, "ucosm"), coin(321, "ustake")]; - // With admin + // Without admin await client.instantiate( alice.address0, deployedHackatom.codeId, @@ -282,10 +333,13 @@ describe("SigningCosmWasmClient", () => { }, "contract 1", defaultInstantiateFee, - { admin: makeRandomAddress() }, + { + funds: funds, + memo: "instantiate it", + }, ); - // Without admin + // With admin await client.instantiate( alice.address0, deployedHackatom.codeId, @@ -295,6 +349,10 @@ describe("SigningCosmWasmClient", () => { }, "contract 1", defaultInstantiateFee, + { + funds: funds, + admin: makeRandomAddress(), + }, ); client.disconnect(); @@ -346,42 +404,65 @@ describe("SigningCosmWasmClient", () => { client.disconnect(); }); - it("works with Amino JSON signing", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutWasmd(); - pending("wasmd 0.50 does not work with Amino JSON signing"); - const aminoJsonWallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { + const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix, }); const client = await SigningCosmWasmClient.connectWithSigner( wasmd.endpoint, - aminoJsonWallet, + wallet, defaultSigningClientOptions, ); const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee); const funds = [coin(1234, "ucosm"), coin(321, "ustake")]; - const salt = Random.getBytes(64); const msg = { verifier: alice.address0, beneficiary: makeRandomAddress(), }; - const { contractAddress } = await client.instantiate2( - alice.address0, - codeId, - salt, - msg, - "My cool label--", - defaultInstantiateFee, - { - memo: "Let's see if the memo is used", - funds: funds, - }, - ); + // Without admin + { + const salt = Random.getBytes(64); + const { contractAddress } = await client.instantiate2( + alice.address0, + codeId, + salt, + msg, + "My cool label--", + defaultInstantiateFee, + { + memo: "Let's see if the memo is used", + funds: funds, + }, + ); + const ucosmBalance = await client.getBalance(contractAddress, "ucosm"); + const ustakeBalance = await client.getBalance(contractAddress, "ustake"); + expect(ucosmBalance).toEqual(funds[0]); + expect(ustakeBalance).toEqual(funds[1]); + } - const ucosmBalance = await client.getBalance(contractAddress, "ucosm"); - const ustakeBalance = await client.getBalance(contractAddress, "ustake"); - expect(ucosmBalance).toEqual(funds[0]); - expect(ustakeBalance).toEqual(funds[1]); + // With admin + { + const salt = Random.getBytes(64); + const { contractAddress } = await client.instantiate2( + alice.address0, + codeId, + salt, + msg, + "My cool label--", + defaultInstantiateFee, + { + memo: "Let's see if the memo is used", + funds: funds, + admin: makeRandomAddress(), + }, + ); + const ucosmBalance = await client.getBalance(contractAddress, "ucosm"); + const ustakeBalance = await client.getBalance(contractAddress, "ustake"); + expect(ucosmBalance).toEqual(funds[0]); + expect(ustakeBalance).toEqual(funds[1]); + } client.disconnect(); }); @@ -528,9 +609,8 @@ describe("SigningCosmWasmClient", () => { client.disconnect(); }); - it("works with legacy Amino signer", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutWasmd(); - pending("wasmd 0.50 does not work with Amino JSON signing"); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); const client = await SigningCosmWasmClient.connectWithSigner( wasmd.endpoint, @@ -632,9 +712,8 @@ describe("SigningCosmWasmClient", () => { client.disconnect(); }); - it("works with legacy Amino signer", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutWasmd(); - pending("wasmd 0.50 does not work with Amino JSON signing"); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); const client = await SigningCosmWasmClient.connectWithSigner( wasmd.endpoint, @@ -794,7 +873,7 @@ describe("SigningCosmWasmClient", () => { client.disconnect(); }); - it("works with legacy Amino signer", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutWasmd(); const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix }); const client = await SigningCosmWasmClient.connectWithSigner( diff --git a/packages/stargate/src/modules/gov/messages.spec.ts b/packages/stargate/src/modules/gov/messages.spec.ts index da995ad07e..dbd8becf3c 100644 --- a/packages/stargate/src/modules/gov/messages.spec.ts +++ b/packages/stargate/src/modules/gov/messages.spec.ts @@ -148,7 +148,7 @@ describe("gov messages", () => { client.disconnect(); }); - it("works with Amino JSON sign mode", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutSimapp(); assert(voterWalletAmino); assert(proposalId, "Missing proposal ID"); @@ -206,7 +206,7 @@ describe("gov messages", () => { client.disconnect(); }); - it("works with Amino JSON sign mode", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutSimapp(); if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546"); assert(voterWalletAmino); diff --git a/packages/stargate/src/modules/staking/messages.spec.ts b/packages/stargate/src/modules/staking/messages.spec.ts index 1fe96c8569..36c4b5093b 100644 --- a/packages/stargate/src/modules/staking/messages.spec.ts +++ b/packages/stargate/src/modules/staking/messages.spec.ts @@ -94,7 +94,7 @@ describe("staking messages", () => { client.disconnect(); }); - it("works with Amino JSON sign mode", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutSimapp(); if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546"); @@ -235,7 +235,7 @@ describe("staking messages", () => { client.disconnect(); }); - it("works with Amino JSON sign mode", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutSimapp(); if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546"); diff --git a/packages/stargate/src/modules/vesting/messages.spec.ts b/packages/stargate/src/modules/vesting/messages.spec.ts index 64649fef58..8dd553a4b0 100644 --- a/packages/stargate/src/modules/vesting/messages.spec.ts +++ b/packages/stargate/src/modules/vesting/messages.spec.ts @@ -45,7 +45,7 @@ describe("vesting messages", () => { client.disconnect(); }); - it("works with Amino JSON sign mode", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutSimapp46OrHigher(); // Amino JSON broken on chain before Cosmos SDK 0.46 const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( diff --git a/packages/stargate/src/signingstargateclient.spec.ts b/packages/stargate/src/signingstargateclient.spec.ts index 399186c7f0..e8d7f8aedd 100644 --- a/packages/stargate/src/signingstargateclient.spec.ts +++ b/packages/stargate/src/signingstargateclient.spec.ts @@ -133,7 +133,7 @@ describe("SigningStargateClient", () => { expect(after).toEqual(amount[0]); }); - it("works with legacy Amino signer", async () => { + it("works with Amino JSON signer", async () => { pendingWithoutSimapp(); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( @@ -301,7 +301,7 @@ describe("SigningStargateClient", () => { } }); - it("works with Amino signing", async () => { + it("works with Amino JSON signer", async () => { pending("We cannot test this easily anymore since the IBC module was removed from simapp"); const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic); const client = await SigningStargateClient.connectWithSigner( diff --git a/scripts/wasmd/env b/scripts/wasmd/env index d3dd44fc3e..29d66ded4a 100644 --- a/scripts/wasmd/env +++ b/scripts/wasmd/env @@ -1,5 +1,5 @@ # Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags REPOSITORY="cosmwasm/wasmd" -VERSION="v0.50.0" +VERSION="v0.51.0-rc.5" CONTAINER_NAME="wasmd"