Skip to content

Commit 02621d2

Browse files
Fix PR comments
1 parent e0f7b8e commit 02621d2

File tree

4 files changed

+38
-73
lines changed

4 files changed

+38
-73
lines changed

docker-compose.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ services:
388388
- "config:/config"
389389
- "das-committee-a-data:/das"
390390
command:
391-
- --conf.file=/config/l2_das_committee_a.json
391+
- --conf.file=/config/l2_das_committee.json
392392

393393
das-committee-b:
394394
pid: host # allow debugging
@@ -401,7 +401,7 @@ services:
401401
- "config:/config"
402402
- "das-committee-b-data:/das"
403403
command:
404-
- --conf.file=/config/l2_das_committee_b.json
404+
- --conf.file=/config/l2_das_committee.json
405405

406406
das-mirror:
407407
pid: host # allow debugging

scripts/config.ts

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,18 @@ function writeGethGenesisConfig(argv: any) {
161161
fs.writeFileSync(path.join(consts.configpath, "val_jwt.hex"), val_jwt)
162162
}
163163

164+
type ChainInfo = {
165+
[key: string]: any;
166+
};
167+
168+
// Define a function to return ChainInfo
169+
function getChainInfo(): ChainInfo {
170+
const filePath = path.join(consts.configpath, "l2_chain_info.json");
171+
const fileContents = fs.readFileSync(filePath).toString();
172+
const chainInfo: ChainInfo = JSON.parse(fileContents);
173+
return chainInfo;
174+
}
175+
164176
function writeConfigs(argv: any) {
165177
const valJwtSecret = path.join(consts.configpath, "val_jwt.hex")
166178
const chainInfoFile = path.join(consts.configpath, "l2_chain_info.json")
@@ -232,7 +244,7 @@ function writeConfigs(argv: any) {
232244
}
233245
},
234246
"data-availability": {
235-
"enable": false,
247+
"enable": argv.anytrust,
236248
"rpc-aggregator": dasBackendsJsonConfig(argv),
237249
"rest-aggregator": {
238250
"enable": true,
@@ -262,12 +274,7 @@ function writeConfigs(argv: any) {
262274
},
263275
}
264276

265-
const deploydata = JSON.parse(
266-
fs
267-
.readFileSync(path.join(consts.configpath, "deployment.json"))
268-
.toString()
269-
);
270-
baseConfig.node["data-availability"]["sequencer-inbox-address"] = ethers.utils.hexlify(deploydata["sequencer-inbox"]);
277+
baseConfig.node["data-availability"]["sequencer-inbox-address"] = ethers.utils.hexlify(getChainInfo()[0]["rollup"]["sequencer-inbox"]);
271278

272279
const baseConfJSON = JSON.stringify(baseConfig)
273280

@@ -283,19 +290,13 @@ function writeConfigs(argv: any) {
283290
simpleConfig.node["batch-poster"]["redis-url"] = ""
284291
simpleConfig.execution["sequencer"].enable = true
285292
if (argv.anytrust) {
286-
simpleConfig.node["data-availability"].enable = true
287293
simpleConfig.node["data-availability"]["rpc-aggregator"].enable = true
288-
simpleConfig.node["data-availability"]["rest-aggregator"].enable = true
289294
}
290295
fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(simpleConfig))
291296
} else {
292297
let validatorConfig = JSON.parse(baseConfJSON)
293298
validatorConfig.node.staker.enable = true
294299
validatorConfig.node.staker["use-smart-contract-wallet"] = true
295-
if (argv.anytrust) {
296-
validatorConfig.node["data-availability"].enable = true
297-
validatorConfig.node["data-availability"]["rest-aggregator"].enable = true
298-
}
299300
let validconfJSON = JSON.stringify(validatorConfig)
300301
fs.writeFileSync(path.join(consts.configpath, "validator_config.json"), validconfJSON)
301302

@@ -308,19 +309,13 @@ function writeConfigs(argv: any) {
308309
sequencerConfig.node["seq-coordinator"].enable = true
309310
sequencerConfig.execution["sequencer"].enable = true
310311
sequencerConfig.node["delayed-sequencer"].enable = true
311-
if (argv.anytrust) {
312-
sequencerConfig.node["data-availability"].enable = true
313-
sequencerConfig.node["data-availability"]["rest-aggregator"].enable = true
314-
}
315312
fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig))
316313

317314
let posterConfig = JSON.parse(baseConfJSON)
318315
posterConfig.node["seq-coordinator"].enable = true
319316
posterConfig.node["batch-poster"].enable = true
320317
if (argv.anytrust) {
321-
posterConfig.node["data-availability"].enable = true
322318
posterConfig.node["data-availability"]["rpc-aggregator"].enable = true
323-
posterConfig.node["data-availability"]["rest-aggregator"].enable = true
324319
}
325320
fs.writeFileSync(path.join(consts.configpath, "poster_config.json"), JSON.stringify(posterConfig))
326321
}
@@ -432,7 +427,8 @@ function writeL3ChainConfig(argv: any) {
432427
fs.writeFileSync(path.join(consts.configpath, "l3_chain_config.json"), l3ChainConfigJSON)
433428
}
434429

435-
function writeL2DASCommitteeConfig(argv: any, sequencerInboxAddr: string) {
430+
function writeL2DASCommitteeConfig(argv: any) {
431+
const sequencerInboxAddr = ethers.utils.hexlify(getChainInfo()[0]["rollup"]["sequencer-inbox"]);
436432
const l2DASCommitteeConfig = {
437433
"data-availability": {
438434
"key": {
@@ -456,7 +452,7 @@ function writeL2DASCommitteeConfig(argv: any, sequencerInboxAddr: string) {
456452
}
457453
const l2DASCommitteeConfigJSON = JSON.stringify(l2DASCommitteeConfig)
458454

459-
fs.writeFileSync(path.join(consts.configpath, "l2_das_committee_" + argv.committeeMember + ".json"), l2DASCommitteeConfigJSON)
455+
fs.writeFileSync(path.join(consts.configpath, "l2_das_committee.json"), l2DASCommitteeConfigJSON)
460456
}
461457

462458
function writeL2DASMirrorConfig(argv: any, sequencerInboxAddr: string) {
@@ -591,36 +587,16 @@ export const writeL3ChainConfigCommand = {
591587
export const writeL2DASCommitteeConfigCommand = {
592588
command: "write-l2-das-committee-config",
593589
describe: "writes daserver committee member config file",
594-
builder: {
595-
committeeMember: {
596-
string: true,
597-
describe: "Unique identifier for the das committee member",
598-
default: "not_set"
599-
},
600-
},
601590
handler: (argv: any) => {
602-
const deploydata = JSON.parse(
603-
fs
604-
.readFileSync(path.join(consts.configpath, "deployment.json"))
605-
.toString()
606-
);
607-
const sequencerInboxAddr = ethers.utils.hexlify(deploydata["sequencer-inbox"]);
608-
609-
writeL2DASCommitteeConfig(argv, sequencerInboxAddr)
591+
writeL2DASCommitteeConfig(argv)
610592
}
611593
}
612594

613595
export const writeL2DASMirrorConfigCommand = {
614596
command: "write-l2-das-mirror-config",
615597
describe: "writes daserver mirror config file",
616598
handler: (argv: any) => {
617-
const deploydata = JSON.parse(
618-
fs
619-
.readFileSync(path.join(consts.configpath, "deployment.json"))
620-
.toString()
621-
);
622-
const sequencerInboxAddr = ethers.utils.hexlify(deploydata["sequencer-inbox"]);
623-
599+
const sequencerInboxAddr = ethers.utils.hexlify(getChainInfo()[0]["rollup"]["sequencer-inbox"]);
624600
writeL2DASMirrorConfig(argv, sequencerInboxAddr)
625601
}
626602
}

scripts/ethcommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ async function setValidKeyset(argv: any, upgradeExecutorAddr: string, sequencerI
386386
argv.to = "address_" + upgradeExecutorAddr
387387
argv.ethamount = "0"
388388

389-
await runStress(argv, sendTransaction);
389+
await sendTransaction(argv, 0);
390390

391391
argv.provider.destroy();
392392
}

test-node.bash

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,9 @@ while [[ $# -gt 0 ]]; do
224224
shift
225225
;;
226226
--l2-anytrust)
227-
l2anytrust=true
228-
shift
229-
;;
227+
l2anytrust=true
228+
shift
229+
;;
230230
--redundantsequencers)
231231
simple=false
232232
redundantsequencers=$2
@@ -260,7 +260,7 @@ while [[ $# -gt 0 ]]; do
260260
echo --l3-fee-token L3 chain is set up to use custom fee token. Only valid if also '--l3node' is provided
261261
echo --l3-fee-token-decimals Number of decimals to use for custom fee token. Only valid if also '--l3-fee-token' is provided
262262
echo --l3-token-bridge Deploy L2-L3 token bridge. Only valid if also '--l3node' is provided
263-
echo --l2-anytrust run the L2 as an AnyTrust chain
263+
echo --l2-anytrust run the L2 as an AnyTrust chain
264264
echo --batchposters batch posters [0-3]
265265
echo --redundantsequencers redundant sequencers [0-3]
266266
echo --detach detach from nodes after running them
@@ -286,13 +286,6 @@ done
286286
NODES="sequencer"
287287
INITIAL_SEQ_NODES="sequencer"
288288

289-
#if $l2anytrust; then
290-
# # NODES="$NODES das-committee-a das-committee-b das-mirror"
291-
# NODES="$NODES das-committee-a das-committee-b"
292-
#fi
293-
294-
#NODES="$NODES sequencer"
295-
296289
if ! $simple; then
297290
NODES="$NODES redis"
298291
fi
@@ -465,27 +458,23 @@ if $l2anytrust; then
465458
docker compose run --user root --entrypoint sh datool -c "chown -R 1000:1000 /das*"
466459
docker compose run datool keygen --dir /das-committee-a/keys
467460
docker compose run datool keygen --dir /das-committee-b/keys
468-
sequencerinbox=`docker compose run --entrypoint sh datool -c "cat /config/l2_chain_info.json | jq -r '.[].rollup.\"sequencer-inbox\"'"`
469-
docker compose run scripts write-l2-das-committee-config --committeeMember a
470-
docker compose run scripts write-l2-das-committee-config --committeeMember b
461+
docker compose run scripts write-l2-das-committee-config
471462
docker compose run scripts write-l2-das-mirror-config
472-
fi
473463

474-
das_bls_a=`docker compose run --entrypoint sh datool -c "cat /das-committee-a/keys/das_bls.pub"`
475-
das_bls_b=`docker compose run --entrypoint sh datool -c "cat /das-committee-b/keys/das_bls.pub"`
464+
das_bls_a=`docker compose run --entrypoint sh datool -c "cat /das-committee-a/keys/das_bls.pub"`
465+
das_bls_b=`docker compose run --entrypoint sh datool -c "cat /das-committee-b/keys/das_bls.pub"`
476466

477-
docker compose run scripts write-l2-das-keyset-config --dasBlsA $das_bls_a --dasBlsB $das_bls_b
478-
docker compose run --entrypoint sh datool -c "/usr/local/bin/datool dumpkeyset --conf.file /config/l2_das_keyset.json | grep 'Keyset: ' | awk '{ printf \"%s\", \$2 }' > /config/l2_das_keyset.hex"
479-
docker compose run scripts set-valid-keyset
467+
docker compose run scripts write-l2-das-keyset-config --dasBlsA $das_bls_a --dasBlsB $das_bls_b
468+
docker compose run --entrypoint sh datool -c "/usr/local/bin/datool dumpkeyset --conf.file /config/l2_das_keyset.json | grep 'Keyset: ' | awk '{ printf \"%s\", \$2 }' > /config/l2_das_keyset.hex"
469+
docker compose run scripts set-valid-keyset
480470

481-
anytrustNodeConfigLine="--anytrust --dasBlsA $das_bls_a --dasBlsB $das_bls_b"
471+
anytrustNodeConfigLine="--anytrust --dasBlsA $das_bls_a --dasBlsB $das_bls_b"
472+
fi
482473

483-
if $run; then
484-
echo == Starting AnyTrust committee and mirror
485-
docker compose up --wait das-committee-a das-committee-b das-mirror
486-
# TODO how to make these containers go down since they are now
487-
# run in the background
488-
fi
474+
if $run; then
475+
echo == Starting AnyTrust committee and mirror
476+
docker compose up --wait das-committee-a das-committee-b das-mirror
477+
fi
489478
fi
490479

491480
if $force_init; then

0 commit comments

Comments
 (0)