Skip to content

Commit

Permalink
Merge branch 'develop' into BCI-2702-Apply-LimitMultiplier-to-gas-lim…
Browse files Browse the repository at this point in the history
…it-in-all-gas-estimators
  • Loading branch information
silaslenihan authored Mar 22, 2024
2 parents c39b995 + 9457e5f commit a91e13f
Show file tree
Hide file tree
Showing 45 changed files with 1,494 additions and 286 deletions.
5 changes: 5 additions & 0 deletions .changeset/chilled-buses-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

Dispatcher service for external peering
5 changes: 5 additions & 0 deletions .changeset/friendly-adults-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

change auto 2.3 flat fees from link to USD
43 changes: 43 additions & 0 deletions .github/workflows/build-publish-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,49 @@ jobs:
dockerhub_username: ${{ secrets.DOCKERHUB_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_READONLY_PASSWORD }}
git-commit-sha: ${{ steps.git-ref.outputs.checked-out || github.sha }}

- name: Setup GAP
# Don't run for plugins.
if: matrix.image.name == ''
uses: smartcontractkit/.github/actions/setup-gap@1bc7ce34fa81fffcb4a6eb0e4e12e59d94d0fc8f # [email protected]
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_ARN }}
api-gateway-host: ${{ secrets.AWS_API_GW_HOST_K8S_SAND }}
use-k8s: "true"
k8s-cluster-name: ${{ secrets.AWS_EKS_CLUSTER_NAME_SAND }}
use-private-ecr-registry: true
ecr-private-registry: ${{ secrets.AWS_ACCOUNT_ID_PROD }}
metrics-job-name: push-chainlink-develop ${{ matrix.image.name }}
gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }}
gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }}
gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }}

# A mutable image tag is used for these CRIBs and it was just built/published
# from this workflow. The deployment has an `imagePullPolicy: Always` set, so
# we need to restart the deployments to pick up the new image.
- name: Restart K8s Deployments for CRIBs
# Don't run for plugins.
if: matrix.image.name == ''
shell: bash
run: |
set -euo pipefail
# Removes the "smartcontractkit/" (org name) prefix.
REPO_NAME_ONLY="${GITHUB_REPOSITORY##*/}"
K8S_NAMESPACE="crib-${REPO_NAME_ONLY}-develop"
deployment_node_names=$(kubectl --namespace "${K8S_NAMESPACE}" \
get deployments \
-l "app=${K8S_NAMESPACE}" \
-o custom-columns=:metadata.name --no-headers)
IFS=$'\n' read -r -d '' -a deployment_names_arr <<< "$deployment_node_names" || :
for name in "${deployment_names_arr[@]}"; do
echo "Restarting deployment: $name"
kubectl --namespace "${K8S_NAMESPACE}" \
rollout restart "deployment/${name}"
done
- name: Collect Metrics
if: always()
id: collect-gha-metrics
Expand Down
45 changes: 0 additions & 45 deletions .github/workflows/build-publish-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,51 +53,6 @@ jobs:
dockerhub_username: ${{ secrets.DOCKERHUB_READONLY_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_READONLY_PASSWORD }}

- name: Get PR labels
id: pr-labels
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
run: |
RESPONSE=$(gh pr view ${PR_NUMBER} --json labels)
# Check if the labels command was successful
if [[ $? -ne 0 ]]; then
echo "Error fetching labels"
exit 1
fi
echo "RESPONSE=${RESPONSE}"
LABELS=$(echo "$RESPONSE" | jq -r '.labels | map(.name) | join(", ")')
# Check if any labels were found
if [[ -z "${LABELS:-}" ]]; then
echo "No labels found"
else
echo "labels=${LABELS}" | tee -a "${GITHUB_OUTPUT}"
fi
- name: Setup GAP
if: contains(steps.pr-labels.outputs.labels, 'crib')
uses: smartcontractkit/.github/actions/setup-gap@main
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-role-arn: ${{ secrets.AWS_OIDC_IAM_ROLE_PUBLISH_PR_ARN }}
api-gateway-host: ${{ secrets.AWS_API_GW_HOST_ARGO_SAND }}
use-argocd: "true"
argocd-user: ${{ secrets.ARGOCD_USER_SAND }}
argocd-pass: ${{ secrets.ARGOCD_PASS_SAND }}

# Run an Argo CD sync after the image is built.
- name: Argo CD App Sync
if: contains(steps.pr-labels.outputs.labels, 'crib')
shell: bash
env:
PR_NUMBER: ${{ github.event.number }}
run: |
argocd app sync \
--plaintext \
--grpc-web \
--async \
"crib-chainlink-${PR_NUMBER}"
- name: Collect Metrics
if: always()
id: collect-gha-metrics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ kind: Deployment
{{ end }}
metadata:
name: {{ $.Release.Name }}-{{ $cfg.name }}-db
labels:
app: {{ $.Release.Name }}-db
instance: {{ $cfg.name }}-db
release: {{ $.Release.Name }}
spec:
{{ if $.Values.db.stateful }}
serviceName: {{ $.Release.Name }}-db-${{ $cfg.name }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ spec:
- podSelector:
matchLabels:
app: {{ $.Release.Name }}
# Allow all runner pods to access the database pods.
- podSelector:
matchLabels:
app: runner
ports:
- protocol: TCP
port: 5432
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ if eq $index 0 }}{{ $.Release.Name }}-{{ $cfg.name }}-bootstrap{{ else }}{{ $.Release.Name }}-{{ $cfg.name }}{{ end }}
labels:
app: {{ $.Release.Name }}
instance: {{ $cfg.name }}
release: {{ $.Release.Name }}
{{- range $key, $value := $.Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
strategy:
# Need to recreate the pod to deal with lease lock held by old pod.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@ spec:
policyTypes:
- Ingress
ingress:
# Allow all ingress traffic between the node pods and from runner pod.
# Allow all ingress traffic between the node pods.
- from:
- podSelector:
matchLabels:
app: {{ $.Release.Name }}
- podSelector:
matchLabels:
app: runner
{{- end }}
4 changes: 4 additions & 0 deletions charts/chainlink-cluster/templates/geth-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: geth-{{ $cfg.networkId }}
labels:
app: geth
release: {{ $.Release.Name }}
instance: geth-{{ $cfg.networkId }}
spec:
selector:
matchLabels:
Expand Down
4 changes: 0 additions & 4 deletions charts/chainlink-cluster/templates/geth-networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ spec:
- podSelector:
matchLabels:
app: {{ $.Release.Name }}
# Allow http and websocket connections from the runner pods.
- podSelector:
matchLabels:
app: runner
ports:
- protocol: TCP
port: 8544
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ spec:
- podSelector:
matchLabels:
app: {{ $.Release.Name }}
# Allow http traffic from the runner pods.
- podSelector:
matchLabels:
app: runner
ports:
- protocol: TCP
port: 1080
Expand Down
5 changes: 5 additions & 0 deletions contracts/.changeset/smooth-spiders-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts": patch
---

change auto 2.3 flat fees from link to USD

Large diffs are not rendered by default.

66 changes: 43 additions & 23 deletions contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ contract SetConfig is SetUp {
AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1);
billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_000,
flatFeeMicroLink: 20_000,
flatFeeMilliCents: 20_000,
priceFeed: 0x2222222222222222222222222222222222222222,
fallbackPrice: 2_000_000_000, // $20
minSpend: 100_000
Expand Down Expand Up @@ -348,7 +348,7 @@ contract SetConfig is SetUp {

AutomationRegistryBase2_3.BillingConfig memory config = registry.getBillingTokenConfig(billingTokenAddress);
assertEq(config.gasFeePPB, 5_000);
assertEq(config.flatFeeMicroLink, 20_000);
assertEq(config.flatFeeMilliCents, 20_000);
assertEq(config.priceFeed, 0x2222222222222222222222222222222222222222);
assertEq(config.minSpend, 100_000);

Expand All @@ -369,14 +369,14 @@ contract SetConfig is SetUp {
AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](2);
billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_001,
flatFeeMicroLink: 20_001,
flatFeeMilliCents: 20_001,
priceFeed: 0x2222222222222222222222222222222222222221,
fallbackPrice: 100,
minSpend: 100
});
billingConfigs[1] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_002,
flatFeeMicroLink: 20_002,
flatFeeMilliCents: 20_002,
priceFeed: 0x2222222222222222222222222222222222222222,
fallbackPrice: 200,
minSpend: 200
Expand All @@ -401,14 +401,14 @@ contract SetConfig is SetUp {

AutomationRegistryBase2_3.BillingConfig memory config1 = registry.getBillingTokenConfig(billingTokenAddress1);
assertEq(config1.gasFeePPB, 5_001);
assertEq(config1.flatFeeMicroLink, 20_001);
assertEq(config1.flatFeeMilliCents, 20_001);
assertEq(config1.priceFeed, 0x2222222222222222222222222222222222222221);
assertEq(config1.fallbackPrice, 100);
assertEq(config1.minSpend, 100);

AutomationRegistryBase2_3.BillingConfig memory config2 = registry.getBillingTokenConfig(billingTokenAddress2);
assertEq(config2.gasFeePPB, 5_002);
assertEq(config2.flatFeeMicroLink, 20_002);
assertEq(config2.flatFeeMilliCents, 20_002);
assertEq(config2.priceFeed, 0x2222222222222222222222222222222222222222);
assertEq(config2.fallbackPrice, 200);
assertEq(config2.minSpend, 200);
Expand All @@ -429,7 +429,7 @@ contract SetConfig is SetUp {
AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs1 = new AutomationRegistryBase2_3.BillingConfig[](1);
billingConfigs1[0] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_001,
flatFeeMicroLink: 20_001,
flatFeeMilliCents: 20_001,
priceFeed: 0x2222222222222222222222222222222222222221,
fallbackPrice: 100,
minSpend: 100
Expand All @@ -445,7 +445,7 @@ contract SetConfig is SetUp {
AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs2 = new AutomationRegistryBase2_3.BillingConfig[](1);
billingConfigs2[0] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_002,
flatFeeMicroLink: 20_002,
flatFeeMilliCents: 20_002,
priceFeed: 0x2222222222222222222222222222222222222222,
fallbackPrice: 200,
minSpend: 200
Expand Down Expand Up @@ -481,7 +481,7 @@ contract SetConfig is SetUp {

AutomationRegistryBase2_3.BillingConfig memory config2 = registry.getBillingTokenConfig(billingTokenAddress2);
assertEq(config2.gasFeePPB, 5_002);
assertEq(config2.flatFeeMicroLink, 20_002);
assertEq(config2.flatFeeMilliCents, 20_002);
assertEq(config2.priceFeed, 0x2222222222222222222222222222222222222222);
assertEq(config2.fallbackPrice, 200);
assertEq(config2.minSpend, 200);
Expand All @@ -503,14 +503,14 @@ contract SetConfig is SetUp {
AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](2);
billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_001,
flatFeeMicroLink: 20_001,
flatFeeMilliCents: 20_001,
priceFeed: 0x2222222222222222222222222222222222222221,
fallbackPrice: 100,
minSpend: 100
});
billingConfigs[1] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_002,
flatFeeMicroLink: 20_002,
flatFeeMilliCents: 20_002,
priceFeed: 0x2222222222222222222222222222222222222222,
fallbackPrice: 200,
minSpend: 200
Expand All @@ -537,7 +537,7 @@ contract SetConfig is SetUp {
AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1);
billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({
gasFeePPB: 5_000,
flatFeeMicroLink: 20_000,
flatFeeMilliCents: 20_000,
priceFeed: 0x2222222222222222222222222222222222222222,
fallbackPrice: 2_000_000_000, // $20
minSpend: 100_000
Expand Down Expand Up @@ -665,14 +665,14 @@ contract NOPsSettlement is SetUp {
registry.transmit(reportContext, reportBytes, rs, ss, vs);

// verify transmitters have positive balances
(bool active, uint8 index, uint96 balance, uint96 lastCollected, ) = registry.getTransmitterInfo(TRANSMITTERS[1]);
assertTrue(active);
assertEq(1, index);
assertTrue(balance > 0);
assertEq(0, lastCollected);

uint256[] memory payments = new uint256[](TRANSMITTERS.length);
for (uint256 i = 0; i < payments.length; i++) {
for (uint256 i = 0; i < TRANSMITTERS.length; i++) {
(bool active, uint8 index, uint96 balance, uint96 lastCollected, ) = registry.getTransmitterInfo(TRANSMITTERS[i]);
assertTrue(active);
assertEq(i, index);
assertTrue(balance > 0);
assertEq(0, lastCollected);

payments[i] = balance;
}

Expand All @@ -683,10 +683,12 @@ contract NOPsSettlement is SetUp {
registry.settleNOPsOffchain();

// verify that transmitters balance has been zeroed out
(active, index, balance, , ) = registry.getTransmitterInfo(TRANSMITTERS[2]);
assertTrue(active);
assertEq(2, index);
assertEq(0, balance);
for (uint256 i = 0; i < TRANSMITTERS.length; i++) {
(bool active, uint8 index, uint96 balance, uint96 lastCollected, ) = registry.getTransmitterInfo(TRANSMITTERS[i]);
assertTrue(active);
assertEq(i, index);
assertEq(0, balance);
}
}

function testDisableOffchainPaymentsRevertDueToUnauthorizedCaller() public {
Expand Down Expand Up @@ -880,3 +882,21 @@ contract OnTokenTransfer is SetUp {
assertEq(registry.getBalance(linkUpkeepID), beforeBalance + 100);
}
}

contract GetMinBalanceForUpkeep is SetUp {
function test_accountsForFlatFee() public {
// set fee to 0
AutomationRegistryBase2_3.BillingConfig memory usdTokenConfig = registry.getBillingTokenConfig(address(usdToken));
usdTokenConfig.flatFeeMilliCents = 0;
_updateBillingTokenConfig(registry, address(usdToken), usdTokenConfig);

uint256 minBalanceBefore = registry.getMinBalanceForUpkeep(usdUpkeepID);

// set fee to non-zero
usdTokenConfig.flatFeeMilliCents = 100;
_updateBillingTokenConfig(registry, address(usdToken), usdTokenConfig);

uint256 minBalanceAfter = registry.getMinBalanceForUpkeep(usdUpkeepID);
assertEq(minBalanceAfter, minBalanceBefore + (uint256(usdTokenConfig.flatFeeMilliCents) * 1e13));
}
}
Loading

0 comments on commit a91e13f

Please sign in to comment.