Skip to content

Commit

Permalink
auto: fix chain module
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixFan1992 committed Aug 16, 2024
1 parent e780e5c commit 0545615
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts/src/v0.8/automation/chains/ArbitrumModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/automation/chains/ChainModuleBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/automation/chains/OptimismModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/src/v0.8/automation/chains/OptimismModuleV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/automation/chains/ScrollModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down
2 changes: 1 addition & 1 deletion contracts/src/v0.8/automation/interfaces/IChainModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]];
Expand Down

0 comments on commit 0545615

Please sign in to comment.