@@ -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+
164176function 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
462458function writeL2DASMirrorConfig ( argv : any , sequencerInboxAddr : string ) {
@@ -591,36 +587,16 @@ export const writeL3ChainConfigCommand = {
591587export 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
613595export 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}
0 commit comments