diff --git a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/initialize.flow.ts b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/initialize.flow.ts index 03ebb5565..d846514d9 100644 --- a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/initialize.flow.ts +++ b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/initialize.flow.ts @@ -10,12 +10,11 @@ import CommitOffchainConfig from './offchainConfig/commit' import SetConfig from './setConfig' import SetBilling from './setBilling' import { logger, prompt } from '@chainlink/gauntlet-core/dist/utils' +import OCR2Inspect from './inspection/inspect' export default class OCR2InitializeFlow extends FlowCommand { static id = 'ocr2:initialize:flow' static category = CONTRACT_LIST.OCR_2 - static examples = [ - 'yarn gauntlet ocr2:initialize:flow --network=local --id=[ID] --rdd=[PATH_TO_RDD] --version=[OFFCHAIN_CONFIG_VERSION(optional)]', - ] + static examples = ['yarn gauntlet ocr2:initialize:flow --network=local --id=[ID] --rdd=[PATH_TO_RDD]'] constructor(flags, args) { super(flags, args, waitExecute, makeAbstractCommand) @@ -44,7 +43,7 @@ export default class OCR2InitializeFlow extends FlowCommand command: BeginOffchainConfig, flags: { state: FlowCommand.ID.contract(this.stepIds.OCR_2), - version: this.flags.version || 1, + version: 2, }, }, { @@ -83,6 +82,16 @@ export default class OCR2InitializeFlow extends FlowCommand state: FlowCommand.ID.contract(this.stepIds.OCR_2), }, }, + { + name: 'Inspection', + command: OCR2Inspect, + flags: { + state: FlowCommand.ID.contract(this.stepIds.OCR_2), + billingAccessController: process.env.BILLING_ACCESS_CONTROLLER || this.flags.billingAccessController, + requesterAccessController: process.env.REQUESTER_ACCESS_CONTROLLER || this.flags.requesterAccessController, + link: process.env.LINK || this.flags.link, + }, + }, ] } diff --git a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/inspection/inspect.ts b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/inspection/inspect.ts index ac8a2713c..ebebea32c 100644 --- a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/inspection/inspect.ts +++ b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/inspection/inspect.ts @@ -31,12 +31,10 @@ export default class OCR2Inspect extends SolanaCommand { const rdd = getRDD(this.flags.rdd) const info = rdd.contracts[this.flags.state] const aggregatorOperators: string[] = info.oracles.map((o) => o.operator) - const transmitters = aggregatorOperators.map((operator) => rdd.operators[operator].nodeAddress[0]) - const billingAccessController = - this.flags.billingAccessController || process.env.BILLING_ADMIN_ACCESS_CONTROLLER_ADDRESS - const requesterAccessController = - this.flags.requesterAccessController || process.env.REQUESTER_ADMIN_ACCESS_CONTROLLER_ADDRESS - const link = this.flags.link || process.env.LINK_ADDRESS + const transmitters = aggregatorOperators.map((operator) => rdd.operators[operator].ocrNodeAddress[0]) + const billingAccessController = this.flags.billingAccessController || process.env.BILLING_ACCESS_CONTROLLER + const requesterAccessController = this.flags.requesterAccessController || process.env.REQUESTER_ACCESS_CONTROLLER + const link = this.flags.link || process.env.LINK const offchainConfig = WriteOffchainConfig.makeInputFromRDD(rdd, this.flags.state) return { description: info.name, @@ -80,6 +78,11 @@ export default class OCR2Inspect extends SolanaCommand { ) const onChainOCRConfig = this.deserializeConfig(bufferedConfig) + const wrappedComparableLongNumber = (v: any) => { + // Proto encoding will ignore falsy values. + if (!v) return '0' + return toComparableLongNumber(v) + } const longNumberInspections = [ 'deltaProgressNanoseconds', 'deltaResendNanoseconds', @@ -93,7 +96,7 @@ export default class OCR2Inspect extends SolanaCommand { 'maxDurationShouldTransmitAcceptedReportNanoseconds', ].map((prop) => inspection.makeInspection( - toComparableLongNumber(onChainOCRConfig[prop]), + wrappedComparableLongNumber(onChainOCRConfig[prop]), toComparableNumber(input.offchainConfig[prop]), `Offchain Config "${prop}"`, ), @@ -129,7 +132,7 @@ export default class OCR2Inspect extends SolanaCommand { inspection.makeInspection( toComparablePubKey(onChainState.config.billingAccessController), toComparablePubKey(input.billingAccessController), - 'Requester access controller', + 'Billing access controller', ), inspection.makeInspection( onChainState.oracles.xs @@ -158,17 +161,17 @@ export default class OCR2Inspect extends SolanaCommand { 'Offchain Config "reportingPluginConfig.alphaAcceptInfinite"', ), inspection.makeInspection( - toComparableLongNumber(onChainOCRConfig.reportingPluginConfig.alphaReportPpb), + wrappedComparableLongNumber(onChainOCRConfig.reportingPluginConfig.alphaReportPpb), toComparableNumber(input.offchainConfig.reportingPluginConfig.alphaReportPpb), `Offchain Config "reportingPluginConfig.alphaReportPpb"`, ), inspection.makeInspection( - toComparableLongNumber(onChainOCRConfig.reportingPluginConfig.alphaAcceptPpb), + wrappedComparableLongNumber(onChainOCRConfig.reportingPluginConfig.alphaAcceptPpb), toComparableNumber(input.offchainConfig.reportingPluginConfig.alphaAcceptPpb), `Offchain Config "reportingPluginConfig.alphaAcceptPpb"`, ), inspection.makeInspection( - toComparableLongNumber(onChainOCRConfig.reportingPluginConfig.deltaCNanoseconds), + wrappedComparableLongNumber(onChainOCRConfig.reportingPluginConfig.deltaCNanoseconds), toComparableNumber(input.offchainConfig.reportingPluginConfig.deltaCNanoseconds), `Offchain Config "reportingPluginConfig.deltaCNanoseconds"`, ), diff --git a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts index df8df9129..8bf6aad55 100644 --- a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts +++ b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/begin.ts @@ -1,5 +1,5 @@ import { Result } from '@chainlink/gauntlet-core' -import { logger } from '@chainlink/gauntlet-core/dist/utils' +import { logger, prompt } from '@chainlink/gauntlet-core/dist/utils' import { SolanaCommand, TransactionResponse } from '@chainlink/gauntlet-solana' import { PublicKey } from '@solana/web3.js' import BN from 'bn.js' @@ -27,6 +27,8 @@ export default class BeginOffchainConfig extends SolanaCommand { const state = new PublicKey(this.flags.state) const owner = this.wallet.payer + await prompt(`Begin setting Offchain config version ${this.flags.version}?`) + const tx = await program.rpc.beginOffchainConfig(new BN(this.flags.version), { accounts: { state: state, diff --git a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/setOffchainConfig.flow.ts b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/setOffchainConfig.flow.ts index 04b84a9c4..18634d0d2 100644 --- a/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/setOffchainConfig.flow.ts +++ b/gauntlet/packages/gauntlet-solana-contracts/src/commands/contracts/ocr2/offchainConfig/setOffchainConfig.flow.ts @@ -9,7 +9,7 @@ import CommitOffchainConfig from './commit' export default class SetOffchainConfigFlow extends FlowCommand { static id = 'ocr2:set_offchain_config:flow' static category = CONTRACT_LIST.OCR_2 - static examples = ['yarn gauntlet ocr2:set_offchain_config:flow --network=local --version=1 --rdd=[PATH_TO_RDD]'] + static examples = ['yarn gauntlet ocr2:set_offchain_config:flow --network=local --rdd=[PATH_TO_RDD]'] constructor(flags, args) { super(flags, args, waitExecute, makeAbstractCommand) @@ -20,6 +20,9 @@ export default class SetOffchainConfigFlow extends FlowCommand