@@ -81,7 +81,7 @@ describe('L1Publisher integration', () => {
81
81
let rollupAddress : Address ;
82
82
let outboxAddress : Address ;
83
83
84
- let rollup : GetContractReturnType < typeof RollupAbi , ViemPublicClient > ;
84
+ let rollup : RollupContract ;
85
85
let outbox : GetContractReturnType < typeof OutboxAbi , ViemPublicClient > ;
86
86
87
87
let publisher : SequencerPublisher ;
@@ -111,8 +111,8 @@ describe('L1Publisher integration', () => {
111
111
112
112
const progressTimeBySlot = async ( slotsToJump = 1n ) => {
113
113
const currentTime = ( await publicClient . getBlock ( ) ) . timestamp ;
114
- const currentSlot = await rollup . read . getCurrentSlot ( ) ;
115
- const timestamp = await rollup . read . getTimestampForSlot ( [ currentSlot + slotsToJump ] ) ;
114
+ const currentSlot = await rollup . getSlotNumber ( ) ;
115
+ const timestamp = await rollup . getTimestampForSlot ( currentSlot + slotsToJump ) ;
116
116
if ( timestamp > currentTime ) {
117
117
await ethCheatCodes . warp ( Number ( timestamp ) ) ;
118
118
}
@@ -133,11 +133,7 @@ describe('L1Publisher integration', () => {
133
133
outboxAddress = getAddress ( l1ContractAddresses . outboxAddress . toString ( ) ) ;
134
134
135
135
// Set up contract instances
136
- rollup = getContract ( {
137
- address : rollupAddress ,
138
- abi : RollupAbi ,
139
- client : publicClient ,
140
- } ) ;
136
+ rollup = new RollupContract ( publicClient , l1ContractAddresses . rollupAddress ) ;
141
137
outbox = getContract ( {
142
138
address : outboxAddress ,
143
139
abi : OutboxAbi ,
@@ -242,10 +238,10 @@ describe('L1Publisher integration', () => {
242
238
await fork . close ( ) ;
243
239
244
240
const ts = ( await publicClient . getBlock ( ) ) . timestamp ;
245
- baseFee = new GasFees ( 0 , await rollup . read . getManaBaseFeeAt ( [ ts , true ] ) ) ;
241
+ baseFee = new GasFees ( 0 , await rollup . getManaBaseFeeAt ( ts , true ) ) ;
246
242
247
243
// We jump to the next epoch such that the committee can be setup.
248
- const timeToJump = await rollup . read . getEpochDuration ( ) ;
244
+ const timeToJump = await rollup . getEpochDuration ( ) ;
249
245
await progressTimeBySlot ( timeToJump ) ;
250
246
} ) ;
251
247
@@ -394,7 +390,7 @@ describe('L1Publisher integration', () => {
394
390
} ;
395
391
396
392
const buildAndPublishBlock = async ( numTxs : number , jsonFileNamePrefix : string ) => {
397
- const archiveInRollup_ = await rollup . read . archive ( ) ;
393
+ const archiveInRollup_ = await rollup . archive ( ) ;
398
394
expect ( hexStringToBuffer ( archiveInRollup_ . toString ( ) ) ) . toEqual ( new Fr ( GENESIS_ARCHIVE_ROOT ) . toBuffer ( ) ) ;
399
395
400
396
const blockNumber = await publicClient . getBlockNumber ( ) ;
@@ -421,8 +417,8 @@ describe('L1Publisher integration', () => {
421
417
) ;
422
418
423
419
const ts = ( await publicClient . getBlock ( ) ) . timestamp ;
424
- const slot = await rollup . read . getSlotAt ( [ ts + BigInt ( config . ethereumSlotDuration ) ] ) ;
425
- const timestamp = await rollup . read . getTimestampForSlot ( [ slot ] ) ;
420
+ const slot = await rollup . getSlotAt ( ts + BigInt ( config . ethereumSlotDuration ) ) ;
421
+ const timestamp = await rollup . getTimestampForSlot ( slot ) ;
426
422
427
423
const globalVariables = new GlobalVariables (
428
424
new Fr ( chainId ) ,
@@ -432,7 +428,7 @@ describe('L1Publisher integration', () => {
432
428
new Fr ( timestamp ) ,
433
429
coinbase ,
434
430
feeRecipient ,
435
- new GasFees ( Fr . ZERO , new Fr ( await rollup . read . getManaBaseFeeAt ( [ timestamp , true ] ) ) ) ,
431
+ new GasFees ( Fr . ZERO , new Fr ( await rollup . getManaBaseFeeAt ( timestamp , true ) ) ) ,
436
432
) ;
437
433
438
434
const block = await buildBlock ( globalVariables , txs , currentL1ToL2Messages ) ;
@@ -482,7 +478,7 @@ describe('L1Publisher integration', () => {
482
478
hash : logs [ i ] . transactionHash ! ,
483
479
} ) ;
484
480
485
- const blobPublicInputsHash = await rollup . read . getBlobPublicInputsHash ( [ BigInt ( i + 1 ) ] ) ;
481
+ const blobPublicInputsHash = await rollup . getBlobPublicInputsHash ( BigInt ( i + 1 ) ) ;
486
482
const expectedHash = sha256 ( Buffer . from ( BlockBlobPublicInputs . fromBlobs ( blobs ) . toString ( ) . substring ( 2 ) , 'hex' ) ) ;
487
483
expect ( blobPublicInputsHash ) . toEqual ( `0x${ expectedHash . toString ( 'hex' ) } ` ) ;
488
484
@@ -549,7 +545,7 @@ describe('L1Publisher integration', () => {
549
545
550
546
it ( `shows propose custom errors if tx reverts` , async ( ) => {
551
547
// REFACTOR: code below is duplicated from "builds blocks of 2 empty txs building on each other"
552
- const archiveInRollup_ = await rollup . read . archive ( ) ;
548
+ const archiveInRollup_ = await rollup . archive ( ) ;
553
549
expect ( hexStringToBuffer ( archiveInRollup_ . toString ( ) ) ) . toEqual ( new Fr ( GENESIS_ARCHIVE_ROOT ) . toBuffer ( ) ) ;
554
550
555
551
// Set up different l1-to-l2 messages than the ones on the inbox, so this submission reverts
@@ -559,8 +555,8 @@ describe('L1Publisher integration', () => {
559
555
560
556
const txs = await Promise . all ( [ makeProcessedTx ( 0x1000 ) , makeProcessedTx ( 0x2000 ) ] ) ;
561
557
const ts = ( await publicClient . getBlock ( ) ) . timestamp ;
562
- const slot = await rollup . read . getSlotAt ( [ ts + BigInt ( config . ethereumSlotDuration ) ] ) ;
563
- const timestamp = await rollup . read . getTimestampForSlot ( [ slot ] ) ;
558
+ const slot = await rollup . getSlotAt ( ts + BigInt ( config . ethereumSlotDuration ) ) ;
559
+ const timestamp = await rollup . getTimestampForSlot ( slot ) ;
564
560
const globalVariables = new GlobalVariables (
565
561
new Fr ( chainId ) ,
566
562
new Fr ( config . version ) ,
@@ -569,7 +565,7 @@ describe('L1Publisher integration', () => {
569
565
new Fr ( timestamp ) ,
570
566
coinbase ,
571
567
feeRecipient ,
572
- new GasFees ( Fr . ZERO , new Fr ( await rollup . read . getManaBaseFeeAt ( [ timestamp , true ] ) ) ) ,
568
+ new GasFees ( Fr . ZERO , new Fr ( await rollup . getManaBaseFeeAt ( timestamp , true ) ) ) ,
573
569
) ;
574
570
const block = await buildBlock ( globalVariables , txs , l1ToL2Messages ) ;
575
571
prevHeader = block . header ;
0 commit comments