From 75cc798cd063fec9c7854c3a80c245a0774490e6 Mon Sep 17 00:00:00 2001 From: Michael Xiao Date: Mon, 4 Nov 2024 09:27:23 -0500 Subject: [PATCH] Allow override on cfbenchmarks2 (#3528) * Allow cfb2 override * Update comments --- .changeset/four-rocks-deliver.md | 5 +++++ .../scripts/src/get-changed-adapters/soakTestBlacklist.ts | 2 ++ packages/sources/cfbenchmarks/src/endpoint/crypto.ts | 5 +++++ packages/sources/cfbenchmarks/src/endpoint/utils.ts | 5 +++++ packages/sources/cfbenchmarks/src/transport/crypto-ws.ts | 7 ++++++- 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 .changeset/four-rocks-deliver.md diff --git a/.changeset/four-rocks-deliver.md b/.changeset/four-rocks-deliver.md new file mode 100644 index 0000000000..c6e940a929 --- /dev/null +++ b/.changeset/four-rocks-deliver.md @@ -0,0 +1,5 @@ +--- +'@chainlink/cfbenchmarks-adapter': minor +--- + +Seperate cfb with cfb2 diff --git a/packages/scripts/src/get-changed-adapters/soakTestBlacklist.ts b/packages/scripts/src/get-changed-adapters/soakTestBlacklist.ts index 757937c706..9aefbce999 100644 --- a/packages/scripts/src/get-changed-adapters/soakTestBlacklist.ts +++ b/packages/scripts/src/get-changed-adapters/soakTestBlacklist.ts @@ -88,4 +88,6 @@ export const SoakTestBlacklist: string[] = [ 'blockchain.com', // Does not support . in the name 'cache.gold', 'ion.au', + 'galaxy', // Not deployed internally + 'stader-balance', // Not deployed internally ] diff --git a/packages/sources/cfbenchmarks/src/endpoint/crypto.ts b/packages/sources/cfbenchmarks/src/endpoint/crypto.ts index 8c19c377bd..11190e915b 100644 --- a/packages/sources/cfbenchmarks/src/endpoint/crypto.ts +++ b/packages/sources/cfbenchmarks/src/endpoint/crypto.ts @@ -30,6 +30,11 @@ export const inputParameters = new InputParameters( description: 'The symbol of the currency to convert to', required: false, }, + adapterNameOverride: { + type: 'string', + description: 'Used internally for override and metrics, do not set this field', + required: false, + }, }, [ { diff --git a/packages/sources/cfbenchmarks/src/endpoint/utils.ts b/packages/sources/cfbenchmarks/src/endpoint/utils.ts index c6b94309f0..1e388d0481 100644 --- a/packages/sources/cfbenchmarks/src/endpoint/utils.ts +++ b/packages/sources/cfbenchmarks/src/endpoint/utils.ts @@ -18,7 +18,12 @@ const overridenBaseQuoteFromId: BaseQuoteToIdLookup = { export function customInputValidation( req: AdapterRequest, + adapterSettings: BaseEndpointTypes['Settings'], ): AdapterError | undefined { + if (adapterSettings.API_SECONDARY) { + req.requestContext.data.adapterNameOverride = 'cfbenchmarks2' + } + const { base, quote, index } = req.requestContext.data // Base and quote must be provided OR index must be provided if (!(index || (base && quote))) { diff --git a/packages/sources/cfbenchmarks/src/transport/crypto-ws.ts b/packages/sources/cfbenchmarks/src/transport/crypto-ws.ts index b7488eecc7..663363ef76 100644 --- a/packages/sources/cfbenchmarks/src/transport/crypto-ws.ts +++ b/packages/sources/cfbenchmarks/src/transport/crypto-ws.ts @@ -48,7 +48,12 @@ export const makeWsTransport = ( const value = Number(message.value) return [ { - params: { index, base: undefined, quote: undefined }, + params: { + index, + base: undefined, + quote: undefined, + ...(type != 'primary' && { adapterNameOverride: 'cfbenchmarks2' }), + }, response: { result: value, data: {