Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registry 2 1 utils contract #9727

Merged
merged 4 commits into from
Jul 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ $SCRIPTPATH/native_solc8_16_compile dev/automation/2_1/KeeperRegistryLogicA2_1.s
$SCRIPTPATH/native_solc8_16_compile dev/automation/2_1/KeeperRegistryLogicB2_1.sol
$SCRIPTPATH/native_solc8_16_compile dev/automation/2_1/interfaces/IKeeperRegistryMaster.sol
$SCRIPTPATH/native_solc8_16_compile dev/automation/2_1/interfaces/ILogAutomation.sol
$SCRIPTPATH/native_solc8_16_compile dev/automation/2_1/AutomationUtils2_1.sol
$SCRIPTPATH/native_solc8_6_compile dev/automation/tests/LogUpkeepCounter.sol
$SCRIPTPATH/native_solc8_6_compile automation/UpkeepTranscoder.sol
$SCRIPTPATH/native_solc8_6_compile tests/VerifiableLoadUpkeep.sol
Expand Down
27 changes: 27 additions & 0 deletions contracts/src/v0.8/dev/automation/2_1/AutomationUtils2_1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.16;

import "./KeeperRegistryBase2_1.sol";
import "./interfaces/ILogAutomation.sol";

/**
* @notice this file exposes structs that are otherwise internal to the automation registry
* doing this allows those structs to be encoded and decoded with type safety in offchain code
* and tests because generated wrappers are made available
*/

contract AutomationUtils2_1 {
function _onChainConfig(KeeperRegistryBase2_1.OnchainConfig memory) external {}

function _report(KeeperRegistryBase2_1.Report memory) external {}

function _logTriggerConfig(KeeperRegistryBase2_1.LogTriggerConfig memory) external {}

function _conditionalTriggerConfig(KeeperRegistryBase2_1.ConditionalTriggerConfig memory) external {}

function _logTrigger(KeeperRegistryBase2_1.LogTrigger memory) external {}

function _conditionalTrigger(KeeperRegistryBase2_1.ConditionalTrigger memory) external {}

function _log(Log memory) external {}
}
28 changes: 7 additions & 21 deletions contracts/src/v0.8/dev/automation/2_1/KeeperRegistry2_1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -384,31 +384,17 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, ER
/**
* @dev _decodeReport decodes a serialized report into a Report struct
*/
function _decodeReport(bytes memory rawReport) internal pure returns (Report memory) {
(
uint256 fastGasWei,
uint256 linkNative,
uint256[] memory upkeepIds,
uint256[] memory gasLimits,
bytes[] memory triggers,
bytes[] memory performDatas
) = abi.decode(rawReport, (uint256, uint256, uint256[], uint256[], bytes[], bytes[]));
function _decodeReport(bytes calldata rawReport) internal pure returns (Report memory) {
Report memory report = abi.decode(rawReport, (Report));
uint256 expectedLength = report.upkeepIds.length;
if (
upkeepIds.length != gasLimits.length ||
upkeepIds.length != triggers.length ||
upkeepIds.length != performDatas.length
report.gasLimits.length != expectedLength ||
report.triggers.length != expectedLength ||
report.performDatas.length != expectedLength
) {
revert InvalidReport();
}
return
Report({
fastGasWei: fastGasWei,
linkNative: linkNative,
upkeepIds: upkeepIds,
gasLimits: gasLimits,
triggers: triggers,
performDatas: performDatas
});
return report;
}

/**
Expand Down
Loading
Loading