Skip to content

Commit

Permalink
add feeds manager operator forwarder support for ocr2 (#52)
Browse files Browse the repository at this point in the history
* add forwarder address to ocr2 chain config
  • Loading branch information
eutopian authored Sep 8, 2023
1 parent 94e8a16 commit 4480f1f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/sharp-rice-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@smartcontractkit/operator-ui': patch
---

Add support for using operator forwarder in OCR2 jobs managed by FMS
3 changes: 3 additions & 0 deletions src/components/Form/ChainConfigurationForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe('ChainConfigurationForm', () => {
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
ocr2ForwarderAddress: '',
}

render(
Expand Down Expand Up @@ -80,6 +81,7 @@ describe('ChainConfigurationForm', () => {
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
ocr2ForwarderAddress: '',
}

render(
Expand Down Expand Up @@ -138,6 +140,7 @@ describe('ChainConfigurationForm', () => {
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
ocr2ForwarderAddress: '',
}

render(
Expand Down
31 changes: 24 additions & 7 deletions src/components/Form/ChainConfigurationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,26 @@ import {
import Typography from '@material-ui/core/Typography'

export type FormValues = {
chainID: string
chainType: string
accountAddr: string
adminAddr: string
chainID: string
chainType: string
fluxMonitorEnabled: boolean
ocr1Enabled: boolean
ocr1IsBootstrap: boolean
ocr1KeyBundleID?: string | null
ocr1Multiaddr?: string | null
ocr1P2PPeerID?: string | null
ocr1KeyBundleID?: string | null
ocr2CommitPluginEnabled: boolean
ocr2Enabled: boolean
ocr2ExecutePluginEnabled: boolean
ocr2ForwarderAddress?: string | null
ocr2IsBootstrap: boolean
ocr2Multiaddr?: string | null
ocr2P2PPeerID?: string | null
ocr2KeyBundleID?: string | null
ocr2CommitPluginEnabled: boolean
ocr2ExecutePluginEnabled: boolean
ocr2MedianPluginEnabled: boolean
ocr2MercuryPluginEnabled: boolean
ocr2Multiaddr?: string | null
ocr2P2PPeerID?: string | null
}

const ValidationSchema = Yup.object().shape({
Expand Down Expand Up @@ -89,6 +90,7 @@ const ValidationSchema = Yup.object().shape({
ocr2ExecutePluginEnabled: Yup.boolean().required('Required'),
ocr2MedianPluginEnabled: Yup.boolean().required('Required'),
ocr2MercuryPluginEnabled: Yup.boolean().required('Required'),
ocr2ForwarderAddress: Yup.string().nullable(),
})

const styles = (theme: Theme) => {
Expand Down Expand Up @@ -504,6 +506,21 @@ export const ChainConfigurationForm = withStyles(styles)(
}}
/>
</Grid>

<Grid item xs={12} md={12}>
<Field
component={TextField}
id="ocr2ForwarderAddress"
name="ocr2ForwarderAddress"
label="Forwarder Address (optional)"
fullWidth
helperText="The forwarder address from the Operator Forwarder Contract"
FormHelperTextProps={{
'data-testid':
'ocr2ForwarderAddress-helper-text',
}}
/>
</Grid>
</>
)}
</>
Expand Down
1 change: 1 addition & 0 deletions src/hooks/queries/useFeedsManagersWithProposalsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const FEEDS_MANAGER__CHAIN_CONFIG_FIELDS = gql`
enabled
isBootstrap
multiaddr
forwarderAddress
p2pPeerID
keyBundleID
plugins {
Expand Down
1 change: 1 addition & 0 deletions src/screens/FeedsManager/EditSupportedChainDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export const EditSupportedChainDialog = ({
ocr2ExecutePluginEnabled: cfg.ocr2JobConfig.plugins.execute,
ocr2MedianPluginEnabled: cfg.ocr2JobConfig.plugins.median,
ocr2MercuryPluginEnabled: cfg.ocr2JobConfig.plugins.mercury,
ocr2ForwarderAddress: cfg.ocr2JobConfig.forwarderAddress,
}

const chainIDs: string[] = chainData
Expand Down
1 change: 1 addition & 0 deletions src/screens/FeedsManager/NewSupportedChainDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const NewSupportedChainDialog = ({ onClose, open, onSubmit }: Props) => {
ocr2ExecutePluginEnabled: false,
ocr2MedianPluginEnabled: false,
ocr2MercuryPluginEnabled: false,
ocr2ForwarderAddress: '',
}

const chainIDs: string[] = chainData
Expand Down
8 changes: 8 additions & 0 deletions src/screens/FeedsManager/SupportedChainsCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,10 @@ export const SupportedChainsCard = withStyles(styles)(
ocr2KeyBundleID:
values.ocr2KeyBundleID != '' ? values.ocr2KeyBundleID : null,
ocr2Plugins: `{"commit":${values.ocr2CommitPluginEnabled},"execute":${values.ocr2ExecutePluginEnabled},"median":${values.ocr2MedianPluginEnabled},"mercury":${values.ocr2MercuryPluginEnabled}}`,
ocr2ForwarderAddress:
values.ocr2ForwarderAddress !== ''
? values.ocr2ForwarderAddress
: null,
},
},
})
Expand Down Expand Up @@ -408,6 +412,10 @@ export const SupportedChainsCard = withStyles(styles)(
ocr2KeyBundleID:
values.ocr2KeyBundleID != '' ? values.ocr2KeyBundleID : null,
ocr2Plugins: `{"commit":${values.ocr2CommitPluginEnabled},"execute":${values.ocr2ExecutePluginEnabled},"median":${values.ocr2MedianPluginEnabled},"mercury":${values.ocr2MercuryPluginEnabled}}`,
ocr2ForwarderAddress:
values.ocr2ForwarderAddress !== ''
? values.ocr2ForwarderAddress
: null,
},
},
})
Expand Down

0 comments on commit 4480f1f

Please sign in to comment.