Skip to content

Commit ee5d3cb

Browse files
committed
fix(c4-117-g11): using > 0 costs more gas than != 0 when used on a uint in a require()
Signed-off-by: Tomás Migone <[email protected]>
1 parent 18afb3a commit ee5d3cb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

contracts/gateway/L1GraphTokenGateway.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ contract L1GraphTokenGateway is Initializable, GraphTokenGateway, L1ArbitrumMess
203203
) external payable override notPaused returns (bytes memory) {
204204
IGraphToken token = graphToken();
205205
require(_l1Token == address(token), "TOKEN_NOT_GRT");
206-
require(_amount > 0, "INVALID_ZERO_AMOUNT");
206+
require(_amount != 0, "INVALID_ZERO_AMOUNT");
207207
require(_to != address(0), "INVALID_DESTINATION");
208208

209209
// nested scopes to avoid stack too deep errors

contracts/l2/gateway/L2GraphTokenGateway.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ contract L2GraphTokenGateway is GraphTokenGateway, L2ArbitrumMessenger, Reentran
143143
bytes calldata _data
144144
) public payable override notPaused nonReentrant returns (bytes memory) {
145145
require(_l1Token == l1GRT, "TOKEN_NOT_GRT");
146-
require(_amount > 0, "INVALID_ZERO_AMOUNT");
146+
require(_amount != 0, "INVALID_ZERO_AMOUNT");
147147
require(msg.value == 0, "INVALID_NONZERO_VALUE");
148148
require(_to != address(0), "INVALID_DESTINATION");
149149

0 commit comments

Comments
 (0)