Skip to content

Commit

Permalink
rollup: disable queue batch append flag (#383)
Browse files Browse the repository at this point in the history
* rollup: disable queue batch append flag

* batch-submit: bugfix
  • Loading branch information
tynes authored Dec 19, 2020
1 parent 58b0e97 commit 68133ab
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 7 deletions.
42 changes: 37 additions & 5 deletions packages/batch-submitter/src/batch-submitter/tx-batch-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {
getContractInterface,
getContractFactory,
} from '@eth-optimism/contracts'
import { OptimismProvider } from '@eth-optimism/provider'
import { Logger } from '@eth-optimism/core-utils'

/* Internal Imports */
import {
Expand Down Expand Up @@ -38,6 +40,33 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
protected l2ChainId: number
protected syncing: boolean
protected lastL1BlockNumber: number
private disableQueueBatchAppend: boolean

constructor(
signer: Signer,
l2Provider: OptimismProvider,
minTxSize: number,
maxTxSize: number,
maxBatchSize: number,
numConfirmations: number,
finalityConfirmations: number,
pullFromAddressManager: boolean,
log: Logger,
disableQueueBatchAppend: boolean
) {
super(
signer,
l2Provider,
minTxSize,
maxTxSize,
maxBatchSize,
numConfirmations,
finalityConfirmations,
pullFromAddressManager,
log
)
this.disableQueueBatchAppend = disableQueueBatchAppend
}

/*****************************
* Batch Submitter Overrides *
Expand Down Expand Up @@ -84,11 +113,14 @@ export class TransactionBatchSubmitter extends BatchSubmitter {
this.log.info(
`Syncing mode enabled! Skipping batch submission and clearing ${pendingQueueElements} queue elements`
)
// Empty the queue with a huge `appendQueueBatch(..)` call
return this._submitAndLogTx(
this.chainContract.appendQueueBatch(99999999),
'Cleared queue!'
)

if (!this.disableQueueBatchAppend) {
// Empty the queue with a huge `appendQueueBatch(..)` call
return this._submitAndLogTx(
this.chainContract.appendQueueBatch(99999999),
'Cleared queue!'
)
}
}
this.log.info('Syncing mode enabled but queue is empty. Skipping...')
return
Expand Down
4 changes: 3 additions & 1 deletion packages/batch-submitter/src/exec/run-batch-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const requiredEnvVars: RequiredEnvVars = {
}
/* Optional Env Vars
* FRAUD_SUBMISSION_ADDRESS
* DISABLE_QUEUE_BATCH_APPEND
*/

export const run = async () => {
Expand Down Expand Up @@ -83,7 +84,8 @@ export const run = async () => {
parseInt(requiredEnvVars.NUM_CONFIRMATIONS, 10),
parseInt(requiredEnvVars.NUM_CONFIRMATIONS, 10),
true,
getLogger(TX_BATCH_SUBMITTER_LOG_TAG)
getLogger(TX_BATCH_SUBMITTER_LOG_TAG),
!!process.env.DISABLE_QUEUE_BATCH_APPEND
)

const stateBatchSubmitter = new StateBatchSubmitter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ describe('TransactionBatchSubmitter', () => {
1,
1,
false,
getLogger(TX_BATCH_SUBMITTER_LOG_TAG)
getLogger(TX_BATCH_SUBMITTER_LOG_TAG),
false
)
})

Expand Down

0 comments on commit 68133ab

Please sign in to comment.