-
Notifications
You must be signed in to change notification settings - Fork 327
Initial CBTC BTC Implementation #4443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 2cf4156 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…es Adapters - Added @chainlink/dlc-cbtc-btc-attester-por-adapter for querying Bitcoin reserves. - Introduced @chainlink/dlc-cbtc-canton-digital-assets-por-adapter for retrieving total CBTC supply from the Digital Asset API. - Updated .pnp.cjs and .yarnrc.yml to reflect new package references and enabled ESM loader. - Created necessary configuration, endpoints, and transport layers for both adapters. - Included comprehensive tests for both adapters to ensure functionality and accuracy.
- Added dependencies for Bitcoin address calculation: bip32, bitcoinjs-lib, and tiny-secp256k1. - Introduced CHANGELOG.md for the @chainlink/dlc-cbtc-btc-por-adapter, documenting the initial release and key features. - Updated README.md to reflect changes in configuration and functionality. - Implemented address calculation logic in address.ts, ensuring trustless verification against the Attester API. - Enhanced reserves calculation logic in por.ts, including confirmation counting and pending spend handling. - Added comprehensive unit and integration tests to validate the adapter's functionality.
mmcallister-cll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look like the correct structure. We don't have instances of nested EAs under a since source EA. You might want to consider separating these out into multiple packages/sources EAs for discrete APIs and/or packages/composites for EAs that call other EAs.
0181e81 to
0226225
Compare
cd12877 to
23e9fcd
Compare
- Updated configuration to use `ATTESTER_API_URLS` as a comma-separated list of URLs. - Introduced utility functions `parseUrls` and `medianBigInt` for handling URL parsing and median calculation. - Modified transport logic to query multiple attesters and calculate reserves independently. - Adjusted integration and unit tests to accommodate changes in configuration and functionality.
- Updated configuration to utilize `ATTESTER_API_URLS` for multiple attester endpoints. - Added utility functions `buildUrl`, `parseUrls`, and `medianBigInt` for improved URL handling and median calculations. - Modified transport logic to fetch data from multiple attesters in parallel and compute the median supply. - Adjusted integration and unit tests to reflect the new configuration and functionality.
- Introduced the new adapter for CBTC Proof of Reserves, supporting multiple endpoints: `attesterSupply`, `daSupply`, and `reserves`. - Added configuration options for API URLs and execution intervals. - Developed utility functions for URL handling and median calculations. - Created integration and unit tests to validate the adapter's functionality and ensure accurate responses. - Removed the deprecated BTC PoR adapter and its associated files to streamline the codebase.
* update changeset, remove unused test-payload file * removing customInputValidation on required config
Closes #DS-990
Description
Adds a new CBTC Bitcoin Proof of Reserves adapter that queries Bitcoin blockchain UTXOs directly to verify BTC reserves across configured vault addresses.
Changes
@chainlink/dlc-cbtc-btc-por-adapterpackageSteps to Test
Build the adapter:
Run unit tests:
Start the adapter locally:
Query the reserves endpoint:
Verify the response returns total reserves in satoshis:
{ "result": 301089400, "data": { "result": 301089400 }, "statusCode": 200 }Quality Assurance
If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant
infra-k8sconfiguration file.If a new adapter was made, or an existing one was modified so that its environment variables have changed, update the relevant
adapter-secretsconfiguration file.If a new adapter was made, or a new endpoint was added, update the
test-payload.jsonfile with relevant requests.The branch naming follows git flow (
feature/x,chore/x,release/x,hotfix/x,fix/x) or is created from Jira.This is related to a maximum of one Jira story or GitHub issue.
Types are safe (avoid TypeScript/TSLint features like any and disable, instead use more specific types).
All code changes have 100% unit and integration test coverage. If testing is not applicable or too difficult to justify doing, the reasoning should be documented explicitly in the PR.