From 8818da3d628c12d626a6882aec82244099d47623 Mon Sep 17 00:00:00 2001 From: Nour Elrashidy Date: Tue, 3 Dec 2024 16:38:36 +0100 Subject: [PATCH 1/2] Update default rate limit and cleanup comments --- core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go b/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go index dece927d02..e1315eaa6b 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go @@ -22,7 +22,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/plugins/ccip/tokendata/http" ) -// TODO: double check the validty of default values for lombard's API after checking docs const ( apiVersion = "v1" attestationPath = "deposits/getByHash" @@ -36,8 +35,8 @@ const ( maxCoolDownDuration = 10 * time.Minute // defaultRequestInterval defines the rate in requests per second that the attestation API can be called. - // this is set according to the APIs documentated 10 requests per second rate limit. - defaultRequestInterval = 100 * time.Millisecond + // this is set according to the APIs recommended 1 request per second rate limit. + defaultRequestInterval = 1000 * time.Millisecond // APIIntervalRateLimitDisabled is a special value to disable the rate limiting. APIIntervalRateLimitDisabled = -1 @@ -75,10 +74,9 @@ type TokenDataReader struct { type messageAttestationResponse struct { MessageHash string `json:"message_hash"` Status attestationStatus `json:"status"` - Attestation string `json:"attestation"` // Attestation represented by abi.encode(payload, proof) + Attestation string `json:"attestation,omitempty"` // Attestation represented by abi.encode(payload, proof) } -// TODO: Adjust after checking API docs type attestationRequest struct { PayloadHashes []string `json:"messageHash"` } @@ -87,8 +85,6 @@ type attestationResponse struct { Attestations []messageAttestationResponse `json:"attestations"` } -// TODO: Implement encoding/decoding - type sourceTokenData struct { SourcePoolAddress []byte DestTokenAddress []byte From 93ab907c9fbb72f449a233db91113fe2c23688d7 Mon Sep 17 00:00:00 2001 From: Nour Elrashidy Date: Tue, 3 Dec 2024 20:35:28 +0100 Subject: [PATCH 2/2] Update default request interval to the updated 5 rps --- core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go b/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go index 0fd645624b..0e36e7ae5b 100644 --- a/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go +++ b/core/services/ocr2/plugins/ccip/tokendata/lbtc/lbtc.go @@ -34,8 +34,8 @@ const ( maxCoolDownDuration = 10 * time.Minute // defaultRequestInterval defines the rate in requests per second that the attestation API can be called. - // this is set according to the APIs recommended 1 request per second rate limit. - defaultRequestInterval = 1000 * time.Millisecond + // this is set according to the APIs recommended 5 requests per second rate limit. + defaultRequestInterval = 200 * time.Millisecond // APIIntervalRateLimitDisabled is a special value to disable the rate limiting. APIIntervalRateLimitDisabled = -1