From a0310bf6ac8e0608961090db98b5dd866495b64c Mon Sep 17 00:00:00 2001 From: Kodey Kilday-Thomas Date: Wed, 18 Dec 2024 12:02:44 +0000 Subject: [PATCH] fix: remove l1 fee logic --- .../functions/v1_3_0_zksync/FunctionsBilling.sol | 9 +++------ .../interfaces/zksync/ISystemContext.sol | 9 --------- .../libraries/ZKSyncChainSpecificUtil.sol | 16 ---------------- 3 files changed, 3 insertions(+), 31 deletions(-) delete mode 100644 contracts/src/v0.8/functions/v1_3_0_zksync/interfaces/zksync/ISystemContext.sol delete mode 100644 contracts/src/v0.8/functions/v1_3_0_zksync/libraries/ZKSyncChainSpecificUtil.sol diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol index c44a606940b..83067d2deb8 100644 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol @@ -3,8 +3,7 @@ pragma solidity ^0.8.19; import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; -import {IFunctionsBilling, FunctionsBillingConfig} from "./interfaces/IFunctionsBilling.sol"; -import {ZKSyncChainSpecificUtil} from "./libraries/ZKSyncChainSpecificUtil.sol"; +import {IFunctionsBilling, FunctionsBillingConfig} from "../v1_0_0/interfaces/IFunctionsBilling.sol"; import {Routable} from "../v1_0_0/Routable.sol"; import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; @@ -201,8 +200,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @NOTE: Basis Points are 1/100th of 1%, divide by 10_000 to bring back to original units uint256 executionGas = s_config.gasOverheadBeforeCallback + s_config.gasOverheadAfterCallback + callbackGasLimit; - uint256 l1FeeWei = ZKSyncChainSpecificUtil._getCurrentTxL1GasFees(); - uint96 estimatedGasReimbursementJuels = _getJuelsFromWei((gasPriceWithOverestimation * executionGas) + l1FeeWei); + uint96 estimatedGasReimbursementJuels = _getJuelsFromWei(gasPriceWithOverestimation * executionGas); uint96 feesJuels = uint96(donFeeJuels) + uint96(adminFeeJuels) + uint96(operationFeeJuels); @@ -295,10 +293,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { FunctionsResponse.Commitment memory commitment = abi.decode(onchainMetadata, (FunctionsResponse.Commitment)); uint256 gasOverheadWei = (commitment.gasOverheadBeforeCallback + commitment.gasOverheadAfterCallback) * tx.gasprice; - uint256 l1FeeShareWei = ZKSyncChainSpecificUtil._getCurrentTxL1GasFees() / reportBatchSize; // Gas overhead without callback - uint96 gasOverheadJuels = _getJuelsFromWei(gasOverheadWei + l1FeeShareWei); + uint96 gasOverheadJuels = _getJuelsFromWei(gasOverheadWei); uint96 juelsPerGas = _getJuelsFromWei(tx.gasprice); // The Functions Router will perform the callback to the client contract diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/interfaces/zksync/ISystemContext.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/interfaces/zksync/ISystemContext.sol deleted file mode 100644 index 6d9232f8f6a..00000000000 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/interfaces/zksync/ISystemContext.sol +++ /dev/null @@ -1,9 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -address constant SYSTEM_CONTEXT = address(0x000000000000000000000000000000000000800B); - -interface ISystemContext { - function gasPrice() external view returns (uint256); - function gasPerPubdataByte() external view returns (uint256 gasPerPubdataByte); -} diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/libraries/ZKSyncChainSpecificUtil.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/libraries/ZKSyncChainSpecificUtil.sol deleted file mode 100644 index e3e21c6fc99..00000000000 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/libraries/ZKSyncChainSpecificUtil.sol +++ /dev/null @@ -1,16 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {SYSTEM_CONTEXT, ISystemContext} from "../interfaces/zksync/ISystemContext.sol"; - -/// @dev A library that abstracts out opcodes that behave differently across chains. -/// @dev The methods below return values that are pertinent to the given chain. -/// @dev The exisiting library used within other functions contracts contains opcodes not supported by ZKSync -library ZKSyncChainSpecificUtil { - function _getCurrentTxL1GasFees() internal view returns (uint256 l1FeeWei) { - ISystemContext systemContext = ISystemContext(SYSTEM_CONTEXT); - - // blob_gas_price_on_l1 * gas_per_byte ~= gas_price_on_l2 * l2_gas_PerPubdataByte - return systemContext.gasPrice() * systemContext.gasPerPubdataByte(); - } -}