From 5d11ac87d69121bad48078ce24e3eec44f3a4968 Mon Sep 17 00:00:00 2001 From: CedarMist <134699267+CedarMist@users.noreply.github.com> Date: Mon, 30 Oct 2023 18:30:50 +0000 Subject: [PATCH] contracts: changed gas padding naming to match rust code --- contracts/contracts/Sapphire.sol | 8 ++++---- contracts/contracts/tests/Gas.sol | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/contracts/Sapphire.sol b/contracts/contracts/Sapphire.sol index 5a64b636..1099cc4c 100644 --- a/contracts/contracts/Sapphire.sol +++ b/contracts/contracts/Sapphire.sol @@ -25,7 +25,7 @@ library Sapphire { 0x0100000000000000000000000000000000000008; address internal constant GAS_USED = 0x0100000000000000000000000000000000000009; - address internal constant GAS_PAD = + address internal constant PAD_GAS = 0x010000000000000000000000000000000000000a; // Oasis-specific, general precompiles @@ -237,8 +237,8 @@ library Sapphire { * * Will cause a reversion if the current usage is more than the amount */ - function gaspad(uint128 toAmount) internal view { - (bool success, ) = GAS_PAD.staticcall(abi.encode(toAmount)); + function padGas(uint128 toAmount) internal view { + (bool success, ) = PAD_GAS.staticcall(abi.encode(toAmount)); require(success, "verify: failed"); } @@ -246,7 +246,7 @@ library Sapphire { * @dev Returns the amount of gas currently used by the transaction * @custom:see @oasisprotocol/oasis-sdk :: precompile/gas.rs :: call_gas_used */ - function gasused() internal view returns (uint64) { + function gasUsed() internal view returns (uint64) { (bool success, bytes memory v) = GAS_USED.staticcall(""); require(success, "gasused: failed"); return abi.decode(v, (uint64)); diff --git a/contracts/contracts/tests/Gas.sol b/contracts/contracts/tests/Gas.sol index dc81c6bb..cdcedf62 100644 --- a/contracts/contracts/tests/Gas.sol +++ b/contracts/contracts/tests/Gas.sol @@ -18,6 +18,6 @@ contract GasTests { tmp = x; } - Sapphire.gaspad(padGasAmount); + Sapphire.padGas(padGasAmount); } }