Skip to content

Commit 0a11681

Browse files
committed
Split containers into 3
1 parent cccc82e commit 0a11681

File tree

13 files changed

+193
-44
lines changed

13 files changed

+193
-44
lines changed

.env.example

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ ORBIT_CHAIN_NAME=
4242

4343
# Other constants
4444
##########################
45-
CHAIN_CONFIG_FOLDER="chainConfig"
46-
NODE_CONFIG_FILENAME="node-config"
4745
FUNDING_AMOUNT=
46+
47+
# Configures the node to not wait for finalized blocks on the parent chain to sequence
48+
# delayed messages or read information from the parent chain.
4849
DISABLE_L1_FINALITY=true
50+
51+
# Configures the node to post batches and make assertions every minute
52+
USE_FAST_L1_POSTING=true

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "nitro"]
22
path = nitro
33
url = https://github.com/OffchainLabs/nitro/
4-
branch = v3.5.5
4+
branch = v3.6.3

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,22 @@ Make a copy of the `.env.example` file and call it `.env`. Then, make sure you s
3636

3737
`yarn run deployTokenBridge`
3838

39+
## Structure of docker containers
40+
41+
When starting your nodes with `docker compose up`, up to four containers will start:
42+
43+
- `batch-poster`: the sequencer/batch-poster for your chain
44+
- `staker`: the validator/staker for your chain
45+
- `rpc`: a regular RPC node for your chain
46+
- `das-server`: a Data Availability Server if you're running an AnyTrust chain
47+
48+
You can manage each individual container with the following commands:
49+
50+
- `docker compose stop <container>`: stops the specified container
51+
- `docker compose start <container>`: starts the specified container
52+
- `docker compose restart <container>`: restarts the specified container
53+
- `docker compose create <container>`: creates the specified container (in case it's been removed)
54+
3955
## Update the WASM module root of your node (WIP)
4056

4157
When you modify the State Transition Function (STF) of your node, you have to update the WASM module root on-chain. You can find more information about what this means in the [Arbitrum documentation portal](https://docs.arbitrum.io/launch-orbit-chain/how-tos/customize-stf).

chainConfig/.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,10 @@
22
*
33
# Except this file
44
!.gitignore
5-
!keys
6-
!keys/*
5+
6+
!batch-poster
7+
!staker
8+
!rpc
9+
!das-server
10+
!das-server/keys
11+
!das-server/keys/*
File renamed without changes.
File renamed without changes.

docker-compose.yaml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,48 @@
11
version: '3.9'
22
services:
3-
nitro:
3+
batch-poster:
4+
image: "${NITRO_DOCKER_IMAGE_TAG}"
5+
ports:
6+
- "127.0.0.1:8149:${NITRO_PORT}"
7+
- "127.0.0.1:9642:9642"
8+
volumes:
9+
- "./chainConfig/batch-poster:/home/user/.arbitrum"
10+
command:
11+
- --conf.file=/home/user/.arbitrum/batch-poster-config.json
12+
- --node.feed.output.enable
13+
- --node.feed.output.port=9642
14+
15+
staker:
16+
depends_on:
17+
- batch-poster
18+
image: "${NITRO_DOCKER_IMAGE_TAG}"
19+
ports:
20+
- "127.0.0.1:8249:${NITRO_PORT}"
21+
volumes:
22+
- "./chainConfig/staker:/home/user/.arbitrum"
23+
command:
24+
- --conf.file=/home/user/.arbitrum/staker-config.json
25+
- --execution.forwarding-target=http://batch-poster:8449
26+
- --node.feed.input.url=ws://batch-poster:9642
27+
28+
rpc:
29+
depends_on:
30+
- batch-poster
431
image: "${NITRO_DOCKER_IMAGE_TAG}"
532
ports:
633
- "127.0.0.1:${NITRO_PORT}:${NITRO_PORT}"
734
volumes:
8-
- "./${CHAIN_CONFIG_FOLDER}:/home/user/.arbitrum"
9-
command: --conf.file /home/user/.arbitrum/${NODE_CONFIG_FILENAME}.json
35+
- "./chainConfig/rpc:/home/user/.arbitrum"
36+
command:
37+
- --conf.file=/home/user/.arbitrum/rpc-config.json
38+
- --execution.forwarding-target=http://batch-poster:8449
39+
- --node.feed.input.url=ws://batch-poster:9642
1040

1141
das-server:
1242
image: "${NITRO_DOCKER_IMAGE_TAG}"
1343
entrypoint: [ "/bin/bash", "-c", "/das-server.sh ${USE_ANYTRUST}" ]
1444
volumes:
15-
- "./${CHAIN_CONFIG_FOLDER}:/home/user/.arbitrum"
45+
- "./chainConfig/das-server:/home/user/.arbitrum"
1646
- "./shell-scripts/das-server.sh:/das-server.sh"
1747
- "./${DAS_LOCAL_STORAGE}:/home/user/das-data"
1848
ports:

nitro

Submodule nitro updated 242 files

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"updateWASM": "ts-node ./scripts/updateWasmModuleRoot.ts",
1515
"updateNodeConfig": "ts-node ./scripts/updateNodeConfiguration.ts",
1616
"recoverFundsFromParentChain": "ts-node ./scripts/recoverFundsFromParentChain.ts",
17-
"clean": "find chainConfig -mindepth 1 ! -name '.gitignore' ! -name 'keys' ! -name 'das_bls*' -delete && find chainDasData -mindepth 1 ! -name '.gitignore' -delete"
17+
"clean": "find chainConfig -mindepth 1 ! -name '.gitignore' ! -name 'batch-poster' ! -name 'staker' ! -name 'rpc' ! -name 'das-server' ! -name 'keys' ! -name 'das_bls*' -delete && find chainDasData -mindepth 1 ! -name '.gitignore' -delete"
1818
},
1919
"keywords": [],
2020
"author": "",

scripts/chain-deployer/deployNewOrbitChain.ts

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
prepareDasConfig,
2323
saveDasNodeConfigFile,
2424
chainIsAnytrust,
25+
splitConfigPerType,
2526
} from '../../src/utils';
2627
import 'dotenv/config';
2728

@@ -30,12 +31,10 @@ if (
3031
!process.env.PARENT_CHAIN_ID ||
3132
!process.env.CHAIN_OWNER_PRIVATE_KEY ||
3233
!process.env.BATCH_POSTER_PRIVATE_KEY ||
33-
!process.env.STAKER_PRIVATE_KEY ||
34-
!process.env.CHAIN_CONFIG_FOLDER ||
35-
!process.env.NODE_CONFIG_FILENAME
34+
!process.env.STAKER_PRIVATE_KEY
3635
) {
3736
throw new Error(
38-
'The following environment variables must be present: PARENT_CHAIN_ID, CHAIN_OWNER_PRIVATE_KEY, BATC_POSTER_PRIVATE_KEY, STAKER_PRIVATE_KEY, CHAIN_CONFIG_FOLDER, NODE_CONFIG_FILENAME',
37+
'The following environment variables must be present: PARENT_CHAIN_ID, CHAIN_OWNER_PRIVATE_KEY, BATC_POSTER_PRIVATE_KEY, STAKER_PRIVATE_KEY',
3938
);
4039
}
4140

@@ -139,22 +138,20 @@ const main = async () => {
139138
? process.env.PARENT_CHAIN_BEACON_RPC_URL
140139
: undefined,
141140
};
142-
let nodeConfig = prepareNodeConfig(nodeConfigParameters);
141+
let baseNodeConfig = prepareNodeConfig(nodeConfigParameters);
143142

144-
if (process.env.DISABLE_L1_FINALITY) {
143+
if (process.env.DISABLE_L1_FINALITY === 'true') {
145144
const updatedNodeConfig = {
146145
node: {
147146
'delayed-sequencer': {
148147
'require-full-finality': false,
149148
},
150149
'batch-poster': {
151-
'max-delay': '1m',
152150
'data-poster': {
153151
'wait-for-l1-finality': false,
154152
},
155153
},
156154
'staker': {
157-
'make-assertion-interval': '1m',
158155
'data-poster': {
159156
'wait-for-l1-finality': false,
160157
},
@@ -169,16 +166,50 @@ const main = async () => {
169166
},
170167
},
171168
};
172-
nodeConfig = deepMerge(nodeConfig, updatedNodeConfig);
169+
baseNodeConfig = deepMerge(baseNodeConfig, updatedNodeConfig);
170+
}
171+
172+
if (process.env.USE_FAST_L1_POSTING === 'true') {
173+
const updatedNodeConfig = {
174+
node: {
175+
'batch-poster': {
176+
'max-delay': '1m',
177+
},
178+
'staker': {
179+
'make-assertion-interval': '1m',
180+
},
181+
},
182+
};
183+
baseNodeConfig = deepMerge(baseNodeConfig, updatedNodeConfig);
173184
}
174185

175186
// Extra customizable options
176-
if (process.env.NITRO_PORT) {
177-
nodeConfig.http!.port = Number(process.env.NITRO_PORT);
187+
if (process.env.NITRO_PORT != '') {
188+
baseNodeConfig.http!.port = Number(process.env.NITRO_PORT);
178189
}
179190

180-
const filePath = saveNodeConfigFile(nodeConfig);
181-
console.log(`Node config written to ${filePath}`);
191+
//
192+
// NOTE:
193+
// The following configuration is added to the batch poster in the docker-compose file
194+
// - --node.feed.output.enable
195+
// - --node.feed.output.port=9642
196+
//
197+
// The following configuration is added to the staker and rpc in the docker-compose file
198+
// - --execution.forwarding-target 'http://batch-poster:8449'
199+
// - --node.feed.input.url ws://batch-poster:9642
200+
//
201+
202+
// Split config into the different entities
203+
const { batchPosterConfig, stakerConfig, rpcConfig } = splitConfigPerType(baseNodeConfig);
204+
205+
const batchPosterfilePath = saveNodeConfigFile('batch-poster', batchPosterConfig);
206+
console.log(`Batch poster config written to ${batchPosterfilePath}`);
207+
208+
const stakerFilePath = saveNodeConfigFile('staker', stakerConfig);
209+
console.log(`Staker config written to ${stakerFilePath}`);
210+
211+
const rpcFilePath = saveNodeConfigFile('rpc', rpcConfig);
212+
console.log(`RPC config written to ${rpcFilePath}`);
182213

183214
// If we want to use AnyTrust, we need to:
184215
// 1. set the right keyset in the SequencerInbox

0 commit comments

Comments
 (0)