diff --git a/contracts/core/Dispatcher.sol b/contracts/core/Dispatcher.sol index b1393dc2..618aa044 100644 --- a/contracts/core/Dispatcher.sol +++ b/contracts/core/Dispatcher.sol @@ -562,7 +562,7 @@ contract Dispatcher is OwnableUpgradeable, UUPSUpgradeable, IDispatcher { // call // and x/64 for the remaining execution after the low-level call. If this low-level call runs out of gas, then // gasLeft will be equal to x/64 at the start of the remaining execution. so we should check gasBefore < 1/64 - if (!success && gasleft() < gasBeforeCall / 64) { + if (!success && gasleft() <= gasBeforeCall / 64) { // Only check for out of gas if the call failed; if it was a successful call then it was gauranteed to not // run out of gas revert IBCErrors.notEnoughGas(); diff --git a/test/Dispatcher.gasGriefing.sol b/test/Dispatcher.gasGriefing.t.sol similarity index 97% rename from test/Dispatcher.gasGriefing.sol rename to test/Dispatcher.gasGriefing.t.sol index 5fda2737..83f31ac5 100644 --- a/test/Dispatcher.gasGriefing.sol +++ b/test/Dispatcher.gasGriefing.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; -import {Base} from "./Dispatcher.Base.t.sol"; +import {Base} from "./Dispatcher.base.t.sol"; import {GasUsingMars} from "./mocks/GasUsingMars.sol"; import {IbcEndpoint, ChannelEnd, IbcUtils, IbcPacket, IBCErrors} from "../contracts/libs/Ibc.sol"; import {TestUtilsTest} from "./TestUtils.t.sol"; diff --git a/test/mocks/GasUsingMars.sol b/test/mocks/GasUsingMars.sol index 70f31452..a84aa7ca 100644 --- a/test/mocks/GasUsingMars.sol +++ b/test/mocks/GasUsingMars.sol @@ -39,7 +39,7 @@ contract GasUsingMars is Mars { return AckPacket(true, abi.encodePacked('{ "account": "account", "reply": "got the message" }')); } - function _useGas() internal { + function _useGas() internal view { // This function is used to test the gas usage of the contract uint256 startingGas = gasleft(); uint256 dummyInt = 0;