Skip to content

Commit e5ac325

Browse files
authored
Merge pull request #1920 from cosmos/simapp53
Add simapp testing for Cosmos SDK 0.53
2 parents 0b2c40e + 2523ae5 commit e5ac325

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3591
-23
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105
test-backends:
106106
strategy:
107107
matrix:
108-
simapp: ["simapp47", "simapp50"]
108+
simapp: ["simapp47", "simapp50", "simapp53"]
109109
runs-on: ubuntu-24.04
110110
steps:
111111
- uses: actions/checkout@v6
@@ -150,4 +150,5 @@ jobs:
150150
run: |
151151
[ "${{ matrix.simapp }}" = "simapp47" ] && export SIMAPP47_ENABLED=1 SLOW_SIMAPP47_ENABLED=1
152152
[ "${{ matrix.simapp }}" = "simapp50" ] && export SIMAPP50_ENABLED=1 SLOW_SIMAPP50_ENABLED=1
153+
[ "${{ matrix.simapp }}" = "simapp53" ] && export SIMAPP53_ENABLED=1 SLOW_SIMAPP53_ENABLED=1
153154
yarn run test

packages/faucet/src/testutils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
export const simappEnabled = !!(
2-
globalThis.process?.env.SIMAPP47_ENABLED || globalThis.process?.env.SIMAPP50_ENABLED
2+
globalThis.process?.env.SIMAPP47_ENABLED ||
3+
globalThis.process?.env.SIMAPP50_ENABLED ||
4+
globalThis.process?.env.SIMAPP53_ENABLED
35
);

packages/ledger-amino/src/testutils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ export const faucet = {
1111
export const ledgerEnabled: boolean = !!globalThis.process?.env.LEDGER_ENABLED;
1212

1313
export const simappEnabled: boolean = !!(
14-
globalThis.process?.env.SIMAPP47_ENABLED || globalThis.process?.env.SIMAPP50_ENABLED
14+
globalThis.process?.env.SIMAPP47_ENABLED ||
15+
globalThis.process?.env.SIMAPP50_ENABLED ||
16+
globalThis.process?.env.SIMAPP53_ENABLED
1517
);
1618

1719
export const simapp = {

packages/stargate/src/modules/distribution/queries.spec.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import { MsgDelegate } from "cosmjs-types/cosmos/staking/v1beta1/tx";
66
import { QueryClient } from "../../queryclient";
77
import { SigningStargateClient } from "../../signingstargateclient";
88
import { assertIsDeliverTxSuccess } from "../../stargateclient";
9-
import { defaultSigningClientOptions, faucet, simapp, simappEnabled, validator } from "../../testutils";
9+
import {
10+
defaultSigningClientOptions,
11+
externalCommunityPool,
12+
faucet,
13+
simapp,
14+
simappEnabled,
15+
validator,
16+
} from "../../testutils";
1017
import { MsgDelegateEncodeObject } from "../";
1118
import { DistributionExtension, setupDistributionExtension } from "./queries";
1219

@@ -51,9 +58,15 @@ async function makeClientWithDistribution(
5158
it("works", async () => {
5259
const [client, cometClient] = await makeClientWithDistribution(simapp.tendermintUrlHttp);
5360

54-
const response = await client.distribution.communityPool();
55-
expect(response.pool).toBeDefined();
56-
expect(response.pool).not.toBeNull();
61+
if (externalCommunityPool) {
62+
await expectAsync(client.distribution.communityPool()).toBeRejectedWithError(
63+
/external community pool is enabled - use the CommunityPool query exposed by the external community pool/i,
64+
);
65+
} else {
66+
const response = await client.distribution.communityPool();
67+
expect(response.pool).toBeDefined();
68+
expect(response.pool).not.toBeNull();
69+
}
5770

5871
cometClient.disconnect();
5972
});

packages/stargate/src/signingstargateclient.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import {
4343
ModifyingDirectSecp256k1HdWallet,
4444
ModifyingSecp256k1HdWallet,
4545
simapp,
46-
simapp50Enabled,
46+
simapp47Enabled,
4747
simappEnabled,
4848
validator,
4949
} from "./testutils";
@@ -118,10 +118,10 @@ import {
118118
);
119119
assertIsDeliverTxSuccess(result);
120120

121-
if (simapp50Enabled) {
122-
expect(result.rawLog).toEqual(""); // empty now (https://github.com/cosmos/cosmos-sdk/pull/15845)
123-
} else {
121+
if (simapp47Enabled) {
124122
expect(result.rawLog).toBeTruthy();
123+
} else {
124+
expect(result.rawLog).toEqual(""); // empty for 0.50+ (https://github.com/cosmos/cosmos-sdk/pull/15845)
125125
}
126126
expect(result.events.length).toBeGreaterThanOrEqual(1);
127127

@@ -159,10 +159,10 @@ import {
159159
);
160160
assertIsDeliverTxSuccess(result);
161161

162-
if (simapp50Enabled) {
163-
expect(result.rawLog).toEqual(""); // empty now (https://github.com/cosmos/cosmos-sdk/pull/15845)
164-
} else {
162+
if (simapp47Enabled) {
165163
expect(result.rawLog).toBeTruthy();
164+
} else {
165+
expect(result.rawLog).toEqual(""); // empty for 0.50+ (https://github.com/cosmos/cosmos-sdk/pull/15845)
166166
}
167167
expect(result.events.length).toBeGreaterThanOrEqual(1);
168168

packages/stargate/src/stargateclient.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
nonExistentAddress,
2929
simapp,
3030
simapp47Enabled,
31-
simapp50Enabled,
3231
simappEnabled,
3332
slowSimapp,
3433
slowSimappEnabled,
@@ -377,10 +376,10 @@ describe("isDeliverTxSuccess", () => {
377376

378377
const { gasUsed, rawLog, transactionHash } = txResult;
379378
expect(gasUsed).toBeGreaterThan(0);
380-
if (simapp50Enabled) {
381-
expect(rawLog).toEqual(""); // empty now (https://github.com/cosmos/cosmos-sdk/pull/15845)
382-
} else {
379+
if (simapp47Enabled) {
383380
expect(rawLog).toMatch(/{"key":"amount","value":"1234567ucosm"}/);
381+
} else {
382+
expect(rawLog).toEqual(""); // empty for 0.50+ (https://github.com/cosmos/cosmos-sdk/pull/15845)
384383
}
385384
expect(transactionHash).toMatch(/^[0-9A-F]{64}$/);
386385

@@ -453,11 +452,11 @@ describe("isDeliverTxSuccess", () => {
453452
: // New error code for SDK 0.50+
454453
/Broadcasting transaction failed with code 4/i,
455454
);
456-
if (simapp50Enabled) {
455+
if (simapp47Enabled) {
456+
expect(error.code).toEqual(7);
457+
} else {
457458
// New error code for SDK 0.50+
458459
expect(error.code).toEqual(4);
459-
} else {
460-
expect(error.code).toEqual(7);
461460
}
462461
expect(error.codespace).toEqual("sdk");
463462
}

packages/stargate/src/testutils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ import { SigningStargateClientOptions } from "./signingstargateclient";
1717

1818
export const simapp47Enabled: boolean = !!globalThis.process?.env.SIMAPP47_ENABLED;
1919
export const simapp50Enabled: boolean = !!globalThis.process?.env.SIMAPP50_ENABLED;
20-
export const simappEnabled: boolean = simapp47Enabled || simapp50Enabled;
20+
export const simapp53Enabled: boolean = !!globalThis.process?.env.SIMAPP53_ENABLED;
21+
export const simappEnabled: boolean = simapp47Enabled || simapp50Enabled || simapp53Enabled;
2122

2223
export const slowSimappEnabled: boolean =
23-
!!globalThis.process?.env.SLOW_SIMAPP47_ENABLED || !!globalThis.process?.env.SLOW_SIMAPP50_ENABLED;
24+
!!globalThis.process?.env.SLOW_SIMAPP47_ENABLED ||
25+
!!globalThis.process?.env.SLOW_SIMAPP50_ENABLED ||
26+
!!globalThis.process?.env.SLOW_SIMAPP53_ENABLED;
27+
28+
// Starting with Cosmos SDK 0.53, an external community pool is used which causes some distribution queries to fail
29+
export const externalCommunityPool = !simapp47Enabled && !simapp50Enabled;
2430

2531
export function makeRandomAddressBytes(): Uint8Array<ArrayBuffer> {
2632
return Random.getBytes(20);

packages/stargate/webpack.web.config.cjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ module.exports = [
2121
SLOW_SIMAPP47_ENABLED: "",
2222
SIMAPP50_ENABLED: "",
2323
SLOW_SIMAPP50_ENABLED: "",
24+
SIMAPP53_ENABLED: "",
25+
SLOW_SIMAPP53_ENABLED: "",
2426
}),
2527
],
2628
resolve: {

scripts/simapp53/README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Local Simd development network
2+
3+
## Starting the blockchain
4+
5+
Run the following:
6+
7+
```
8+
cd scripts/simapp53
9+
./start.sh
10+
```
11+
12+
## Preset accounts
13+
14+
1. **Faucet**\
15+
economy stock theory fatal elder harbor betray wasp final emotion task
16+
crumble siren bottom lizard educate guess current outdoor pair theory focus
17+
wife stone\
18+
Address 0: cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6\
19+
Address 1: cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5\
20+
Address 2: cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k\
21+
Address 3: cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx\
22+
Address 4: cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx\
23+
Pubkey 0: A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ\
24+
Pubkey 1: AiDosfIbBi54XJ1QjCeApumcy/FjdtF+YhywPf3DKTx7\
25+
Pubkey 2: AzQg33JZqH7vSsm09esZY5bZvmzYwE/SY78cA0iLxpD7\
26+
Pubkey 3: A3gOAlB6aiRTCPvWMQg2+ZbGYNsLd8qlvV28m8p2UhY2\
27+
Pubkey 4: Aum2063ub/ErUnIUB36sK55LktGUStgcbSiaAnL1wadu
28+
2. **Alice**: Test account for the cosmwasm package that can run in parallel
29+
with faucet without sequence conflicts\
30+
enlist hip relief stomach skate base shallow young switch frequent cry park\
31+
Address 0: cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada\
32+
Address 1: cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0\
33+
Address 2: cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5\
34+
Address 3: cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta\
35+
Address 4: cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce\
36+
Pubkey 0: A9cXhWb8ZpqCzkA8dQCPV29KdeRLV3rUYxrkHudLbQtS\
37+
Pubkey 1: A4XluzvcUx0ViLF0DjYW5/noArGwpltDstoUUZo+g1b0\
38+
Pubkey 2: A5TKr1NKc/MKRJ7+EHDD9PlzmGaPD/di/6hzZyBwxoy5\
39+
Pubkey 3: A/HSABDUqMB2qDy+PA7fiuuuA+hfrco2VwwiThMiTzUx\
40+
Pubkey 4: A7usTiqgqfxL/WKhoephDUSCHBQlLagtwI/qTmEteTRM
41+
3. **Bob**: Test account (unused for now)\
42+
remain fragile remove stamp quiz bus country dress critic mammal office need\
43+
Address 0: cosmos1lvrwcvrqlc5ktzp2c4t22xgkx29q3y83lktgzl\
44+
Address 1: cosmos1vkv9sfwaak76weyamqx0flmng2vuquxqcuqukh\
45+
Address 2: cosmos106jwym4s9aujcmes26myzzwqsccw09sdm0v5au\
46+
Address 3: cosmos1c7wpeen2uv8thayf7g8q2rgpm29clj0dgrdtzw\
47+
Address 4: cosmos1mjxpv9ft30wer7ma7kwfxhm42l379xutplrdk6\
48+
Pubkey 0: A0d/GxY+UALE+miWJP0qyq4/EayG1G6tsg24v+cbD6By\
49+
Pubkey 1: Agqd6njsVEQD1CR+F2aqEb8hil5NXZ06mjKgetaNC12t\
50+
Pubkey 2: A6e9ElvKaM0DKWh1bIdK3bgB14dyEDgIXYMA0Lbs1GoQ\
51+
Pubkey 3: AkAK5PQaucieWMb0+tTRY01feYI+upRnoNK556eD0Ibb\
52+
Pubkey 4: A5HMVEAJsupdQWItbZv5Z1xZifDixQi6tjU/hJpZY1bF
53+
4. **Unused**: for testing account state; this account never changes balances or
54+
sequences\
55+
oyster design unusual machine spread century engine gravity focus cave carry
56+
slot\
57+
ArkCaFUJ/IH+vKBmNRCdUVl3mCAhbopk9jjW4Ko4OfRQ\
58+
cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u
59+
5. **Guest**: account for manual testing\
60+
degree tackle suggest window test behind mesh extra cover prepare oak script\
61+
Am/+YV0LaeqQPu7BDJuDHV7J8y68ptkGs10YS+9s71Nq\
62+
cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej
63+
64+
### Multisig accounts
65+
66+
1. 1/5 threshold multisig of the first 5 faucet accounts\
67+
cosmos1v75snhly7wfndk83ud4daygh397vcmkta8rlzq
68+
2. 2/5 threshold multisig of the first 5 faucet accounts\
69+
cosmos1h90ml36rcu7yegwduzgzderj2jmq49hcpfclw9
70+
3. 3/5 threshold multisig of the first 5 faucet accounts\
71+
cosmos1d2mg2euvus3tu2tprfwrfzeal4xu7kygugjxjc

scripts/simapp53/env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Choose from https://github.com/cosmos/cosmos-sdk/pkgs/container/simapp
2+
REPOSITORY="ghcr.io/cosmos/simapp"
3+
VERSION="0.53.4"
4+
CONTAINER_NAME="simapp"
5+
CONTAINER_NAME_SLOW="simapp-slow"

0 commit comments

Comments
 (0)