Skip to content

Commit 139b283

Browse files
committed
last @krofax comments
1 parent 3e29d4c commit 139b283

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

pages/interop/estimate-costs.mdx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ There are several factors that determine the cost of an [interop transaction](/i
3636
You can either use [`CrossL2Inbox`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/CrossL2Inbox.sol) directly, or use the cross domain messenger, [`L2ToL2CrossDomainMessenger`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol), which uses `CrossL2Inbox` internally.
3737
* The transaction type.
3838
Every interop message has two transactions, an [initiating message](/interop/message-passing#initiating-message) in a transaction to the source chain, and an [executing message](/interop/message-passing#executing-message) in the destination chain.
39-
* Whether autorelay is turned on.
40-
When enabled for a specific chain, the `L2ToL2CrossDomainMessenger` still executes a message, but the chain operator covers the execution costs.
4139

4240
## CrossL2Inbox
4341

@@ -73,7 +71,7 @@ Where:
7371
* `n` = number of data bytes in the log entry
7472

7573
Every transaction posted costs at least *21,000* gas.
76-
In comparison, the hashing operation costs approximately [*30+0.2×\<number of bytes>*](https://www.evm.codes/?fork=cancun#20), which is negligible by comparison.
74+
The hashing operation costs approximately [*30+0.2×\<number of bytes>*](https://www.evm.codes/?fork=cancun#20), which is negligible by comparison.
7775
We can usually ignore the [memory expansion cost](https://www.evm.codes/about#memoryexpansion), unless the validating contract uses a really large amount of memory.
7876

7977
The cost of using the message is beyond the scope here, because it depends on your application.
@@ -94,8 +92,8 @@ This would typically be written to previously empty storage, so the cost is *22,
9492
Then it [increments the nonce value](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/L2ToL2CrossDomainMessenger.sol#L158).
9593
Overwriting previously used storage (which means storage where the present value is *not* zero) only costs *5,000* gas.
9694

97-
So, the initiating message costs a little over *27,100* gas, plus the negligible cost of emitting the log message, a few if statements, etc.
98-
Of course, it is created as part of a transaction, so we might want to include the *21,000* transaction cost too.
95+
Hence, the gas cost for creating an initiating message is approximately *27,100* gas, plus minor overhead for log emission and contract operations.
96+
Note that this estimate excludes the 21,000 gas base transaction cost, which applies to all transactions.
9997

10098
### Executing message
10199

0 commit comments

Comments
 (0)