Skip to content

Commit 9f015f7

Browse files
authored
Scripts improvements (#18)
* Update build commands and clean node-env script * fix node-envv * clean up * update doc * fixes * rm tests files * rm * fix example * fix * improvements to scripts * lint * add lint * fix
1 parent c28f102 commit 9f015f7

File tree

7 files changed

+364
-67
lines changed

7 files changed

+364
-67
lines changed

.github/workflows/lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Deno
18+
uses: denoland/setup-deno@v2
19+
with:
20+
deno-version: v2.x
21+
22+
- name: Run linter
23+
run: deno task lint

README.md

Lines changed: 59 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This does the following:
2727
Update `tools/deploy.ts` to include new contracts you want to deploy.
2828
Make sure to specify the constructor arguments and the value, if needed.
2929

30-
Once you have the chain running (see [Running the Development Stack](#running-the-development-stack)), deploy the contracts by running:
30+
Once you have the chain running (see [Running the Revive Stack](#running-the-revive-stack)), deploy the contracts by running:
3131

3232
```sh
3333
deno task deploy [--filter <contract-name>]
@@ -94,9 +94,21 @@ eth-rpc build
9494

9595
These commands will compile the binaries into `~/polkadot-sdk/target/debug/`. The build process may take some time on the first run.
9696

97-
## Running the Development Stack
97+
# Testing Tips
9898

99-
Once built, you can run the complete development stack in tmux:
99+
## Running the Revive Stack
100+
101+
Once built, you can run each service individually:
102+
103+
```sh
104+
# Run the development node
105+
dev-node run
106+
107+
# In another terminal, run the Ethereum RPC bridge
108+
eth-rpc run ws://localhost:9944
109+
```
110+
111+
Alternatively, you can run the complete development stack in tmux:
100112

101113
```sh
102114
# Run both services in separate tmux panes
@@ -107,23 +119,61 @@ revive_dev_stack
107119
revive_dev_stack proxy
108120
```
109121

110-
Alternatively, you can run each service individually:
122+
## Running the Geth Stack
123+
124+
To test contracts against standard Ethereum with Geth:
111125

112126
```sh
113-
# Run the development node
114-
dev-node run
127+
# Run geth in development mode (default port 8545)
128+
geth-dev
115129

116-
# In another terminal, run the Ethereum RPC bridge
117-
eth-rpc run ws://localhost:9944
130+
# Or specify a custom port
131+
geth-dev 8546
118132
```
119133

120-
To test contracts with Geth
134+
Alternatively, you can run geth with mitmproxy in a tmux window:
121135

122136
```sh
123137
# Run geth with mitmproxy in a tmux window
124138
geth_stack
125139
```
126140

141+
This will start a local Geth development node with HTTP RPC enabled, useful for comparing behavior between Revive and standard EVM environments.
142+
143+
## Recording and Replaying RPC Requests
144+
145+
### Recording RPC Requests
146+
147+
When testing and debugging, you can record all `eth_sendRawTransaction` requests using the `--record` flag:
148+
149+
```sh
150+
# Record requests when running eth-rpc
151+
eth-rpc run ws://localhost:9944 --record
152+
```
153+
154+
When `--record` is enabled, eth-rpc will:
155+
156+
- Log all output to console and `/tmp/eth-rpc.log`
157+
- Extract and save all `eth_sendRawTransaction` requests to `/tmp/eth-rpc-requests.log`
158+
159+
### Replaying Recorded Requests
160+
161+
You can replay recorded requests using the `scripts/run-all.sh` script:
162+
163+
```sh
164+
# Replay all recorded requests against localhost:8545
165+
./scripts/run-all.sh
166+
```
167+
168+
This script will:
169+
170+
- Send each recorded transaction to the RPC endpoint
171+
- Wait for transaction receipts
172+
- Display status (✓ for success, ✗ for failure)
173+
- Report any errors or failed transactions at the end
174+
175+
This is useful for regression testing - record a successful test session, then replay it against new builds to ensure compatibility.
176+
127177
# Learn more
128178

129179
- [Asset Hub documentation](https://contracts.polkadot.io) to learn more about building Smart Contracts on Asset Hub.

deno.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"tasks": {
3+
"lint": "deno fmt --check && deno lint",
34
"build": {
45
"description": "Build contracts from the contracts directory and output bytecode and abi in the codegen directory",
56
"command": "deno run --env-file --allow-all tools/build.ts"
@@ -20,7 +21,7 @@
2021
"react/jsx-runtime": "npm:react@^19.2.0/jsx-runtime",
2122
"solc": "npm:solc@^0.8.30",
2223
"viem": "npm:viem@^2.38.4",
23-
"viem/accounts": "npm:viem@^2.38.4/accounts",
24+
"viem/accounts": "npm:viem@^2.38.4/accounts"
2425
},
2526
"compilerOptions": {
2627
"strict": true,

0 commit comments

Comments
 (0)