You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* update instuction more frendly way
* Update README.md
* number set zero
* fix message-relayer wrong env name issue
* add qa to readme
* Update README.md
* set v1 to each containers
* setup replica
* update redame
* update readme
* Update README.md
* Update README.md
Docker configuration for running the OPSack version of Verse Layer middleware.
2
+
This repository offers Docker configurations for effortlessly running the Opstack version of Verse Layer middlewares. Launching Verse is a 4-step process:
3
+
1. Prepare Assets and Environment
4
+
2. Verifying Correct Startup of Verse
5
+
3. Launch Your Verse
6
+
4. Activate Verse Verifier
3
7
4
-
## Place build artifacts
5
-
Place `deploy-config.json` and `addresses.json` files downloaded from the [verse build tool](https://tools-fe.oasys.games/) into the assets directory.
8
+
Please follow the steps below to get your Verse up and running. If you encounter any issues while building, please refer to the [QA](#frequently-asked-questions) section.
9
+
10
+
## Steps to Launch Verse
11
+
Before beginning, ensure that the L1 contract sets have already been deployed, and you possess the necessary configuration files (`addresses.json`, `deploy-config.json`). If not, please refer to the contract sets deployment section in our [technical documentation](https://docs.oasys.games/docs/verse-developer/how-to-build-verse/manual).
12
+
13
+
### 1. Prepare Assets and Environment
14
+
#### Place Configuration Files
15
+
Move the `deploy-config.json` and `addresses.json` files into the assets directory.
6
16
```shell
7
17
mv /download-path/deploy-config.json ./assets
8
18
mv /download-path/addresses.json ./assets
9
19
```
10
20
11
-
## Create `.env`
12
-
Create an environment variables file for containers. Please copy the sample file and edit it.
21
+
#### Generate jwt.txt
22
+
Generate a JWT secret for authentication between op-node and op-geth. This secret does not require backup.
23
+
```shell
24
+
openssl rand -hex 32 > ./assets/jwt.txt
25
+
```
26
+
27
+
#### Configure .env
28
+
Set up an environment variables file for your Verse. We provide samples for both mainnet and testnet configurations.
29
+
Copy the appropriate sample file and modify it as needed.
13
30
```shell
14
31
# Sample for mainnet
15
32
cp .env.sample.mainnet .env
@@ -18,47 +35,59 @@ cp .env.sample.mainnet .env
18
35
cp .env.sample.testnet .env
19
36
```
20
37
21
-
The `OP_L2OO_ADDR` is obtained from the `addresses.json`.
38
+
To configure the environment file with addresses sourced from `addresses.json`, use the following commands to extract the required addresses:
22
39
```shell
40
+
# Retrieve OP_L2OO_ADDR from addresses.json
23
41
jq .L2OutputOracleProxy ./assets/addresses.json
24
-
```
25
42
26
-
If you do not know how to create a private key, you can use [oasys-pos-cli](https://github.com/oasysgames/oasys-pos-cli). Please download the binary from the [release page](https://github.com/oasysgames/oasys-pos-cli/releases) and execute the key generation command.
43
+
# Retrieve OP_AM_ADDR from addresses.json. There's no need for concern if the result returns a zero address.
If you're unsure about creating a private key, you can utilize [oasys-pos-cli](https://github.com/oasysgames/oasys-pos-cli). Download the binary from the [releases page](https://github.com/oasysgames/oasys-pos-cli/releases) and run the key generation command.
28
54
```shell
29
55
$ oaspos crypto:create-account
30
56
Address : 0xabcd1234...
31
57
Key : 0xabcd1234...
32
58
```
33
-
34
59
Please fund at least 10 OAS to the following address. This address will send transactions to our L1 to cover the required gas fees:
35
60
- OP_PROPOSER_ADDR
36
61
- OP_BATCHER_ADDR
37
62
- MR_PROVER_ADDR
38
63
- MR_FINALIZER_ADDR
39
64
- VERIFY_SUBMITTER_ADDR
40
65
66
+
#### Install Dependencies
67
+
Install the required dependencies to run the scripts.
68
+
```shell
69
+
yarn install
70
+
```
41
71
42
-
##Create `jwt.txt`
43
-
Create the JWT secret used for authentication between `op-node` and `op-geth`. This secret does not need to be backed up.
72
+
#### Pull Docker Containers
73
+
Pull all the required Docker images for Verse middleware.
It's crucial to emphasize that **the following steps must be executed in sequence without any delay between each step** up to the `Run services` point. If you pause or stop at any step, it's advisable to delete all data by removing the ./data folder to ensure a clean state.
49
-
---
50
-
## Updating deploy-config.json
51
-
Update the latest Layer 1 (L1) height to the most recent height.
52
-
```sh
53
-
# Set the shell script to be executable
54
-
chmod 744 update-deploy-config.sh
55
77
56
-
# Execute the script
57
-
./update-deploy-config.sh
78
+
### 2. Verifying Correct Startup of Verse
79
+
#### Update the Starting Block
80
+
Ensure the update of the starting block is successful by executing:
81
+
```shell
82
+
node updateStartingBlock.js
83
+
```
84
+
This script updates the starting block information in the L1 contract. To manually specify, use a option. For example, to set the starting block number to 123, the command would be:
Ensure the successful generation of the genesis block (number=0):
73
102
```shell
74
103
docker-compose run --rm --no-deps op-geth init /assets/genesis.json
75
104
```
76
105
77
-
## Run services
106
+
107
+
### 3. Launch Your Verse
108
+
This step follows the previous ones and ultimately leads to the startup of Docker containers.
109
+
110
+
It's crucial to emphasize that **all steps must be executed in sequence without any delay between each step** up to the `Run Services` point. If you pause or stop at any step, it is recommended to restart from the `Update the Starting Block` step within this section.
111
+
112
+
First, clear all outputs from the previous section.
113
+
```shell
114
+
rm -r ./data
115
+
```
116
+
#### Update the Starting Block
117
+
Repeat the commands from the previous section.
118
+
#### Generate Chain Configurations
119
+
Repeat the commands from the previous section.
120
+
#### Generate the Genesis Block
121
+
Repeat the commands from the previous section.
122
+
#### Run Services
123
+
Finally, launch your Verse by starting up the middleware components.
124
+
```shell
125
+
docker-compose up -d op-geth op-node op-batcher op-proposer message-relayer
126
+
```
127
+
128
+
### 4. Activate Verse Verifier
129
+
Verse Verifier is our unique mechanism designed to expedite L2 withdrawals. Originally, the Optimistic Rollup required a 7-day waiting period to complete L2 withdrawals. By validating the L2 state with our L1 validator sets, we can bypass this waiting window.
130
+
131
+
To activate the Instant Verifier, please fill out the application form below. The Oasys team will then build a replica Verse on your system.
132
+
-[To use instant verifier in verse(Mainnet)](https://docs.google.com/forms/d/1qlkMaL7RWIl09H0Zz0FH23To9cXJ0eIF5bHwhav8OzA/edit#response=ACYDBNjmRXkOBhy-xdFF76faASIJ8Twf_ZHCrhZgJmnMqkhTOY4m7x6uz7oJP6bEuKtaBO0)
133
+
134
+
Once the replica is set up, you can start the Instant Verifier by running:
135
+
```sh
136
+
docker-compose up -d verse-verifier
137
+
```
138
+
139
+
## Steps to Start a Replica Node
140
+
First, copy the `rollup.json` and `genesis.json` files. If you do not have the original files, please contact the original Verse builder to obtain them.
141
+
```shell
142
+
cp assets/rollup.json assets-replica/
143
+
cp assets/genesis.json assets-replica/
144
+
```
145
+
Generate a JWT secret.
146
+
```shell
147
+
openssl rand -hex 32 > ./assets-replica/jwt.txt
148
+
```
149
+
Initialize the Genesis Block.
78
150
```shell
79
-
docker-compose up -d op-geth op-node op-batcher op-proposer verse-verifier
151
+
docker-compose run --rm --no-deps op-geth-replica init /assets/genesis.json
152
+
```
153
+
Start the services.
154
+
```sh
155
+
docker-compose up -d op-geth-replica op-node-replica
156
+
```
157
+
Once running, and after sufficient time has passed, verify that the replica has caught up with the origin. It's important to note that since the replica constructs blocks from L1 data rolled up by the origin, it cannot catch up to the latest head of the origin. It will **always be approximately 100 blocks behind**.
### When I restart the service, it takes about 5 to 10 minutes to start producing a new block. Is this normal?
189
+
Yes, it's normal. When the op-node restarts, it begins to walk the L2 backwards from the unsafe L2 head until it finds an L2 block whose L1 origin is canonical. This process involves identifying finalized and safe L2 blocks. This backtracking stops if it finds a finalized L2 head. However, our L2 doesn't have finality, so it backtracks through a sequential window of 3600 blocks. This backtracking takes time. Please wait patiently until it finishes.
190
+
191
+
During this process, you will see the following log in the op-node:
192
+
```sh
193
+
2024-04-13 09:44:43 t=2024-04-13T02:44:43+0000 lvl=info msg="Walking back L1Block by hash" curr=0x97076d901ec6d79e3dcd1fcc1856c57309eda9c8fe3ac630391c028d72b53bfe:3233556 next=0x193fbd673363aa527ac2848086f09c8490e65469f2276ddb3e3593e3979c2ae5:3233555 l2block=0x049c131483a2d7421d8273a0c5fbe66d8f916b86f163775e254215243ba60928:3339
194
+
```
195
+
196
+
---
197
+
### The op-proposer outputs a `block hash does not match` error repeatedly. How should I address this?
198
+
If the error logs look like the following, you can address this issue by restarting the op-node with the `--omit-l1blockhash-in-proposals` flag:
199
+
```sh
200
+
2024-04-14 10:05:56 t=2024-04-14T03:05:56+0000 lvl=warn msg="Failed to create a transaction, will retry" service=proposer err="failed to estimate gas: execution reverted: L2OutputOracle: block hash does not match the hash at the expected height"
80
201
```
202
+
This error occurs when the op-node has been stopped for more than 4 hours, as the L1 contract cannot refer to an old block hash (older than 1024 blocks). By excluding the L1 block hash from the L2 state proposal, this issue can be resolved.
203
+
204
+
Example to Set in Docker-Compose:
205
+
```yml
206
+
op-proposer:
207
+
...
208
+
command: >
209
+
...
210
+
--omit-l1blockhash-in-proposals
211
+
```
212
+
213
+
---
214
+
### How to Configure Services to Print Debug-Level Logs for Issue Identification
215
+
Below is a table showing how to configure each service to output debug-level logs to help identify issues:
216
+
217
+
|Service|Service|
218
+
|--|--|
219
+
|op-node|Include the `--log.level=debug` option in the start command line|
220
+
|op-geth|Include the `--verbosity=5` option in the start command line|
221
+
|op-batcher|Same as op-node |
222
+
|op-proposer|Same as op-node|
223
+
|message-relayer|Set the `MESSAGE_RELAYER__LOG_LEVEL` environment variable to `debug`|
224
+
|verse-verifier|Set the environment variable `DEBUG=1`|
225
+
226
+
---
227
+
### How to Discard All L2 Data and Restart?
228
+
To start fresh with Layer 2, you can delete all outputs from L2OutputOracle and change the inbox address. This process is extremely risky, so please carefully consider alternative methods before proceeding.
229
+
230
+
#### Delete All Outputs
231
+
First, check the `nextOutputIndex` of L2OutputOracle. If it returns zero, you can skip this process. You can find the address of L2OutputOracle in the `L2OutputOracleProxy` within the `addresses.json`.
232
+
```solidity
233
+
function nextOutputIndex() public view returns (uint256);
234
+
```
235
+
Next, verify the challenger address using the following method; only this address can delete outputs.
236
+
```solidity
237
+
function CHALLENGER() public view returns (address);
238
+
```
239
+
Delete all outputs using `deleteL2Outputs` with zero as the argument:
240
+
- _l2OutputIndex: This is the index number to remain as output. Set this value to zero.
241
+
```solidity
242
+
function deleteL2Outputs(uint256 _l2OutputIndex) external virtual;
243
+
```
244
+
Finally, confirm that all outputs have been deleted by calling nextOutputIndex again.
245
+
246
+
#### Change the Inbox Address
247
+
Manually update the inbox address in addresses.json and deploy-config.json.
248
+
249
+
|File|Property|
250
+
|--|--|
251
+
|addresses.json|BatchInbox|
252
+
|deploy-config.json|batchInboxAddress|
253
+
254
+
Ensure that no transactions have ever been sent to this address, as required. As our recommended solution, increment the last digit of the inbox address as shown below:
255
+
```sh
256
+
# Original
257
+
0xfF0000000000000000000000000000004ee9Ff00
258
+
259
+
# Original
260
+
0xfF0000000000000000000000000000004ee9Ff01
261
+
```
262
+
263
+
Once all changes are made, please restart your system by following the steps in the [Launch Your Verse](#3-launch-your-verse) section.
0 commit comments