From 05456152841b3350f528a5dfa0240bbcb83b9f30 Mon Sep 17 00:00:00 2001 From: FelixFan1992 Date: Fri, 16 Aug 2024 18:21:12 -0400 Subject: [PATCH] auto: fix chain module --- contracts/src/v0.8/automation/chains/ArbitrumModule.sol | 2 +- contracts/src/v0.8/automation/chains/ChainModuleBase.sol | 2 +- contracts/src/v0.8/automation/chains/OptimismModule.sol | 2 +- contracts/src/v0.8/automation/chains/OptimismModuleV2.sol | 4 ++-- contracts/src/v0.8/automation/chains/ScrollModule.sol | 2 +- contracts/src/v0.8/automation/interfaces/IChainModule.sol | 2 +- contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol | 2 +- contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/contracts/src/v0.8/automation/chains/ArbitrumModule.sol b/contracts/src/v0.8/automation/chains/ArbitrumModule.sol index e27a0809b7e..2ad6fdddc8c 100644 --- a/contracts/src/v0.8/automation/chains/ArbitrumModule.sol +++ b/contracts/src/v0.8/automation/chains/ArbitrumModule.sol @@ -31,7 +31,7 @@ contract ArbitrumModule is ChainModuleBase { return ARB_SYS.arbBlockNumber(); } - function getCurrentL1Fee() external view override returns (uint256) { + function getCurrentL1Fee(uint256) external view override returns (uint256) { return ARB_GAS.getCurrentTxL1GasFees(); } diff --git a/contracts/src/v0.8/automation/chains/ChainModuleBase.sol b/contracts/src/v0.8/automation/chains/ChainModuleBase.sol index e9b082063bb..52829d43e5d 100644 --- a/contracts/src/v0.8/automation/chains/ChainModuleBase.sol +++ b/contracts/src/v0.8/automation/chains/ChainModuleBase.sol @@ -18,7 +18,7 @@ contract ChainModuleBase is IChainModule { return blockhash(n); } - function getCurrentL1Fee() external view virtual returns (uint256) { + function getCurrentL1Fee(uint256) external view virtual returns (uint256) { return 0; } diff --git a/contracts/src/v0.8/automation/chains/OptimismModule.sol b/contracts/src/v0.8/automation/chains/OptimismModule.sol index 91c1c0ed968..255369cc8e6 100644 --- a/contracts/src/v0.8/automation/chains/OptimismModule.sol +++ b/contracts/src/v0.8/automation/chains/OptimismModule.sol @@ -16,7 +16,7 @@ contract OptimismModule is ChainModuleBase { uint256 private constant FIXED_GAS_OVERHEAD = 60_000; uint256 private constant PER_CALLDATA_BYTE_GAS_OVERHEAD = 270; - function getCurrentL1Fee() external view override returns (uint256) { + function getCurrentL1Fee(uint256) external view override returns (uint256) { return OVM_GASPRICEORACLE.getL1Fee(bytes.concat(msg.data, OP_L1_DATA_FEE_PADDING)); } diff --git a/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol b/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol index a4f6d20a99a..f95df3280c8 100644 --- a/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol +++ b/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol @@ -30,8 +30,8 @@ contract OptimismModuleV2 is ChainModuleBase, ConfirmedOwner { constructor() ConfirmedOwner(msg.sender) {} - function getCurrentL1Fee() external view override returns (uint256) { - return (s_l1FeeCoefficient * _getL1Fee(msg.data.length)) / 100; + function getCurrentL1Fee(uint256 dataSize) external view override returns (uint256) { + return (s_l1FeeCoefficient * _getL1Fee(dataSize)) / 100; } function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) { diff --git a/contracts/src/v0.8/automation/chains/ScrollModule.sol b/contracts/src/v0.8/automation/chains/ScrollModule.sol index 1e41ed3805f..9c1c94de727 100644 --- a/contracts/src/v0.8/automation/chains/ScrollModule.sol +++ b/contracts/src/v0.8/automation/chains/ScrollModule.sol @@ -18,7 +18,7 @@ contract ScrollModule is ChainModuleBase { uint256 private constant FIXED_GAS_OVERHEAD = 45_000; uint256 private constant PER_CALLDATA_BYTE_GAS_OVERHEAD = 170; - function getCurrentL1Fee() external view override returns (uint256) { + function getCurrentL1Fee(uint256) external view override returns (uint256) { return SCROLL_ORACLE.getL1Fee(bytes.concat(msg.data, SCROLL_L1_FEE_DATA_PADDING)); } diff --git a/contracts/src/v0.8/automation/interfaces/IChainModule.sol b/contracts/src/v0.8/automation/interfaces/IChainModule.sol index e3a4b32c9b1..47d5b25111e 100644 --- a/contracts/src/v0.8/automation/interfaces/IChainModule.sol +++ b/contracts/src/v0.8/automation/interfaces/IChainModule.sol @@ -11,7 +11,7 @@ interface IChainModule { // retrieve the L1 data fee for a L2 transaction. it should return 0 for L1 chains and // L2 chains which don't have L1 fee component. it uses msg.data to estimate L1 data so // it must be used with a transaction. Return value in wei. - function getCurrentL1Fee() external view returns (uint256); + function getCurrentL1Fee(uint256 dataSize) external view returns (uint256); // retrieve the L1 data fee for a L2 simulation. it should return 0 for L1 chains and // L2 chains which don't have L1 fee component. Return value in wei. diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol index f0c703679ca..464e8746398 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol @@ -115,7 +115,7 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain }); uint256 blocknumber = hotVars.chainModule.blockNumber(); - uint256 l1Fee = hotVars.chainModule.getCurrentL1Fee(); + uint256 l1Fee = hotVars.chainModule.getCurrentL1Fee(msg.data.length); for (uint256 i = 0; i < report.upkeepIds.length; i++) { upkeepTransmitInfo[i].upkeep = s_upkeep[report.upkeepIds[i]]; diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol index 6113cbf9fd1..031d7b5dfb8 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol @@ -136,7 +136,7 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain }); uint256 blocknumber = hotVars.chainModule.blockNumber(); - uint256 l1Fee = hotVars.chainModule.getCurrentL1Fee(); + uint256 l1Fee = hotVars.chainModule.getCurrentL1Fee(msg.data.length); for (uint256 i = 0; i < report.upkeepIds.length; i++) { upkeepTransmitInfo[i].upkeep = s_upkeep[report.upkeepIds[i]];