Optimistic Rollups: Sequencer & Batch Submitter - lukso-network/network-optimism-integration-test GitHub Wiki
OVM Transaction Queue
Source: https://docs.optimism.io/
This is where the sequencer is allowed to post transactions which they recieved off chain to be applied to the rollup chain. Transactions can only be moved from the OVM Transaction Queue to the Canonical Transaction Chain if the transactions in the L1->L2 transaction queue are not older than some number of L1 blocks.
Sequencer (Geth L2 node)
It looks like the Sequencer
is a Geth L2 node
while ROLLUP_VERIFIER_ENABLE
is not set.
Log from sequencer Ingesting transactions from L1
Handle the enqueue'd transactions. This codepath is only useful for the sequencer, as the verifier should only handle transactions from sequencer batch append and queue batch append. The transactions need to be played in order and there is no guarantee of order when it comes to the txcache iteration, so collect an array of pointers and then sort them by index.
INFO [11-16|07:41:49.097] Ingesting transactions from L1 count=0
INFO [11-16|07:41:49.098] Sequencer Ingest Queue Status syncing=false tip-height=42
DEBUG[11-16|07:41:59.661] Served rollup_getInfo conn=172.21.0.5:48970 reqid=75 t=89.136µs
DEBUG[11-16|07:41:59.698] Served eth_blockNumber conn=172.21.0.5:48976 reqid=76 t=37.69µs
DEBUG[11-16|07:41:59.699] Served eth_chainId conn=172.21.0.5:48978 reqid=77 t=25.656µs
DEBUG[11-16|07:42:01.466] Current full block not old enough number=0 hash=f07849…7c07aa delay=90000
Batch Submitter (node.js service)
Repo: https://github.com/ethereum-optimism/optimism-monorepo
File path: optimism-monorepo/packages/batch-submitter/exec/run-batch-submitter.js
Contains an executable batch submitter service which watches L1 and a local L2 node and submits batches to the CanonicalTransactionChain
& StateCommitmentChain
based on its local information.
const requiredEnvVars = {
SEQUENCER_PRIVATE_KEY: 'SEQUENCER_PRIVATE_KEY',
L1_NODE_WEB3_URL: 'L1_NODE_WEB3_URL',
L2_NODE_WEB3_URL: 'L2_NODE_WEB3_URL',
MIN_TX_SIZE: 'MIN_TX_SIZE',
MAX_TX_SIZE: 'MAX_TX_SIZE',
MAX_BATCH_SIZE: 'MAX_BATCH_SIZE',
POLL_INTERVAL: 'POLL_INTERVAL',
NUM_CONFIRMATIONS: 'NUM_CONFIRMATIONS',
FINALITY_CONFIRMATIONS: 'FINALITY_CONFIRMATIONS',
RUN_TX_BATCH_SUBMITTER: 'RUN_TX_BATCH_SUBMITTER',
RUN_STATE_BATCH_SUBMITTER: 'RUN_STATE_BATCH_SUBMITTER',
};
After ROLLUP_VERIFIER_ENABLE=true
:
batch_submitter_1 | 2020-11-30T13:21:05.853Z error:oe:batch-submitter:tx-chain Verifier mode enabled! Batch submitter only compatible with sequencer mode
optimism-integration_batch_submitter_1 exited with code 1
Geth L2 console output:
batch_submitter_1 | 2020-11-30T13:50:43.187Z info:oe:batch-submitter:tx-chain No txs to submit. Skipping batch submission...
geth_l2_1 | DEBUG[11-30|13:50:51.878] Current full block not old enough number=0 hash=cfd33d…8e5e6d delay=90000
geth_l2_1 | DEBUG[11-30|13:50:52.774] get common ancestor index=6846271 count=2
geth_l2_1 | DEBUG[11-30|13:50:52.774] Processing block height=6846272 hash=0xc803cb335076c33a7a12a1c03bde81ac41dc39b844fcbef21956b6accd420235
geth_l2_1 | INFO [11-30|13:50:52.783] Ingesting transactions from L1 count=0
geth_l2_1 | DEBUG[11-30|13:50:52.783] Processing block height=6846273 hash=0x0c3c1e64611183c3511ed8cf3123efd8c4efa89e5fdaaca9e47c6d5cd3e11ee3
geth_l2_1 | INFO [11-30|13:50:52.792] Ingesting transactions from L1 count=0
geth_l2_1 | DEBUG[11-30|13:50:58.205] Served rollup_getInfo conn=34.107.106.8:48194 reqid=102 t=125.018µs
geth_l2_1 | DEBUG[11-30|13:50:58.319] Served eth_blockNumber conn=34.107.106.8:48208 reqid=103 t=52.541µs
geth_l2_1 | DEBUG[11-30|13:50:58.320] Served eth_chainId conn=34.107.106.8:48210 reqid=104 t=22.823µs
batch_submitter_1 | 2020-11-30T13:50:58.322Z info:oe:batch-submitter:tx-chain No txs to submit. Skipping batch submission...
No txs to submit. Skipping batch submission...
output comes from this code fragment:
async _getBatchStartAndEnd() {
const startBlock = parseInt(await this.chainContract.getTotalElements(), 16) + 1;
const endBlock = Math.min(startBlock + this.maxBatchSize, await this.l2Provider.getBlockNumber()) + 1;
if (startBlock >= endBlock) {
if (startBlock > endBlock) {
this.log
.error(`More chain elements in L1 (${startBlock}) than in the L2 node (${endBlock}).
This shouldn't happen because we don't submit batches if the sequencer is syncing.`);
}
this.log.info(`No txs to submit. Skipping batch submission...`);
return;
}
return {
start: startBlock,
end: endBlock,
};
}