@@ -86,6 +86,7 @@ const dummy4844Reader = '0x0000000000000000000000000000000000000089'
8686
8787// let rollup: RollupContract
8888let rollup : RollupContract
89+ let batchPosterManager : Signer
8990let rollupUser : RollupUserLogic
9091let rollupAdmin : RollupAdminLogic
9192let bridge : Bridge
@@ -132,6 +133,7 @@ const setup = async () => {
132133 const val3 = accounts [ 4 ]
133134 const val4 = accounts [ 5 ]
134135 sequencer = accounts [ 6 ]
136+ const batchPosterManager = accounts [ 7 ]
135137
136138 const oneStep0Fac = ( await ethers . getContractFactory (
137139 'OneStepProver0'
@@ -285,7 +287,7 @@ const setup = async () => {
285287
286288 const deployParams = {
287289 config : await getDefaultConfig ( ) ,
288- batchPoster : await sequencer . getAddress ( ) ,
290+ batchPosters : [ await sequencer . getAddress ( ) ] ,
289291 validators : [
290292 await val1 . getAddress ( ) ,
291293 await val2 . getAddress ( ) ,
@@ -296,6 +298,7 @@ const setup = async () => {
296298 nativeToken : ethers . constants . AddressZero ,
297299 deployFactoriesToL2 : true ,
298300 maxFeePerGasForRetryables : maxFeePerGas ,
301+ batchPosterManager : await batchPosterManager . getAddress ( ) ,
299302 }
300303
301304 const response = await rollupCreator . createRollup ( deployParams , {
@@ -322,6 +325,10 @@ const setup = async () => {
322325 ) ) as SequencerInbox__factory
323326 ) . attach ( rollupCreatedEvent . sequencerInbox )
324327
328+ await sequencerInbox
329+ . connect ( await impersonateAccount ( rollupCreatedEvent . upgradeExecutor ) )
330+ . setBatchPosterManager ( await batchPosterManager . getAddress ( ) )
331+
325332 challengeManager = (
326333 ( await ethers . getContractFactory (
327334 'ChallengeManager'
@@ -346,6 +353,7 @@ const setup = async () => {
346353 delayedBridge : rollupCreatedEvent . bridge ,
347354 delayedInbox : rollupCreatedEvent . inboxAddress ,
348355 bridge,
356+ batchPosterManager,
349357 upgradeExecutorAddress : rollupCreatedEvent . upgradeExecutor ,
350358 adminproxy : rollupCreatedEvent . adminProxy ,
351359 }
@@ -524,6 +532,7 @@ describe('ArbRollup', () => {
524532 bridge : bridgeContract ,
525533 admin : adminI ,
526534 validators : validatorsI ,
535+ batchPosterManager : batchPosterManagerI ,
527536 upgradeExecutorAddress,
528537 adminproxy : adminproxyAddress ,
529538 } = await setup ( )
@@ -535,6 +544,7 @@ describe('ArbRollup', () => {
535544 upgradeExecutor = upgradeExecutorAddress
536545 adminproxy = adminproxyAddress
537546 rollup = new RollupContract ( rollupUser . connect ( validators [ 0 ] ) )
547+ batchPosterManager = batchPosterManagerI
538548 } )
539549
540550 it ( 'should only initialize once' , async function ( ) {
@@ -1125,6 +1135,7 @@ describe('ArbRollup', () => {
11251135 rollupUser : rollupUserContract ,
11261136 admin : adminI ,
11271137 validators : validatorsI ,
1138+ batchPosterManager : batchPosterManagerI ,
11281139 upgradeExecutorAddress,
11291140 } = await setup ( )
11301141 rollupAdmin = rollupAdminContract
@@ -1133,6 +1144,7 @@ describe('ArbRollup', () => {
11331144 validators = validatorsI
11341145 upgradeExecutor = upgradeExecutorAddress
11351146 rollup = new RollupContract ( rollupUser . connect ( validators [ 0 ] ) )
1147+ batchPosterManager = batchPosterManagerI
11361148 } )
11371149
11381150 it ( 'should stake on initial node again' , async function ( ) {
@@ -1383,6 +1395,81 @@ describe('ArbRollup', () => {
13831395 ) . to . eq ( 'view' )
13841396 } )
13851397
1398+ it ( 'can set is sequencer' , async function ( ) {
1399+ const testAddress = await accounts [ 9 ] . getAddress ( )
1400+ expect ( await sequencerInbox . isSequencer ( testAddress ) ) . to . be . false
1401+ await expect (
1402+ sequencerInbox . setIsSequencer ( testAddress , true )
1403+ ) . to . revertedWith (
1404+ `NotBatchPosterManager("${ await sequencerInbox . signer . getAddress ( ) } ")`
1405+ )
1406+ expect ( await sequencerInbox . isSequencer ( testAddress ) ) . to . be . false
1407+
1408+ await (
1409+ await sequencerInbox
1410+ . connect ( batchPosterManager )
1411+ . setIsSequencer ( testAddress , true )
1412+ ) . wait ( )
1413+
1414+ expect ( await sequencerInbox . isSequencer ( testAddress ) ) . to . be . true
1415+
1416+ await (
1417+ await sequencerInbox
1418+ . connect ( batchPosterManager )
1419+ . setIsSequencer ( testAddress , false )
1420+ ) . wait ( )
1421+
1422+ expect ( await sequencerInbox . isSequencer ( testAddress ) ) . to . be . false
1423+ } )
1424+
1425+ it ( 'can set a batch poster' , async function ( ) {
1426+ const testAddress = await accounts [ 9 ] . getAddress ( )
1427+ expect ( await sequencerInbox . isBatchPoster ( testAddress ) ) . to . be . false
1428+ await expect (
1429+ sequencerInbox . setIsBatchPoster ( testAddress , true )
1430+ ) . to . revertedWith (
1431+ `NotBatchPosterManager("${ await sequencerInbox . signer . getAddress ( ) } ")`
1432+ )
1433+ expect ( await sequencerInbox . isBatchPoster ( testAddress ) ) . to . be . false
1434+
1435+ await (
1436+ await sequencerInbox
1437+ . connect ( batchPosterManager )
1438+ . setIsBatchPoster ( testAddress , true )
1439+ ) . wait ( )
1440+
1441+ expect ( await sequencerInbox . isBatchPoster ( testAddress ) ) . to . be . true
1442+
1443+ await (
1444+ await sequencerInbox
1445+ . connect ( batchPosterManager )
1446+ . setIsBatchPoster ( testAddress , false )
1447+ ) . wait ( )
1448+
1449+ expect ( await sequencerInbox . isBatchPoster ( testAddress ) ) . to . be . false
1450+ } )
1451+
1452+ it ( 'can set batch poster manager' , async function ( ) {
1453+ const testManager = await accounts [ 8 ] . getAddress ( )
1454+ expect ( await sequencerInbox . batchPosterManager ( ) ) . to . eq (
1455+ await batchPosterManager . getAddress ( )
1456+ )
1457+ await expect (
1458+ sequencerInbox . connect ( accounts [ 8 ] ) . setBatchPosterManager ( testManager )
1459+ ) . to . revertedWith ( `NotOwner("${ testManager } ", "${ upgradeExecutor } ")` )
1460+ expect ( await sequencerInbox . batchPosterManager ( ) ) . to . eq (
1461+ await batchPosterManager . getAddress ( )
1462+ )
1463+
1464+ await (
1465+ await sequencerInbox
1466+ . connect ( await impersonateAccount ( upgradeExecutor ) )
1467+ . setBatchPosterManager ( testManager )
1468+ ) . wait ( )
1469+
1470+ expect ( await sequencerInbox . batchPosterManager ( ) ) . to . eq ( testManager )
1471+ } )
1472+
13861473 it ( 'should fail the chainid fork check' , async function ( ) {
13871474 await expect ( sequencerInbox . removeDelayAfterFork ( ) ) . to . revertedWith (
13881475 'NotForked()'
0 commit comments