Skip to content

Commit

Permalink
Merge branch 'develop' into enumberableSet
Browse files Browse the repository at this point in the history
  • Loading branch information
shileiwill authored Apr 22, 2024
2 parents af3b5db + 28df745 commit ed86b01
Show file tree
Hide file tree
Showing 260 changed files with 4,713 additions and 3,704 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-penguins-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Fix in memory data source cache changes/bug that only allowed pipeline results where none of the data sources failed. #bugfix
5 changes: 5 additions & 0 deletions .changeset/chilled-bikes-unite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#internal Add script to create test database user and update docs
5 changes: 5 additions & 0 deletions .changeset/four-shoes-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Removed AppConfig from Evm config #internal
5 changes: 5 additions & 0 deletions .changeset/fresh-lizards-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#internal Updates required to work with chainlink-common changes to support grpc streams for capabilities
6 changes: 6 additions & 0 deletions .changeset/hungry-ways-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"chainlink": patch
---

#bugfix
vrf fix replay number of blocks logic and add logging for job specs
5 changes: 5 additions & 0 deletions .changeset/lucky-ghosts-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

core/services/keystore: switch to sqlutil.DataStore #internal
5 changes: 5 additions & 0 deletions .changeset/orange-squids-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal Remote Trigger setup
5 changes: 5 additions & 0 deletions .changeset/plenty-wombats-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#wip Regenerate Keystone wrappers
7 changes: 7 additions & 0 deletions .changeset/stale-terms-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"chainlink": patch
---

Bump libocr => fd3cab206b2ca3b7ff207996b95673b2d6303ec4

#internal
5 changes: 4 additions & 1 deletion .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: CI lint for Golang
description: Runs CI lint for Golang
inputs:
# general inputs
id:
description: Unique metrics collection id
required: true
name:
description: Name of the lint action
default: lint
Expand Down Expand Up @@ -72,7 +75,7 @@ runs:
if: always()
uses: smartcontractkit/push-gha-metrics-action@dea9b546553cb4ca936607c2267a09c004e4ab3f # v3.0.0
with:
id: chainlink-golang-ci
id: chainlink-golang-ci-${{ inputs.id }}
basic-auth: ${{ inputs.gc-basic-auth }}
hostname: ${{ inputs.gc-host }}
org-id: ${{ inputs.gc-org-id }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
uses: ./.github/actions/golangci-lint
if: ${{ needs.filter.outputs.changes == 'true' }}
with:
id: core
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- name: Golang Lint
uses: ./.github/actions/golangci-lint
with:
id: scripts
name: lint-scripts
go-directory: core/scripts
go-version-file: core/scripts/go.mod
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/helm-chart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,29 @@ on:
jobs:
ci-lint-helm-charts:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
actions: read
steps:
- name: Add repositories
run: |
helm repo add mockserver https://www.mock-server.com
helm repo add opentelemetry-collector https://open-telemetry.github.io/opentelemetry-helm-charts
helm repo add tempo https://grafana.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
- name: ci-lint-helm-charts
uses: smartcontractkit/.github/actions/ci-lint-charts@6b08487b176ef7cad086526d0b54ddff6691c044 # ci-lint-charts@0.1.2
uses: smartcontractkit/.github/actions/ci-lint-charts@7fa39741b11e66ed59f8aad786d4b9356c389f3f # ci-lint-charts@0.2.0
with:
# chart testing inputs
chart-testing-extra-args: "--lint-conf=lintconf.yaml"
charts-dir: charts/chainlink-cluster
# grafana inputs
metrics-job-name: ci-lint-helm-charts
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}

ci-kubeconform:
runs-on: ubuntu-latest
steps:
- name: ci-kubeconform
uses: smartcontractkit/.github/actions/ci-kubeconform@1ae8a9a984814c4daf50aa96f03be2cba0ef3fec # [email protected]
with:
# kubeform inputs
charts-dir: charts/chainlink-cluster
# grafana inputs
metrics-job-name: ci-kubeconform
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ tools/clroot/db.sqlite3-wal
.DS_Store
.envrc
.env*
.dbenv
!charts/chainlink-cluster/.env.example
!.github/actions/setup-postgres/.env
.direnv
Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.devspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ builds:
post: ./tools/bin/goreleaser_utils build_post_hook {{ dir .Path }} {{ .Os }} {{ .Arch }}
env:
- CGO_ENABLED=1
- CC=$ZIG_EXEC cc -target x86_64-linux-gnu
- CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu
- CC=$ZIG_EXEC cc -target x86_64-linux-gnu -Wno-error=unused-command-line-argument
- CCX=$ZIG_EXEC c++ -target x86_64-linux-gnu -Wno-error=unused-command-line-argument
flags:
- -trimpath
- -buildmode=pie
Expand Down
4 changes: 4 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ testscripts: chainlink-test ## Install and run testscript against testdata/scrip
testscripts-update: ## Update testdata/scripts/* files via testscript.
make testscripts TS_FLAGS="-u"

.PHONY: setup-testdb
setup-testdb: ## Setup the test database.
./core/scripts/setup_testdb.sh

.PHONY: testdb
testdb: ## Prepares the test database.
go run . local db preparetest
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,20 +167,28 @@ go generate ./...

5. Prepare your development environment:

```bash
export CL_DATABASE_URL=postgresql://127.0.0.1:5432/chainlink_test?sslmode=disable
```
The tests require a postgres database. In turn, the environment variable
`CL_DATABASE_URL` must be set to value that can connect to `_test` database, and the user must be able to create and drop
the given `_test` database.

Note: Other environment variables should not be set for all tests to pass

6. Drop/Create test database and run migrations:
There helper script for initial setup to create an appropriate test user. It requires postgres to be running on localhost at port 5432. You will be prompted for
the `postgres` user password

```bash
make setup-testdb
```

This script will save the `CL_DATABASE_URL` in `.dbenv`

Changes to database require migrations to be run. Similarly, `pull`'ing the repo may require migrations to run.
After the one-time setup above:
```
source .dbenv
make testdb
```

If you do end up modifying the migrations for the database, you will need to rerun

7. Run tests:

```bash
Expand Down
5 changes: 5 additions & 0 deletions contracts/.changeset/old-pianos-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts": patch
---

#wip Add Capability Registry skeleton
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all_keystone
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ compileContract () {
"$ROOT"/contracts/src/v0.8/"$1"
}

compileContract keystone/CapabilityRegistry.sol
compileContract keystone/KeystoneForwarder.sol
compileContract keystone/OCR3Capability.sol
41 changes: 41 additions & 0 deletions contracts/src/v0.8/keystone/CapabilityRegistry.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {TypeAndVersionInterface} from "../interfaces/TypeAndVersionInterface.sol";
import {OwnerIsCreator} from "../shared/access/OwnerIsCreator.sol";

struct Capability {
// Capability type, e.g. "data-streams-reports"
// bytes32(string); validation regex: ^[a-z0-9_\-:]{1,32}$
// Not "type" because that's a reserved keyword in Solidity.
bytes32 capabilityType;
// Semver, e.g., "1.2.3"
// bytes32(string); must be valid Semver + max 32 characters.
bytes32 version;
}

contract CapabilityRegistry is OwnerIsCreator, TypeAndVersionInterface {
mapping(bytes32 => Capability) private s_capabilities;

event CapabilityAdded(bytes32 indexed capabilityId);

function typeAndVersion() external pure override returns (string memory) {
return "CapabilityRegistry 1.0.0";
}

function addCapability(Capability calldata capability) external onlyOwner {
bytes32 capabilityId = getCapabilityID(capability.capabilityType, capability.version);
s_capabilities[capabilityId] = capability;
emit CapabilityAdded(capabilityId);
}

function getCapability(bytes32 capabilityID) public view returns (Capability memory) {
return s_capabilities[capabilityID];
}

/// @notice This functions returns a Capability ID packed into a bytes32 for cheaper access
/// @return A unique identifier for the capability
function getCapabilityID(bytes32 capabilityType, bytes32 version) public pure returns (bytes32) {
return keccak256(abi.encodePacked(capabilityType, version));
}
}
21 changes: 21 additions & 0 deletions contracts/src/v0.8/keystone/test/CapabilityRegistry.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {Test} from "forge-std/Test.sol";
import {Capability, CapabilityRegistry} from "../CapabilityRegistry.sol";

contract CapabilityRegistryTest is Test {
function setUp() public virtual {}

function testAddCapability() public {
CapabilityRegistry capabilityRegistry = new CapabilityRegistry();

capabilityRegistry.addCapability(Capability("data-streams-reports", "1.0.0"));

bytes32 capabilityId = capabilityRegistry.getCapabilityID(bytes32("data-streams-reports"), bytes32("1.0.0"));
Capability memory capability = capabilityRegistry.getCapability(capabilityId);

assertEq(capability.capabilityType, "data-streams-reports");
assertEq(capability.version, "1.0.0");
}
}
Loading

0 comments on commit ed86b01

Please sign in to comment.