Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/batch-submitter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"@types/chai": "^4.2.18",
"@types/lodash": "^4.14.168",
"@types/mocha": "^8.2.2",
"@types/node": "^15.12.2",
"@types/node": "22",
"@types/prettier": "^2.2.3",
"@types/rimraf": "^3.0.0",
"@types/sinon": "^9.0.10",
Expand Down
17 changes: 15 additions & 2 deletions packages/batch-submitter/src/batch-submitter/batch-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ export abstract class BatchSubmitter {
beforeSendTransaction: async (tx: ethers.TransactionRequest) => {
this.logger.info(`Submitting ${txName} transaction`, {
txType: tx.type,
gasPrice: tx.gasPrice ? toNumber(tx.gasPrice) : 0,
maxFeePerGas: tx.maxFeePerGas ? toNumber(tx.maxFeePerGas) : 0,
maxPriorityFeePerGas: tx.maxPriorityFeePerGas
? toNumber(tx.maxPriorityFeePerGas)
: 0,
maxFeePerBlobGas: tx.maxFeePerBlobGas
? toNumber(tx.maxFeePerBlobGas)
: 0,
gasLimit: tx.gasLimit ? toNumber(tx.gasLimit) : 0,
nonce: toNumber(tx.nonce),
contractAddr: tx.to,
Expand Down Expand Up @@ -275,7 +283,6 @@ export abstract class BatchSubmitter {
err: any
) => Promise<boolean>
): Promise<ethers.TransactionReceipt> {
this.lastBatchSubmissionTimestamp = Date.now()
this.logger.debug('Submitting transaction & waiting for receipt...')

let receipt: ethers.TransactionReceipt
Expand Down Expand Up @@ -308,7 +315,13 @@ export abstract class BatchSubmitter {
return
}

this.logger.info('Received transaction receipt', { receipt })
// Update last submission timestamp when it's successful
this.lastBatchSubmissionTimestamp = Date.now()
this.logger.info('Received transaction receipt', {
txHash: receipt.hash,
blockNumber: receipt.blockNumber,
status: receipt.status,
})
this.logger.info(successMessage)
this.metrics.batchesSubmitted.inc()
this.metrics.submissionGasUsed.observe(toNumber(receipt.gasUsed))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export class StateBatchSubmitter extends BatchSubmitter {
type: 2,
to: tx.to,
data: tx.data,
value: ethers.parseEther('0'),
value: 0n,
}
const mpcAddress = mpcInfo.mpc_address
txUnsign.nonce = await this.signer.provider.getTransactionCount(
Expand All @@ -339,39 +339,26 @@ export class StateBatchSubmitter extends BatchSubmitter {
data: tx.data,
})
txUnsign.chainId = (await this.signer.provider.getNetwork()).chainId
// mpc model can use ynatm
// tx.gasPrice = gasPrice
const replaced = await setTxEIP1559Fees(
txUnsign,
await this.pendingStorage.getPendingTx(mpcAddress),
this.l1Provider,
this.resubmissionTimeout
)

this.logger.info('submitting state with mpc address', {
mpcAddress,
this.logger.info('submitting state tx with mpc address', {
from: mpcAddress,
nonce: txUnsign.nonce,
to: tx.to,
replaced,
startBlock,
endBlock,
txUnsign,
})

const submitSignedTransaction = (): Promise<TransactionReceipt> => {
return this.transactionSubmitter.submitSignedTransaction(
txUnsign,
async () => {
const replaced = await setTxEIP1559Fees(
txUnsign,
await this.pendingStorage.getPendingTx(mpcAddress),
this.l1Provider,
this.resubmissionTimeout
)
this.logger.info('fee updated', {
maxFeePerGas: txUnsign.maxFeePerGas.toString(),
maxPriorityFeePerGas: txUnsign.maxPriorityFeePerGas.toString(),
replaced,
})

const signedTx = await mpcClient.signTx(
txUnsign,
mpcInfo.mpc_id,
this.mpcSignTimeout
)
return signedTx
},
() => mpcClient.signTx(txUnsign, mpcInfo.mpc_id, this.mpcSignTimeout),
this._makeHooks('appendSequencerBatch')
)
}
Expand Down Expand Up @@ -502,7 +489,7 @@ export class StateBatchSubmitter extends BatchSubmitter {
}

this.logger.info('Generated state commitment batch', {
stateRoots, // list of stateRoots
stateRootsCount: stateRoots.length,
})
return {
stateRoots,
Expand Down
Loading