Skip to content

Commit

Permalink
Merge branch 'develop' into feature/MERC-114/block-range-guarantee
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav authored Jun 7, 2023
2 parents e1edcaa + 17c7061 commit a548fae
Show file tree
Hide file tree
Showing 7 changed files with 339 additions and 292 deletions.
20 changes: 14 additions & 6 deletions contracts/src/v0.8/dev/automation/2_1/KeeperRegistry2_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, ER

// Actually perform the target upkeep
(upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = _performUpkeep(
upkeepTransmitInfo[i].upkeep,
upkeepTransmitInfo[i].upkeep.forwarder,
report.gasLimits[i],
report.performDatas[i]
);

Expand Down Expand Up @@ -216,7 +217,7 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, ER
if (s_hotVars.paused) revert RegistryPaused();

Upkeep memory upkeep = s_upkeep[id];
return _performUpkeep(upkeep, performData);
return _performUpkeep(upkeep.forwarder, upkeep.executeGas, performData);
}

/**
Expand Down Expand Up @@ -400,17 +401,23 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, ER
uint256 fastGasWei,
uint256 linkNative,
uint256[] memory upkeepIds,
uint256[] memory gasLimits,
bytes[] memory triggers,
bytes[] memory performDatas
) = abi.decode(rawReport, (uint256, uint256, uint256[], bytes[], bytes[]));
if (upkeepIds.length != triggers.length || upkeepIds.length != performDatas.length) {
) = abi.decode(rawReport, (uint256, uint256, uint256[], uint256[], bytes[], bytes[]));
if (
upkeepIds.length != gasLimits.length ||
upkeepIds.length != triggers.length ||
upkeepIds.length != performDatas.length
) {
revert InvalidReport();
}
return
Report({
fastGasWei: fastGasWei,
linkNative: linkNative,
upkeepIds: upkeepIds,
gasLimits: gasLimits,
triggers: triggers,
performDatas: performDatas
});
Expand Down Expand Up @@ -528,12 +535,13 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, ER
* transmitter and the exact gas required by the Upkeep
*/
function _performUpkeep(
Upkeep memory upkeep,
AutomationForwarder forwarder,
uint256 executeGas,
bytes memory performData
) private nonReentrant returns (bool success, uint256 gasUsed) {
gasUsed = gasleft();
bytes memory callData = abi.encodeWithSelector(PERFORM_SELECTOR, performData);
success = upkeep.forwarder.forward(upkeep.executeGas, callData);
success = forwarder.forward(executeGas, callData);
gasUsed = gasUsed - gasleft();
return (success, gasUsed);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention {
bytes internal constant L1_FEE_DATA_PADDING =
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";

uint256 internal constant REGISTRY_GAS_OVERHEAD = 75_000; // Used only in maxPayment estimation, not in actual payment
uint256 internal constant REGISTRY_GAS_OVERHEAD = 80_000; // Used only in maxPayment estimation, not in actual payment
uint256 internal constant REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD = 20; // Used only in maxPayment estimation, not in actual payment. Value scales with performData length.
uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 7_500; // Used only in maxPayment estimation, not in actual payment. Value scales with f.

Expand Down Expand Up @@ -279,11 +279,11 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention {
}

// Report transmitted by OCR to transmit function
// TODO - do we use this struct anywhere?
struct Report {
uint256 fastGasWei;
uint256 linkNative;
uint256[] upkeepIds;
uint256[] gasLimits;
bytes[] triggers;
bytes[] performDatas;
}
Expand Down
Loading

0 comments on commit a548fae

Please sign in to comment.