|
| 1 | +# Hemitrap |
| 2 | + |
| 3 | +Hemitrap is a 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 could 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: |
| 43 | + |
| 44 | +_NOTE_: Before you run the below command, I suggest updating 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