Skip to content

Commit

Permalink
Merge branch 'develop' into ship-774-add-base-sepolia-config
Browse files Browse the repository at this point in the history
  • Loading branch information
finleydecker authored Feb 7, 2024
2 parents 89e31ff + 7eb5600 commit f7d5cfe
Show file tree
Hide file tree
Showing 60 changed files with 2,040 additions and 1,001 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,11 @@ jobs:
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf-evm-simulated
- name: vrfv2
nodes: 3
nodes: 4
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2-evm-simulated
- name: vrfv2plus
nodes: 3
nodes: 4
os: ubuntu-latest
pyroscope_env: ci-smoke-vrf2plus-evm-simulated
- name: forwarder_ocr
Expand Down
92 changes: 32 additions & 60 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,29 @@
# 1. Per Github docs: "Order is important; the last matching pattern takes the most precedence."
# Please define less specific codeowner paths before more specific codeowner paths in order for the more specific rule to have priority

# Misc
/core/store @samsondav @jmank88
/core/chains @samsondav
/core/logger @jmank88
/core/internal @samsondav @jmank88
# Core
/core @smartcontractkit/foundations

# Chains
/common @smartcontractkit/integrations
/core/chains/evm @samsondav @prashantkumar1982
/core/chains/evm/headtracker @pinebit @samsondav @prashantkumar1982
/core/chains/evm/client @samsondav @prashantkumar1982
/core/chains/evm/log @jmank88 @prashantkumar1982 @connorwstein
/core/chains/evm/logpoller @reductionista @connorwstein
/core/chains/cosmos @archseer @cfal
/core/chains/ @smartcontractkit/integrations

# Services
/core/services/cron @samsondav
/core/services/directrequest @connorwstein @samsondav
/core/services/feeds @jkongie
/core/services/fluxmonitorv2 @jkongie @PiotrTrzpil @connorwstein
/core/services/health @samsondav
/core/services/job @connorwstein
/core/services/keystore @RyanRHall
/core/services/ocr* @connorwstein @samsondav
/core/services/ocr2 @jmank88 @krehermann
/core/services/periodicbackup @PiotrTrzpil @samsondav
/core/services/pg @samsondav
/core/services/pipeline @connorwstein @prashantkumar1982
/core/services/synchronization
/core/services/telemetry
/core/services/relay/evm/mercury @samsondav @sdrug @martin-cll
/core/services/directrequest @smartcontractkit/keepers
/core/services/feeds @smartcontractkit/FMS

# To be deprecated in Chainlink V3
/core/services/fluxmonitorv2 @smartcontractkit/foundations
/core/services/job @smartcontractkit/ccip
/core/services/keystore @smartcontractkit/keepers
/core/services/ocr* @smartcontractkit/foundations
/core/services/periodicbackup @smartcontractkit/foundations
/core/services/pg @smartcontractkit/foundations @samsondav
/core/services/pipeline @smartcontractkit/foundations @smartcontractkit/integrations
/core/services/telemetry @smartcontractkit/realtime
/core/services/relay/evm/mercury @smartcontractkit/mercury-team
/core/services/webhook @smartcontractkit/foundations @smartcontractkit/integrations
/core/services/llo @smartcontractkit/mercury-team

# VRF-related services
/core/services/vrf @smartcontractkit/vrf-team
Expand All @@ -48,27 +40,16 @@
/core/services/keeper @smartcontractkit/keepers
/core/services/ocr2/plugins/ocr2keeper @smartcontractkit/keepers

/core/services/webhook @samsondav

# Chainlink Functions
core/services/functions @smartcontractkit/functions
core/services/ocr2/plugins/functions @smartcontractkit/functions
core/services/s4 @pinebit @bolekk
core/service/ocr2/plugins/s4 @pinebit @bolekk
core/services/ocr2/plugins/threshold @KuphJr @bolekk
core/services/relay/evm/functions.go @bolekk @justinkaseman @KuphJr
core/services/relay/evm/functions @bolekk @justinkaseman @KuphJr
core/services/s4 @smartcontractkit/functions
core/service/ocr2/plugins/s4 @smartcontractkit/functions
core/services/ocr2/plugins/threshold @smartcontractkit/functions
core/services/relay/evm/functions @smartcontractkit/functions
core/services/relay/evm/functions @smartcontractkit/functions
core/scripts/functions @smartcontractkit/functions
core/scripts/gateway @bolekk @pinebit

# API
/core/web @jkongie

# CLI
/core/cmd @jkongie @jmank88 @samsondav

# UI
/operator-ui/ @DeividasK @jkongie
core/scripts/gateway @smartcontractkit/functions

# Contracts
/contracts/ @RensR
Expand All @@ -78,23 +59,21 @@ core/scripts/gateway @bolekk @pinebit
# This could give some false positives, so afterwards we match on the project directories
# to ensure the entire directory is always owned by the correct team.

/contracts/**/*shared* @RensR
/contracts/**/*keeper* @smartcontractkit/keepers
/contracts/**/*upkeep* @smartcontractkit/keepers
/contracts/**/*automation* @smartcontractkit/keepers
/contracts/**/*functions* @smartcontractkit/functions
/contracts/**/*llo-feeds* @austinborn @Fletch153
/contracts/**/*llo-feeds* @smartcontrackit/mercury-team
/contracts/**/*vrf* @smartcontractkit/vrf-team
/contracts/**/*l2ep* @simsonraj
/contracts/**/*operatorforwarder* @essamhassan
/contracts/**/*l2ep* @smartcontractkit/integrations

/contracts/src/v0.8/automation @smartcontractkit/keepers
/contracts/src/v0.8/functions @smartcontractkit/functions
# TODO: interfaces folder, folder should be removed and files moved to the correct folders
/contracts/src/v0.8/l2ep @simsonraj
/contracts/src/v0.8/llo-feeds @austinborn @Fletch153
/contracts/src/v0.8/l2ep @chris-de-leon-cll
/contracts/src/v0.8/llo-feeds @smartcontractkit/mercury-team
# TODO: mocks folder, folder should be removed and files moved to the correct folders
/contracts/src/v0.8/operatorforwarder @essamhassan
/contracts/src/v0.8/operatorforwarder @smartcontractkit/foundations
/contracts/src/v0.8/shared @RensR
# TODO: tests folder, folder should be removed and files moved to the correct folders
# TODO: transmission folder, owner should be found
Expand All @@ -112,10 +91,7 @@ core/scripts/gateway @bolekk @pinebit
/integration-tests/**/*automation* @smartcontractkit/keepers

# CI/CD
/.github/** @chainchad @javuto @jkongie @jmank88 @samsondav
/.github/workflows/integration-tests.yml @smartcontractkit/test-tooling-team
/.github/workflows/integration-chaos-tests.yml @smartcontractkit/test-tooling-team
/.github/workflows/integration-tests-publish.yml @smartcontractkit/test-tooling-team
/.github/** @smartcontractkit/releng @smartcontractkit/test-tooling-team
/.github/workflows/performance-tests.yml @smartcontractkit/test-tooling-team
/.github/workflows/automation-ondemand-tests.yml @smartcontractkit/keepers
/.github/workflows/automation-benchmark-tests.yml @smartcontractkit/keepers
Expand All @@ -138,9 +114,5 @@ flake.nix @smartcontractkit/prodsec-public
flake.lock @smartcontractkit/prodsec-public

# Config
./core/config @samsondav @jmank88
./docs/CONFIG.md @samsondav @jmank88 @dwightjl
./internal/config/docs.toml @samsondav @jmank88 @dwightjl

# LOOP Plugins
/plugins @jmank88 @krehermann
./docs/CONFIG.md @smartcontractkit/foundations @smartcontractkit/devrel
./internal/config/docs.toml @smartcontractkit/foundations @smartcontractkit/devrel

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import {AutomationRegistryBase2_2} from "../v2_2/AutomationRegistryBase2_2.sol";
import {AutomationRegistryLogicA2_2} from "../v2_2/AutomationRegistryLogicA2_2.sol";
import {AutomationRegistryLogicB2_2} from "../v2_2/AutomationRegistryLogicB2_2.sol";
import {IAutomationRegistryMaster} from "../interfaces/v2_2/IAutomationRegistryMaster.sol";
import {AutomationCompatibleInterface} from "../../interfaces/AutomationCompatibleInterface.sol";

contract AutomationRegistry2_2_SetUp is BaseTest {
address internal constant LINK_ETH_FEED = 0x1111111111111111111111111111111111111110;
address internal constant FAST_GAS_FEED = 0x1111111111111111111111111111111111111112;
address internal constant LINK_TOKEN = 0x1111111111111111111111111111111111111113;
address internal constant ZERO_ADDRESS = address(0);

// Signer private keys used for these test
uint256 internal constant PRIVATE0 = 0x7b2e97fe057e6de99d6872a2ef2abf52c9b4469bc848c2465ac3fcd8d336e81d;
Expand Down Expand Up @@ -50,7 +52,8 @@ contract AutomationRegistry2_2_SetUp is BaseTest {
LINK_TOKEN,
LINK_ETH_FEED,
FAST_GAS_FEED,
address(forwarderLogic)
address(forwarderLogic),
ZERO_ADDRESS
);
AutomationRegistryLogicA2_2 logicA2_2 = new AutomationRegistryLogicA2_2(logicB2_2);
IAutomationRegistryMaster registry2_2 = IAutomationRegistryMaster(
Expand All @@ -72,6 +75,22 @@ contract AutomationRegistry2_2_LatestConfigDetails is AutomationRegistry2_2_SetU
}
}

contract AutomationRegistry2_2_CheckUpkeep is AutomationRegistry2_2_SetUp {
function testPreventExecutionOnCheckUpkeep() public {
IAutomationRegistryMaster registry = IAutomationRegistryMaster(
address(deployRegistry2_2(AutomationRegistryBase2_2.Mode(0)))
);

uint256 id = 1;
bytes memory triggerData = abi.encodePacked("trigger_data");

// The tx.origin is the DEFAULT_SENDER (0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38) of foundry
// Expecting a revert since the tx.origin is not address(0)
vm.expectRevert(abi.encodeWithSelector(IAutomationRegistryMaster.OnlySimulatedBackend.selector));
registry.checkUpkeep(id, triggerData);
}
}

contract AutomationRegistry2_2_SetConfig is AutomationRegistry2_2_SetUp {
event ConfigSet(
uint32 previousConfigBlockNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain
logicA.getLinkAddress(),
logicA.getLinkNativeFeedAddress(),
logicA.getFastGasFeedAddress(),
logicA.getAutomationForwarderLogic()
logicA.getAutomationForwarderLogic(),
logicA.getAllowedReadOnlyAddress()
)
Chainable(address(logicA))
{}
Expand Down Expand Up @@ -195,7 +196,9 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain
function simulatePerformUpkeep(
uint256 id,
bytes calldata performData
) external cannotExecute returns (bool success, uint256 gasUsed) {
) external returns (bool success, uint256 gasUsed) {
_preventExecution();

if (s_hotVars.paused) revert RegistryPaused();
Upkeep memory upkeep = s_upkeep[id];
(success, gasUsed) = _performUpkeep(upkeep.forwarder, upkeep.performGas, performData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {EnumerableSet} from "../../../vendor/openzeppelin-solidity/v4.7.3/contra
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/v0.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";
Expand All @@ -21,7 +20,7 @@ import {UpkeepFormat} from "../../interfaces/UpkeepTranscoderInterface.sol";
* AutomationRegistry and AutomationRegistryLogic
* @dev all errors, events, and internal functions should live here
*/
abstract contract AutomationRegistryBase2_2 is ConfirmedOwner, ExecutionPrevention {
abstract contract AutomationRegistryBase2_2 is ConfirmedOwner {
using Address for address;
using EnumerableSet for EnumerableSet.UintSet;
using EnumerableSet for EnumerableSet.AddressSet;
Expand Down Expand Up @@ -69,6 +68,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner, ExecutionPreventi
AggregatorV3Interface internal immutable i_fastGasFeed;
Mode internal immutable i_mode;
address internal immutable i_automationForwarderLogic;
address internal immutable i_allowedReadOnlyAddress;

/**
* @dev - The storage is gas optimised for one and only one function - transmit. All the storage accessed in transmit
Expand Down Expand Up @@ -138,6 +138,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner, ExecutionPreventi
error OnlyCallableByProposedPayee();
error OnlyCallableByUpkeepPrivilegeManager();
error OnlyPausedUpkeep();
error OnlySimulatedBackend();
error OnlyUnpausedUpkeep();
error ParameterLengthError();
error PaymentGreaterThanAllLINK();
Expand Down Expand Up @@ -449,19 +450,23 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner, ExecutionPreventi
* @param link address of the LINK Token
* @param linkNativeFeed address of the LINK/Native price feed
* @param fastGasFeed address of the Fast Gas price feed
* @param automationForwarderLogic the address of automation forwarder logic
* @param allowedReadOnlyAddress the address of the allowed read only address
*/
constructor(
Mode mode,
address link,
address linkNativeFeed,
address fastGasFeed,
address automationForwarderLogic
address automationForwarderLogic,
address allowedReadOnlyAddress
) ConfirmedOwner(msg.sender) {
i_mode = mode;
i_link = LinkTokenInterface(link);
i_linkNativeFeed = AggregatorV3Interface(linkNativeFeed);
i_fastGasFeed = AggregatorV3Interface(fastGasFeed);
i_automationForwarderLogic = automationForwarderLogic;
i_allowedReadOnlyAddress = allowedReadOnlyAddress;
}

// ================================================================
Expand Down Expand Up @@ -962,4 +967,13 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner, ExecutionPreventi
_;
s_hotVars.reentrancyGuard = false;
}

/**
* @notice only allows a pre-configured address to initiate offchain read
*/
function _preventExecution() internal view {
if (tx.origin != i_allowedReadOnlyAddress) {
revert OnlySimulatedBackend();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable {
logicB.getLinkAddress(),
logicB.getLinkNativeFeedAddress(),
logicB.getFastGasFeedAddress(),
logicB.getAutomationForwarderLogic()
logicB.getAutomationForwarderLogic(),
logicB.getAllowedReadOnlyAddress()
)
Chainable(address(logicB))
{}
Expand All @@ -49,7 +50,6 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable {
bytes memory triggerData
)
public
cannotExecute
returns (
bool upkeepNeeded,
bytes memory performData,
Expand All @@ -60,6 +60,8 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable {
uint256 linkNative
)
{
_preventExecution();

Trigger triggerType = _getTriggerType(id);
HotVars memory hotVars = s_hotVars;
Upkeep memory upkeep = s_upkeep[id];
Expand Down Expand Up @@ -172,7 +174,6 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable {
bytes calldata extraData
)
external
cannotExecute
returns (bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed)
{
bytes memory payload = abi.encodeWithSelector(CHECK_CALLBACK_SELECTOR, values, extraData);
Expand All @@ -190,9 +191,10 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable {
bytes memory payload
)
public
cannotExecute
returns (bool upkeepNeeded, bytes memory performData, UpkeepFailureReason upkeepFailureReason, uint256 gasUsed)
{
_preventExecution();

Upkeep memory upkeep = s_upkeep[id];
gasUsed = gasleft();
(bool success, bytes memory result) = upkeep.forwarder.getTarget().call{gas: s_storage.checkGasLimit}(payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 {
address link,
address linkNativeFeed,
address fastGasFeed,
address automationForwarderLogic
) AutomationRegistryBase2_2(mode, link, linkNativeFeed, fastGasFeed, automationForwarderLogic) {}
address automationForwarderLogic,
address allowedReadOnlyAddress
)
AutomationRegistryBase2_2(mode, link, linkNativeFeed, fastGasFeed, automationForwarderLogic, allowedReadOnlyAddress)
{}

// ================================================================
// | UPKEEP MANAGEMENT |
Expand Down Expand Up @@ -300,6 +303,10 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 {
return i_automationForwarderLogic;
}

function getAllowedReadOnlyAddress() external view returns (address) {
return i_allowedReadOnlyAddress;
}

function upkeepTranscoderVersion() public pure returns (UpkeepFormat) {
return UPKEEP_TRANSCODER_VERSION_BASE;
}
Expand Down
Loading

0 comments on commit f7d5cfe

Please sign in to comment.