From ae8e0857dadbd1fa69a32ac93d1f1fcf8189d27a Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 12:45:32 -0400 Subject: [PATCH 01/10] move audited automation contracts to their long term home --- .../2_0}/UpkeepTranscoder3_0.sol | 0 .../automation/2_1/AutomationForwarder.sol | 0 .../2_1/AutomationForwarderLogic.sol | 0 .../automation/2_1/AutomationRegistrar2_1.sol | 0 .../automation/2_1/AutomationUtils2_1.sol | 0 .../{dev => }/automation/2_1/Chainable.sol | 0 .../automation/2_1/KeeperRegistry2_1.sol | 0 .../automation/2_1/KeeperRegistryBase2_1.sol | 0 .../2_1/KeeperRegistryLogicA2_1.sol | 0 .../2_1/KeeperRegistryLogicB2_1.sol | 0 .../v0.8/{dev => }/automation/2_1/README.md | 0 .../automation/2_1/UpkeepTranscoder4_0.sol | 0 .../2_1/interfaces/IAutomationForwarder.sol | 0 .../IAutomationRegistryConsumer.sol | 0 .../2_1/interfaces/IKeeperRegistryMaster.sol | 0 .../2_1/interfaces/ILogAutomation.sol | 0 .../StreamsLookupCompatibleInterface.sol | 0 .../2_1/mocks/MockKeeperRegistry2_1.sol | 0 .../automation/2_1/mocks/UpkeepCounter.sol | 0 .../2_1/test/AutomationForwarder.t.sol | 0 .../automation/2_1/test/BaseTest.t.sol | 0 .../automation/2_1/test/StructFactory.sol | 0 .../testhelpers}/DummyProtocol.sol | 0 .../LogTriggeredStreamsLookup.sol | 0 .../testhelpers}/LogUpkeepCounter.sol | 0 .../upkeeps/LinkAvailableBalanceMonitor.sol | 0 .../v0.8/dev/automation/CanaryUpkeep1_2.sol | 96 ------------------- 27 files changed, 96 deletions(-) rename contracts/src/v0.8/{dev/automation => automation/2_0}/UpkeepTranscoder3_0.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/AutomationForwarder.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/AutomationForwarderLogic.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/AutomationRegistrar2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/AutomationUtils2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/Chainable.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/KeeperRegistry2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/KeeperRegistryBase2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/KeeperRegistryLogicA2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/KeeperRegistryLogicB2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/README.md (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/UpkeepTranscoder4_0.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/interfaces/IAutomationForwarder.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/interfaces/IAutomationRegistryConsumer.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/interfaces/IKeeperRegistryMaster.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/interfaces/ILogAutomation.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/mocks/MockKeeperRegistry2_1.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/mocks/UpkeepCounter.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/test/AutomationForwarder.t.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/test/BaseTest.t.sol (100%) rename contracts/src/v0.8/{dev => }/automation/2_1/test/StructFactory.sol (100%) rename contracts/src/v0.8/{dev/automation/tests => automation/testhelpers}/DummyProtocol.sol (100%) rename contracts/src/v0.8/{dev/automation/tests => automation/testhelpers}/LogTriggeredStreamsLookup.sol (100%) rename contracts/src/v0.8/{dev/automation/tests => automation/testhelpers}/LogUpkeepCounter.sol (100%) rename contracts/src/v0.8/{dev => }/automation/upkeeps/LinkAvailableBalanceMonitor.sol (100%) delete mode 100644 contracts/src/v0.8/dev/automation/CanaryUpkeep1_2.sol diff --git a/contracts/src/v0.8/dev/automation/UpkeepTranscoder3_0.sol b/contracts/src/v0.8/automation/2_0/UpkeepTranscoder3_0.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/UpkeepTranscoder3_0.sol rename to contracts/src/v0.8/automation/2_0/UpkeepTranscoder3_0.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/AutomationForwarder.sol b/contracts/src/v0.8/automation/2_1/AutomationForwarder.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/AutomationForwarder.sol rename to contracts/src/v0.8/automation/2_1/AutomationForwarder.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/AutomationForwarderLogic.sol b/contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/AutomationForwarderLogic.sol rename to contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/AutomationRegistrar2_1.sol b/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/AutomationRegistrar2_1.sol rename to contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/AutomationUtils2_1.sol b/contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/AutomationUtils2_1.sol rename to contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/Chainable.sol b/contracts/src/v0.8/automation/2_1/Chainable.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/Chainable.sol rename to contracts/src/v0.8/automation/2_1/Chainable.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/KeeperRegistry2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/KeeperRegistry2_1.sol rename to contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryBase2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/KeeperRegistryBase2_1.sol rename to contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicA2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicA2_1.sol rename to contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/KeeperRegistryLogicB2_1.sol rename to contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/README.md b/contracts/src/v0.8/automation/2_1/README.md similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/README.md rename to contracts/src/v0.8/automation/2_1/README.md diff --git a/contracts/src/v0.8/dev/automation/2_1/UpkeepTranscoder4_0.sol b/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/UpkeepTranscoder4_0.sol rename to contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/interfaces/IAutomationForwarder.sol b/contracts/src/v0.8/automation/2_1/interfaces/IAutomationForwarder.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/interfaces/IAutomationForwarder.sol rename to contracts/src/v0.8/automation/2_1/interfaces/IAutomationForwarder.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/interfaces/IAutomationRegistryConsumer.sol b/contracts/src/v0.8/automation/2_1/interfaces/IAutomationRegistryConsumer.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/interfaces/IAutomationRegistryConsumer.sol rename to contracts/src/v0.8/automation/2_1/interfaces/IAutomationRegistryConsumer.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/interfaces/IKeeperRegistryMaster.sol b/contracts/src/v0.8/automation/2_1/interfaces/IKeeperRegistryMaster.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/interfaces/IKeeperRegistryMaster.sol rename to contracts/src/v0.8/automation/2_1/interfaces/IKeeperRegistryMaster.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/interfaces/ILogAutomation.sol b/contracts/src/v0.8/automation/2_1/interfaces/ILogAutomation.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/interfaces/ILogAutomation.sol rename to contracts/src/v0.8/automation/2_1/interfaces/ILogAutomation.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol b/contracts/src/v0.8/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol rename to contracts/src/v0.8/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/mocks/MockKeeperRegistry2_1.sol b/contracts/src/v0.8/automation/2_1/mocks/MockKeeperRegistry2_1.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/mocks/MockKeeperRegistry2_1.sol rename to contracts/src/v0.8/automation/2_1/mocks/MockKeeperRegistry2_1.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/mocks/UpkeepCounter.sol b/contracts/src/v0.8/automation/2_1/mocks/UpkeepCounter.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/mocks/UpkeepCounter.sol rename to contracts/src/v0.8/automation/2_1/mocks/UpkeepCounter.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/test/AutomationForwarder.t.sol b/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/test/AutomationForwarder.t.sol rename to contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/test/BaseTest.t.sol b/contracts/src/v0.8/automation/2_1/test/BaseTest.t.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/test/BaseTest.t.sol rename to contracts/src/v0.8/automation/2_1/test/BaseTest.t.sol diff --git a/contracts/src/v0.8/dev/automation/2_1/test/StructFactory.sol b/contracts/src/v0.8/automation/2_1/test/StructFactory.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/2_1/test/StructFactory.sol rename to contracts/src/v0.8/automation/2_1/test/StructFactory.sol diff --git a/contracts/src/v0.8/dev/automation/tests/DummyProtocol.sol b/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/tests/DummyProtocol.sol rename to contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol diff --git a/contracts/src/v0.8/dev/automation/tests/LogTriggeredStreamsLookup.sol b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/tests/LogTriggeredStreamsLookup.sol rename to contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol diff --git a/contracts/src/v0.8/dev/automation/tests/LogUpkeepCounter.sol b/contracts/src/v0.8/automation/testhelpers/LogUpkeepCounter.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/tests/LogUpkeepCounter.sol rename to contracts/src/v0.8/automation/testhelpers/LogUpkeepCounter.sol diff --git a/contracts/src/v0.8/dev/automation/upkeeps/LinkAvailableBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol similarity index 100% rename from contracts/src/v0.8/dev/automation/upkeeps/LinkAvailableBalanceMonitor.sol rename to contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol diff --git a/contracts/src/v0.8/dev/automation/CanaryUpkeep1_2.sol b/contracts/src/v0.8/dev/automation/CanaryUpkeep1_2.sol deleted file mode 100644 index bf711eb565f..00000000000 --- a/contracts/src/v0.8/dev/automation/CanaryUpkeep1_2.sol +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.6; - -import "../../automation/interfaces/KeeperCompatibleInterface.sol"; -import "../../automation/interfaces/1_2/KeeperRegistryInterface1_2.sol"; -import "../../shared/access/ConfirmedOwner.sol"; - -error NoKeeperNodes(); -error InsufficientInterval(); - -/** - * @notice A canary upkeep which requires a different keeper to service its upkeep at an interval. This makes sure that - * all keepers are in a healthy state. - */ -contract CanaryUpkeep1_2 is KeeperCompatibleInterface, ConfirmedOwner { - uint256 private s_keeperIndex; - uint256 private s_interval; - uint256 private s_timestamp; - KeeperRegistryExecutableInterface private immutable i_keeperRegistry; - - /** - * @param keeperRegistry address of a keeper registry - */ - constructor(KeeperRegistryExecutableInterface keeperRegistry, uint256 interval) ConfirmedOwner(msg.sender) { - i_keeperRegistry = keeperRegistry; - s_timestamp = block.timestamp; - s_interval = interval; - s_keeperIndex = 0; - } - - /** - * @return the current keeper index - */ - function getKeeperIndex() external view returns (uint256) { - return s_keeperIndex; - } - - /** - * @return the current timestamp - */ - function getTimestamp() external view returns (uint256) { - return s_timestamp; - } - - /** - * @return the current interval - */ - function getInterval() external view returns (uint256) { - return s_interval; - } - - /** - * @return the keeper registry - */ - function getKeeperRegistry() external view returns (KeeperRegistryExecutableInterface) { - return i_keeperRegistry; - } - - /** - * @notice updates the interval - * @param interval the new interval - */ - function setInterval(uint256 interval) external onlyOwner { - s_interval = interval; - } - - /** - * @notice returns true if keeper array is not empty and sufficient time has passed - */ - function checkUpkeep(bytes calldata /* checkData */) external view override returns (bool, bytes memory) { - bool upkeepNeeded = block.timestamp >= s_interval + s_timestamp; - return (upkeepNeeded, bytes("")); - } - - /** - * @notice checks keepers array limit, timestamp limit, and requires transaction origin must be the anticipated keeper. - * If all checks pass, update the keeper index and timestamp. Otherwise, revert this transaction. - */ - function performUpkeep(bytes calldata /* performData */) external override { - (State memory _s, Config memory _c, address[] memory keepers) = i_keeperRegistry.getState(); - if (keepers.length == 0) { - revert NoKeeperNodes(); - } - if (block.timestamp < s_interval + s_timestamp) { - revert InsufficientInterval(); - } - // if keepers array is shortened, this statement will make sure keeper index is always valid - if (s_keeperIndex >= keepers.length) { - s_keeperIndex = 0; - } - - require(tx.origin == keepers[s_keeperIndex], "transaction origin is not the anticipated keeper."); - s_keeperIndex = (s_keeperIndex + 1) % keepers.length; - s_timestamp = block.timestamp; - } -} From d0e785a054407362e7531840efacf5ce16ad268d Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 14:10:15 -0400 Subject: [PATCH 02/10] update import paths --- contracts/foundry.toml | 5 ---- .../generate-automation-master-interface.ts | 2 +- .../native_solc_compile_all_automation | 2 +- .../automation/2_1/AutomationForwarder.sol | 2 +- .../2_1/AutomationForwarderLogic.sol | 4 +-- .../automation/2_1/AutomationRegistrar2_1.sol | 10 +++---- .../automation/2_1/AutomationUtils2_1.sol | 2 +- .../v0.8/automation/2_1/KeeperRegistry2_1.sol | 12 ++++---- .../automation/2_1/KeeperRegistryBase2_1.sol | 28 +++++++++---------- .../2_1/KeeperRegistryLogicA2_1.sol | 12 ++++---- .../2_1/KeeperRegistryLogicB2_1.sol | 8 +++--- .../automation/2_1/UpkeepTranscoder4_0.sol | 8 +++--- .../2_1/test/AutomationForwarder.t.sol | 2 +- .../v0.8/automation/{2_1 => }/Chainable.sol | 0 .../2_1}/IKeeperRegistryMaster.sol | 0 .../interfaces/IAutomationForwarder.sol | 2 +- .../IAutomationRegistryConsumer.sol | 0 .../{2_1 => }/interfaces/ILogAutomation.sol | 0 .../StreamsLookupCompatibleInterface.sol | 0 .../{2_1 => }/mocks/MockKeeperRegistry2_1.sol | 0 .../testhelpers/LogTriggeredStreamsLookup.sol | 6 ++-- .../testhelpers/LogUpkeepCounter.sol | 2 +- .../mocks => testhelpers}/UpkeepCounter.sol | 0 .../upkeeps/LinkAvailableBalanceMonitor.sol | 10 +++---- .../src/v0.8/tests/StreamsLookupUpkeep.sol | 2 +- .../src/v0.8/tests/VerifiableLoadBase.sol | 6 ++-- .../tests/VerifiableLoadLogTriggerUpkeep.sol | 4 +-- .../VerifiableLoadStreamsLookupUpkeep.sol | 2 +- .../automation/IKeeperRegistryMaster.test.ts | 2 +- 29 files changed, 64 insertions(+), 69 deletions(-) rename contracts/src/v0.8/automation/{2_1 => }/Chainable.sol (100%) rename contracts/src/v0.8/automation/{2_1/interfaces => interfaces/2_1}/IKeeperRegistryMaster.sol (100%) rename contracts/src/v0.8/automation/{2_1 => }/interfaces/IAutomationForwarder.sol (85%) rename contracts/src/v0.8/automation/{2_1 => }/interfaces/IAutomationRegistryConsumer.sol (100%) rename contracts/src/v0.8/automation/{2_1 => }/interfaces/ILogAutomation.sol (100%) rename contracts/src/v0.8/automation/{2_1 => }/interfaces/StreamsLookupCompatibleInterface.sol (100%) rename contracts/src/v0.8/automation/{2_1 => }/mocks/MockKeeperRegistry2_1.sol (100%) rename contracts/src/v0.8/automation/{2_1/mocks => testhelpers}/UpkeepCounter.sol (100%) diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 78ad4adf5dc..2434f4a04f1 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -33,11 +33,6 @@ src = 'src/v0.8/automation' test = 'src/v0.8/automation/test' solc_version = '0.8.6' -[profile.automation-dev] -optimizer_runs = 10000 -src = 'src/v0.8/dev/automation' -test = 'src/v0.8/dev/automation/test' - [profile.llo-feeds] optimizer_runs = 1000000 src = 'src/v0.8/llo-feeds' diff --git a/contracts/scripts/generate-automation-master-interface.ts b/contracts/scripts/generate-automation-master-interface.ts index c480098c77f..821b0caac60 100644 --- a/contracts/scripts/generate-automation-master-interface.ts +++ b/contracts/scripts/generate-automation-master-interface.ts @@ -9,7 +9,7 @@ import { utils } from 'ethers' import fs from 'fs' import { exec } from 'child_process' -const dest = 'src/v0.8/dev/automation/2_1/interfaces' +const dest = 'src/v0.8/automation/interfaces/2_1' const srcDest = `${dest}/IKeeperRegistryMaster.sol` const tmpDest = `${dest}/tmp.txt` diff --git a/contracts/scripts/native_solc_compile_all_automation b/contracts/scripts/native_solc_compile_all_automation index e7dbe0db676..06333f13ee5 100755 --- a/contracts/scripts/native_solc_compile_all_automation +++ b/contracts/scripts/native_solc_compile_all_automation @@ -56,7 +56,7 @@ compileContract dev/automation/2_1/AutomationRegistrar2_1.sol compileContract dev/automation/2_1/KeeperRegistry2_1.sol compileContract dev/automation/2_1/KeeperRegistryLogicA2_1.sol compileContract dev/automation/2_1/KeeperRegistryLogicB2_1.sol -compileContract dev/automation/2_1/interfaces/IKeeperRegistryMaster.sol +compileContract dev/automation/2_1/interfaces/2_1/IKeeperRegistryMaster.sol compileContract dev/automation/2_1/interfaces/ILogAutomation.sol compileContract dev/automation/2_1/AutomationUtils2_1.sol compileContract dev/automation/2_1/AutomationForwarderLogic.sol diff --git a/contracts/src/v0.8/automation/2_1/AutomationForwarder.sol b/contracts/src/v0.8/automation/2_1/AutomationForwarder.sol index 4d574884b8d..efdc1138489 100644 --- a/contracts/src/v0.8/automation/2_1/AutomationForwarder.sol +++ b/contracts/src/v0.8/automation/2_1/AutomationForwarder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol"; +import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol"; uint256 constant PERFORM_GAS_CUSHION = 5_000; diff --git a/contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol b/contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol index 0a5535ce061..14077300d4f 100644 --- a/contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol +++ b/contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol"; -import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; +import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; contract AutomationForwarderLogic is ITypeAndVersion { IAutomationRegistryConsumer private s_registry; diff --git a/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol b/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol index 847098e0fd4..78aad99882a 100644 --- a/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol +++ b/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {LinkTokenInterface} from "../../../shared/interfaces/LinkTokenInterface.sol"; -import {IKeeperRegistryMaster} from "./interfaces/IKeeperRegistryMaster.sol"; -import {TypeAndVersionInterface} from "../../../interfaces/TypeAndVersionInterface.sol"; -import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; -import {IERC677Receiver} from "../../../shared/interfaces/IERC677Receiver.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {IKeeperRegistryMaster} from "../interfaces/2_1/IKeeperRegistryMaster.sol"; +import {TypeAndVersionInterface} from "../../interfaces/TypeAndVersionInterface.sol"; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; /** * @notice Contract to accept requests for upkeep registrations diff --git a/contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol b/contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol index 1c1d76399bb..4c18db9a2d7 100644 --- a/contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol +++ b/contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.16; import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; -import {ILogAutomation, Log} from "./interfaces/ILogAutomation.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; /** * @notice this file exposes structs that are otherwise internal to the automation registry diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol index 88d173f2288..7760d7c3e77 100644 --- a/contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol +++ b/contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; -import {Address} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; -import {Proxy} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/proxy/Proxy.sol"; +import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; +import {Address} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; +import {Proxy} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/proxy/Proxy.sol"; import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; import {KeeperRegistryLogicB2_1} from "./KeeperRegistryLogicB2_1.sol"; -import {Chainable} from "./Chainable.sol"; -import {IERC677Receiver} from "../../../shared/interfaces/IERC677Receiver.sol"; -import {OCR2Abstract} from "../../../shared/ocr2/OCR2Abstract.sol"; +import {Chainable} from "../Chainable.sol"; +import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; /** * @notice Registry for adding work for Chainlink Keepers to perform on client diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol index ccd286fda2f..d8448028ed9 100644 --- a/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol +++ b/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol @@ -1,20 +1,20 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; -import {Address} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; -import {ArbGasInfo} from "../../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import {OVM_GasPriceOracle} from "../../../vendor/@eth-optimism/contracts/0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; -import {ExecutionPrevention} from "../../../automation/ExecutionPrevention.sol"; -import {ArbSys} from "../../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; -import {StreamsLookupCompatibleInterface} from "./interfaces/StreamsLookupCompatibleInterface.sol"; -import {ILogAutomation, Log} from "./interfaces/ILogAutomation.sol"; -import {IAutomationForwarder} from "./interfaces/IAutomationForwarder.sol"; -import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; -import {AggregatorV3Interface} from "../../../interfaces/AggregatorV3Interface.sol"; -import {LinkTokenInterface} from "../../../shared/interfaces/LinkTokenInterface.sol"; -import {KeeperCompatibleInterface} from "../../../automation/interfaces/KeeperCompatibleInterface.sol"; -import {UpkeepTranscoderInterface, UpkeepFormat} from "../../../automation/interfaces/UpkeepTranscoderInterface.sol"; +import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; +import {Address} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; +import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; +import {OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts/0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import {ExecutionPrevention} from "../ExecutionPrevention.sol"; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {AggregatorV3Interface} from "../../interfaces/AggregatorV3Interface.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {UpkeepTranscoderInterface, UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; /** * @notice Base Keeper Registry contract, contains shared logic between diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol index ef9acaf9a8b..33c40e7fdd3 100644 --- a/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol +++ b/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol @@ -1,15 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; -import {Address} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; +import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; +import {Address} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; import {KeeperRegistryLogicB2_1} from "./KeeperRegistryLogicB2_1.sol"; -import {Chainable} from "./Chainable.sol"; +import {Chainable} from "../Chainable.sol"; import {AutomationForwarder} from "./AutomationForwarder.sol"; -import {IAutomationForwarder} from "./interfaces/IAutomationForwarder.sol"; -import {UpkeepTranscoderInterfaceV2} from "../../../automation/interfaces/UpkeepTranscoderInterfaceV2.sol"; -import {MigratableKeeperRegistryInterfaceV2} from "../../../automation/interfaces/MigratableKeeperRegistryInterfaceV2.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {MigratableKeeperRegistryInterfaceV2} from "../interfaces/MigratableKeeperRegistryInterfaceV2.sol"; /** * @notice Logic contract, works in tandem with KeeperRegistry as a proxy diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol b/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol index ce9d49eac3d..a3d3230a322 100644 --- a/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol +++ b/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol @@ -2,10 +2,10 @@ pragma solidity 0.8.16; import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; -import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; -import {Address} from "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; -import {UpkeepFormat} from "../../../automation/interfaces/UpkeepTranscoderInterface.sol"; -import {IAutomationForwarder} from "./interfaces/IAutomationForwarder.sol"; +import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; +import {Address} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; +import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { using Address for address; diff --git a/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol b/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol index fa990df91c9..aa79fb4e821 100644 --- a/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol +++ b/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol @@ -2,11 +2,11 @@ pragma solidity 0.8.16; -import {UpkeepTranscoderInterfaceV2} from "../../../automation/interfaces/UpkeepTranscoderInterfaceV2.sol"; -import {TypeAndVersionInterface} from "../../../interfaces/TypeAndVersionInterface.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {TypeAndVersionInterface} from "../../interfaces/TypeAndVersionInterface.sol"; import {KeeperRegistryBase2_1 as R21} from "./KeeperRegistryBase2_1.sol"; -import {IAutomationForwarder} from "./interfaces/IAutomationForwarder.sol"; -import {AutomationRegistryBaseInterface, UpkeepInfo} from "../../../automation/interfaces/2_0/AutomationRegistryInterface2_0.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; +import {AutomationRegistryBaseInterface, UpkeepInfo} from "../interfaces/2_0/AutomationRegistryInterface2_0.sol"; enum RegistryVersion { V12, diff --git a/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol b/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol index d876def8bf0..c636f0b2c79 100644 --- a/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol +++ b/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol @@ -10,7 +10,7 @@ import {UpkeepCounter} from "../mocks/UpkeepCounter.sol"; import {BaseTest} from "./BaseTest.t.sol"; // in contracts directory, run -// forge test --match-path src/v0.8/dev/automation/2_1/test/AutomationForwarder.t.sol +// forge test --match-path src/v0.8/automation/2_1/test/AutomationForwarder.t.sol contract AutomationForwarderSetUp is BaseTest { IAutomationForwarder internal forwarder; diff --git a/contracts/src/v0.8/automation/2_1/Chainable.sol b/contracts/src/v0.8/automation/Chainable.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/Chainable.sol rename to contracts/src/v0.8/automation/Chainable.sol diff --git a/contracts/src/v0.8/automation/2_1/interfaces/IKeeperRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/2_1/IKeeperRegistryMaster.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/interfaces/IKeeperRegistryMaster.sol rename to contracts/src/v0.8/automation/interfaces/2_1/IKeeperRegistryMaster.sol diff --git a/contracts/src/v0.8/automation/2_1/interfaces/IAutomationForwarder.sol b/contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol similarity index 85% rename from contracts/src/v0.8/automation/2_1/interfaces/IAutomationForwarder.sol rename to contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol index fbf9743d0ca..0a53de697a1 100644 --- a/contracts/src/v0.8/automation/2_1/interfaces/IAutomationForwarder.sol +++ b/contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ITypeAndVersion} from "../../../../shared/interfaces/ITypeAndVersion.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {IAutomationRegistryConsumer} from "./IAutomationRegistryConsumer.sol"; interface IAutomationForwarder is ITypeAndVersion { diff --git a/contracts/src/v0.8/automation/2_1/interfaces/IAutomationRegistryConsumer.sol b/contracts/src/v0.8/automation/interfaces/IAutomationRegistryConsumer.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/interfaces/IAutomationRegistryConsumer.sol rename to contracts/src/v0.8/automation/interfaces/IAutomationRegistryConsumer.sol diff --git a/contracts/src/v0.8/automation/2_1/interfaces/ILogAutomation.sol b/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/interfaces/ILogAutomation.sol rename to contracts/src/v0.8/automation/interfaces/ILogAutomation.sol diff --git a/contracts/src/v0.8/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol b/contracts/src/v0.8/automation/interfaces/StreamsLookupCompatibleInterface.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol rename to contracts/src/v0.8/automation/interfaces/StreamsLookupCompatibleInterface.sol diff --git a/contracts/src/v0.8/automation/2_1/mocks/MockKeeperRegistry2_1.sol b/contracts/src/v0.8/automation/mocks/MockKeeperRegistry2_1.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/mocks/MockKeeperRegistry2_1.sol rename to contracts/src/v0.8/automation/mocks/MockKeeperRegistry2_1.sol diff --git a/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol index 5c542a9b07e..eb7f3c48f69 100644 --- a/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol +++ b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {ILogAutomation, Log} from "../2_1/interfaces/ILogAutomation.sol"; -import "../2_1/interfaces/StreamsLookupCompatibleInterface.sol"; -import {ArbSys} from "../../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; +import "../interfaces/StreamsLookupCompatibleInterface.sol"; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; interface IVerifierProxy { /** diff --git a/contracts/src/v0.8/automation/testhelpers/LogUpkeepCounter.sol b/contracts/src/v0.8/automation/testhelpers/LogUpkeepCounter.sol index 84e53b65493..a51f2d2af1a 100644 --- a/contracts/src/v0.8/automation/testhelpers/LogUpkeepCounter.sol +++ b/contracts/src/v0.8/automation/testhelpers/LogUpkeepCounter.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.6; -import {ILogAutomation, Log} from "../2_1/interfaces/ILogAutomation.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; contract LogUpkeepCounter is ILogAutomation { bytes32 sig1 = 0x3d53a39550e04688065827f3bb86584cb007ab9ebca7ebd528e7301c9c31eb5d; diff --git a/contracts/src/v0.8/automation/2_1/mocks/UpkeepCounter.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepCounter.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/mocks/UpkeepCounter.sol rename to contracts/src/v0.8/automation/testhelpers/UpkeepCounter.sol diff --git a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol index 1ed1237f615..af24d86e3c8 100644 --- a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol @@ -2,11 +2,11 @@ pragma solidity 0.8.6; -import "../../../shared/access/ConfirmedOwner.sol"; -import "../../../automation/interfaces/KeeperCompatibleInterface.sol"; -import "../../../vendor/openzeppelin-solidity/v4.7.0/contracts/security/Pausable.sol"; -import "../../../vendor/openzeppelin-solidity/v4.7.0/contracts/token/ERC20/IERC20.sol"; -import "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableMap.sol"; +import "../../shared/access/ConfirmedOwner.sol"; +import "../interfaces/KeeperCompatibleInterface.sol"; +import "../../vendor/openzeppelin-solidity/v4.7.0/contracts/security/Pausable.sol"; +import "../../vendor/openzeppelin-solidity/v4.7.0/contracts/token/ERC20/IERC20.sol"; +import "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableMap.sol"; interface IAggregatorProxy { function aggregator() external view returns (address); diff --git a/contracts/src/v0.8/tests/StreamsLookupUpkeep.sol b/contracts/src/v0.8/tests/StreamsLookupUpkeep.sol index 9b28875020d..c4593a898d0 100644 --- a/contracts/src/v0.8/tests/StreamsLookupUpkeep.sol +++ b/contracts/src/v0.8/tests/StreamsLookupUpkeep.sol @@ -1,7 +1,7 @@ pragma solidity 0.8.16; import "../automation/interfaces/AutomationCompatibleInterface.sol"; -import "../dev/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol"; +import "../automation/interfaces/StreamsLookupCompatibleInterface.sol"; import {ArbSys} from "../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; interface IVerifierProxy { diff --git a/contracts/src/v0.8/tests/VerifiableLoadBase.sol b/contracts/src/v0.8/tests/VerifiableLoadBase.sol index 2832cb05504..69ebb90cc2b 100644 --- a/contracts/src/v0.8/tests/VerifiableLoadBase.sol +++ b/contracts/src/v0.8/tests/VerifiableLoadBase.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.16; import "../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; -import "../dev/automation/2_1/interfaces/IKeeperRegistryMaster.sol"; +import "../automation/interfaces/2_1/IKeeperRegistryMaster.sol"; import {ArbSys} from "../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; -import "../dev/automation/2_1/AutomationRegistrar2_1.sol"; -import {LogTriggerConfig} from "../dev/automation/2_1/AutomationUtils2_1.sol"; +import "../automation/2_1/AutomationRegistrar2_1.sol"; +import {LogTriggerConfig} from "../automation/2_1/AutomationUtils2_1.sol"; abstract contract VerifiableLoadBase is ConfirmedOwner { error IndexOutOfRange(); diff --git a/contracts/src/v0.8/tests/VerifiableLoadLogTriggerUpkeep.sol b/contracts/src/v0.8/tests/VerifiableLoadLogTriggerUpkeep.sol index 02ad2ef2d45..d83a1e57125 100644 --- a/contracts/src/v0.8/tests/VerifiableLoadLogTriggerUpkeep.sol +++ b/contracts/src/v0.8/tests/VerifiableLoadLogTriggerUpkeep.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.16; import "./VerifiableLoadBase.sol"; -import "../dev/automation/2_1/interfaces/ILogAutomation.sol"; -import "../dev/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol"; +import "../automation/interfaces/ILogAutomation.sol"; +import "../automation/interfaces/StreamsLookupCompatibleInterface.sol"; contract VerifiableLoadLogTriggerUpkeep is VerifiableLoadBase, StreamsLookupCompatibleInterface, ILogAutomation { bool public useMercury; diff --git a/contracts/src/v0.8/tests/VerifiableLoadStreamsLookupUpkeep.sol b/contracts/src/v0.8/tests/VerifiableLoadStreamsLookupUpkeep.sol index 451de7aebdb..1212420b0bd 100644 --- a/contracts/src/v0.8/tests/VerifiableLoadStreamsLookupUpkeep.sol +++ b/contracts/src/v0.8/tests/VerifiableLoadStreamsLookupUpkeep.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.16; import "./VerifiableLoadBase.sol"; -import "../dev/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol"; +import "../automation/interfaces/StreamsLookupCompatibleInterface.sol"; contract VerifiableLoadStreamsLookupUpkeep is VerifiableLoadBase, StreamsLookupCompatibleInterface { constructor(AutomationRegistrar2_1 _registrar, bool _useArb) VerifiableLoadBase(_registrar, _useArb) {} diff --git a/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts b/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts index a3a18473eca..86d2b03f919 100644 --- a/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts +++ b/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts @@ -87,7 +87,7 @@ describe('IKeeperRegistryMaster', () => { const checksum = ethers.utils.id(compositeABIs.join('')) const knownChecksum = fs .readFileSync( - 'src/v0.8/dev/automation/2_1/interfaces/IKeeperRegistryMaster.sol', + 'src/v0.8/automation/2_1/interfaces/2_1/IKeeperRegistryMaster.sol', ) .toString() .slice(17, 83) // checksum located at top of file From e8e5b5ed38754c8ae42c06b2562a7f88fb40aebc Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 14:58:26 -0400 Subject: [PATCH 03/10] update go compile scripts --- .../native_solc_compile_all_automation | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contracts/scripts/native_solc_compile_all_automation b/contracts/scripts/native_solc_compile_all_automation index 06333f13ee5..c38f4c2e3d5 100755 --- a/contracts/scripts/native_solc_compile_all_automation +++ b/contracts/scripts/native_solc_compile_all_automation @@ -37,7 +37,7 @@ compileContract automation/2_0/KeeperRegistry2_0.sol compileContract automation/2_0/KeeperRegistryLogic2_0.sol compileContract automation/UpkeepTranscoder.sol compileContract automation/mocks/MockAggregatorProxy.sol -compileContract dev/automation/tests/LogUpkeepCounter.sol +compileContract automation/testhelpers/LogUpkeepCounter.sol # Keepers x VRF v2 compileContract KeepersVRFConsumer.sol @@ -52,17 +52,17 @@ solc-select use $SOLC_VERSION export SOLC_VERSION=$SOLC_VERSION # v0.8.16 -compileContract dev/automation/2_1/AutomationRegistrar2_1.sol -compileContract dev/automation/2_1/KeeperRegistry2_1.sol -compileContract dev/automation/2_1/KeeperRegistryLogicA2_1.sol -compileContract dev/automation/2_1/KeeperRegistryLogicB2_1.sol -compileContract dev/automation/2_1/interfaces/2_1/IKeeperRegistryMaster.sol -compileContract dev/automation/2_1/interfaces/ILogAutomation.sol -compileContract dev/automation/2_1/AutomationUtils2_1.sol -compileContract dev/automation/2_1/AutomationForwarderLogic.sol -compileContract dev/automation/tests/LogTriggeredStreamsLookup.sol -compileContract dev/automation/tests/DummyProtocol.sol -compileContract dev/automation/2_1/interfaces/StreamsLookupCompatibleInterface.sol +compileContract automation/2_1/AutomationRegistrar2_1.sol +compileContract automation/2_1/KeeperRegistry2_1.sol +compileContract automation/2_1/KeeperRegistryLogicA2_1.sol +compileContract automation/2_1/KeeperRegistryLogicB2_1.sol +compileContract automation/interfaces/2_1/IKeeperRegistryMaster.sol +compileContract automation/interfaces/ILogAutomation.sol +compileContract automation/2_1/AutomationUtils2_1.sol +compileContract automation/2_1/AutomationForwarderLogic.sol +compileContract automation/testhelpers/LogTriggeredStreamsLookup.sol +compileContract automation/testhelpers/DummyProtocol.sol +compileContract automation/interfaces/StreamsLookupCompatibleInterface.sol compileContract tests/VerifiableLoadUpkeep.sol compileContract tests/VerifiableLoadStreamsLookupUpkeep.sol From b164575bc7c6e0827fbdb8cfe5278a59fe26f3aa Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 15:12:25 -0400 Subject: [PATCH 04/10] fix --- contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts b/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts index 86d2b03f919..b29b8add1c2 100644 --- a/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts +++ b/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts @@ -87,7 +87,7 @@ describe('IKeeperRegistryMaster', () => { const checksum = ethers.utils.id(compositeABIs.join('')) const knownChecksum = fs .readFileSync( - 'src/v0.8/automation/2_1/interfaces/2_1/IKeeperRegistryMaster.sol', + 'src/v0.8/automation/interfaces/2_1/IKeeperRegistryMaster.sol', ) .toString() .slice(17, 83) // checksum located at top of file From a0029ba2cfd66a25ad43dc34d12680464f548604 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 16:01:32 -0400 Subject: [PATCH 05/10] bugfix --- contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts b/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts index c94dffa6b84..16a2e274980 100644 --- a/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts +++ b/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts @@ -2,7 +2,7 @@ import { ethers } from 'hardhat' import { BigNumber, Signer } from 'ethers' import moment from 'moment' import { assert } from 'chai' -import { CanaryUpkeep12 as CanaryUpkeep } from '../../../typechain/CanaryUpkeep12' +import { CanaryUpkeep1_2 as CanaryUpkeep } from '../../../typechain/CanaryUpkeep1_2' import { CanaryUpkeep1_2__factory as CanaryUpkeepFactory } from '../../../typechain/factories/CanaryUpkeep1_2__factory' import { KeeperRegistry1_2 as KeeperRegistry } from '../../../typechain/KeeperRegistry1_2' import { KeeperRegistry1_2__factory as KeeperRegistryFactory } from '../../../typechain/factories/KeeperRegistry1_2__factory' From 50dce5a670ebaaf386a2b3487c7464bf4ac2eab6 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 16:10:40 -0400 Subject: [PATCH 06/10] bugfix --- .../v0.8/automation/2_1/test/AutomationForwarder.t.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol b/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol index c636f0b2c79..8b1bf0924e9 100644 --- a/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol +++ b/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol"; -import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; +import {IAutomationRegistryConsumer} from "../../interfaces/IAutomationRegistryConsumer.sol"; +import {IAutomationForwarder} from "../../interfaces/IAutomationForwarder.sol"; import {AutomationForwarder} from "../AutomationForwarder.sol"; import {AutomationForwarderLogic} from "../AutomationForwarderLogic.sol"; -import {MockKeeperRegistry2_1} from "../mocks/MockKeeperRegistry2_1.sol"; -import {UpkeepCounter} from "../mocks/UpkeepCounter.sol"; +import {MockKeeperRegistry2_1} from "../../mocks/MockKeeperRegistry2_1.sol"; +import {UpkeepCounter} from "../../testhelpers/UpkeepCounter.sol"; import {BaseTest} from "./BaseTest.t.sol"; // in contracts directory, run From 76af00ccee1c056b8b6c90fcd7177570a540f2ec Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Mon, 11 Sep 2023 16:21:48 -0400 Subject: [PATCH 07/10] remove foundry solc_version from automation profile --- contracts/foundry.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 2434f4a04f1..3b98f944582 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -31,7 +31,6 @@ solc_version = '0.8.6' optimizer_runs = 10000 src = 'src/v0.8/automation' test = 'src/v0.8/automation/test' -solc_version = '0.8.6' [profile.llo-feeds] optimizer_runs = 1000000 From 824077bec3cae0f3e4ade667397f51dfa75c7120 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Tue, 12 Sep 2023 12:01:58 -0400 Subject: [PATCH 08/10] remove canary upkeep --- .../v0.8/automation/CanaryUpkeep1_2.test.ts | 225 ------------------ 1 file changed, 225 deletions(-) delete mode 100644 contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts diff --git a/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts b/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts deleted file mode 100644 index 16a2e274980..00000000000 --- a/contracts/test/v0.8/automation/CanaryUpkeep1_2.test.ts +++ /dev/null @@ -1,225 +0,0 @@ -import { ethers } from 'hardhat' -import { BigNumber, Signer } from 'ethers' -import moment from 'moment' -import { assert } from 'chai' -import { CanaryUpkeep1_2 as CanaryUpkeep } from '../../../typechain/CanaryUpkeep1_2' -import { CanaryUpkeep1_2__factory as CanaryUpkeepFactory } from '../../../typechain/factories/CanaryUpkeep1_2__factory' -import { KeeperRegistry1_2 as KeeperRegistry } from '../../../typechain/KeeperRegistry1_2' -import { KeeperRegistry1_2__factory as KeeperRegistryFactory } from '../../../typechain/factories/KeeperRegistry1_2__factory' -import { fastForward, reset } from '../../test-helpers/helpers' -import { getUsers, Personas } from '../../test-helpers/setup' -import { evmRevert } from '../../test-helpers/matchers' - -let personas: Personas -let canaryUpkeep: CanaryUpkeep -let canaryUpkeepFactory: CanaryUpkeepFactory -let owner: Signer -let nelly: Signer -let nancy: Signer -let ned: Signer -let keeperAddresses: string[] -let keeperRegistry: KeeperRegistry -let keeperRegistryFactory: KeeperRegistryFactory - -const defaultInterval = 300 -const paymentPremiumPPB = BigNumber.from(250000000) -const flatFeeMicroLink = BigNumber.from(0) -const blockCountPerTurn = BigNumber.from(3) -const stalenessSeconds = BigNumber.from(43820) -const gasCeilingMultiplier = BigNumber.from(1) -const checkGasLimit = BigNumber.from(20000000) -const fallbackGasPrice = BigNumber.from(200) -const fallbackLinkPrice = BigNumber.from(200000000) -const maxPerformGas = BigNumber.from(5000000) -const minUpkeepSpend = BigNumber.from('1000000000000000000') -const transcoder = ethers.constants.AddressZero -const registrar = ethers.constants.AddressZero -const config = { - paymentPremiumPPB, - flatFeeMicroLink, - blockCountPerTurn, - checkGasLimit, - stalenessSeconds, - gasCeilingMultiplier, - minUpkeepSpend, - maxPerformGas, - fallbackGasPrice, - fallbackLinkPrice, - transcoder, - registrar, -} - -describe('CanaryUpkeep1_2', () => { - before(async () => { - personas = (await getUsers()).personas - owner = personas.Default - nelly = personas.Nelly - nancy = personas.Nancy - ned = personas.Ned - keeperAddresses = [ - await nelly.getAddress(), - await nancy.getAddress(), - await ned.getAddress(), - ] - }) - beforeEach(async () => { - // @ts-ignore bug in autogen file - keeperRegistryFactory = await ethers.getContractFactory('KeeperRegistry1_2') - keeperRegistry = await keeperRegistryFactory - .connect(owner) - .deploy( - ethers.constants.AddressZero, - ethers.constants.AddressZero, - ethers.constants.AddressZero, - config, - ) - await keeperRegistry.deployed() - - // @ts-ignore bug in autogen file - canaryUpkeepFactory = await ethers.getContractFactory('CanaryUpkeep1_2') - canaryUpkeep = await canaryUpkeepFactory - .connect(owner) - .deploy(keeperRegistry.address, defaultInterval) - await canaryUpkeep.deployed() - }) - - afterEach(async () => { - await reset() - }) - - describe('setInterval()', () => { - it('allows the owner setting interval', async () => { - await canaryUpkeep.connect(owner).setInterval(400) - const newInterval = await canaryUpkeep.getInterval() - assert.equal( - newInterval.toNumber(), - 400, - 'The interval is not updated correctly', - ) - }) - - it('does not allow someone who is not an owner setting interval', async () => { - await evmRevert( - canaryUpkeep.connect(ned).setInterval(400), - 'Only callable by owner', - ) - }) - }) - - describe('checkUpkeep()', () => { - it('returns true when sufficient time passes', async () => { - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - const [needsUpkeep] = await canaryUpkeep.checkUpkeep('0x') - assert.isTrue(needsUpkeep) - }) - - it('returns false when insufficient time passes', async () => { - await fastForward(moment.duration(2, 'minutes').asSeconds()) - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - const [needsUpkeep] = await canaryUpkeep.checkUpkeep('0x') - assert.isFalse(needsUpkeep) - }) - - it('returns false when keeper array is empty', async () => { - await fastForward(moment.duration(6, 'minutes').asSeconds()) - const [needsUpkeep] = await canaryUpkeep.checkUpkeep('0x') - assert.isTrue(needsUpkeep) - }) - }) - - describe('performUpkeep()', () => { - it('enforces that transaction origin is the anticipated keeper', async () => { - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - - const oldTimestamp = await canaryUpkeep.connect(nelly).getTimestamp() - const oldKeeperIndex = await canaryUpkeep.connect(nelly).getKeeperIndex() - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(nelly).performUpkeep('0x') - const newKeeperIndex = await canaryUpkeep.connect(nelly).getKeeperIndex() - assert.equal( - newKeeperIndex.toNumber() - oldKeeperIndex.toNumber(), - 1, - 'keeper index needs to increment by 1 after performUpkeep', - ) - - const newTimestamp = await canaryUpkeep.connect(nelly).getTimestamp() - const interval = await canaryUpkeep.connect(nelly).getInterval() - assert.isAtLeast( - newTimestamp.toNumber() - oldTimestamp.toNumber(), - interval.toNumber(), - 'timestamp needs to be updated after performUpkeep', - ) - }) - - it('enforces that keeper index will reset to zero after visiting the last keeper', async () => { - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(nelly).performUpkeep('0x') - - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(nancy).performUpkeep('0x') - - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(ned).performUpkeep('0x') - - const keeperIndex = await canaryUpkeep.connect(ned).getKeeperIndex() - assert.equal( - keeperIndex.toNumber(), - 0, - 'Keeper index is not updated properly', - ) - }) - - it('updates the keeper index after the keepers array is shortened', async () => { - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(nelly).performUpkeep('0x') - - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(nancy).performUpkeep('0x') - - let shortAddresses: string[] = [ - await nelly.getAddress(), - await nancy.getAddress(), - ] - await keeperRegistry.setKeepers(shortAddresses, shortAddresses) - - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await canaryUpkeep.connect(nelly).performUpkeep('0x') - const keeperIndex = await canaryUpkeep.getKeeperIndex() - assert.equal( - keeperIndex.toNumber(), - 1, - 'Keeper index is not updated properly', - ) - }) - - it('reverts if the keeper array is empty', async () => { - await evmRevert( - canaryUpkeep.connect(nelly).performUpkeep('0x'), - `NoKeeperNodes`, - ) - }) - - it('reverts if not enough time has passed', async () => { - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - await fastForward(moment.duration(3, 'minutes').asSeconds()) - await evmRevert( - canaryUpkeep.connect(nelly).performUpkeep('0x'), - `InsufficientInterval`, - ) - }) - - it('reverts if an incorrect keeper tries to perform upkeep', async () => { - await keeperRegistry.setKeepers(keeperAddresses, keeperAddresses) - await fastForward(moment.duration(6, 'minutes').asSeconds()) - await evmRevert( - canaryUpkeep.connect(nancy).performUpkeep('0x'), - 'transaction origin is not the anticipated keeper.', - ) - }) - }) -}) From 4cfbc782f3f023a498f07f37ce917949dd169baf Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Tue, 12 Sep 2023 13:02:39 -0400 Subject: [PATCH 09/10] update foundry snapshot --- contracts/gas-snapshots/automation.gas-snapshot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contracts/gas-snapshots/automation.gas-snapshot b/contracts/gas-snapshots/automation.gas-snapshot index a90453b1029..620e0b22559 100644 --- a/contracts/gas-snapshots/automation.gas-snapshot +++ b/contracts/gas-snapshots/automation.gas-snapshot @@ -1,3 +1,8 @@ +AutomationForwarder_forward:testBasicSuccess() (gas: 87630) +AutomationForwarder_forward:testNotAuthorizedReverts() (gas: 24560) +AutomationForwarder_forward:testWrongFunctionSelectorSuccess() (gas: 17958) +AutomationForwarder_updateRegistry:testBasicSuccess() (gas: 14577) +AutomationForwarder_updateRegistry:testNotFromRegistryNotAuthorizedReverts() (gas: 17665) HeartbeatRequester_getAggregatorRequestHeartbeat:testBasicSuccess() (gas: 75412) HeartbeatRequester_getAggregatorRequestHeartbeat:testHeartbeatNotPermittedReverts() (gas: 21730) HeartbeatRequester_permitHeartbeat:testBasicDeployerSuccess() (gas: 48229) From e5580e3ae1fba838eae2ecc9a12c183353f64d36 Mon Sep 17 00:00:00 2001 From: Ryan Hall Date: Tue, 12 Sep 2023 15:59:29 -0400 Subject: [PATCH 10/10] disable snapshot tests for automation --- .github/workflows/solidity-foundry.yml | 4 ++-- contracts/GNUmakefile | 2 +- contracts/gas-snapshots/automation-dev.gas-snapshot | 5 ----- 3 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 contracts/gas-snapshots/automation-dev.gas-snapshot diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index 9af9b1dd566..f504f58b62e 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -30,7 +30,7 @@ jobs: tests: strategy: matrix: - product: [ vrf, automation, llo-feeds, functions, automation-dev, shared ] + product: [vrf, automation, llo-feeds, functions, shared] needs: [changes] if: needs.changes.outputs.changes == 'true' name: Tests @@ -72,7 +72,7 @@ jobs: FOUNDRY_PROFILE: ${{ matrix.product }} - name: Run Forge snapshot - if: ${{ !contains(fromJson('["vrf"]'), matrix.product) }} + if: ${{ !contains(fromJson('["vrf"]'), matrix.product) && !contains(fromJson('["automation"]'), matrix.product) }} run: | forge snapshot --nmt "testFuzz_\w{1,}?" --check gas-snapshots/${{ matrix.product }}.gas-snapshot id: snapshot diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile index 5a5376bb1eb..58ff23575e7 100644 --- a/contracts/GNUmakefile +++ b/contracts/GNUmakefile @@ -1,7 +1,7 @@ # ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry # profile defined. Adding a product to this list will make it available for # snapshotting. -ALL_FOUNDRY_PRODUCTS = vrf automation llo-feeds functions automation-dev shared +ALL_FOUNDRY_PRODUCTS = vrf automation llo-feeds functions shared # To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var # or call the target with `FOUNDRY_PROFILE=product` diff --git a/contracts/gas-snapshots/automation-dev.gas-snapshot b/contracts/gas-snapshots/automation-dev.gas-snapshot deleted file mode 100644 index badbfba604c..00000000000 --- a/contracts/gas-snapshots/automation-dev.gas-snapshot +++ /dev/null @@ -1,5 +0,0 @@ -AutomationForwarder_forward:testBasicSuccess() (gas: 87630) -AutomationForwarder_forward:testNotAuthorizedReverts() (gas: 25427) -AutomationForwarder_forward:testWrongFunctionSelectorSuccess() (gas: 17958) -AutomationForwarder_updateRegistry:testBasicSuccess() (gas: 14577) -AutomationForwarder_updateRegistry:testNotFromRegistryNotAuthorizedReverts() (gas: 17665) \ No newline at end of file