Skip to content

Commit 68aa81d

Browse files
authored
Merge pull request #1947 from cosmos/Add-evmd
feat(test): add evmd
2 parents f0d63d4 + f05c106 commit 68aa81d

Some content is hidden

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

54 files changed

+5684
-29
lines changed

.github/workflows/coverage.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
node-version: 24
2020
cache: 'yarn'
2121

22+
- name: Build evmd
23+
run: ./scripts/evmd/build.sh
24+
- name: Start evmd
25+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/start.sh &
26+
- name: Start slow evmd
27+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/slow_start.sh &
2228
- name: Start wasmd
2329
run: RUNNER_TRACKING_ID="" && ./scripts/wasmd/start.sh &
2430
- name: Start simapp
@@ -38,11 +44,15 @@ jobs:
3844
- name: Build
3945
run: yarn build
4046

47+
- name: Initialize evmd
48+
run: ./scripts/evmd/init.sh
4149
- name: Initialize wasmd (deploy contracts and friends)
4250
run: ./scripts/wasmd/init.sh
4351

4452
- name: Test with coverage
4553
env:
54+
EVMD_ENABLED: 1
55+
SLOW_EVMD_ENABLED: 1
4656
HTTPSERVER_ENABLED: 1
4757
SIMAPP50_ENABLED: 1
4858
SLOW_SIMAPP50_ENABLED: 1

.github/workflows/test.yml

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
node-version: 24
2020
cache: 'yarn'
2121

22+
- name: Build evmd
23+
run: ./scripts/evmd/build.sh
24+
- name: Start evmd
25+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/start.sh &
26+
- name: Start slow evmd
27+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/slow_start.sh &
2228
- name: Start wasmd
2329
run: RUNNER_TRACKING_ID="" && ./scripts/wasmd/start.sh &
2430
- name: Start simapp
@@ -38,11 +44,15 @@ jobs:
3844
- name: Build
3945
run: yarn build
4046

47+
- name: Initialize evmd
48+
run: ./scripts/evmd/init.sh
4149
- name: Initialize wasmd (deploy contracts and friends)
4250
run: ./scripts/wasmd/init.sh
4351

4452
- name: Test
4553
env:
54+
EVMD_ENABLED: 1
55+
SLOW_EVMD_ENABLED: 1
4656
HTTPSERVER_ENABLED: 1
4757
SIMAPP50_ENABLED: 1
4858
SLOW_SIMAPP50_ENABLED: 1
@@ -68,6 +78,12 @@ jobs:
6878
node-version: "${{ matrix.node-version }}"
6979
cache: 'yarn'
7080

81+
- name: Build evmd
82+
run: ./scripts/evmd/build.sh
83+
- name: Start evmd
84+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/start.sh &
85+
- name: Start slow evmd
86+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/slow_start.sh &
7187
- name: Start wasmd
7288
run: RUNNER_TRACKING_ID="" && ./scripts/wasmd/start.sh &
7389
- name: Start simapp
@@ -87,11 +103,15 @@ jobs:
87103
- name: Build
88104
run: yarn build
89105

106+
- name: Initialize evmd
107+
run: ./scripts/evmd/init.sh
90108
- name: Initialize wasmd (deploy contracts and friends)
91109
run: ./scripts/wasmd/init.sh
92110

93111
- name: Test
94112
env:
113+
EVMD_ENABLED: 1
114+
SLOW_EVMD_ENABLED: 1
95115
HTTPSERVER_ENABLED: 1
96116
SIMAPP50_ENABLED: 1
97117
SLOW_SIMAPP50_ENABLED: 1
@@ -105,7 +125,7 @@ jobs:
105125
test-backends:
106126
strategy:
107127
matrix:
108-
simapp: ["simapp47", "simapp50", "simapp53"]
128+
backend: ["simapp47", "simapp50", "simapp53", "evmd"]
109129
runs-on: ubuntu-24.04
110130
steps:
111131
- uses: actions/checkout@v6
@@ -118,12 +138,23 @@ jobs:
118138
node-version: 24
119139
cache: 'yarn'
120140

141+
- name: Build evmd
142+
if: matrix.backend == 'evmd'
143+
run: ./scripts/evmd/build.sh
144+
- name: Start evmd
145+
if: matrix.backend == 'evmd'
146+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/start.sh &
147+
- name: Start slow evmd
148+
if: matrix.backend == 'evmd'
149+
run: RUNNER_TRACKING_ID="" && ./scripts/evmd/slow_start.sh &
121150
- name: Start wasmd
122151
run: RUNNER_TRACKING_ID="" && ./scripts/wasmd/start.sh &
123152
- name: Start simapp
124-
run: RUNNER_TRACKING_ID="" && ./scripts/${{ matrix.simapp }}/start.sh &
153+
if: startsWith(matrix.backend, 'simapp')
154+
run: RUNNER_TRACKING_ID="" && ./scripts/${{ matrix.backend }}/start.sh &
125155
- name: Start slow simapp
126-
run: RUNNER_TRACKING_ID="" && ./scripts/${{ matrix.simapp }}/slow_start.sh &
156+
if: startsWith(matrix.backend, 'simapp')
157+
run: RUNNER_TRACKING_ID="" && ./scripts/${{ matrix.backend }}/slow_start.sh &
127158
- name: Start Tendermint blockchains
128159
run: RUNNER_TRACKING_ID="" && ./scripts/tendermint/all_start.sh &
129160
- name: Start socket server
@@ -137,6 +168,9 @@ jobs:
137168
- name: Build
138169
run: yarn build
139170

171+
- name: Initialize evmd
172+
if: matrix.backend == 'evmd'
173+
run: ./scripts/evmd/init.sh
140174
- name: Initialize wasmd (deploy contracts and friends)
141175
run: ./scripts/wasmd/init.sh
142176

@@ -148,7 +182,8 @@ jobs:
148182
SKIP_BUILD: 1
149183
WASMD_ENABLED: 1
150184
run: |
151-
[ "${{ matrix.simapp }}" = "simapp47" ] && export SIMAPP47_ENABLED=1 SLOW_SIMAPP47_ENABLED=1
152-
[ "${{ matrix.simapp }}" = "simapp50" ] && export SIMAPP50_ENABLED=1 SLOW_SIMAPP50_ENABLED=1
153-
[ "${{ matrix.simapp }}" = "simapp53" ] && export SIMAPP53_ENABLED=1 SLOW_SIMAPP53_ENABLED=1
185+
[ "${{ matrix.backend }}" = "simapp47" ] && export SIMAPP47_ENABLED=1 SLOW_SIMAPP47_ENABLED=1
186+
[ "${{ matrix.backend }}" = "simapp50" ] && export SIMAPP50_ENABLED=1 SLOW_SIMAPP50_ENABLED=1
187+
[ "${{ matrix.backend }}" = "simapp53" ] && export SIMAPP53_ENABLED=1 SLOW_SIMAPP53_ENABLED=1
188+
[ "${{ matrix.backend }}" = "evmd" ] && export EVMD_ENABLED=1 SLOW_EVMD_ENABLED=1
154189
yarn run test

.gitignore

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ coverage/
3737
!.yarn/sdks
3838
!.yarn/versions
3939

40-
# Yarn on Mac
41-
# The fsevents-patch is added on macOS but removed on other systems. To avoid annoying back and forth
42-
# we just ignore it here. The file is not needed in the Linux-based CI and `yarn install` will bring it back on
43-
# macOS based dev machines.
40+
# Yarn platform-specific bindings
41+
# Platform-specific packages are added/removed depending on the OS. To avoid annoying back and forth
42+
# we ignore them here. They are not needed in CI and `yarn install` will bring them back on the
43+
# appropriate platform.
4444
.yarn/cache/fsevents-patch-*-*.zip
45+
.yarn/cache/@unrs-resolver-binding-*-*.zip
46+
47+
AGENTS.md

HACKING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ export WASMD_ENABLED=1
6060
./scripts/simapp50/start.sh
6161
export SIMAPP50_ENABLED=1
6262

63+
# Start evmd (build Docker image first time only)
64+
./scripts/evmd/build.sh # Only needed once
65+
./scripts/evmd/start.sh
66+
./scripts/evmd/init.sh
67+
export EVMD_ENABLED=1
68+
6369
# Start Tendermint
6470
./scripts/tendermint/all_start.sh
6571
export TENDERMINT_ENABLED=1
@@ -79,12 +85,14 @@ yarn test
7985
unset HTTPSERVER_ENABLED
8086
unset SOCKETSERVER_ENABLED
8187
unset TENDERMINT_ENABLED
88+
unset EVMD_ENABLED
8289
unset SIMAPP50_ENABLED
8390
unset WASMD_ENABLED
8491
./scripts/httpserver/stop.sh
8592
./scripts/socketserver/stop.sh
8693
./scripts/tendermint/all_stop.sh
87-
./scripts/simapp/stop.sh
94+
./scripts/evmd/stop.sh
95+
./scripts/simapp50/stop.sh
8896
./scripts/wasmd/stop.sh
8997
```
9098

@@ -110,13 +118,19 @@ order to avoid conflicts. Here is an overview of the ports used:
110118
| 1318 | simapp LCD API | Manual Stargate debugging |
111119
| 1319 | wasmd LCD API | Manual Stargate debugging |
112120
| 1320 | simapp slow LCD API | Manual Stargate debugging |
121+
| 1321 | evmd REST API | EVM chain tests |
122+
| 1322 | evmd slow REST API | EVM chain tests |
113123
| 4444 | socketserver | @cosmjs/sockets tests |
114124
| 4445 | socketserver slow | @cosmjs/sockets tests |
115125
| 5555 | httpserver | @cosmjs/tendermint-rpc tests |
116126
| 9090 | simapp gRPC | Manual Stargate debugging |
127+
| 9091 | evmd gRPC | EVM chain tests |
128+
| 9092 | evmd slow gRPC | EVM chain tests |
117129
| 11101 | Standalone CometBFT 1.x RPC | @cosmjs/tendermint-rpc tests |
118130
| 11137 | Standalone Tendermint 0.37 RPC | @cosmjs/tendermint-rpc tests |
119131
| 11138 | Standalone CometBFT 0.38 RPC | @cosmjs/tendermint-rpc tests |
120132
| 26658 | simapp Tendermint RPC | Stargate client tests |
121133
| 26659 | wasmd Tendermint RPC | @cosmjs/cosmwasm tests |
122134
| 26660 | simapp slow Tendermint RPC | Stargate client tests |
135+
| 26661 | evmd Tendermint RPC | EVM chain tests |
136+
| 26662 | evmd slow Tendermint RPC | EVM chain tests |

packages/cosmwasm/src/testutils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ export interface ContractUploadInstructions {
4141
readonly data: Uint8Array;
4242
}
4343

44+
export const evmd = {
45+
blockTime: 1_000, // ms
46+
chainId: "evmd-testing",
47+
endpoint: "http://localhost:26661",
48+
prefix: "evmos",
49+
};
50+
4451
export const wasmd = {
4552
blockTime: 1_000, // ms
4653
chainId: "testing",
@@ -144,6 +151,7 @@ export const deployedIbcReflect = {
144151
],
145152
};
146153

154+
export const evmdEnabled: boolean = !!globalThis.process?.env.EVMD_ENABLED;
147155
export const wasmdEnabled: boolean = !!globalThis.process?.env.WASMD_ENABLED;
148156

149157
/** Returns first element. Throws if array has a different length than 1. */

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ import { BaseAccount } from "cosmjs-types/cosmos/auth/v1beta1/auth";
55
import { Any } from "cosmjs-types/google/protobuf/any";
66

77
import { QueryClient } from "../../queryclient";
8-
import { nonExistentAddress, simapp, simappEnabled, unused, validator } from "../../testutils";
8+
import {
9+
evmd,
10+
evmdEnabled,
11+
evmfaucet,
12+
nonExistentAddress,
13+
simapp,
14+
simappEnabled,
15+
unused,
16+
validator,
17+
} from "../../testutils";
918
import { AuthExtension, setupAuthExtension } from "./queries";
1019

1120
async function makeClientWithAuth(rpcUrl: string): Promise<[QueryClient & AuthExtension, CometClient]> {
@@ -59,3 +68,29 @@ async function makeClientWithAuth(rpcUrl: string): Promise<[QueryClient & AuthEx
5968
});
6069
});
6170
});
71+
72+
(evmdEnabled ? describe : xdescribe)("AuthExtension (evmd)", () => {
73+
describe("account", () => {
74+
it("works for account with pubkey and non-zero sequence", async () => {
75+
const [client, cometClient] = await makeClientWithAuth(evmd.tendermintUrlHttp);
76+
const account = await client.auth.account(evmfaucet.address0);
77+
assert(account);
78+
79+
expect(account.typeUrl).toEqual("/cosmos.auth.v1beta1.BaseAccount");
80+
const decoded = BaseAccount.decode(account.value);
81+
expect(decoded.address).toEqual(evmfaucet.address0);
82+
expect(Number(decoded.accountNumber)).toBeGreaterThanOrEqual(0);
83+
expect(Number(decoded.sequence)).toBeGreaterThanOrEqual(0);
84+
85+
cometClient.disconnect();
86+
});
87+
88+
it("rejects for non-existent address", async () => {
89+
const [client, cometClient] = await makeClientWithAuth(evmd.tendermintUrlHttp);
90+
91+
await expectAsync(client.auth.account(nonExistentAddress)).toBeRejectedWithError(/not found/i);
92+
93+
cometClient.disconnect();
94+
});
95+
});
96+
});

0 commit comments

Comments
 (0)