From 57dbd03758d850c21bf52ebb967198ed88c3205c Mon Sep 17 00:00:00 2001 From: ilija Date: Tue, 31 Oct 2023 12:53:25 +0100 Subject: [PATCH 1/4] Update job gql to reflect core node changes --- src/screens/Job/JobView.tsx | 7 ------- src/screens/Job/generateJobDefinition.test.ts | 12 ------------ support/factories/gql/fetchJob.ts | 1 - 3 files changed, 20 deletions(-) diff --git a/src/screens/Job/JobView.tsx b/src/screens/Job/JobView.tsx index b3e88ec2..6bdb182b 100644 --- a/src/screens/Job/JobView.tsx +++ b/src/screens/Job/JobView.tsx @@ -22,7 +22,6 @@ const JOB_PAYLOAD__SPEC = gql` contractAddress evmChainID minIncomingConfirmations - minIncomingConfirmationsEnv minContractPaymentLinkJuels requesters } @@ -47,19 +46,14 @@ const JOB_PAYLOAD__SPEC = gql` } ... on OCRSpec { blockchainTimeout - blockchainTimeoutEnv contractAddress contractConfigConfirmations - contractConfigConfirmationsEnv contractConfigTrackerPollInterval - contractConfigTrackerPollIntervalEnv contractConfigTrackerSubscribeInterval - contractConfigTrackerSubscribeIntervalEnv evmChainID isBootstrapPeer keyBundleID observationTimeout - observationTimeoutEnv p2pBootstrapPeers p2pv2Bootstrappers transmitterAddress @@ -85,7 +79,6 @@ const JOB_PAYLOAD__SPEC = gql` coordinatorAddress fromAddresses minIncomingConfirmations - minIncomingConfirmationsEnv pollPeriod publicKey requestedConfsDelay diff --git a/src/screens/Job/generateJobDefinition.test.ts b/src/screens/Job/generateJobDefinition.test.ts index 8e300fa3..c38a10b0 100644 --- a/src/screens/Job/generateJobDefinition.test.ts +++ b/src/screens/Job/generateJobDefinition.test.ts @@ -63,7 +63,6 @@ observationSource = """ contractAddress: '0x0000000000000000000000000000000000000000', evmChainID: '42', minIncomingConfirmations: 3, - minIncomingConfirmationsEnv: false, minContractPaymentLinkJuels: '100000000000000', requesters: ['0x59bbE8CFC79c76857fE0eC27e67E4957370d72B5'], }, @@ -210,20 +209,15 @@ observationSource = """ spec: { __typename: 'OCRSpec', blockchainTimeout: '20s', - blockchainTimeoutEnv: true, contractAddress: '0x1469877c88F19E273EFC7Ef3C9D944574583B8a0', contractConfigConfirmations: 3, - contractConfigConfirmationsEnv: false, contractConfigTrackerPollInterval: '1m0s', - contractConfigTrackerPollIntervalEnv: false, contractConfigTrackerSubscribeInterval: '2m0s', - contractConfigTrackerSubscribeIntervalEnv: false, evmChainID: '42', keyBundleID: '4ee612467c3caea7bdab57ab62937adfc4d195516c30139a737f85098b35d9af', isBootstrapPeer: false, observationTimeout: '10s', - observationTimeoutEnv: false, p2pBootstrapPeers: [ '/ip4/139.59.41.32/tcp/12000/p2p/12D3KooWGKhStcrvCr5RBYKaSRNX4ojrxHcmpJuFmHWenT6aAQAY', ], @@ -288,20 +282,15 @@ observationSource = """ spec: { __typename: 'OCRSpec', blockchainTimeout: '20s', - blockchainTimeoutEnv: true, contractAddress: '0x1469877c88F19E273EFC7Ef3C9D944574583B8a0', contractConfigConfirmations: 3, - contractConfigConfirmationsEnv: true, contractConfigTrackerPollInterval: '1m0s', - contractConfigTrackerPollIntervalEnv: true, contractConfigTrackerSubscribeInterval: '2m0s', - contractConfigTrackerSubscribeIntervalEnv: true, evmChainID: '42', isBootstrapPeer: true, keyBundleID: '4ee612467c3caea7bdab57ab62937adfc4d195516c30139a737f85098b35d9af', observationTimeout: '10s', - observationTimeoutEnv: true, p2pBootstrapPeers: [ '/ip4/139.59.41.32/tcp/12000/p2p/12D3KooWGKhStcrvCr5RBYKaSRNX4ojrxHcmpJuFmHWenT6aAQAY', ], @@ -451,7 +440,6 @@ juelsPerFeeCoinSource = "1000000000" evmChainID: '42', fromAddresses: ['0x3cCad4715152693fE3BC4460591e3D3Fbd071b42'], minIncomingConfirmations: 6, - minIncomingConfirmationsEnv: false, pollPeriod: '10s', publicKey: '0x92594ee04c179eb7d439ff1baacd98b81a7d7a6ed55c86ca428fa025bd9c914301', diff --git a/support/factories/gql/fetchJob.ts b/support/factories/gql/fetchJob.ts index 13aace93..2d283509 100644 --- a/support/factories/gql/fetchJob.ts +++ b/support/factories/gql/fetchJob.ts @@ -21,7 +21,6 @@ export function buildJob( contractAddress: '0x0000000000000000000000000000000000000000', evmChainID: '42', minIncomingConfirmations: 3, - minIncomingConfirmationsEnv: false, minContractPaymentLinkJuels: '100000000000000', requesters: ['0x59bbE8CFC79c76857fE0eC27e67E4957370d72B5'], }, From 2c450fa4ed35ff5e3c84f02380c163304f6e7857 Mon Sep 17 00:00:00 2001 From: ilija Date: Tue, 31 Oct 2023 13:39:43 +0100 Subject: [PATCH 2/4] Update tab definition and job definitions and tests --- src/screens/Job/TabDefinition.tsx | 16 +------ src/screens/Job/generateJobDefinition.test.ts | 20 -------- src/screens/Job/generateJobDefinition.ts | 47 ++----------------- 3 files changed, 4 insertions(+), 79 deletions(-) diff --git a/src/screens/Job/TabDefinition.tsx b/src/screens/Job/TabDefinition.tsx index ae2b8eef..56b8e308 100644 --- a/src/screens/Job/TabDefinition.tsx +++ b/src/screens/Job/TabDefinition.tsx @@ -15,7 +15,7 @@ interface Props { } export const TabDefinition = ({ job }: Props) => { - const { definition, envDefinition } = generateJobDefinition(job) + const { definition } = generateJobDefinition(job) return ( @@ -33,20 +33,6 @@ export const TabDefinition = ({ job }: Props) => { {definition} - - {envDefinition.trim() && ( - <> - - Job attributes set by environment variables - - - - - {envDefinition} - - - - )} ) diff --git a/src/screens/Job/generateJobDefinition.test.ts b/src/screens/Job/generateJobDefinition.test.ts index c38a10b0..3417a017 100644 --- a/src/screens/Job/generateJobDefinition.test.ts +++ b/src/screens/Job/generateJobDefinition.test.ts @@ -47,7 +47,6 @@ observationSource = """ const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid Direct Request definition', () => { @@ -91,7 +90,6 @@ observationSource = """ const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid Keeper definition', () => { @@ -134,7 +132,6 @@ observationSource = """ const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid Flux Monitor definition', () => { @@ -194,7 +191,6 @@ observationSource = """ const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid OCR definition', () => { @@ -267,7 +263,6 @@ observationSource = """ const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('blockchainTimeout = "20s"\n') }) it('generates a valid OCR Bootstrap definition', () => { @@ -332,17 +327,8 @@ observationSource = """ fetch -> parse -> multiply; """ ` - - const expectedEnvDefinition = `blockchainTimeout = "20s" -contractConfigConfirmations = 3 -contractConfigTrackerPollInterval = "1m0s" -contractConfigTrackerSubscribeInterval = "2m0s" -observationTimeout = "10s" -` - const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual(expectedEnvDefinition) }) it('generates a valid OCR 2 definition', () => { @@ -422,7 +408,6 @@ juelsPerFeeCoinSource = "1000000000" const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid VRF definition', () => { @@ -489,7 +474,6 @@ observationSource = """ ` const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid Webhook definition', () => { @@ -523,7 +507,6 @@ observationSource = """ ` const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid Bootstrap definition', () => { @@ -569,7 +552,6 @@ chainID = 1_337 ` const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid blockhashstore definition', () => { @@ -621,7 +603,6 @@ fromAddresses = [ "0x52926EF10c19E810a52f11e942E502B15c7E2fEE" ] ` const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) it('generates a valid Gateway definition', () => { @@ -653,6 +634,5 @@ Port = 8_080 ` const output = generateJobDefinition(job) expect(output.definition).toEqual(expectedOutput) - expect(output.envDefinition).toEqual('') }) }) diff --git a/src/screens/Job/generateJobDefinition.ts b/src/screens/Job/generateJobDefinition.ts index 7b8588d4..769f67a8 100644 --- a/src/screens/Job/generateJobDefinition.ts +++ b/src/screens/Job/generateJobDefinition.ts @@ -3,7 +3,6 @@ import pick from 'lodash/pick' export interface JobDefinition { definition: string - envDefinition: string } // Extracts fields from the job that are common to all specs. @@ -29,51 +28,12 @@ const extractObservationSourceField = ({ } } -// Extracts the fields matching the keys from the spec. If another field of of -// the same name with an 'Env' suffix exists, we remove it from the returned -// object. +// Extracts the fields matching the keys from the spec. const extractSpecFields = ( spec: T, ...keys: K[] ) => { - // For every key, check for the existence of an another field of the same name - // with an 'Env' suffix - const scopedKeys = keys.filter((key) => { - const envKey = `${key as string}Env` as K - if (Object.prototype.hasOwnProperty.call(spec, envKey)) { - // We are relying on this always being a boolean but we can't guarantee it - return !spec[envKey] - } - - return true - }) - - return pick(spec, ...scopedKeys) -} - -// Extracts the fields which have a field of the same name with an 'Env' suffix -// and the 'Env' field returns true. -const extractEnvValues = (spec: T) => { - // For every key with an 'Env' suffix, find a key of the same name without the - // suffix. - const regex = /(.+)Env$/ - const envValueKeys: K[] = [] - for (const key of Object.keys(spec)) { - const match = key.match(regex) - - if (match) { - const envKey = key as K - // We are relying on this always being a boolean but we can't guarantee it - if (spec[envKey]) { - // Check that the key without the 'Env' suffix exists - if (Object.prototype.hasOwnProperty.call(spec, match[1])) { - envValueKeys.push(match[1] as K) - } - } - } - } - - return pick(spec, ...envValueKeys) + return pick(spec, ...keys) } // Stringifies the job spec as TOML @@ -294,7 +254,7 @@ export const generateJobDefinition = ( break default: - return { definition: '', envDefinition: '' } + return { definition: '' } case 'WebhookSpec': values = { ...extractJobFields(job), @@ -306,6 +266,5 @@ export const generateJobDefinition = ( return { definition: toTOMLString(values), - envDefinition: toTOMLString(extractEnvValues(job.spec)), } } From 3aa6f4e1952d38e444264146641e9fb990bd0fa1 Mon Sep 17 00:00:00 2001 From: ilija Date: Tue, 31 Oct 2023 13:55:12 +0100 Subject: [PATCH 3/4] Fix lint --- .../ConfigurationV2Card.tsx | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx b/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx index 60002ba8..828f6088 100644 --- a/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx +++ b/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx @@ -16,10 +16,10 @@ import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' import { prism } from 'react-syntax-highlighter/dist/esm/styles/prism' import ExpandMoreIcon from '@material-ui/icons/ExpandMore' import Typography from '@material-ui/core/Typography' -import List from "@material-ui/core/List"; -import ListItem from "@material-ui/core/ListItem"; -import ListItemIcon from "@material-ui/core/ListItemIcon"; -import RemoveCircleOutline from "@material-ui/icons/RemoveCircleOutline"; +import List from '@material-ui/core/List' +import ListItem from '@material-ui/core/ListItem' +import ListItemIcon from '@material-ui/core/ListItemIcon' +import RemoveCircleOutline from '@material-ui/icons/RemoveCircleOutline' const DeprecationWarning = () => { const newTelemConfig = @@ -37,22 +37,27 @@ const DeprecationWarning = () => { - + + + TelemetryIngress.URL and{' '} - TelemetryIngress.ServerPubKey will no longer be allowed. - Please switch to TelemetryIngress.Endpoints: + TelemetryIngress.ServerPubKey will no longer be + allowed. Please switch to TelemetryIngress.Endpoints: {newTelemConfig} - + + + - P2P.V1 will no longer be supported and must not be set in TOML - configuration in order to boot. Use P2P.V2 instead. If you are - using both, V1 can simply be removed. + P2P.V1 will no longer be supported and must not be + set in TOML configuration in order to boot. Use{' '} + P2P.V2 instead. If you are using both,{' '} + V1 can simply be removed. From 4c5ad831b5e92ddefde73f8e981154b12d33e7f2 Mon Sep 17 00:00:00 2001 From: ilija Date: Tue, 31 Oct 2023 14:26:29 +0100 Subject: [PATCH 4/4] Fix job definition tests expected outputs --- src/screens/Job/generateJobDefinition.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/screens/Job/generateJobDefinition.test.ts b/src/screens/Job/generateJobDefinition.test.ts index 3417a017..402ee9c5 100644 --- a/src/screens/Job/generateJobDefinition.test.ts +++ b/src/screens/Job/generateJobDefinition.test.ts @@ -238,6 +238,7 @@ name = "ocr job" externalJobID = "00000000-0000-0000-0000-0000000000001" gasLimit = 1_000 maxTaskDuration = "10s" +blockchainTimeout = "20s" contractAddress = "0x1469877c88F19E273EFC7Ef3C9D944574583B8a0" contractConfigConfirmations = 3 contractConfigTrackerPollInterval = "1m0s" @@ -310,10 +311,15 @@ name = "ocr job" externalJobID = "00000000-0000-0000-0000-0000000000001" gasLimit = 1_000 maxTaskDuration = "10s" +blockchainTimeout = "20s" contractAddress = "0x1469877c88F19E273EFC7Ef3C9D944574583B8a0" +contractConfigConfirmations = 3 +contractConfigTrackerPollInterval = "1m0s" +contractConfigTrackerSubscribeInterval = "2m0s" evmChainID = "42" isBootstrapPeer = true keyBundleID = "4ee612467c3caea7bdab57ab62937adfc4d195516c30139a737f85098b35d9af" +observationTimeout = "10s" p2pBootstrapPeers = [ "/ip4/139.59.41.32/tcp/12000/p2p/12D3KooWGKhStcrvCr5RBYKaSRNX4ojrxHcmpJuFmHWenT6aAQAY" ]