Skip to content

Commit

Permalink
Merge branch 'develop' into BCI-3862-change-dsl-block-primitive-to-st…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
Farber98 committed Aug 8, 2024
2 parents 41794b9 + 2ac9d98 commit 7a9cef5
Show file tree
Hide file tree
Showing 126 changed files with 19,650 additions and 1,527 deletions.
5 changes: 5 additions & 0 deletions .changeset/eight-radios-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#added merging core/capabilities/ccip from https://github.com/smartcontractkit/ccip
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ updates:
directory: "/"
schedule:
interval: monthly
open-pull-requests-limit: 10
open-pull-requests-limit: 0
ignore:
# Old versions are pinned for libocr.
- dependency-name: github.com/libp2p/go-libp2p-core
Expand Down
32 changes: 28 additions & 4 deletions .github/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ runner-test-matrix:
test_env_type: k8s-remote-runner
runs_on: ubuntu-latest
test_cmd: cd integration-tests/ && go test soak/ocr_test.go -v -test.run ^TestOCRv1Soak$ -test.parallel=1 -timeout 30m -count=1 -json
test_config_override_required: true
test_secrets_required: true
test_inputs:
test_suite: soak

Expand Down Expand Up @@ -543,15 +545,37 @@ runner-test-matrix:
chainlink_upgrade_version: develop
pyroscope_env: ci-smoke-automation-upgrade-tests

- id: integration-tests/reorg/automation_reorg_test.go
- id: integration-tests/reorg/automation_reorg_test.go^TestAutomationReorg/registry_2_0
path: integration-tests/reorg/automation_reorg_test.go
runs_on: ubuntu-latest
test_env_type: k8s-remote-runner
test_env_type: docker
test_inputs:
test_suite: reorg
workflows:
- Run Automation On Demand Tests (TEST WORKFLOW)
test_cmd: cd integration-tests/reorg && DETACH_RUNNER=false go test -v -test.run ^TestAutomationReorg/registry_2_0 -test.parallel=1 -timeout 30m -count=1 -json
pyroscope_env: ci-automation-on-demand-reorg

- id: integration-tests/reorg/automation_reorg_test.go^TestAutomationReorg/registry_2_1
path: integration-tests/reorg/automation_reorg_test.go
runs_on: ubuntu-latest
test_env_type: docker
test_inputs:
test_suite: reorg
workflows:
- Run Automation On Demand Tests (TEST WORKFLOW)
test_cmd: cd integration-tests/reorg && DETACH_RUNNER=false go test -v -test.run ^TestAutomationReorg/registry_2_1 -test.parallel=2 -timeout 30m -count=1 -json
pyroscope_env: ci-automation-on-demand-reorg

- id: integration-tests/reorg/automation_reorg_test.go^TestAutomationReorg/registry_2_2
path: integration-tests/reorg/automation_reorg_test.go
runs_on: ubuntu-latest
test_env_type: docker
test_inputs:
test_suite: reorg
workflows:
- Run Automation On Demand Tests (TEST WORKFLOW)
test_cmd: cd integration-tests/reorg && DETACH_RUNNER=false go test -v -test.run ^TestAutomationReorg$ -test.parallel=7 -timeout 60m -count=1 -json
test_cmd: cd integration-tests/reorg && DETACH_RUNNER=false go test -v -test.run ^TestAutomationReorg/registry_2_2 -test.parallel=2 -timeout 30m -count=1 -json
pyroscope_env: ci-automation-on-demand-reorg

- id: integration-tests/chaos/automation_chaos_test.go
Expand All @@ -560,7 +584,7 @@ runner-test-matrix:
runs_on: ubuntu-latest
workflows:
- Run Automation On Demand Tests (TEST WORKFLOW)
test_cmd: cd integration-tests/chaos && DETACH_RUNNER=false go test -v -test.run ^TestAutomationChaos$ -test.parallel=15 -timeout 60m -count=1 -json
test_cmd: cd integration-tests/chaos && DETACH_RUNNER=false go test -v -test.run ^TestAutomationChaos$ -test.parallel=20 -timeout 60m -count=1 -json
pyroscope_env: ci-automation-on-demand-chaos
test_inputs:
test_suite: chaos
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/run-automation-ondemand-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,18 @@ jobs:
# Run reorg tests if enabled
if [[ "${{ github.event.inputs.enableReorg }}" == 'true' ]]; then
cat >> test_list.yaml <<EOF
- id: integration-tests/reorg/automation_reorg_test.go
- id: integration-tests/reorg/automation_reorg_test.go^TestAutomationReorg/registry_2_0
test_inputs:
chainlink_image: ${{ steps.determine-build.outputs.image }}
chainlink_version: ${{ steps.determine-build.outputs.version }}
- id: integration-tests/reorg/automation_reorg_test.go^TestAutomationReorg/registry_2_1
test_inputs:
chainlink_image: ${{ steps.determine-build.outputs.image }}
chainlink_version: ${{ steps.determine-build.outputs.version }}
- id: integration-tests/reorg/automation_reorg_test.go^TestAutomationReorg/registry_2_2
test_inputs:
chainlink_image: ${{ steps.determine-build.outputs.image }}
chainlink_version: ${{ steps.determine-build.outputs.version }}
EOF
fi
Expand Down
4 changes: 4 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ packages:
github.com/smartcontractkit/chainlink/v2/core/bridges:
interfaces:
ORM:
github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types:
interfaces:
CCIPOracle:
OracleCreator:
github.com/smartcontractkit/chainlink/v2/core/capabilities/remote/types:
interfaces:
Dispatcher:
Expand Down
18 changes: 5 additions & 13 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ gomod: ## Ensure chainlink's go dependencies are installed.
go mod download

.PHONY: gomodtidy
gomodtidy: ## Run go mod tidy on all modules.
go mod tidy
cd ./core/scripts && go mod tidy
cd ./integration-tests && go mod tidy
cd ./integration-tests/load && go mod tidy
cd ./dashboard-lib && go mod tidy
gomodtidy: gomods ## Run go mod tidy on all modules.
gomods tidy

.PHONY: docs
docs: ## Install and run pkgsite to view Go docs
Expand Down Expand Up @@ -89,12 +85,8 @@ abigen: ## Build & install abigen.
./tools/bin/build_abigen

.PHONY: generate
generate: abigen codecgen mockery protoc ## Execute all go:generate commands.
go generate -x ./...
cd ./core/scripts && go generate -x ./...
cd ./integration-tests && go generate -x ./...
cd ./integration-tests/load && go generate -x ./...
cd ./dashboard-lib && go generate -x ./...
generate: abigen codecgen mockery protoc gomods ## Execute all go:generate commands.
gomods -w go generate -x ./...
mockery

.PHONY: rm-mocked
Expand Down Expand Up @@ -136,7 +128,7 @@ presubmit: ## Format go files and imports.

.PHONY: gomods
gomods: ## Install gomods
go install github.com/jmank88/[email protected].1
go install github.com/jmank88/[email protected].3

.PHONY: mockery
mockery: $(mockery) ## Install mockery.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ THE SOFTWARE.


*All content residing under (1) “/contracts/src/v0.8/ccip”; (2)
“/core/gethwrappers/ccip”; (3) “/core/services/ocr2/plugins/ccip” are licensed
“/core/gethwrappers/ccip”; (3) “/core/services/ocr2/plugins/ccip”; (4) "/core/capabilities/ccip" are licensed
under “Business Source License 1.1” with a Change Date of May 23, 2027 and
Change License to “MIT License”

Expand Down
5 changes: 5 additions & 0 deletions contracts/.changeset/loud-lobsters-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/contracts': patch
---

auto: create a replication from v2_3 to v2_3_zksync
5 changes: 5 additions & 0 deletions contracts/.changeset/mean-zoos-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/contracts': patch
---

add OZ v0.5 contracts
1 change: 1 addition & 0 deletions contracts/.solhintignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
./src/v0.8/automation/libraries/internal/Cron.sol
./src/v0.8/automation/AutomationForwarder.sol
./src/v0.8/automation/AutomationForwarderLogic.sol
./src/v0.8/automation/ZKSyncAutomationForwarder.sol
./src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol
./src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol

Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/native_solc_compile_all_automation
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ compileContract automation/v2_3/AutomationUtils2_3.sol
compileContract automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol

compileContract automation/testhelpers/MockETHUSDAggregator.sol
compileContract automation/test/v2_3/WETH9.sol
compileContract automation/test/WETH9.sol
92 changes: 92 additions & 0 deletions contracts/src/v0.8/automation/ZKSyncAutomationForwarder.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.16;

import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol";

uint256 constant PERFORM_GAS_CUSHION = 5_000;

/**
* @title AutomationForwarder is a relayer that sits between the registry and the customer's target contract
* @dev The purpose of the forwarder is to give customers a consistent address to authorize against,
* which stays consistent between migrations. The Forwarder also exposes the registry address, so that users who
* want to programmatically interact with the registry (ie top up funds) can do so.
*/
contract ZKSyncAutomationForwarder {
/// @notice the user's target contract address
address private immutable i_target;

/// @notice the shared logic address
address private immutable i_logic;

IAutomationRegistryConsumer private s_registry;

constructor(address target, address registry, address logic) {
s_registry = IAutomationRegistryConsumer(registry);
i_target = target;
i_logic = logic;
}

/**
* @notice forward is called by the registry and forwards the call to the target
* @param gasAmount is the amount of gas to use in the call
* @param data is the 4 bytes function selector + arbitrary function data
* @return success indicating whether the target call succeeded or failed
*/
function forward(uint256 gasAmount, bytes memory data) external returns (bool success, uint256 gasUsed) {
if (msg.sender != address(s_registry)) revert();
address target = i_target;
gasUsed = gasleft();
assembly {
let g := gas()
// Compute g -= PERFORM_GAS_CUSHION and check for underflow
if lt(g, PERFORM_GAS_CUSHION) {
revert(0, 0)
}
g := sub(g, PERFORM_GAS_CUSHION)
// if g - g//64 <= gasAmount, revert
// (we subtract g//64 because of EIP-150)
if iszero(gt(sub(g, div(g, 64)), gasAmount)) {
revert(0, 0)
}
// solidity calls check that a contract actually exists at the destination, so we do the same
if iszero(extcodesize(target)) {
revert(0, 0)
}
// call with exact gas
success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0)
}
gasUsed = gasUsed - gasleft();
return (success, gasUsed);
}

function getTarget() external view returns (address) {
return i_target;
}

fallback() external {
// copy to memory for assembly access
address logic = i_logic;
// copied directly from OZ's Proxy contract
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())

// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), logic, 0, calldatasize(), 0, 0)

// Copy the returned data.
returndatacopy(0, 0, returndatasize())

switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
}
Loading

0 comments on commit 7a9cef5

Please sign in to comment.