Skip to content

Commit 86f39f2

Browse files
authored
Cleanup (#20)
* 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 * fixes * fixes * fixes * add doc * fixes * lint fixes
1 parent 400505d commit 86f39f2

File tree

4 files changed

+400340
-62
lines changed

4 files changed

+400340
-62
lines changed

README.md

Lines changed: 67 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ eth-rpc build
9595
These commands will compile the binaries into `~/polkadot-sdk/target/debug/`. The build process may take some time on the first run.
9696

9797
> **Note**: The helper scripts use the `POLKADOT_SDK_DIR` environment variable to locate the Polkadot SDK repository. By default, it points to `~/polkadot-sdk`. If you cloned the repository to a different location, you can override this by setting the environment variable before sourcing the scripts:
98+
>
9899
> ```sh
99100
> export POLKADOT_SDK_DIR=/path/to/your/polkadot-sdk
100101
> source scripts/node-env.sh
@@ -150,17 +151,23 @@ This will start a local Geth development node with HTTP RPC enabled, useful for
150151

151152
### Recording RPC Requests
152153

153-
When testing and debugging, you can record all `eth_sendRawTransaction` requests using the `--record` flag:
154+
When testing and debugging, you can record all `eth_sendRawTransaction` requests using the `--record` flag. This works with both `eth-rpc` and `revive_dev_stack`:
154155

155156
```sh
156157
# Record requests when running eth-rpc
157158
eth-rpc run ws://localhost:9944 --record
159+
160+
# Or specify a custom path for the recorded requests
161+
eth-rpc run ws://localhost:9944 --record=/path/to/requests.log
162+
163+
# Record requests when running the full stack in tmux
164+
revive_dev_stack --record
158165
```
159166

160167
When `--record` is enabled, eth-rpc will:
161168

162169
- Log all output to console and `/tmp/eth-rpc.log`
163-
- Extract and save all `eth_sendRawTransaction` requests to `/tmp/eth-rpc-requests.log`
170+
- Extract and save all `eth_sendRawTransaction` requests to `/tmp/eth-rpc-requests.log` (or your custom path)
164171

165172
### Replaying Recorded Requests
166173

@@ -180,6 +187,64 @@ This script will:
180187

181188
This is useful for regression testing - record a successful test session, then replay it against new builds to ensure compatibility.
182189

190+
## Additional Testing Utilities
191+
192+
The `node-env.sh` script provides several other useful functions for testing and development:
193+
194+
### Differential Testing
195+
196+
Run differential tests against the local dev node using the [revive-differential-tests](https://github.com/paritytech/revive-differential-tests) repository:
197+
198+
```sh
199+
# Build the dev-node and generate the chainspec required by retester
200+
dev-node build --retester
201+
# Start the revive-dev-stack with the chainspec required by retester
202+
revive_dev_stack --retester
203+
# Run a specific differential test
204+
retester_test "./resolc-compiler-tests/fixtures/solidity/complex/create/create2_many/test.json"
205+
```
206+
207+
> **Note**: Requires the `revive-differential-tests` repository to be cloned. By default, it looks for the repository at `~/github/revive-differential-tests`. You can override this by setting the `RETESTER_DIR` environment variable:
208+
>
209+
> ```sh
210+
> export RETESTER_DIR=/path/to/revive-differential-tests
211+
> ```
212+
213+
### Cast Configuration Helpers
214+
215+
Quickly configure `cast` CLI tool for different environments:
216+
217+
```sh
218+
# Configure for local development
219+
cast_local
220+
221+
# Configure for Westend Asset Hub testnet
222+
cast_westend
223+
224+
# Configure for Passet Hub testnet
225+
cast_passet
226+
```
227+
228+
These functions set up the `PRIVATE_KEY` and `ETH_RPC_URL` environment variables, allowing you to use `cast` commands without repeatedly specifying credentials.
229+
230+
### Testing Against Westend/Passet Hub
231+
232+
Build and run custom chain specs for testing on Westend Asset Hub or Passet Hub:
233+
234+
```sh
235+
# Build and run Westend Asset Hub runtime locally
236+
westend build # Build runtime and generate chain spec
237+
westend run # Run with polkadot-omni-node
238+
239+
# Run the full Westend stack in tmux
240+
westend_stack
241+
242+
# Similarly for Passet Hub (requires https://github.com/paseo-network/passet-hub checkout under ~/github/passet-hub-
243+
passet build
244+
passet run
245+
passet_stack
246+
```
247+
183248
# Learn more
184249

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

0 commit comments

Comments
 (0)