Skip to content

Commit b6e72e8

Browse files
hemitrap: localnet fork testing (#706)
* hemitrap: localnet fork testing * added an simple TESTING_FORK env variable that can be set when running localnet tests. when this is set, it will point at the forked daemons from the hemi-node repo * added HEMITRAP.md documentation on how to run the deploy environment testing * spelling fix from pr review * fix duplicate var declaration * Update e2e/proposer-code-1.2.sh Co-authored-by: Joshua Sing <[email protected]> * Update e2e/proposer-code-1.3.sh Co-authored-by: Joshua Sing <[email protected]> * move request bodies to env vars when setting proposer * add note about hemitrap being not for production * Update copyright year in main_test.go --------- Co-authored-by: Joshua Sing <[email protected]>
1 parent a772083 commit b6e72e8

File tree

4 files changed

+740
-32
lines changed

4 files changed

+740
-32
lines changed

e2e/HEMITRAP.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Hemitrap
2+
3+
Hemitrap is a testing/non-production feature that allows a user to fork a synced production
4+
(testnet or mainnet) hemi node and run a local, isolated private network
5+
for (mainly) testing contract upgrades.
6+
7+
## How to use
8+
9+
You will need the hemi-node repo cloned
10+
11+
```shell
12+
git clone https://github.com/hemilabs/hemi-node
13+
```
14+
15+
Then, sync a node.
16+
17+
18+
_NOTE_: As of now only testnet is supported.
19+
20+
```shell
21+
cd /path/to/hemi-node
22+
23+
./scripts/gen.sh testnet snap hemi-min
24+
25+
docker compose -f ./testnet/docker-compose.yml up --profiles hemi-min
26+
```
27+
28+
Let that sync.
29+
30+
Once your node is synced, you should be able to tell by:
31+
32+
_NOTE_: there are ways to do this in one command, but this works.
33+
34+
```shell
35+
docker compose -f ./testnet/docker-compose.yml exec -it op-geth-l2
36+
geth attach datadir/geth/geth.ipc
37+
eth.syncing
38+
```
39+
40+
Then, stop your containers (ctrl+c).
41+
42+
Then, similar to the above, run the following:
43+
44+
Before you run the below command, I update the `rollup.json`
45+
file to have the network run a little faster for local testing. Updating these
46+
two values:
47+
```json
48+
{
49+
"max_sequencer_drift": 200,
50+
"seq_window_size": 20
51+
}
52+
```
53+
54+
```shell
55+
docker compose -f ./testnet/docker-compose.yml up --profiles hemitrap
56+
```
57+
58+
Now you should have a local private network with your own sequencer running.
59+
60+
### Ensure the proposer works
61+
62+
The proposer will need to be updated, at the smart contract level in order to
63+
publish transactions.
64+
65+
Please run one of these scripts, based on the current version you're running in
66+
your fork.
67+
68+
_NOTE_: The upgrade program itself expects the proposer to be a certain "code".
69+
So it's easiest to only run this once per fork.
70+
71+
```shell
72+
./e2e/proposer-code-1.2.sh
73+
```

0 commit comments

Comments
 (0)