Skip to content

Commit 2dfacb6

Browse files
committed
fix: remove unnecessary L2 gas check (OZ N-01 from #700)
1 parent 16dc44e commit 2dfacb6

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

contracts/gateway/L1GraphTokenGateway.sol

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,7 @@ contract L1GraphTokenGateway is GraphTokenGateway, L1ArbitrumMessenger {
217217
extraData.length == 0 || callhookWhitelist[msg.sender] == true,
218218
"CALL_HOOK_DATA_NOT_ALLOWED"
219219
);
220-
require(maxSubmissionCost > 0, "NO_SUBMISSION_COST");
221-
222-
{
223-
// makes sure only sufficient ETH is supplied as required for successful redemption on L2
224-
// if a user does not desire immediate redemption they should provide
225-
// a msg.value of AT LEAST maxSubmissionCost
226-
uint256 expectedEth = maxSubmissionCost.add(_maxGas.mul(_gasPriceBid));
227-
require(msg.value >= expectedEth, "WRONG_ETH_VALUE");
228-
}
220+
require(maxSubmissionCost != 0, "NO_SUBMISSION_COST");
229221
outboundCalldata = getOutboundCalldata(_l1Token, from, _to, _amount, extraData);
230222
}
231223
{

test/gateway/l1GraphTokenGateway.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ describe('L1GraphTokenGateway', () => {
5252
['uint256', 'bytes'],
5353
[maxSubmissionCost, emptyCallHookData],
5454
)
55+
const defaultDataNoSubmissionCost = utils.defaultAbiCoder.encode(
56+
['uint256', 'bytes'],
57+
[toBN(0), emptyCallHookData],
58+
)
5559
const notEmptyCallHookData = '0x12'
5660
const defaultDataWithNotEmptyCallHookData = utils.defaultAbiCoder.encode(
5761
['uint256', 'bytes'],
@@ -471,7 +475,7 @@ describe('L1GraphTokenGateway', () => {
471475
)
472476
await testValidOutboundTransfer(mockRouter.signer, routerEncodedData, emptyCallHookData)
473477
})
474-
it('reverts when called with the wrong value', async function () {
478+
it('reverts when called with no submission cost', async function () {
475479
await grt.connect(tokenSender.signer).approve(l1GraphTokenGateway.address, toGRT('10'))
476480
const tx = l1GraphTokenGateway
477481
.connect(tokenSender.signer)
@@ -481,12 +485,12 @@ describe('L1GraphTokenGateway', () => {
481485
toGRT('10'),
482486
maxGas,
483487
gasPriceBid,
484-
defaultData,
488+
defaultDataNoSubmissionCost,
485489
{
486-
value: defaultEthValue.sub(1),
490+
value: defaultEthValue,
487491
},
488492
)
489-
await expect(tx).revertedWith('WRONG_ETH_VALUE')
493+
await expect(tx).revertedWith('NO_SUBMISSION_COST')
490494
})
491495
it('reverts when called with nonempty calldata, if the sender is not whitelisted', async function () {
492496
await grt.connect(tokenSender.signer).approve(l1GraphTokenGateway.address, toGRT('10'))

0 commit comments

Comments
 (0)