Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dependencies
node_modules/

# Environment
.env
.env.local
.env.*.local

# Logs
*.log

# Local overrides
docker-compose.override.yaml
docker-compose.override.yml

# OS files
.DS_Store
Thumbs.db

# IDE
.idea/
.vscode/
*.swp
*.swo
*~
60 changes: 49 additions & 11 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
- postgres
- sequencer
image: blockscout-testnode
restart: always
restart: unless-stopped
container_name: 'blockscout'
links:
- postgres:database
Expand All @@ -30,8 +30,13 @@ services:

postgres:
image: postgres:13.6
restart: always
restart: unless-stopped
container_name: 'postgres'
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 3s
retries: 5
environment:
POSTGRES_PASSWORD: ''
POSTGRES_USER: 'postgres'
Expand All @@ -43,11 +48,24 @@ services:

redis:
image: redis:6.2.6
restart: on-failure:3
ports:
- "127.0.0.1:6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5

geth:
image: ethereum/client-go:v1.16.4
restart: on-failure:3
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8545 --post-data='{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}' --header='Content-Type: application/json' || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
ports:
- "127.0.0.1:8545:8545"
- "127.0.0.1:8551:8551"
Expand Down Expand Up @@ -157,7 +175,14 @@ services:
sequencer:
pid: host # allow debugging
image: nitro-node-dev-testnode
restart: on-failure:3
entrypoint: /usr/local/bin/nitro
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8547/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
ports:
- "127.0.0.1:8547:8547"
- "127.0.0.1:8548:8548"
Expand All @@ -177,7 +202,8 @@ services:
- --graphql.vhosts=*
- --graphql.corsdomain=*
depends_on:
- geth
geth:
condition: service_healthy

sequencer_b:
pid: host # allow debugging
Expand Down Expand Up @@ -236,6 +262,7 @@ services:
staker-unsafe:
pid: host # allow debugging
image: nitro-node-dev-testnode
restart: on-failure:3
entrypoint: /usr/local/bin/nitro
ports:
- "127.0.0.1:8047:8547"
Expand All @@ -246,13 +273,17 @@ services:
- "config:/config"
command: --conf.file /config/unsafe_staker_config.json
depends_on:
- sequencer
- redis
- validation_node
sequencer:
condition: service_healthy
redis:
condition: service_healthy
validation_node:
condition: service_started

poster:
pid: host # allow debugging
image: nitro-node-dev-testnode
restart: on-failure:3
entrypoint: /usr/local/bin/nitro
ports:
- "127.0.0.1:8147:8547"
Expand All @@ -263,8 +294,10 @@ services:
- "config:/config"
command: --conf.file /config/poster_config.json
depends_on:
- geth
- redis
geth:
condition: service_healthy
redis:
condition: service_healthy

poster_b:
pid: host # allow debugging
Expand Down Expand Up @@ -301,6 +334,7 @@ services:
validator:
pid: host # allow debugging
image: nitro-node-dev-testnode
restart: on-failure:3
entrypoint: /usr/local/bin/nitro
ports:
- "127.0.0.1:8247:8547"
Expand All @@ -311,18 +345,21 @@ services:
- "config:/config"
command: --conf.file /config/validator_config.json --http.port 8547 --http.api net,web3,arb,debug --ws.port 8548
depends_on:
- sequencer
- validation_node
sequencer:
condition: service_healthy
validation_node:
condition: service_started

l3node:
pid: host # allow debugging
image: nitro-node-dev-testnode
restart: on-failure:3
entrypoint: /usr/local/bin/nitro
ports:
- "127.0.0.1:3347:3347"
- "127.0.0.1:3348:3348"
volumes:
- "validator-data:/home/user/.arbitrum/local/nitro"
- "l3node-data:/home/user/.arbitrum/local/nitro"
- "l1keystore:/home/user/l1keystore"
- "config:/config"
command: --conf.file /config/l3node_config.json --http.port 3347 --http.api net,web3,arb,debug,eth --ws.port 3348
Expand Down Expand Up @@ -521,6 +558,7 @@ volumes:
seqdata_d:
unsafestaker-data:
validator-data:
l3node-data:
poster-data:
poster-data-b:
poster-data-c:
Expand Down
38 changes: 27 additions & 11 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,19 @@ import { S3Client, PutObjectCommand, CreateBucketCommand, HeadBucketCommand } fr

const path = require("path");

function warnIfPartialS3Credentials() {
if ((process.env.AWS_ACCESS_KEY_ID && !process.env.AWS_SECRET_ACCESS_KEY) ||
(!process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY)) {
console.warn("Warning: Only one of AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY is set; both must be provided for custom S3 credentials (missing value will default to 'minioadmin')");
}
}

const S3_CONFIG = {
endpoint: "http://minio:9000",
region: "us-east-1",
endpoint: process.env.S3_ENDPOINT || "http://minio:9000",
region: process.env.AWS_REGION || "us-east-1",
credentials: {
accessKeyId: "minioadmin",
secretAccessKey: "minioadmin",
accessKeyId: process.env.AWS_ACCESS_KEY_ID || "minioadmin",
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "minioadmin",
},
forcePathStyle: true,
};
Expand Down Expand Up @@ -189,13 +196,21 @@ function writeGethGenesisConfig(argv: any) {

type ChainInfo = {
[key: string]: any;
};
}[];

// Define a function to return ChainInfo
function getChainInfo(): ChainInfo {
const filePath = path.join(consts.configpath, "l2_chain_info.json");
const fileContents = fs.readFileSync(filePath).toString();
const chainInfo: ChainInfo = JSON.parse(fileContents);
let chainInfo: ChainInfo;
try {
const fileContents = fs.readFileSync(filePath).toString();
chainInfo = JSON.parse(fileContents);
} catch (e: any) {
const action = (e instanceof SyntaxError) ? 'parse' : 'read';
throw new Error(`Failed to ${action} chain info from ${filePath}: ${e.message}`);
}
if (!chainInfo || !Array.isArray(chainInfo) || chainInfo.length === 0) {
throw new Error(`Invalid chain info: expected non-empty array in ${filePath}`);
}
return chainInfo;
}

Expand Down Expand Up @@ -406,7 +421,7 @@ function writeConfigs(argv: any) {
sequencerConfig.node["delayed-sequencer"].enable = true
if (argv.timeboost) {
sequencerConfig.execution.sequencer.timeboost = {
"enable": false, // Create it false initially, turn it on with sed in test-node.bash after contract setup.
"enable": false, // Created false initially; enabled via jq in test-node.bash after auction contract deployment.
"redis-url": argv.redisUrl
};
}
Expand Down Expand Up @@ -449,7 +464,7 @@ function writeConfigs(argv: any) {
l3Config.node["batch-poster"]["redis-url"] = ""
fs.writeFileSync(path.join(consts.configpath, "l3node_config.json"), JSON.stringify(l3Config))

let validationNodeConfig = JSON.parse(JSON.stringify({
const validationNodeConfig = {
"persistent": {
"chain": "local"
},
Expand All @@ -467,7 +482,7 @@ function writeConfigs(argv: any) {
"jwtsecret": valJwtSecret,
"addr": "0.0.0.0",
},
}))
}
fs.writeFileSync(path.join(consts.configpath, "validation_node_config.json"), JSON.stringify(validationNodeConfig))
}

Expand Down Expand Up @@ -882,6 +897,7 @@ export const initTxFilteringMinioCommand = {
fs.writeFileSync(path.join(consts.configpath, "initial_address_hashes.json"), JSON.stringify(initialAddressList, null, 2));
fs.writeFileSync(path.join(consts.configpath, "tx_filtering_salt.hex"), salt);

warnIfPartialS3Credentials();
const s3Client = new S3Client(S3_CONFIG);

try {
Expand Down
Loading
Loading