mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Merge pull request #1579 from cosmos/wasmd-0.51
Test and upgrade to wasmd 0.51 in CI
This commit is contained in:
commit
5c1ec56189
@ -126,24 +126,75 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with legacy Amino signer access type", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutWasmd();
|
pendingWithoutWasmd();
|
||||||
pending("wasmd 0.50 does not work with Amino JSON signing");
|
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||||
const options = { ...defaultSigningClientOptions, prefix: wasmd.prefix };
|
const client = await SigningCosmWasmClient.connectWithSigner(
|
||||||
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet, options);
|
wasmd.endpoint,
|
||||||
|
wallet,
|
||||||
|
defaultSigningClientOptions,
|
||||||
|
);
|
||||||
const wasm = getHackatom().data;
|
const wasm = getHackatom().data;
|
||||||
const accessConfig: AccessConfig = {
|
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
|
||||||
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
alice.address0,
|
||||||
address: "",
|
wasm,
|
||||||
addresses: [],
|
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(
|
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
|
||||||
alice.address0,
|
alice.address0,
|
||||||
wasm,
|
wasm,
|
||||||
defaultUploadFee,
|
defaultUploadFee,
|
||||||
"test memo",
|
"test memo",
|
||||||
accessConfig,
|
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 instantiatePermission = AccessConfig.fromPartial({
|
||||||
|
permission: AccessType.ACCESS_TYPE_EVERYBODY,
|
||||||
|
addresses: [],
|
||||||
|
});
|
||||||
|
const { codeId, checksum, originalSize, compressedSize } = await client.upload(
|
||||||
|
alice.address0,
|
||||||
|
wasm,
|
||||||
|
defaultUploadFee,
|
||||||
|
"test memo",
|
||||||
|
instantiatePermission,
|
||||||
);
|
);
|
||||||
expect(checksum).toEqual(toHex(sha256(wasm)));
|
expect(checksum).toEqual(toHex(sha256(wasm)));
|
||||||
expect(originalSize).toEqual(wasm.length);
|
expect(originalSize).toEqual(wasm.length);
|
||||||
@ -262,15 +313,31 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with legacy Amino signer", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutWasmd();
|
pendingWithoutWasmd();
|
||||||
pending("wasmd 0.50 does not work with Amino JSON signing");
|
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||||
const client = await SigningCosmWasmClient.connectWithSigner(
|
const client = await SigningCosmWasmClient.connectWithSigner(
|
||||||
wasmd.endpoint,
|
wasmd.endpoint,
|
||||||
wallet,
|
wallet,
|
||||||
defaultSigningClientOptions,
|
defaultSigningClientOptions,
|
||||||
);
|
);
|
||||||
|
const funds = [coin(1234, "ucosm"), coin(321, "ustake")];
|
||||||
|
|
||||||
|
// Without admin
|
||||||
|
await client.instantiate(
|
||||||
|
alice.address0,
|
||||||
|
deployedHackatom.codeId,
|
||||||
|
{
|
||||||
|
verifier: alice.address0,
|
||||||
|
beneficiary: makeRandomAddress(),
|
||||||
|
},
|
||||||
|
"contract 1",
|
||||||
|
defaultInstantiateFee,
|
||||||
|
{
|
||||||
|
funds: funds,
|
||||||
|
memo: "instantiate it",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
// With admin
|
// With admin
|
||||||
await client.instantiate(
|
await client.instantiate(
|
||||||
@ -282,19 +349,10 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
},
|
},
|
||||||
"contract 1",
|
"contract 1",
|
||||||
defaultInstantiateFee,
|
defaultInstantiateFee,
|
||||||
{ admin: makeRandomAddress() },
|
|
||||||
);
|
|
||||||
|
|
||||||
// Without admin
|
|
||||||
await client.instantiate(
|
|
||||||
alice.address0,
|
|
||||||
deployedHackatom.codeId,
|
|
||||||
{
|
{
|
||||||
verifier: alice.address0,
|
funds: funds,
|
||||||
beneficiary: makeRandomAddress(),
|
admin: makeRandomAddress(),
|
||||||
},
|
},
|
||||||
"contract 1",
|
|
||||||
defaultInstantiateFee,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
@ -346,42 +404,65 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with Amino JSON signing", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutWasmd();
|
pendingWithoutWasmd();
|
||||||
pending("wasmd 0.50 does not work with Amino JSON signing");
|
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, {
|
||||||
const aminoJsonWallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, {
|
|
||||||
prefix: wasmd.prefix,
|
prefix: wasmd.prefix,
|
||||||
});
|
});
|
||||||
const client = await SigningCosmWasmClient.connectWithSigner(
|
const client = await SigningCosmWasmClient.connectWithSigner(
|
||||||
wasmd.endpoint,
|
wasmd.endpoint,
|
||||||
aminoJsonWallet,
|
wallet,
|
||||||
defaultSigningClientOptions,
|
defaultSigningClientOptions,
|
||||||
);
|
);
|
||||||
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
|
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
|
||||||
const funds = [coin(1234, "ucosm"), coin(321, "ustake")];
|
const funds = [coin(1234, "ucosm"), coin(321, "ustake")];
|
||||||
const salt = Random.getBytes(64);
|
|
||||||
const msg = {
|
const msg = {
|
||||||
verifier: alice.address0,
|
verifier: alice.address0,
|
||||||
beneficiary: makeRandomAddress(),
|
beneficiary: makeRandomAddress(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const { contractAddress } = await client.instantiate2(
|
// Without admin
|
||||||
alice.address0,
|
{
|
||||||
codeId,
|
const salt = Random.getBytes(64);
|
||||||
salt,
|
const { contractAddress } = await client.instantiate2(
|
||||||
msg,
|
alice.address0,
|
||||||
"My cool label--",
|
codeId,
|
||||||
defaultInstantiateFee,
|
salt,
|
||||||
{
|
msg,
|
||||||
memo: "Let's see if the memo is used",
|
"My cool label--",
|
||||||
funds: funds,
|
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");
|
// With admin
|
||||||
const ustakeBalance = await client.getBalance(contractAddress, "ustake");
|
{
|
||||||
expect(ucosmBalance).toEqual(funds[0]);
|
const salt = Random.getBytes(64);
|
||||||
expect(ustakeBalance).toEqual(funds[1]);
|
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();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
@ -528,9 +609,8 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with legacy Amino signer", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutWasmd();
|
pendingWithoutWasmd();
|
||||||
pending("wasmd 0.50 does not work with Amino JSON signing");
|
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||||
const client = await SigningCosmWasmClient.connectWithSigner(
|
const client = await SigningCosmWasmClient.connectWithSigner(
|
||||||
wasmd.endpoint,
|
wasmd.endpoint,
|
||||||
@ -632,9 +712,8 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with legacy Amino signer", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutWasmd();
|
pendingWithoutWasmd();
|
||||||
pending("wasmd 0.50 does not work with Amino JSON signing");
|
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||||
const client = await SigningCosmWasmClient.connectWithSigner(
|
const client = await SigningCosmWasmClient.connectWithSigner(
|
||||||
wasmd.endpoint,
|
wasmd.endpoint,
|
||||||
@ -794,7 +873,7 @@ describe("SigningCosmWasmClient", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with legacy Amino signer", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutWasmd();
|
pendingWithoutWasmd();
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
|
||||||
const client = await SigningCosmWasmClient.connectWithSigner(
|
const client = await SigningCosmWasmClient.connectWithSigner(
|
||||||
|
@ -148,7 +148,7 @@ describe("gov messages", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with Amino JSON sign mode", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutSimapp();
|
pendingWithoutSimapp();
|
||||||
assert(voterWalletAmino);
|
assert(voterWalletAmino);
|
||||||
assert(proposalId, "Missing proposal ID");
|
assert(proposalId, "Missing proposal ID");
|
||||||
@ -206,7 +206,7 @@ describe("gov messages", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with Amino JSON sign mode", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutSimapp();
|
pendingWithoutSimapp();
|
||||||
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
|
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
|
||||||
assert(voterWalletAmino);
|
assert(voterWalletAmino);
|
||||||
|
@ -94,7 +94,7 @@ describe("staking messages", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with Amino JSON sign mode", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutSimapp();
|
pendingWithoutSimapp();
|
||||||
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
|
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ describe("staking messages", () => {
|
|||||||
client.disconnect();
|
client.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with Amino JSON sign mode", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutSimapp();
|
pendingWithoutSimapp();
|
||||||
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
|
if (simapp50Enabled()) pending("Not working, see https://github.com/cosmos/cosmos-sdk/issues/18546");
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ describe("vesting messages", () => {
|
|||||||
client.disconnect();
|
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
|
pendingWithoutSimapp46OrHigher(); // Amino JSON broken on chain before Cosmos SDK 0.46
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
||||||
const client = await SigningStargateClient.connectWithSigner(
|
const client = await SigningStargateClient.connectWithSigner(
|
||||||
|
@ -133,7 +133,7 @@ describe("SigningStargateClient", () => {
|
|||||||
expect(after).toEqual(amount[0]);
|
expect(after).toEqual(amount[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("works with legacy Amino signer", async () => {
|
it("works with Amino JSON signer", async () => {
|
||||||
pendingWithoutSimapp();
|
pendingWithoutSimapp();
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
||||||
const client = await SigningStargateClient.connectWithSigner(
|
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");
|
pending("We cannot test this easily anymore since the IBC module was removed from simapp");
|
||||||
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
|
||||||
const client = await SigningStargateClient.connectWithSigner(
|
const client = await SigningStargateClient.connectWithSigner(
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
|
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
|
||||||
REPOSITORY="cosmwasm/wasmd"
|
REPOSITORY="cosmwasm/wasmd"
|
||||||
VERSION="v0.50.0"
|
VERSION="v0.51.0-rc.5"
|
||||||
|
|
||||||
CONTAINER_NAME="wasmd"
|
CONTAINER_NAME="wasmd"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user