Skip to content

Commit

Permalink
Merge pull request #909 from cosmos/simd-updates
Browse files Browse the repository at this point in the history
Test CosmJS 0.26 against Cosmos SDK 0.44 backend
  • Loading branch information
webmaster128 authored Oct 25, 2021
2 parents 57e4e2c + 360506c commit 0fdf06c
Show file tree
Hide file tree
Showing 90 changed files with 3,369 additions and 105 deletions.
58 changes: 33 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ workflows:
- test:
requires:
- build
matrix:
parameters:
simapp: ["simapp42", "simapp44"]
- test-node-v14:
requires:
- build
Expand Down Expand Up @@ -61,6 +64,9 @@ jobs:
paths:
- packages/*/build/*
test:
parameters:
simapp:
type: string
machine:
# We can't use a containerized environment since it requires remote docker to start custom containers.
# However, we can't access the remote docker's network from the primary container. This is a
Expand Down Expand Up @@ -88,11 +94,11 @@ jobs:
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
command: ./scripts/<< parameters.simapp >>/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
command: ./scripts/<< parameters.simapp >>/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
Expand Down Expand Up @@ -143,16 +149,18 @@ jobs:
name: Start socket server
command: ./scripts/socketserver/start.sh
- run:
name: Run tests
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
WASMD_ENABLED: 1
command: yarn test --stream
command: |
[ "<< parameters.simapp >>" = "simapp42" ] && export SIMAPP42_ENABLED=1 SLOW_SIMAPP42_ENABLED=1
[ "<< parameters.simapp >>" = "simapp44" ] && export SIMAPP44_ENABLED=1 SLOW_SIMAPP44_ENABLED=1
yarn test --stream
- run:
name: Run CLI selftest
working_directory: packages/cli
Expand All @@ -176,8 +184,8 @@ jobs:
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/<< parameters.simapp >>/stop.sh
./scripts/<< parameters.simapp >>/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
test-node-v14:
Expand Down Expand Up @@ -208,11 +216,11 @@ jobs:
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
command: ./scripts/simapp42/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
command: ./scripts/simapp42/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
Expand Down Expand Up @@ -266,8 +274,8 @@ jobs:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
Expand All @@ -291,8 +299,8 @@ jobs:
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/simapp42/stop.sh
./scripts/simapp42/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
test-chrome:
Expand Down Expand Up @@ -324,11 +332,11 @@ jobs:
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
command: ./scripts/simapp42/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
command: ./scripts/simapp42/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
Expand Down Expand Up @@ -382,8 +390,8 @@ jobs:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
Expand All @@ -394,8 +402,8 @@ jobs:
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/simapp42/stop.sh
./scripts/simapp42/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
coverage:
Expand Down Expand Up @@ -426,11 +434,11 @@ jobs:
background: true
- run:
name: Start simapp
command: ./scripts/simapp/start.sh
command: ./scripts/simapp42/start.sh
background: true
- run:
name: Start slow simapp
command: ./scripts/simapp/slow_start.sh
command: ./scripts/simapp42/slow_start.sh
background: true
- run:
name: Start Tendermint blockchains
Expand Down Expand Up @@ -484,8 +492,8 @@ jobs:
environment:
LAUNCHPAD_ENABLED: 1
ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
SLOW_SIMAPP_ENABLED: 1
SIMAPP42_ENABLED: 1
SLOW_SIMAPP42_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
SKIP_BUILD: 1
Expand All @@ -499,8 +507,8 @@ jobs:
command: |
./scripts/socketserver/stop.sh
./scripts/tendermint/all_stop.sh
./scripts/simapp/stop.sh
./scripts/simapp/slow_stop.sh
./scripts/simapp42/stop.sh
./scripts/simapp42/slow_stop.sh
./scripts/wasmd/stop.sh
./scripts/launchpad/stop.sh
docs-build:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ and this project adheres to
adding the fields `LaunchpadLedgerOptions.ledgerAppName` and
`.minLedgerAppVersion`.

### Deprecated

- @cosmjs/stargate: The verified queries from `AuthExtension` and
`BankExtension` as well as `StargateClient.getAccountVerified` are deprecated
and will be removed in 0.27 ([#910]).

[#910]: https://github.com/cosmos/cosmjs/pull/910

## [0.26.2] - 2021-10-12

### Fixed
Expand Down
1 change: 1 addition & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ order to avoid conflicts. Here is an overview of the ports used:
| 1319 | wasmd LCD API | Manual Stargate debugging |
| 4444 | socketserver | @cosmjs/sockets tests |
| 4445 | socketserver slow | @cosmjs/sockets tests |
| 9090 | simapp gRPC | Manual Stargate debugging |
| 11133 | Tendermint 0.33 RPC | @cosmjs/tendermint-rpc tests |
| 11134 | Tendermint 0.34 RPC | @cosmjs/tendermint-rpc tests |
| 26658 | simapp Tendermint RPC | Stargate client tests |
Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Here are some of them to get an idea:

| Package | Description | Latest |
| ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| [@cosmjs/stargate](packages/stargate) | A client library for the Cosmos SDK 0.40 (cosmoshub-4), 0.41 and 0.42 (Stargate) | [![npm version](https://img.shields.io/npm/v/@cosmjs/stargate.svg)](https://www.npmjs.com/package/@cosmjs/stargate) |
| [@cosmjs/stargate](packages/stargate) | A client library for the Cosmos SDK 0.40 (cosmoshub-4), 0.41 and 0.42 (Stargate) | [![npm version](https://img.shields.io/npm/v/@cosmjs/stargate.svg)](https://www.npmjs.com/package/@cosmjs/stargate) |
| [@cosmjs/launchpad](packages/launchpad) | A client library for the Cosmos SDK 0.37 (cosmoshub-3), 0.38 and 0.39 (Launchpad) | [![npm version](https://img.shields.io/npm/v/@cosmjs/launchpad.svg)](https://www.npmjs.com/package/@cosmjs/launchpad) |
| [@cosmjs/faucet](packages/faucet) | A faucet application for node.js | [![npm version](https://img.shields.io/npm/v/@cosmjs/faucet.svg)](https://www.npmjs.com/package/@cosmjs/faucet) |
| [@cosmjs/cosmwasm-stargate](packages/cosmwasm-stargate) | Client for Stargate chains with the CosmWasm module enabled | [![npm version](https://img.shields.io/npm/v/@cosmjs/cosmwasm-stargate.svg)](https://www.npmjs.com/package/@cosmjs/cosmwasm-stargate) |
Expand Down Expand Up @@ -109,6 +109,16 @@ discussion please reach out to the team.

## Known limitations

### 0.26

1. When connecting to a Cosmos SDK 0.44+ backend, the verified queries from
`AuthExtension` and `BankExtension` as well as
`StargateClient.getAccountVerified` will fail because the storage keys are
not stable. Unverified queries can be used instead. Those queries are
deprecated now and will be removed in 0.27 ([#910]).

[#910]: https://github.com/cosmos/cosmjs/pull/910

### 0.25

1. Decoding blocks of height 1 is unsupported. This is fixed in [#815] and will
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/run_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -o errexit -o nounset -o pipefail
command -v shellcheck >/dev/null && shellcheck "$0"

if [ -n "${SIMAPP_ENABLED:-}" ]; then
if [ -n "${SIMAPP42_ENABLED:-}" ]; then
yarn node ./bin/cosmwasm-cli --init examples/cosmwasm.ts --code "process.exit(0)"
fi
if [ -n "${LAUNCHPAD_ENABLED:-}" ]; then
Expand All @@ -13,6 +13,6 @@ yarn node ./bin/cosmwasm-cli --init examples/generate_address.ts --code "process
yarn node ./bin/cosmwasm-cli --init examples/local_faucet.ts --code "process.exit(0)"
yarn node ./bin/cosmwasm-cli --init examples/mask.ts --code "process.exit(0)"
yarn node ./bin/cosmwasm-cli --init examples/multisig_address.ts --code "process.exit(0)"
if [ -n "${SIMAPP_ENABLED:-}" ]; then
if [ -n "${SIMAPP42_ENABLED:-}" ]; then
yarn node ./bin/cosmwasm-cli --init examples/stargate.ts --code "process.exit(0)"
fi
4 changes: 2 additions & 2 deletions packages/faucet/src/faucet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ function pendingWithoutLaunchpad(): void {
}

function pendingWithoutSimapp(): void {
if (!process.env.SIMAPP_ENABLED) {
return pending("Set SIMAPP_ENABLED to enabled Stargate node-based tests");
if (!process.env.SIMAPP42_ENABLED && !process.env.SIMAPP44_ENABLED) {
return pending("Set SIMAPP42_ENABLED or SIMAPP44_ENABLED to enabled Stargate node-based tests");
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ledger-amino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ transactions.
### Stargate tests

Start a local Stargate blockchain as described in
[scripts/simapp/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/simapp/README.md)
[scripts/simapp42/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/simapp42/README.md)
and execute:

```sh
export LEDGER_ENABLED=1
export SIMAPP_ENABLED=1
export SIMAPP42_ENABLED=1
yarn test
```

Expand Down
4 changes: 2 additions & 2 deletions packages/ledger-amino/src/testutils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ export function pendingWithoutLaunchpad(): void {
}

export function simappEnabled(): boolean {
return !!process.env.SIMAPP_ENABLED;
return !!process.env.SIMAPP42_ENABLED || !!process.env.SIMAPP44_ENABLED;
}

export function pendingWithoutSimapp(): void {
if (!simappEnabled()) {
return pending("Set SIMAPP_ENABLED to enable Simapp-based tests");
return pending("Set SIMAPP42_ENABLED or SIMAPP44_ENABLED to enable Simapp-based tests");
}
}

Expand Down
15 changes: 11 additions & 4 deletions packages/stargate/src/queries/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ import { BaseAccount } from "cosmjs-types/cosmos/auth/v1beta1/auth";
import { Any } from "cosmjs-types/google/protobuf/any";
import Long from "long";

import { nonExistentAddress, pendingWithoutSimapp, simapp, unused, validator } from "../testutils.spec";
import {
nonExistentAddress,
pendingWithoutSimapp,
pendingWithoutSimapp42,
simapp,
unused,
validator,
} from "../testutils.spec";
import { AuthExtension, setupAuthExtension } from "./auth";
import { QueryClient } from "./queryclient";

Expand Down Expand Up @@ -68,7 +75,7 @@ describe("AuthExtension", () => {
describe("verified", () => {
describe("account", () => {
it("works for unused account", async () => {
pendingWithoutSimapp();
pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.verified.account(unused.address);
assert(account);
Expand All @@ -85,7 +92,7 @@ describe("AuthExtension", () => {
});

it("works for account with pubkey and non-zero sequence", async () => {
pendingWithoutSimapp();
pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.verified.account(validator.delegatorAddress);
assert(account);
Expand All @@ -102,7 +109,7 @@ describe("AuthExtension", () => {
});

it("returns null for non-existent address", async () => {
pendingWithoutSimapp();
pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.verified.account(nonExistentAddress);

Expand Down
5 changes: 5 additions & 0 deletions packages/stargate/src/queries/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export interface AuthExtension {
* `typeUrl` and decode the `value` using its own type decoder.
*/
readonly account: (address: string) => Promise<Any | null>;
/**
* @deprecated Verified queries are not supported with Cosmos SDK 0.44+.
* See "Known limitations" in README.md.
* Will be rmoved in CosmJS 0.27 (https://github.com/cosmos/cosmjs/pull/910).
*/
readonly verified: {
/**
* Returns an account if it exists and `null` otherwise.
Expand Down
7 changes: 4 additions & 3 deletions packages/stargate/src/queries/bank.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
nonExistentAddress,
nonNegativeIntegerMatcher,
pendingWithoutSimapp,
pendingWithoutSimapp42,
simapp,
unused,
} from "../testutils.spec";
Expand Down Expand Up @@ -147,7 +148,7 @@ describe("BankExtension", () => {
describe("verified", () => {
describe("balance", () => {
it("works for different existing balances", async () => {
pendingWithoutSimapp();
pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md
const [client, tmClient] = await makeClientWithBank(simapp.tendermintUrl);

const response1 = await client.bank.verified.balance(unused.address, simapp.denomFee);
Expand All @@ -165,7 +166,7 @@ describe("BankExtension", () => {
});

it("returns null for non-existent balance", async () => {
pendingWithoutSimapp();
pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md
const [client, tmClient] = await makeClientWithBank(simapp.tendermintUrl);

const response = await client.bank.verified.balance(unused.address, "gintonic");
Expand All @@ -175,7 +176,7 @@ describe("BankExtension", () => {
});

it("returns null for non-existent address", async () => {
pendingWithoutSimapp();
pendingWithoutSimapp42(); // Not supported with 0.44, see "Known limitations" in README.md
const [client, tmClient] = await makeClientWithBank(simapp.tendermintUrl);

const response = await client.bank.verified.balance(nonExistentAddress, simapp.denomFee);
Expand Down
5 changes: 5 additions & 0 deletions packages/stargate/src/queries/bank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export interface BankExtension {
readonly allBalances: (address: string) => Promise<Coin[]>;
readonly totalSupply: () => Promise<Coin[]>;
readonly supplyOf: (denom: string) => Promise<Coin>;
/**
* @deprecated Verified queries are not supported with Cosmos SDK 0.44+.
* See "Known limitations" in README.md.
* Will be rmoved in CosmJS 0.27 (https://github.com/cosmos/cosmjs/pull/910).
*/
readonly verified: {
readonly balance: (address: string, denom: string) => Promise<Coin | null>;
};
Expand Down
Loading

0 comments on commit 0fdf06c

Please sign in to comment.