diff --git a/packages/rollup-core/src/app/data/consumers/queued-geth-submitter.ts b/packages/rollup-core/src/app/data/consumers/queued-geth-submitter.ts index 5cdc1ddfd3ed1..b2fc57987fbab 100644 --- a/packages/rollup-core/src/app/data/consumers/queued-geth-submitter.ts +++ b/packages/rollup-core/src/app/data/consumers/queued-geth-submitter.ts @@ -7,7 +7,7 @@ import { /* Internal Imports */ import { L1DataService } from '../../../types/data' -import { BlockBatches, L2NodeService } from '../../../types' +import { GethSubmission, L2NodeService } from '../../../types' const log = getLogger('l2-batch-submitter') @@ -28,27 +28,25 @@ export class QueuedGethSubmitter extends ScheduledTask { * @inheritDoc */ public async runTask(): Promise { - let blockBatches: BlockBatches + let gethSubmission: GethSubmission try { - blockBatches = await this.l1DataService.getNextQueuedGethSubmission() + gethSubmission = await this.l1DataService.getNextQueuedGethSubmission() } catch (e) { - logError(log, `Error fetching next batch for L2 submission!`, e) + logError(log, `Error fetching next Geth Submission!`, e) return } - if (!blockBatches) { - log.debug(`No batches ready for submission to L2.`) + if (!gethSubmission) { + log.debug(`No Geth Submissions ready to be sent.`) return } try { - await this.l2NodeService.sendBlockBatches(blockBatches) + await this.l2NodeService.sendGethSubmission(gethSubmission) } catch (e) { logError( log, - `Error sending batch to BlockBatchSubmitter! Block Batches: ${JSON.stringify( - blockBatches - )}`, + `Error sending Geth Submission: ${JSON.stringify(gethSubmission)}`, e ) return @@ -56,12 +54,12 @@ export class QueuedGethSubmitter extends ScheduledTask { try { await this.l1DataService.markQueuedGethSubmissionSubmittedToGeth( - blockBatches.batchNumber + gethSubmission.submissionNumber ) } catch (e) { logError( log, - `Error marking L1 Batch as Submitted to L2. L1 Batch Number: ${blockBatches.batchNumber}`, + `Error marking Geth Submission submitted to Geth. L1 Batch Number: ${gethSubmission.submissionNumber}`, e ) return diff --git a/packages/rollup-core/src/app/data/data-service.ts b/packages/rollup-core/src/app/data/data-service.ts index 6cf6de21fc131..2c17198a3a538 100644 --- a/packages/rollup-core/src/app/data/data-service.ts +++ b/packages/rollup-core/src/app/data/data-service.ts @@ -6,7 +6,7 @@ import { Block, TransactionResponse } from 'ethers/providers' /* Internal Imports */ import { - BlockBatches, + GethSubmission, DataService, GethSubmissionQueueStatus, TransactionBatchSubmission, @@ -230,7 +230,7 @@ export class DefaultDataService implements DataService { /** * @inheritDoc */ - public async getNextQueuedGethSubmission(): Promise { + public async getNextQueuedGethSubmission(): Promise { const res: Row[] = await this.rdb.select(` SELECT geth_submission_queue_index, target, calldata, block_timestamp, block_number, l1_tx_hash, l1_tx_index, l1_tx_log_index, queue_origin, sender, l1_message_sender, gas_limit, nonce, signature FROM next_queued_geth_submission @@ -245,41 +245,40 @@ export class DefaultDataService implements DataService { const blockNumber = res[0]['block_number'] return { - batchNumber: gethSubmissionNumber, + submissionNumber: gethSubmissionNumber, timestamp, blockNumber, - batches: [ - res.map((row: Row, indexWithinSubmission: number) => { - const tx: RollupTransaction = { - indexWithinSubmission, - l1TxHash: row['l1_tx_hash'], - l1TxIndex: row['l1_tx_index'], - l1TxLogIndex: row['l1_tx_log_index'], - target: row['target'], - calldata: row['calldata'], // TODO: may have to format Buffer => string - l1Timestamp: row['block_timestamp'], - l1BlockNumber: row['block_number'], - queueOrigin: row['queue_origin'], - } - - if (!!row['sender']) { - tx.sender = row['sender'] - } - if (!!row['l1MessageSender']) { - tx.l1MessageSender = row['l1_message_sender'] - } - if (!!row['gas_limit']) { - tx.gasLimit = row['gas_limit'] - } - if (!!row['nonce']) { - tx.nonce = row['nonce'] - } - if (!!row['signature']) { - tx.nonce = row['signature'] - } - return tx - }), - ], + rollupTransactions: res.map((row: Row, indexWithinSubmission: number) => { + const tx: RollupTransaction = { + l1RollupTxId: parseInt(row['id'], 10), + indexWithinSubmission, + l1TxHash: row['l1_tx_hash'], + l1TxIndex: row['l1_tx_index'], + l1TxLogIndex: row['l1_tx_log_index'], + target: row['target'], + calldata: row['calldata'], // TODO: may have to format Buffer => string + l1Timestamp: row['block_timestamp'], + l1BlockNumber: row['block_number'], + queueOrigin: row['queue_origin'], + } + + if (!!row['sender']) { + tx.sender = row['sender'] + } + if (!!row['l1MessageSender']) { + tx.l1MessageSender = row['l1_message_sender'] + } + if (!!row['gas_limit']) { + tx.gasLimit = row['gas_limit'] + } + if (!!row['nonce']) { + tx.nonce = parseInt(row['nonce'], 10) + } + if (!!row['signature']) { + tx.nonce = row['signature'] + } + return tx + }), } } @@ -599,7 +598,7 @@ export class DefaultDataService implements DataService { transactionHash: row['tx_hash'], to: row['target'], from: row['sender'], - nonce: row['nonce'], + nonce: parseInt(row['nonce'], 10), calldata: row['calldata'], stateRoot: row['state_root'], gasPrice: row['gas_price'], diff --git a/packages/rollup-core/src/app/data/producers/l2-chain-data-persister.ts b/packages/rollup-core/src/app/data/producers/l2-chain-data-persister.ts index 19c5968d8f856..6ebd951a9a364 100644 --- a/packages/rollup-core/src/app/data/producers/l2-chain-data-persister.ts +++ b/packages/rollup-core/src/app/data/producers/l2-chain-data-persister.ts @@ -131,6 +131,9 @@ export class L2ChainDataPersister extends ChainDataProcessor { if (!!response['l1MessageSender']) { res.l1MessageSender = response['l1MessageSender'] } + if (!!response['l1RollupTxId']) { + res.l1RollupTransactionId = response['l1RollupTxId'] + } if (!!response.r && !!response.s && response.v !== undefined) { res.signature = `${response.r}${remove0x( response.s diff --git a/packages/rollup-core/src/app/l2-node-service.ts b/packages/rollup-core/src/app/l2-node-service.ts index 2e54e0b1d7e8a..50f391dc24e00 100644 --- a/packages/rollup-core/src/app/l2-node-service.ts +++ b/packages/rollup-core/src/app/l2-node-service.ts @@ -1,18 +1,24 @@ /* External Imports */ -import { getLogger, Logger, numberToHexString } from '@eth-optimism/core-utils' +import { + getLogger, + Logger, + numberToHexString, + strToHexStr, +} from '@eth-optimism/core-utils' import { JsonRpcProvider } from 'ethers/providers' import { Wallet } from 'ethers' /* Internal Imports */ -import { BlockBatches, L2NodeService } from '../types' +import { GethSubmission, L2NodeService } from '../types' const log: Logger = getLogger('block-batch-submitter') export class DefaultL2NodeService implements L2NodeService { - // params: [blockBatchesJSONString, signedBlockBatchesJSONString] + // params: [gethSubmissionJSONString, signedGethSubmissionJSONString] // -- note all numbers are replaces with hex strings when serialized - public static readonly sendBlockBatchesMethod: string = 'eth_sendBlockBatches' + public static readonly sendGethSubmission: string = + 'eth_sendRollupTransactions' private readonly l2Provider: JsonRpcProvider @@ -23,29 +29,37 @@ export class DefaultL2NodeService implements L2NodeService { /** * @inheritDoc */ - public async sendBlockBatches(blockBatches: BlockBatches): Promise { - if (!blockBatches) { - const msg = `Received undefined Block Batch!.` + public async sendGethSubmission( + gethSubmission: GethSubmission + ): Promise { + if (!gethSubmission) { + const msg = `Received undefined Geth Submission!.` log.error(msg) throw msg } - if (!blockBatches.batches || !blockBatches.batches.length) { - log.error(`Received empty block batch: ${JSON.stringify(blockBatches)}`) + if ( + !gethSubmission.rollupTransactions || + !gethSubmission.rollupTransactions.length + ) { + log.error( + `Received empty Geth Submission: ${JSON.stringify(gethSubmission)}` + ) return } - const payload = JSON.stringify(blockBatches, (k, v) => { + const payload = JSON.stringify(gethSubmission, (k, v) => { if (typeof v === 'number') { return v >= 0 ? numberToHexString(v) : undefined } return v }) - const signedPayload: string = await this.l2Wallet.signMessage(payload) - await this.l2Provider.send(DefaultL2NodeService.sendBlockBatchesMethod, [ - payload, - signedPayload, + const hexPayload: string = strToHexStr(payload) + const signedPayload: string = await this.l2Wallet.signMessage(hexPayload) + + await this.l2Provider.send(DefaultL2NodeService.sendGethSubmission, [ + [hexPayload, signedPayload], ]) } } diff --git a/packages/rollup-core/src/types/data/l1-data-service.ts b/packages/rollup-core/src/types/data/l1-data-service.ts index 2b2b79da4312e..eb14c093be8b2 100644 --- a/packages/rollup-core/src/types/data/l1-data-service.ts +++ b/packages/rollup-core/src/types/data/l1-data-service.ts @@ -2,7 +2,7 @@ import { Block, TransactionResponse } from 'ethers/providers' /* Internal Imports */ -import { BlockBatches, RollupTransaction } from '../types' +import { GethSubmission, RollupTransaction } from '../types' import { GethSubmissionRecord } from './types' export interface L1DataService { @@ -88,7 +88,7 @@ export interface L1DataService { * * @returns The fetched Queued Geth Submission or undefined if one is not present in the DB. */ - getNextQueuedGethSubmission(): Promise + getNextQueuedGethSubmission(): Promise /** * Marks the provided Queued Geth Submission as submitted to L2. diff --git a/packages/rollup-core/src/types/l2-node-service.ts b/packages/rollup-core/src/types/l2-node-service.ts index 36846ff48e704..6411c403d8867 100644 --- a/packages/rollup-core/src/types/l2-node-service.ts +++ b/packages/rollup-core/src/types/l2-node-service.ts @@ -1,4 +1,4 @@ -import { BlockBatches } from './types' +import { GethSubmission } from './types' export interface L2NodeService { /** @@ -6,5 +6,5 @@ export interface L2NodeService { * * @param blockBatches The block batches to send to L2 */ - sendBlockBatches(blockBatches: BlockBatches): Promise + sendGethSubmission(blockBatches: GethSubmission): Promise } diff --git a/packages/rollup-core/src/types/types.ts b/packages/rollup-core/src/types/types.ts index e03ef17cb73ea..dd4cb1b8ddb88 100644 --- a/packages/rollup-core/src/types/types.ts +++ b/packages/rollup-core/src/types/types.ts @@ -18,6 +18,7 @@ export interface L2ToL1Message { } export interface RollupTransaction { + l1RollupTxId?: number indexWithinSubmission: number target: Address calldata: string @@ -71,23 +72,11 @@ export interface LogHandlerContext { handleLog: LogHandler } -export type L1Batch = RollupTransaction[] -export interface BlockBatches { - batchNumber: number +export interface GethSubmission { + submissionNumber: number timestamp: number blockNumber: number - batches: L1Batch[] -} - -export type L1BatchParser = ( - l: Log, - transaction: TransactionResponse -) => Promise - -export interface BatchLogParserContext { - topic: string - contractAddress: Address - parseL1Batch: L1BatchParser + rollupTransactions: RollupTransaction[] } /* Types */ diff --git a/packages/rollup-core/test/app/l2-chain-data-persister.spec.ts b/packages/rollup-core/test/app/l2-chain-data-persister.spec.ts index da15d95b4115e..50320b7888dcc 100644 --- a/packages/rollup-core/test/app/l2-chain-data-persister.spec.ts +++ b/packages/rollup-core/test/app/l2-chain-data-persister.spec.ts @@ -81,6 +81,7 @@ const getTransactionResponse = ( value: undefined, chainId: CHAIN_ID, l1MessageSender: ZERO_ADDRESS, + l1RollupTxId: 1, wait: (confirmations) => { return undefined }, diff --git a/packages/rollup-core/test/app/l2-node-service.spec.ts b/packages/rollup-core/test/app/l2-node-service.spec.ts index 73d99ce3482fb..801819ac3a414 100644 --- a/packages/rollup-core/test/app/l2-node-service.spec.ts +++ b/packages/rollup-core/test/app/l2-node-service.spec.ts @@ -3,6 +3,7 @@ import '../setup' /* External Imports */ import { hexStrToNumber, + hexStrToString, keccak256FromUtf8, TestUtils, } from '@eth-optimism/core-utils' @@ -11,7 +12,7 @@ import { Wallet } from 'ethers' import { JsonRpcProvider } from 'ethers/providers' /* Internal Imports */ -import { BlockBatches, QueueOrigin, RollupTransaction } from '../../src/types' +import { GethSubmission, QueueOrigin, RollupTransaction } from '../../src/types' import { DefaultL2NodeService } from '../../src/app' import { verifyMessage } from 'ethers/utils' @@ -83,8 +84,8 @@ const rollupTx2: RollupTransaction = { queueOrigin: QueueOrigin.SAFETY_QUEUE, } -const deserializeBlockBatches = (serialized: string): BlockBatches => { - return JSON.parse(serialized, (k, v) => { +const deserializeRollupTransactions = (serialized: string): GethSubmission => { + return JSON.parse(hexStrToString(serialized), (k, v) => { switch (k) { case 'blockNumber': case 'timestamp': @@ -118,16 +119,16 @@ describe('L2 Node Service', () => { it('should handle undefined batch properly', async () => { await TestUtils.assertThrowsAsync(async () => { - await l2NodeService.sendBlockBatches(undefined) + await l2NodeService.sendGethSubmission(undefined) }) }) it('should handle batch with undefined transactions properly', async () => { - await l2NodeService.sendBlockBatches({ - batchNumber, + await l2NodeService.sendGethSubmission({ + submissionNumber: batchNumber, timestamp, blockNumber, - batches: undefined, + rollupTransactions: undefined, }) mockedSendProvider.sent.length.should.equal( @@ -137,11 +138,11 @@ describe('L2 Node Service', () => { }) it('should handle batch with empty transactions properly', async () => { - await l2NodeService.sendBlockBatches({ - batchNumber, + await l2NodeService.sendGethSubmission({ + submissionNumber: batchNumber, timestamp, blockNumber, - batches: [], + rollupTransactions: [], }) mockedSendProvider.sent.length.should.equal( @@ -151,16 +152,16 @@ describe('L2 Node Service', () => { }) it('should send single-tx batch properly', async () => { - await l2NodeService.sendBlockBatches({ - batchNumber, + await l2NodeService.sendGethSubmission({ + submissionNumber: batchNumber, timestamp, blockNumber, - batches: [[rollupTx]], + rollupTransactions: [rollupTx], }) mockedSendProvider.sent.length.should.equal(1, 'Should have sent tx!') mockedSendProvider.sent[0].method.should.equal( - DefaultL2NodeService.sendBlockBatchesMethod, + DefaultL2NodeService.sendGethSubmission, 'Sent to incorrect Web3 method!' ) Array.isArray(mockedSendProvider.sent[0].params).should.equal( @@ -168,15 +169,24 @@ describe('L2 Node Service', () => { 'Incorrect params type!' ) const paramsArray = mockedSendProvider.sent[0].params as string[] - paramsArray.length.should.equal(2, 'Incorrect params length') - const [payloadStr, signature] = paramsArray + paramsArray.length.should.equal(1, 'Incorrect params length') + paramsArray[0].length.should.equal(2, 'Incorrect params array length') + const [payloadStr, signature] = paramsArray[0] - const blockBatches: BlockBatches = deserializeBlockBatches(payloadStr) + const gethSubmission: GethSubmission = deserializeRollupTransactions( + payloadStr + ) - blockBatches.timestamp.should.equal(timestamp, 'Incorrect timestamp!') - blockBatches.batches.length.should.equal(1, 'Incorrect num batches!') - blockBatches.batches[0].length.should.equal(1, 'Incorrect num txs!') - blockBatches.batches[0][0].should.deep.equal( + gethSubmission.timestamp.should.equal(timestamp, 'Incorrect timestamp!') + gethSubmission.rollupTransactions.length.should.equal( + 1, + 'Incorrect num batches!' + ) + gethSubmission.rollupTransactions.length.should.equal( + 1, + 'Incorrect num txs!' + ) + gethSubmission.rollupTransactions[0].should.deep.equal( rollupTx, 'Incorrect transaction received!' ) @@ -188,16 +198,16 @@ describe('L2 Node Service', () => { }) it('should send multi-tx batch properly', async () => { - await l2NodeService.sendBlockBatches({ - batchNumber, + await l2NodeService.sendGethSubmission({ + submissionNumber: batchNumber, timestamp, blockNumber, - batches: [[rollupTx, rollupTx2]], + rollupTransactions: [rollupTx, rollupTx2], }) mockedSendProvider.sent.length.should.equal(1, 'Should have sent tx!') mockedSendProvider.sent[0].method.should.equal( - DefaultL2NodeService.sendBlockBatchesMethod, + DefaultL2NodeService.sendGethSubmission, 'Sent to incorrect Web3 method!' ) Array.isArray(mockedSendProvider.sent[0].params).should.equal( @@ -205,23 +215,25 @@ describe('L2 Node Service', () => { 'Incorrect params type!' ) const paramsArray = mockedSendProvider.sent[0].params as string[] - paramsArray.length.should.equal(2, 'Incorrect params length') - const [payloadStr, signature] = paramsArray + paramsArray.length.should.equal(1, 'Incorrect params length') + paramsArray[0].length.should.equal(2, 'Incorrect params array length') + const [payloadStr, signature] = paramsArray[0] - const blockBatches: BlockBatches = deserializeBlockBatches(payloadStr) + const gethSubmission: GethSubmission = deserializeRollupTransactions( + payloadStr + ) - blockBatches.timestamp.should.equal(timestamp, 'Incorrect timestamp!') - blockBatches.batches.length.should.equal(1, 'Incorrect num batches!') - blockBatches.batches[0].length.should.equal( + gethSubmission.timestamp.should.equal(timestamp, 'Incorrect timestamp!') + gethSubmission.rollupTransactions.length.should.equal( 2, 'Incorrect num transactions!' ) - blockBatches.batches[0][0].should.deep.equal( + gethSubmission.rollupTransactions[0].should.deep.equal( rollupTx, 'Incorrect transaction received!' ) - blockBatches.batches[0][1].should.deep.equal( + gethSubmission.rollupTransactions[1].should.deep.equal( rollupTx2, 'Incorrect transaction 2 received!' ) diff --git a/packages/rollup-core/test/app/queued-geth-submitter.spec.ts b/packages/rollup-core/test/app/queued-geth-submitter.spec.ts index 9c7f355f39d7f..9e47338d31b63 100644 --- a/packages/rollup-core/test/app/queued-geth-submitter.spec.ts +++ b/packages/rollup-core/test/app/queued-geth-submitter.spec.ts @@ -4,36 +4,36 @@ import { Wallet } from 'ethers' /* Internal Imports */ import { DefaultDataService, QueuedGethSubmitter } from '../../src/app/data' import { DefaultL2NodeService } from '../../src/app' -import { BlockBatches } from '../../src/types' +import { GethSubmission } from '../../src/types' import { keccak256FromUtf8 } from '@eth-optimism/core-utils/build' class MockL2NodeService extends DefaultL2NodeService { - public readonly sentBlockBatches: BlockBatches[] = [] + public readonly sentSubmissions: GethSubmission[] = [] constructor() { super(Wallet.createRandom()) } - public async sendBlockBatches(blockBatches: BlockBatches): Promise { - this.sentBlockBatches.push(blockBatches) + public async sendGethSubmission(blockBatches: GethSubmission): Promise { + this.sentSubmissions.push(blockBatches) } } class MockL1DataService extends DefaultDataService { - public readonly blockBatchesToReturn: BlockBatches[] = [] - public readonly batchesMarkedSubmitted: number[] = [] + public readonly submissionsToReturn: GethSubmission[] = [] + public readonly submissionsMarkedSubmitted: number[] = [] constructor() { super(undefined) } - public async getNextQueuedGethSubmission(): Promise { - return this.blockBatchesToReturn.shift() + public async getNextQueuedGethSubmission(): Promise { + return this.submissionsToReturn.shift() } public async markQueuedGethSubmissionSubmittedToGeth( batchNumber: number ): Promise { - this.batchesMarkedSubmitted.push(batchNumber) + this.submissionsMarkedSubmitted.push(batchNumber) } } @@ -51,60 +51,58 @@ describe('Optimistic Canonical Chain Batch Submitter', () => { it('should not submit batch if no fitting L1 batch exists', async () => { await batchSubmitter.runTask() - l1DatService.batchesMarkedSubmitted.length.should.equal( + l1DatService.submissionsMarkedSubmitted.length.should.equal( 0, `No Batches should have been marked as sent!` ) - l2NodeService.sentBlockBatches.length.should.equal( + l2NodeService.sentSubmissions.length.should.equal( 0, `No Batches should have been sent!` ) }) it('should send a batch if a fitting one exists', async () => { - const blockBatches: BlockBatches = { - batchNumber: 1, + const blockBatches: GethSubmission = { + submissionNumber: 1, timestamp: 1, blockNumber: 1, - batches: [ - [ - { - indexWithinSubmission: 1, - gasLimit: 0, - nonce: 0, - sender: Wallet.createRandom().address, - target: Wallet.createRandom().address, - calldata: keccak256FromUtf8('calldata'), - l1Timestamp: 1, - l1BlockNumber: 1, - l1TxHash: keccak256FromUtf8('tx hash'), - l1TxIndex: 0, - l1TxLogIndex: 0, - queueOrigin: 1, - }, - ], + rollupTransactions: [ + { + indexWithinSubmission: 1, + gasLimit: 0, + nonce: 0, + sender: Wallet.createRandom().address, + target: Wallet.createRandom().address, + calldata: keccak256FromUtf8('calldata'), + l1Timestamp: 1, + l1BlockNumber: 1, + l1TxHash: keccak256FromUtf8('tx hash'), + l1TxIndex: 0, + l1TxLogIndex: 0, + queueOrigin: 1, + }, ], } - l1DatService.blockBatchesToReturn.push(blockBatches) + l1DatService.submissionsToReturn.push(blockBatches) await batchSubmitter.runTask() - l2NodeService.sentBlockBatches.length.should.equal( + l2NodeService.sentSubmissions.length.should.equal( 1, `1 BlockBatches object should have been submitted!` ) - l2NodeService.sentBlockBatches[0].should.deep.equal( + l2NodeService.sentSubmissions[0].should.deep.equal( blockBatches, `Sent BlockBatches object doesn't match!` ) - l1DatService.batchesMarkedSubmitted.length.should.equal( + l1DatService.submissionsMarkedSubmitted.length.should.equal( 1, `1 batch should have been marked submitted!` ) - l1DatService.batchesMarkedSubmitted[0].should.equal( + l1DatService.submissionsMarkedSubmitted[0].should.equal( 1, `1 batch should have been marked submitted!` ) diff --git a/packages/rollup-core/test/integration/geth-submitter-integration.spec.ts b/packages/rollup-core/test/integration/geth-submitter-integration.spec.ts new file mode 100644 index 0000000000000..bf9e1d3b88443 --- /dev/null +++ b/packages/rollup-core/test/integration/geth-submitter-integration.spec.ts @@ -0,0 +1,50 @@ +/* External Imports */ +import { Wallet } from 'ethers' + +/* Internal Imports */ +import { DefaultDataService, QueuedGethSubmitter } from '../../src/app/data' +import { CHAIN_ID, DefaultL2NodeService } from '../../src/app' +import { GethSubmission, L2NodeService } from '../../src/types' +import { keccak256FromUtf8 } from '@eth-optimism/core-utils/build' +import { JsonRpcProvider } from 'ethers/providers' + +// TODO: Can be used to submit Rollup Transactions to geth. +describe.skip('Optimistic Canonical Chain Batch Submitter', () => { + let l2NodeService: L2NodeService + + beforeEach(async () => { + // Address for wallet: 0x6a399F0A626A505e2F6C2b5Da181d98D722dC86D + const wallet = new Wallet( + 'efb6aa1f37082ac40884a340684672ccbb5a4e6000860953afcf73c90c33e4f9', + new JsonRpcProvider('http://127.0.0.1:8545', CHAIN_ID) + ) + l2NodeService = new DefaultL2NodeService(wallet) + }) + + it('should send a batch to Geth', async () => { + const gethSubmission: GethSubmission = { + submissionNumber: 1, + timestamp: 1, + blockNumber: 1, + rollupTransactions: [ + { + l1RollupTxId: 2, + indexWithinSubmission: 1, + gasLimit: 0, + nonce: 0, + sender: Wallet.createRandom().address, + target: Wallet.createRandom().address, + calldata: keccak256FromUtf8('calldata'), + l1Timestamp: 1, + l1BlockNumber: 1, + l1TxHash: keccak256FromUtf8('tx hash'), + l1TxIndex: 0, + l1TxLogIndex: 0, + queueOrigin: 1, + }, + ], + } + + await l2NodeService.sendGethSubmission(gethSubmission) + }) +})