Skip to content

Commit

Permalink
Move 2 1 automation out of dev (#10587)
Browse files Browse the repository at this point in the history
* move audited automation contracts to their long term home

* update import paths

* update go compile scripts

* fix

* bugfix

* bugfix

* remove foundry solc_version from automation profile

* remove canary upkeep

* update foundry snapshot

* disable snapshot tests for automation
  • Loading branch information
RyanRHall authored Sep 13, 2023
1 parent 0aeb8f5 commit e197ff9
Show file tree
Hide file tree
Showing 40 changed files with 87 additions and 414 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/solidity-foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion contracts/GNUmakefile
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
6 changes: 0 additions & 6 deletions contracts/foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +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.automation-dev]
optimizer_runs = 10000
src = 'src/v0.8/dev/automation'
test = 'src/v0.8/dev/automation/test'

[profile.llo-feeds]
optimizer_runs = 1000000
Expand Down
5 changes: 0 additions & 5 deletions contracts/gas-snapshots/automation-dev.gas-snapshot

This file was deleted.

5 changes: 5 additions & 0 deletions contracts/gas-snapshots/automation.gas-snapshot
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/generate-automation-master-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
24 changes: 12 additions & 12 deletions contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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/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
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// 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
// 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;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading

0 comments on commit e197ff9

Please sign in to comment.