From 45adc0223b27538979fb0cc6c083cc0f178b7977 Mon Sep 17 00:00:00 2001 From: gzeon Date: Wed, 9 Oct 2024 02:06:36 +0900 Subject: [PATCH] docs: improve comments --- src/bridge/SequencerInbox.sol | 10 +++++----- src/libraries/CallerChecker.sol | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index c61d1077..265c2198 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -436,7 +436,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox if (hostChainIsArbitrum) revert DataBlobsNotSupported(); // submit a batch spending report to refund the entity that produced the blob batch data - // same as using calldata, we only submit spending report if the caller is the origin of the tx + // same as using calldata, we only submit spending report if the caller is the origin and is codeless // such that one cannot "double-claim" batch posting refund in the same tx if (CallerChecker.isCallerCodelessOrigin() && !isUsingFeeToken) { submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, blobGas); @@ -449,7 +449,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox uint256 afterDelayedMessagesRead, uint256 prevMessageCount, uint256 newMessageCount, - bool isFromOrigin + bool isFromCodelessOrigin ) internal { (bytes32 dataHash, IBridge.TimeBounds memory timeBounds) = formCallDataHash(data, afterDelayedMessagesRead); @@ -457,7 +457,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox addSequencerL2BatchImpl( dataHash, afterDelayedMessagesRead, - isFromOrigin ? data.length : 0, + isFromCodelessOrigin ? data.length : 0, prevMessageCount, newMessageCount ); @@ -474,12 +474,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox delayedAcc, totalDelayedMessagesRead, timeBounds, - isFromOrigin + isFromCodelessOrigin ? IBridge.BatchDataLocation.TxInput : IBridge.BatchDataLocation.SeparateBatchEvent ); - if (!isFromOrigin) { + if (!isFromCodelessOrigin) { emit SequencerBatchData(seqMessageIndex, data); } } diff --git a/src/libraries/CallerChecker.sol b/src/libraries/CallerChecker.sol index d1a5fd21..1bc93431 100644 --- a/src/libraries/CallerChecker.sol +++ b/src/libraries/CallerChecker.sol @@ -6,9 +6,9 @@ pragma solidity ^0.8.0; library CallerChecker { /** - * @notice A EIP-7702 safe check to ensure the caller is a codeless origin - * @return bool true if the caller is a codeless origin, false otherwise - * @dev If the caller is a codeless origin, then the calldata is guaranteed to be available in the transaction + * @notice A EIP-7702 safe check to ensure the caller is the origin and is codeless + * @return bool true if the caller is the origin and is codeless, false otherwise + * @dev If the caller is the origin and is codeless, then msg.data is guaranteed to be same as tx.data * It also mean the caller would not be able to call a contract multiple times with the same transaction */ function isCallerCodelessOrigin() internal view returns (bool) {