Skip to content

Commit

Permalink
contracts: changed gas padding naming to match rust code
Browse files Browse the repository at this point in the history
  • Loading branch information
CedarMist committed Oct 31, 2023
1 parent e781383 commit 5d11ac8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions contracts/contracts/Sapphire.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -237,16 +237,16 @@ 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");
}

/**
* @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));
Expand Down
2 changes: 1 addition & 1 deletion contracts/contracts/tests/Gas.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ contract GasTests {
tmp = x;
}

Sapphire.gaspad(padGasAmount);
Sapphire.padGas(padGasAmount);
}
}

0 comments on commit 5d11ac8

Please sign in to comment.