Skip to content

Commit 5c1ec56

Browse files
authored
Merge pull request #1579 from cosmos/wasmd-0.51
Test and upgrade to wasmd 0.51 in CI
2 parents f944892 + e6361e9 commit 5c1ec56

File tree

6 files changed

+126
-47
lines changed

6 files changed

+126
-47
lines changed

packages/cosmwasm-stargate/src/signingcosmwasmclient.spec.ts

Lines changed: 118 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -126,24 +126,75 @@ describe("SigningCosmWasmClient", () => {
126126
client.disconnect();
127127
});
128128

129-
it("works with legacy Amino signer access type", async () => {
129+
it("works with Amino JSON signer", async () => {
130130
pendingWithoutWasmd();
131-
pending("wasmd 0.50 does not work with Amino JSON signing");
132131
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
133-
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
134-
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
132+
const client = await SigningCosmWasmClient.connectWithSigner(
133+
wasmd.endpoint,
134+
wallet,
135+
defaultSigningClientOptions,
136+
);
137+
const wasm = getHackatom().data;
138+
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
139+
alice.address0,
140+
wasm,
141+
defaultUploadFee,
142+
);
143+
expect(checksum).toEqual(toHex(sha256(wasm)));
144+
expect(originalSize).toEqual(wasm.length);
145+
expect(compressedSize).toBeLessThan(wasm.length * 0.5);
146+
expect(codeId).toBeGreaterThanOrEqual(1);
147+
client.disconnect();
148+
});
149+
150+
it("works with Amino JSON signer (instantiatePermission set to one address)", async () => {
151+
pending("Known issue: https://github.com/CosmWasm/wasmd/issues/1863");
152+
pendingWithoutWasmd();
153+
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
154+
const client = await SigningCosmWasmClient.connectWithSigner(
155+
wasmd.endpoint,
156+
wallet,
157+
defaultSigningClientOptions,
158+
);
159+
const wasm = getHackatom().data;
160+
const instantiatePermission = AccessConfig.fromPartial({
161+
permission: AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES,
162+
addresses: [makeRandomAddress()],
163+
});
164+
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
165+
alice.address0,
166+
wasm,
167+
defaultUploadFee,
168+
"test memo",
169+
instantiatePermission,
170+
);
171+
expect(checksum).toEqual(toHex(sha256(wasm)));
172+
expect(originalSize).toEqual(wasm.length);
173+
expect(compressedSize).toBeLessThan(wasm.length * 0.5);
174+
expect(codeId).toBeGreaterThanOrEqual(1);
175+
client.disconnect();
176+
});
177+
178+
it("works with Amino JSON signer (instantiatePermission set to everybody)", async () => {
179+
pending("Known issue: https://github.com/CosmWasm/wasmd/issues/1863");
180+
pendingWithoutWasmd();
181+
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
182+
const client = await SigningCosmWasmClient.connectWithSigner(
183+
wasmd.endpoint,
184+
wallet,
185+
defaultSigningClientOptions,
186+
);
135187
const wasm = getHackatom().data;
136-
const accessConfig: AccessConfig = {
188+
const instantiatePermission = AccessConfig.fromPartial({
137189
permission: AccessType.ACCESS_TYPE_EVERYBODY,
138-
address: "",
139190
addresses: [],
140-
};
191+
});
141192
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
142193
alice.address0,
143194
wasm,
144195
defaultUploadFee,
145196
"test memo",
146-
accessConfig,
197+
instantiatePermission,
147198
);
148199
expect(checksum).toEqual(toHex(sha256(wasm)));
149200
expect(originalSize).toEqual(wasm.length);
@@ -262,17 +313,17 @@ describe("SigningCosmWasmClient", () => {
262313
client.disconnect();
263314
});
264315

265-
it("works with legacy Amino signer", async () => {
316+
it("works with Amino JSON signer", async () => {
266317
pendingWithoutWasmd();
267-
pending("wasmd 0.50 does not work with Amino JSON signing");
268318
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
269319
const client = await SigningCosmWasmClient.connectWithSigner(
270320
wasmd.endpoint,
271321
wallet,
272322
defaultSigningClientOptions,
273323
);
324+
const funds = [coin(1234, "ucosm"), coin(321, "ustake")];
274325

275-
// With admin
326+
// Without admin
276327
await client.instantiate(
277328
alice.address0,
278329
deployedHackatom.codeId,
@@ -282,10 +333,13 @@ describe("SigningCosmWasmClient", () => {
282333
},
283334
"contract 1",
284335
defaultInstantiateFee,
285-
{ admin: makeRandomAddress() },
336+
{
337+
funds: funds,
338+
memo: "instantiate it",
339+
},
286340
);
287341

288-
// Without admin
342+
// With admin
289343
await client.instantiate(
290344
alice.address0,
291345
deployedHackatom.codeId,
@@ -295,6 +349,10 @@ describe("SigningCosmWasmClient", () => {
295349
},
296350
"contract 1",
297351
defaultInstantiateFee,
352+
{
353+
funds: funds,
354+
admin: makeRandomAddress(),
355+
},
298356
);
299357

300358
client.disconnect();
@@ -346,42 +404,65 @@ describe("SigningCosmWasmClient", () => {
346404
client.disconnect();
347405
});
348406

349-
it("works with Amino JSON signing", async () => {
407+
it("works with Amino JSON signer", async () => {
350408
pendingWithoutWasmd();
351-
pending("wasmd 0.50 does not work with Amino JSON signing");
352-
const aminoJsonWallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, {
409+
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, {
353410
prefix: wasmd.prefix,
354411
});
355412
const client = await SigningCosmWasmClient.connectWithSigner(
356413
wasmd.endpoint,
357-
aminoJsonWallet,
414+
wallet,
358415
defaultSigningClientOptions,
359416
);
360417
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
361418
const funds = [coin(1234, "ucosm"), coin(321, "ustake")];
362-
const salt = Random.getBytes(64);
363419
const msg = {
364420
verifier: alice.address0,
365421
beneficiary: makeRandomAddress(),
366422
};
367423

368-
const { contractAddress } = await client.instantiate2(
369-
alice.address0,
370-
codeId,
371-
salt,
372-
msg,
373-
"My cool label--",
374-
defaultInstantiateFee,
375-
{
376-
memo: "Let's see if the memo is used",
377-
funds: funds,
378-
},
379-
);
424+
// Without admin
425+
{
426+
const salt = Random.getBytes(64);
427+
const { contractAddress } = await client.instantiate2(
428+
alice.address0,
429+
codeId,
430+
salt,
431+
msg,
432+
"My cool label--",
433+
defaultInstantiateFee,
434+
{
435+
memo: "Let's see if the memo is used",
436+
funds: funds,
437+
},
438+
);
439+
const ucosmBalance = await client.getBalance(contractAddress, "ucosm");
440+
const ustakeBalance = await client.getBalance(contractAddress, "ustake");
441+
expect(ucosmBalance).toEqual(funds[0]);
442+
expect(ustakeBalance).toEqual(funds[1]);
443+
}
380444

381-
const ucosmBalance = await client.getBalance(contractAddress, "ucosm");
382-
const ustakeBalance = await client.getBalance(contractAddress, "ustake");
383-
expect(ucosmBalance).toEqual(funds[0]);
384-
expect(ustakeBalance).toEqual(funds[1]);
445+
// With admin
446+
{
447+
const salt = Random.getBytes(64);
448+
const { contractAddress } = await client.instantiate2(
449+
alice.address0,
450+
codeId,
451+
salt,
452+
msg,
453+
"My cool label--",
454+
defaultInstantiateFee,
455+
{
456+
memo: "Let's see if the memo is used",
457+
funds: funds,
458+
admin: makeRandomAddress(),
459+
},
460+
);
461+
const ucosmBalance = await client.getBalance(contractAddress, "ucosm");
462+
const ustakeBalance = await client.getBalance(contractAddress, "ustake");
463+
expect(ucosmBalance).toEqual(funds[0]);
464+
expect(ustakeBalance).toEqual(funds[1]);
465+
}
385466

386467
client.disconnect();
387468
});
@@ -528,9 +609,8 @@ describe("SigningCosmWasmClient", () => {
528609
client.disconnect();
529610
});
530611

531-
it("works with legacy Amino signer", async () => {
612+
it("works with Amino JSON signer", async () => {
532613
pendingWithoutWasmd();
533-
pending("wasmd 0.50 does not work with Amino JSON signing");
534614
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
535615
const client = await SigningCosmWasmClient.connectWithSigner(
536616
wasmd.endpoint,
@@ -632,9 +712,8 @@ describe("SigningCosmWasmClient", () => {
632712
client.disconnect();
633713
});
634714

635-
it("works with legacy Amino signer", async () => {
715+
it("works with Amino JSON signer", async () => {
636716
pendingWithoutWasmd();
637-
pending("wasmd 0.50 does not work with Amino JSON signing");
638717
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
639718
const client = await SigningCosmWasmClient.connectWithSigner(
640719
wasmd.endpoint,
@@ -794,7 +873,7 @@ describe("SigningCosmWasmClient", () => {
794873
client.disconnect();
795874
});
796875

797-
it("works with legacy Amino signer", async () => {
876+
it("works with Amino JSON signer", async () => {
798877
pendingWithoutWasmd();
799878
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
800879
const client = await SigningCosmWasmClient.connectWithSigner(

packages/stargate/src/modules/gov/messages.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe("gov messages", () => {
148148
client.disconnect();
149149
});
150150

151-
it("works with Amino JSON sign mode", async () => {
151+
it("works with Amino JSON signer", async () => {
152152
pendingWithoutSimapp();
153153
assert(voterWalletAmino);
154154
assert(proposalId, "Missing proposal ID");
@@ -206,7 +206,7 @@ describe("gov messages", () => {
206206
client.disconnect();
207207
});
208208

209-
it("works with Amino JSON sign mode", async () => {
209+
it("works with Amino JSON signer", async () => {
210210
pendingWithoutSimapp();
211211
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
212212
assert(voterWalletAmino);

packages/stargate/src/modules/staking/messages.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe("staking messages", () => {
9494
client.disconnect();
9595
});
9696

97-
it("works with Amino JSON sign mode", async () => {
97+
it("works with Amino JSON signer", async () => {
9898
pendingWithoutSimapp();
9999
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
100100

@@ -235,7 +235,7 @@ describe("staking messages", () => {
235235
client.disconnect();
236236
});
237237

238-
it("works with Amino JSON sign mode", async () => {
238+
it("works with Amino JSON signer", async () => {
239239
pendingWithoutSimapp();
240240
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
241241

packages/stargate/src/modules/vesting/messages.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe("vesting messages", () => {
4545
client.disconnect();
4646
});
4747

48-
it("works with Amino JSON sign mode", async () => {
48+
it("works with Amino JSON signer", async () => {
4949
pendingWithoutSimapp46OrHigher(); // Amino JSON broken on chain before Cosmos SDK 0.46
5050
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
5151
const client = await SigningStargateClient.connectWithSigner(

packages/stargate/src/signingstargateclient.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe("SigningStargateClient", () => {
133133
expect(after).toEqual(amount[0]);
134134
});
135135

136-
it("works with legacy Amino signer", async () => {
136+
it("works with Amino JSON signer", async () => {
137137
pendingWithoutSimapp();
138138
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
139139
const client = await SigningStargateClient.connectWithSigner(
@@ -301,7 +301,7 @@ describe("SigningStargateClient", () => {
301301
}
302302
});
303303

304-
it("works with Amino signing", async () => {
304+
it("works with Amino JSON signer", async () => {
305305
pending("We cannot test this easily anymore since the IBC module was removed from simapp");
306306
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
307307
const client = await SigningStargateClient.connectWithSigner(

scripts/wasmd/env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
22
REPOSITORY="cosmwasm/wasmd"
3-
VERSION="v0.50.0"
3+
VERSION="v0.51.0-rc.5"
44

55
CONTAINER_NAME="wasmd"

0 commit comments

Comments
 (0)