Skip to content

Commit

Permalink
Merge branch 'develop' into f_toml_config
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed Jan 23, 2024
2 parents 6466af8 + 388e779 commit 389ee01
Show file tree
Hide file tree
Showing 85 changed files with 8,561 additions and 838 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build-publish-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
env:
ECR_IMAGE_NAME: crib-chainlink-untrusted
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Git Short SHA
shell: bash
env:
Expand All @@ -36,10 +39,6 @@ jobs:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ROLE_TO_ASSUME: ${{ secrets.AWS_OIDC_IAM_ROLE_PUBLISH_PR_ARN }}

- name: Checkout repository
if: steps.check-image.outputs.exists == 'false'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Build and publish chainlink image
if: steps.check-image.outputs.exists == 'false'
uses: ./.github/actions/build-sign-publish-chainlink
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cmd: ["go_core_tests", "go_core_race_tests"]
cmd: ["go_core_tests", "go_core_race_tests", "go_core_fuzz"]
name: Core Tests (${{ matrix.cmd }})
runs-on: ubuntu20.04-64cores-256GB
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,13 @@ jobs:
file: ocr
pyroscope_env: ci-smoke-ocr-evm-simulated
- name: ocr2
nodes: 4
nodes: 6
os: ubuntu-latest
run: -run TestOCRv2JobReplacement
file: ocr2
pyroscope_env: ci-smoke-ocr2-evm-simulated
- name: ocr2
nodes: 4
nodes: 6
os: ubuntu-latest
pyroscope_env: ci-smoke-ocr2-plugins-evm-simulated
tag_suffix: "-plugins"
Expand Down Expand Up @@ -481,7 +481,7 @@ jobs:
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ github.sha }}${{ matrix.product.tag_suffix }}
aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }}
artifacts_name: ${{ matrix.product.name }}-test-logs
artifacts_name: ${{ matrix.product.name }}${{ matrix.product.tag_suffix }}-test-logs
artifacts_location: ./integration-tests/smoke/logs/
publish_check_name: ${{ matrix.product.name }}
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,12 @@ go.work*
# This sometimes shows up for some reason
tools/flakeytests/coverage.txt

# Integration tests create these files
.test_summary/
.run.id

overrides.toml
# Fuzz tests can create these files
**/testdata/fuzz/*

# Runtime test configuration that might contain secrets
overrides.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ spec:
selector:
matchLabels:
app: {{ $.Release.Name }}-db
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: db
havoc-network-group: db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
template:
metadata:
labels:
app: {{ $.Release.Name }}-db
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: db
havoc-network-group: db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
{{- range $key, $value := $.Values.labels }}
Expand Down
25 changes: 19 additions & 6 deletions charts/chainlink-cluster/templates/chainlink-node-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $.Release.Name }}-{{ $cfg.name }}
name: {{ if eq $index 0 }}{{ $.Release.Name }}-{{ $cfg.name }}-bootstrap{{ else }}{{ $.Release.Name }}-{{ $cfg.name }}{{ end }}
spec:
strategy:
# Need to recreate the pod to deal with lease lock held by old pod.
type: Recreate
selector:
matchLabels:
app: {{ $.Release.Name }}
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
{{ if eq $index 0 }}{{ else }}
havoc-component-group: node
{{ end }}
{{ if eq $index 0 }}{{ else }}
havoc-network-group: {{ if gt $index 2 }}"1"{{ else }}"2"{{ end }}
{{ end }}
instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
template:
metadata:
labels:
app: {{ $.Release.Name }}
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
{{ if eq $index 0 }}{{ else }}
havoc-component-group: node
{{ end }}
{{ if eq $index 0 }}{{ else }}
havoc-network-group: {{ if gt $index 2 }}"1"{{ else }}"2"{{ end }}
{{ end }}

instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
# Used for testing. Role value should either be: bootstrap or node.
# There should only be one "bootstrap" node, the rest should be "node".
# Here we set the first node to be bootstrap, the rest to be node.
role: {{ if eq $index 0 }}bootstrap{{ else }}node{{ end }}
{{- range $key, $value := $.Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
Expand All @@ -43,7 +56,7 @@ spec:
{{- toYaml $.Values.chainlink.securityContext | nindent 12 }}
image: {{ default "public.ecr.aws/chainlink/chainlink" $cfg.image }}
imagePullPolicy: Always
command: ["bash", "-c", "while ! pg_isready -U postgres --host {{ $.Release.Name }}-db-{{ $cfg.name }} --port 5432; do echo \"waiting for database to start\"; sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials"]
command: [ "bash", "-c", "while ! pg_isready -U postgres --host {{ $.Release.Name }}-db-{{ $cfg.name }} --port 5432; do echo \"waiting for database to start\"; sleep 1; done && chainlink -c /etc/node-secrets-volume/default.toml -c /etc/node-secrets-volume/overrides.toml -secrets /etc/node-secrets-volume/secrets.toml node start -d -p /etc/node-secrets-volume/node-password -a /etc/node-secrets-volume/apicredentials --vrfpassword=/etc/node-secrets-volume/apicredentials" ]
ports:
- name: access
containerPort: {{ $.Values.chainlink.web_port }}
Expand Down
8 changes: 8 additions & 0 deletions charts/chainlink-cluster/templates/geth-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ spec:
selector:
matchLabels:
app: geth
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: "blockchain"
havoc-network-group: "blockchain"
release: {{ .Release.Name }}
template:
metadata:
labels:
app: geth
# Used for testing.
# havoc-component-group and havoc-network-group are used by "havoc" chaos testing tool
havoc-component-group: "blockchain"
havoc-network-group: "blockchain"
release: {{ .Release.Name }}
annotations:
{{- range $key, $value := .Values.podAnnotations }}
Expand Down
27 changes: 0 additions & 27 deletions charts/chainlink-cluster/templates/networkpolicy-default-deny.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions charts/chainlink-cluster/templates/networkpolicy-default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: default
spec:
podSelector:
matchLabels: {}
policyTypes:
- Ingress
- Egress
ingress:
{{- if and .Values.networkPolicyDefault.ingress.allowCustomCidrs (not (empty .Values.networkPolicyDefault.ingress.customCidrs)) }}
# Using a comma separated list to make it easy to pass in with:
# `helm template ... --set networkPolicyDefault.ingress.customCidrs=...`
{{- $cidrs := splitList "," .Values.networkPolicyDefault.ingress.customCidrs }}
- from:
{{- range $cidr := $cidrs }}
- ipBlock:
cidr: {{ $cidr | quote }}
{{- end }}
{{- else }}
# Deny all ingress if no rules are specified. Rules can still be specified in other templates.
- {}
{{- end }}
egress:
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: "{{ $.Release.Namespace }}"
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
k8s-app: kube-dns
ports:
- protocol: TCP
port: 53
- protocol: UDP
port: 53
9 changes: 9 additions & 0 deletions charts/chainlink-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,12 @@ podAnnotations:
nodeSelector:
tolerations:
affinity:

# Configure the default network policy.
networkPolicyDefault:
ingress:
allowCustomCidrs: false
# String of comma separated CIDRs
customCidrs: null
# Example:
# customCidrs: "10.0.0.0/16,192.168.0.1/24"
3 changes: 2 additions & 1 deletion common/txmgr/confirmer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ import (
"github.com/prometheus/client_golang/prometheus/promauto"
"go.uber.org/multierr"

commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex"

"github.com/smartcontractkit/chainlink-common/pkg/chains/label"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services"
commonhex "github.com/smartcontractkit/chainlink-common/pkg/utils/hex"
"github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox"

"github.com/smartcontractkit/chainlink/v2/common/client"
Expand Down
1 change: 1 addition & 0 deletions contracts/scripts/native_solc_compile_all_shared
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ compileContract shared/token/ERC677/BurnMintERC677.sol
compileContract shared/token/ERC677/LinkToken.sol
compileContract shared/mocks/WERC20Mock.sol
compileContract vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/ERC20.sol
compileContract shared/test/helpers/ChainReaderTestContract.sol
117 changes: 117 additions & 0 deletions contracts/src/v0.8/shared/test/helpers/ChainReaderTestContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8;

struct TestStruct {
int32 Field;
string DifferentField;
uint8 OracleId;
uint8[32] OracleIds;
address Account;
address[] Accounts;
int192 BigField;
MidLevelTestStruct NestedStruct;
}

struct MidLevelTestStruct {
bytes2 FixedBytes;
InnerTestStruct Inner;
}

struct InnerTestStruct {
int64 IntVal;
string S;
}

contract LatestValueHolder {
event Triggered(
int32 indexed field,
string differentField,
uint8 oracleId,
uint8[32] oracleIds,
address Account,
address[] Accounts,
int192 bigField,
MidLevelTestStruct nestedStruct
);

event TriggeredEventWithDynamicTopic(string indexed fieldHash, string field);

// First topic is event hash
event TriggeredWithFourTopics(int32 indexed field1, int32 indexed field2, int32 indexed field3);

TestStruct[] private s_seen;
uint64[] private s_arr;

constructor() {
// See chain_reader_interface_tests.go in chainlink-relay
s_arr.push(3);
s_arr.push(4);
}

function addTestStruct(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct
) public {
s_seen.push(TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct));
}

function returnSeen(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct
) public pure returns (TestStruct memory) {
return TestStruct(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct);
}

function getElementAtIndex(uint256 i) public view returns (TestStruct memory) {
// See chain_reader_interface_tests.go in chainlink-relay
return s_seen[i - 1];
}

function getPrimitiveValue() public pure returns (uint64) {
// See chain_reader_interface_tests.go in chainlink-relay
return 3;
}

function getDifferentPrimitiveValue() public pure returns (uint64) {
// See chain_reader_interface_tests.go in chainlink-relay
return 1990;
}

function getSliceValue() public view returns (uint64[] memory) {
return s_arr;
}

function triggerEvent(
int32 field,
string calldata differentField,
uint8 oracleId,
uint8[32] calldata oracleIds,
address account,
address[] calldata accounts,
int192 bigField,
MidLevelTestStruct calldata nestedStruct
) public {
emit Triggered(field, differentField, oracleId, oracleIds, account, accounts, bigField, nestedStruct);
}

function triggerEventWithDynamicTopic(string calldata field) public {
emit TriggeredEventWithDynamicTopic(field, field);
}

// first topic is the event signature
function triggerWithFourTopics(int32 field1, int32 field2, int32 field3) public {
emit TriggeredWithFourTopics(field1, field2, field3);
}
}
Loading

0 comments on commit 389ee01

Please sign in to comment.