From fa48bb214ca10ec7a406034a8cfe4cd4b03cabda Mon Sep 17 00:00:00 2001 From: Will Winder Date: Wed, 27 Mar 2024 09:24:09 -0400 Subject: [PATCH 1/5] chore: Add comment about USDC attestations endpoint. --- core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go index 1978ee61d5..5986d60411 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go @@ -231,6 +231,10 @@ func (s *TokenDataReader) getUsdcTokenEndOffset(msg cciptypes.EVM2EVMOnRampCCIPS return usdcTokenEndOffset, nil } +// callAttestationApi calls the USDC attestation API with the given USDC message hash. +// The attestation API is rate limited to 10 requests per second, with a temporary ban +// for 5 minutes if 110 requests are made within a 10-second period. +// Documentation: https://developers.circle.com/stablecoins/reference/getattestation func (s *TokenDataReader) callAttestationApi(ctx context.Context, usdcMessageHash [32]byte) (attestationResponse, error) { body, _, headers, err := s.httpClient.Get( ctx, From dd97f4f2a8bb5bce9f6e78779748402dac2ab54d Mon Sep 17 00:00:00 2001 From: Will Winder Date: Wed, 27 Mar 2024 10:06:37 -0400 Subject: [PATCH 2/5] add a changeset --- .changeset/fluffy-geese-act.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fluffy-geese-act.md diff --git a/.changeset/fluffy-geese-act.md b/.changeset/fluffy-geese-act.md new file mode 100644 index 0000000000..e941d600fd --- /dev/null +++ b/.changeset/fluffy-geese-act.md @@ -0,0 +1,5 @@ +--- +"ccip": patch +--- + +Add comment about USDC attestations endpoint. From ba071fa65e7d839ea5bd38d5181564da02b45473 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Wed, 27 Mar 2024 11:38:54 -0400 Subject: [PATCH 3/5] Update core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go --- .../services/ocr2/plugins/ccip/tokendata/usdc/usdc.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go index 5986d60411..f7e4412a1b 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go @@ -232,9 +232,14 @@ func (s *TokenDataReader) getUsdcTokenEndOffset(msg cciptypes.EVM2EVMOnRampCCIPS } // callAttestationApi calls the USDC attestation API with the given USDC message hash. -// The attestation API is rate limited to 10 requests per second, with a temporary ban -// for 5 minutes if 110 requests are made within a 10-second period. -// Documentation: https://developers.circle.com/stablecoins/reference/getattestation +```suggestion +// The attestation service rate limit is 10 requests per second. If you exceed 10 requests +// per second, the service blocks all API requests for the next 5 minutes and returns an +// HTTP 429 response. +// +// Documentation: +// https://developers.circle.com/stablecoins/reference/getattestation +// https://developers.circle.com/stablecoins/docs/transfer-usdc-on-testnet-from-ethereum-to-avalanche func (s *TokenDataReader) callAttestationApi(ctx context.Context, usdcMessageHash [32]byte) (attestationResponse, error) { body, _, headers, err := s.httpClient.Get( ctx, From 6a217345dfe942d7f43de8508dc1e85a111cef73 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Wed, 27 Mar 2024 11:39:15 -0400 Subject: [PATCH 4/5] Update core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go --- core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go | 1 - 1 file changed, 1 deletion(-) diff --git a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go index f7e4412a1b..189c6375a6 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go @@ -232,7 +232,6 @@ func (s *TokenDataReader) getUsdcTokenEndOffset(msg cciptypes.EVM2EVMOnRampCCIPS } // callAttestationApi calls the USDC attestation API with the given USDC message hash. -```suggestion // The attestation service rate limit is 10 requests per second. If you exceed 10 requests // per second, the service blocks all API requests for the next 5 minutes and returns an // HTTP 429 response. From a8d5e5e69e2a61ab02fed38f18da347134920da8 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Mon, 1 Apr 2024 09:18:04 -0400 Subject: [PATCH 5/5] fix lint errors --- core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go index 189c6375a6..424882ff26 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/usdc/usdc.go @@ -11,9 +11,10 @@ import ( "sync" "time" + "github.com/pkg/errors" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/pkg/errors" cciptypes "github.com/smartcontractkit/chainlink-common/pkg/types/ccip" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils" @@ -232,13 +233,14 @@ func (s *TokenDataReader) getUsdcTokenEndOffset(msg cciptypes.EVM2EVMOnRampCCIPS } // callAttestationApi calls the USDC attestation API with the given USDC message hash. -// The attestation service rate limit is 10 requests per second. If you exceed 10 requests +// The attestation service rate limit is 10 requests per second. If you exceed 10 requests // per second, the service blocks all API requests for the next 5 minutes and returns an // HTTP 429 response. // // Documentation: -// https://developers.circle.com/stablecoins/reference/getattestation -// https://developers.circle.com/stablecoins/docs/transfer-usdc-on-testnet-from-ethereum-to-avalanche +// +// https://developers.circle.com/stablecoins/reference/getattestation +// https://developers.circle.com/stablecoins/docs/transfer-usdc-on-testnet-from-ethereum-to-avalanche func (s *TokenDataReader) callAttestationApi(ctx context.Context, usdcMessageHash [32]byte) (attestationResponse, error) { body, _, headers, err := s.httpClient.Get( ctx,