Skip to content

Commit

Permalink
improve(SpokePool): deposit with message gas optimization (#603)
Browse files Browse the repository at this point in the history
In most cases, we can avoid having to do the `extcodesize` call that’s inside `isContract()`.

This could save [~2600](https://github.com/wolflo/evm-opcodes/blob/main/gas.md#a5-balance-extcodesize-extcodehash) gas per call for non ETH bridges to EOAs
  • Loading branch information
nicholaspai committed Sep 12, 2024
1 parent e99b969 commit 6c9d5b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ abstract contract SpokePool is
}

bytes memory updatedMessage = relayExecution.updatedMessage;
if (recipientToSend.isContract() && updatedMessage.length > 0) {
if (updatedMessage.length > 0 && recipientToSend.isContract()) {
AcrossMessageHandler(recipientToSend).handleV3AcrossMessage(
outputToken,
amountToSend,
Expand Down

0 comments on commit 6c9d5b6

Please sign in to comment.