Skip to content

Commit

Permalink
add some todos
Browse files Browse the repository at this point in the history
  • Loading branch information
infiloop2 committed Feb 15, 2024
1 parent ad83277 commit 2a8173c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ contract ArbitrumModule is ChainModuleBase {

function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) {
(, uint256 perL1CalldataUnit, , , , ) = ARB_GAS.getPricesInWei();
// TODO: Verify this is an accurate estimate
return perL1CalldataUnit * dataSize * 16;
}

Expand Down
2 changes: 2 additions & 0 deletions contracts/src/v0.8/automation/dev/chains/OptimismModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ contract OptimismModule is ChainModuleBase {
OVM_GasPriceOracle private constant OVM_GASPRICEORACLE = OVM_GasPriceOracle(OVM_GASPRICEORACLE_ADDR);

function getCurrentL1Fee() external view override returns (uint256) {
// TODO: Verify this is accruate calcualtion with appropriate padding
return OVM_GASPRICEORACLE.getL1Fee(bytes.concat(msg.data, OP_L1_DATA_FEE_PADDING));
}

function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) {
// fee is 4 per 0 byte, 16 per non-zero byte. Worst case we can have all non zero-bytes.
// Instead of setting bytes to non-zero, we initialize 'new bytes' of length 4*dataSize to cover for zero bytes.
bytes memory txCallData = new bytes(4 * dataSize);
// TODO: Verify this is an accurate estimate
return OVM_GASPRICEORACLE.getL1Fee(bytes.concat(txCallData, OP_L1_DATA_FEE_PADDING));
}

Expand Down
2 changes: 2 additions & 0 deletions contracts/src/v0.8/automation/dev/chains/ScrollModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ contract ScrollModule is ChainModuleBase {
IScrollL1GasPriceOracle private constant SCROLL_ORACLE = IScrollL1GasPriceOracle(SCROLL_ORACLE_ADDR);

function getCurrentL1Fee() external view override returns (uint256) {
// TODO: Verify this is accruate calcualtion with appropriate padding
return SCROLL_ORACLE.getL1Fee(bytes.concat(msg.data, SCROLL_L1_FEE_DATA_PADDING));
}

function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) {
// fee is 4 per 0 byte, 16 per non-zero byte. Worst case we can have all non zero-bytes.
// Instead of setting bytes to non-zero, we initialize 'new bytes' of length 4*dataSize to cover for zero bytes.
// this is the same as OP.
// TODO: Verify this is an accurate estimate
bytes memory txCallData = new bytes(4 * dataSize);
return SCROLL_ORACLE.getL1Fee(bytes.concat(txCallData, SCROLL_L1_FEE_DATA_PADDING));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 {
/**
* @notice sets the chain specific module
*/
// TODO: this can be cleaned up since it can be set in setConfig
function setChainSpecificModule(IChainModule newModule) external onlyOwner {
s_hotVars.chainModule = newModule;
emit ChainSpecificModuleUpdated(address(newModule));
Expand Down

0 comments on commit 2a8173c

Please sign in to comment.