Skip to content

Commit

Permalink
Merge branch 'develop' into vrfv2plus-unique-request-id
Browse files Browse the repository at this point in the history
  • Loading branch information
jinhoonbang committed Mar 13, 2024
2 parents 74d44a1 + 594a7f0 commit 91717d9
Show file tree
Hide file tree
Showing 96 changed files with 7,064 additions and 1,794 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-toes-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

HeadTracker now respects the `FinalityTagEnabled` config option. If the flag is enabled, HeadTracker backfills blocks up to the latest finalized block provided by the corresponding RPC call. To address potential misconfigurations, `HistoryDepth` is now calculated from the latest finalized block instead of the head. NOTE: Consumers (e.g. TXM and LogPoller) do not fully utilize Finality Tag yet.
5 changes: 5 additions & 0 deletions .changeset/mighty-timers-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

make reserveAmounts to be a map
5 changes: 5 additions & 0 deletions .changeset/swift-bobcats-punch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

add liquidity pool for automation 2.3
91 changes: 91 additions & 0 deletions .github/scripts/crib/lib/check-route53-records.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { setTimeout } from "node:timers/promises";
import {
Route53Client,
ListResourceRecordSetsCommand,
} from "@aws-sdk/client-route-53";

// us-east-1 is the global region used by Route 53.
const route53Client = new Route53Client({ region: "us-east-1" });

async function paginateListResourceRecordSets(route53Client, params) {
let isTruncated = true;
let nextRecordName, nextRecordType;
let allRecordSets = [];

while (isTruncated) {
const response = await route53Client.send(
new ListResourceRecordSetsCommand({
...params,
...(nextRecordName && { StartRecordName: nextRecordName }),
...(nextRecordType && { StartRecordType: nextRecordType }),
})
);

allRecordSets = allRecordSets.concat(response.ResourceRecordSets);
isTruncated = response.IsTruncated;
if (isTruncated) {
nextRecordName = response.NextRecordName;
nextRecordType = response.NextRecordType;
}
}

return allRecordSets;
}

/**
* Check if Route 53 records exist for a given Route 53 zone.
*
* @param {string} hostedZoneId The ID of the hosted zone.
* @param {string[]} recordNames An array of record names to check.
* @param {number} maxRetries The maximum number of retries.
* @param {number} initialBackoffMs The initial backoff time in milliseconds.
* @returns {Promise<boolean>} True if records exist, false otherwise.
*/
export async function route53RecordsExist(
hostedZoneId,
recordNames,
maxRetries = 8,
initialBackoffMs = 2000
) {
let attempts = 0;

// We try to gather all records within a specified time limit.
// We issue retries due to an indeterminate amount of time required
// for record propagation.
console.info("Checking DNS records in Route 53...");
while (attempts < maxRetries) {
try {
const allRecordSets = await paginateListResourceRecordSets(
route53Client,
{
HostedZoneId: hostedZoneId,
MaxItems: "300",
}
);

const recordExists = recordNames.every((name) =>
allRecordSets.some((r) => r.Name.includes(name))
);

if (recordExists) {
console.info("All records found in Route 53.");
return true;
}

// If any record is not found, throw an error to trigger a retry
throw new Error(
"One or more DNS records not found in Route 53, retrying..."
);
} catch (error) {
console.error(`Attempt ${attempts + 1}:`, error.message);
if (attempts === maxRetries - 1) {
return false; // Return false after the last attempt
}
// Exponential backoff
await setTimeout(initialBackoffMs * 2 ** attempts);
attempts++;
}
}
// Should not reach here if retries are exhausted
return false;
}
Loading

0 comments on commit 91717d9

Please sign in to comment.