From d202ba22bb59df8f95007f6bc311015a13d0c05b Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 13:13:10 +0200 Subject: [PATCH 01/14] forge fmt --- .../automation/AutomationCompatibleUtils.sol | 22 +- .../v0.8/automation/AutomationForwarder.sol | 20 +- .../automation/AutomationForwarderLogic.sol | 6 +- contracts/src/v0.8/automation/Chainable.sol | 12 +- contracts/src/v0.8/automation/KeeperBase.sol | 1 + .../src/v0.8/automation/KeeperCompatible.sol | 4 +- .../automation/ZKSyncAutomationForwarder.sol | 20 +- .../v0.8/automation/chains/ArbitrumModule.sol | 16 +- .../automation/chains/ChainModuleBase.sol | 12 +- .../v0.8/automation/chains/OptimismModule.sol | 15 +- .../automation/chains/OptimismModuleV2.sol | 22 +- .../v0.8/automation/chains/ScrollModule.sol | 22 +- .../v0.8/automation/dev/MercuryRegistry.sol | 45 +- .../dev/MercuryRegistryBatchUpkeep.sol | 13 +- .../AutomationCompatibleInterface.sol | 8 +- .../interfaces/IAutomationForwarder.sol | 4 +- .../IAutomationRegistryConsumer.sol | 20 +- .../interfaces/IAutomationV21PlusCommon.sol | 43 +- .../automation/interfaces/IChainModule.sol | 12 +- .../automation/interfaces/ILogAutomation.sol | 4 +- .../interfaces/KeeperCompatibleInterface.sol | 1 + .../MigratableKeeperRegistryInterface.sol | 4 +- .../MigratableKeeperRegistryInterfaceV2.sol | 4 +- .../interfaces/v2_1/IKeeperRegistryMaster.sol | 89 ++-- .../v2_2/IAutomationRegistryMaster.sol | 89 ++-- .../v2_3/IAutomationRegistryMaster2_3.sol | 117 +++-- .../interfaces/v2_3/IWrappedNative.sol | 4 +- .../IZKSyncAutomationRegistryMaster2_3.sol | 113 +++-- .../automation/libraries/external/Cron.sol | 20 +- .../automation/libraries/internal/Cron.sol | 126 ++--- .../src/v0.8/automation/mocks/MockArbSys.sol | 4 +- .../mocks/MockKeeperRegistry2_1.sol | 20 +- .../src/v0.8/automation/mocks/MockUpkeep.sol | 33 +- .../automation/test/AutomationForwarder.t.sol | 2 +- .../test/AutomationRegistry2_2.t.sol | 32 +- .../automation/test/MercuryRegistry.t.sol | 15 +- .../test/v2_3/AutomationRegistrar2_3.t.sol | 7 +- .../test/v2_3/AutomationRegistry2_3.t.sol | 427 +++++------------ .../v0.8/automation/test/v2_3/BaseTest.t.sol | 114 ++--- .../test/v2_3_zksync/BaseTest.t.sol | 116 ++--- .../ZKSyncAutomationRegistry2_3.t.sol | 441 ++++++------------ .../AutomationConsumerBenchmark.sol | 19 +- .../automation/testhelpers/CronTestHelper.sol | 34 +- .../automation/testhelpers/DummyProtocol.sol | 5 +- .../KeeperCompatibleTestHelper.sol | 8 +- .../automation/testhelpers/KeeperConsumer.sol | 16 +- .../testhelpers/KeeperConsumerPerformance.sol | 16 +- .../testhelpers/LogTriggeredStreamsLookup.sol | 44 +- .../testhelpers/MockETHUSDAggregator.sol | 8 +- .../testhelpers/MockOVMGasPriceOracle.sol | 8 +- .../testhelpers/PerformDataChecker.sol | 12 +- .../testhelpers/StreamsLookupUpkeep.sol | 26 +- .../testhelpers/UpkeepAutoFunder.sol | 25 +- .../automation/testhelpers/UpkeepCounter.sol | 14 +- .../testhelpers/UpkeepCounterNew.sol | 47 +- .../automation/testhelpers/UpkeepMock.sol | 32 +- .../UpkeepPerformCounterRestrictive.sol | 16 +- .../automation/testhelpers/UpkeepReverter.sol | 4 +- .../testhelpers/VerifiableLoadBase.sol | 104 +++-- .../VerifiableLoadLogTriggerUpkeep.sol | 10 +- .../VerifiableLoadStreamsLookupUpkeep.sol | 10 +- .../testhelpers/VerifiableLoadUpkeep.sol | 10 +- .../v0.8/automation/upkeeps/CronUpkeep.sol | 68 +-- .../automation/upkeeps/CronUpkeepDelegate.sol | 6 +- .../automation/upkeeps/CronUpkeepFactory.sol | 16 +- .../upkeeps/ERC20BalanceMonitor.sol | 44 +- .../automation/upkeeps/EthBalanceMonitor.sol | 26 +- .../upkeeps/LinkAvailableBalanceMonitor.sol | 53 ++- .../upkeeps/UpkeepBalanceMonitor.sol | 41 +- .../v2_1/AutomationRegistrar2_1.sol | 48 +- .../automation/v2_1/AutomationUtils2_1.sol | 28 +- .../automation/v2_1/KeeperRegistry2_1.sol | 37 +- .../automation/v2_1/KeeperRegistryBase2_1.sol | 97 ++-- .../v2_1/KeeperRegistryLogicA2_1.sol | 84 ++-- .../v2_1/KeeperRegistryLogicB2_1.sol | 76 ++- .../automation/v2_1/UpkeepTranscoder4_0.sol | 21 +- .../automation/v2_2/AutomationRegistry2_2.sol | 47 +- .../v2_2/AutomationRegistryBase2_2.sol | 91 ++-- .../v2_2/AutomationRegistryLogicA2_2.sol | 76 ++- .../v2_2/AutomationRegistryLogicB2_2.sol | 79 +++- .../automation/v2_2/AutomationUtils2_2.sol | 28 +- .../v2_3/AutomationRegistrar2_3.sol | 52 ++- .../automation/v2_3/AutomationRegistry2_3.sol | 54 +-- .../v2_3/AutomationRegistryBase2_3.sol | 154 +++--- .../v2_3/AutomationRegistryLogicA2_3.sol | 60 +-- .../v2_3/AutomationRegistryLogicB2_3.sol | 51 +- .../v2_3/AutomationRegistryLogicC2_3.sol | 141 ++++-- .../automation/v2_3/AutomationUtils2_3.sol | 5 +- .../automation/v2_3/UpkeepTranscoder5_0.sol | 2 +- .../ZKSyncAutomationRegistry2_3.sol | 51 +- .../ZKSyncAutomationRegistryBase2_3.sol | 144 +++--- .../ZKSyncAutomationRegistryLogicA2_3.sol | 58 +-- .../ZKSyncAutomationRegistryLogicB2_3.sol | 51 +- .../ZKSyncAutomationRegistryLogicC2_3.sol | 141 ++++-- .../v0.8/data-feeds/test/DataFeedsCache.t.sol | 4 +- .../functions/dev/v1_X/FunctionsBilling.sol | 51 +- .../functions/dev/v1_X/FunctionsClient.sol | 12 +- .../dev/v1_X/FunctionsCoordinator.sol | 34 +- .../functions/dev/v1_X/FunctionsRouter.sol | 72 ++- .../dev/v1_X/FunctionsSubscriptions.sol | 58 ++- .../src/v0.8/functions/dev/v1_X/Routable.sol | 4 +- .../accessControl/TermsOfServiceAllowList.sol | 34 +- .../interfaces/ITermsOfServiceAllowList.sol | 16 +- .../v1_X/example/FunctionsClientExample.sol | 10 +- .../dev/v1_X/interfaces/IFunctionsBilling.sol | 8 +- .../v1_X/interfaces/IFunctionsCoordinator.sol | 8 +- .../dev/v1_X/interfaces/IFunctionsRouter.sol | 12 +- .../interfaces/IFunctionsSubscriptions.sol | 32 +- .../interfaces/IOwnableFunctionsRouter.sol | 2 +- .../dev/v1_X/libraries/ChainSpecificUtil.sol | 29 +- .../dev/v1_X/libraries/FunctionsRequest.sol | 7 +- .../dev/v1_X/libraries/FunctionsResponse.sol | 1 + .../dev/v1_X/mocks/FunctionsV1EventsMock.sol | 29 +- .../functions/dev/v1_X/ocr/OCR2Abstract.sol | 18 +- .../v0.8/functions/dev/v1_X/ocr/OCR2Base.sol | 41 +- .../tests/v1_X/ChainSpecificUtil.t.sol | 38 +- .../tests/v1_X/FunctionsBilling.t.sol | 80 ++-- .../tests/v1_X/FunctionsClient.t.sol | 9 +- .../tests/v1_X/FunctionsCoordinator.t.sol | 27 +- .../tests/v1_X/FunctionsRouter.t.sol | 316 ++++--------- .../tests/v1_X/FunctionsSubscriptions.t.sol | 62 ++- .../FunctionsTermsOfServiceAllowList.t.sol | 16 +- .../src/v0.8/functions/tests/v1_X/Gas.t.sol | 41 +- .../src/v0.8/functions/tests/v1_X/OCR2.t.sol | 2 +- .../src/v0.8/functions/tests/v1_X/Setup.t.sol | 194 ++++---- .../tests/v1_X/ZKSyncFunctionsRouter.t.sol | 67 +-- .../testhelpers/FunctionsClientHarness.sol | 6 +- .../testhelpers/FunctionsClientTestHelper.sol | 28 +- .../FunctionsClientUpgradeHelper.sol | 14 +- .../FunctionsClientWithEmptyCallback.sol | 8 +- .../FunctionsCoordinatorHarness.sol | 36 +- .../FunctionsCoordinatorTestHelper.sol | 6 +- .../testhelpers/FunctionsLoadTestClient.sol | 12 +- .../FunctionsSubscriptionsHarness.sol | 21 +- .../v1_X/testhelpers/FunctionsTestHelper.sol | 12 +- .../tests/v1_X/testhelpers/MockLinkToken.sol | 8 +- .../functions/v1_0_0/FunctionsBilling.sol | 44 +- .../v0.8/functions/v1_0_0/FunctionsClient.sol | 15 +- .../functions/v1_0_0/FunctionsCoordinator.sol | 44 +- .../v0.8/functions/v1_0_0/FunctionsRouter.sol | 72 ++- .../v1_0_0/FunctionsSubscriptions.sol | 58 ++- .../src/v0.8/functions/v1_0_0/Routable.sol | 4 +- .../accessControl/TermsOfServiceAllowList.sol | 29 +- .../interfaces/ITermsOfServiceAllowList.sol | 12 +- .../v1_0_0/example/FunctionsClientExample.sol | 10 +- .../v1_0_0/interfaces/IFunctionsBilling.sol | 8 +- .../interfaces/IFunctionsCoordinator.sol | 8 +- .../v1_0_0/interfaces/IFunctionsRouter.sol | 12 +- .../interfaces/IFunctionsSubscriptions.sol | 32 +- .../interfaces/IOwnableFunctionsRouter.sol | 2 +- .../v1_0_0/libraries/FunctionsRequest.sol | 7 +- .../v1_0_0/libraries/FunctionsResponse.sol | 1 + .../v1_0_0/mocks/FunctionsV1EventsMock.sol | 30 +- .../functions/v1_0_0/ocr/OCR2Abstract.sol | 18 +- .../v0.8/functions/v1_0_0/ocr/OCR2Base.sol | 38 +- .../functions/v1_1_0/FunctionsBilling.sol | 38 +- .../functions/v1_1_0/FunctionsCoordinator.sol | 37 +- .../v1_1_0/libraries/ChainSpecificUtil.sol | 27 +- .../functions/v1_1_0/ocr/OCR2Abstract.sol | 18 +- .../v0.8/functions/v1_1_0/ocr/OCR2Base.sol | 37 +- .../functions/v1_3_0/FunctionsBilling.sol | 51 +- .../v0.8/functions/v1_3_0/FunctionsClient.sol | 12 +- .../functions/v1_3_0/FunctionsCoordinator.sol | 33 +- .../accessControl/TermsOfServiceAllowList.sol | 35 +- .../interfaces/ITermsOfServiceAllowList.sol | 12 +- .../v1_3_0/interfaces/IFunctionsBilling.sol | 8 +- .../functions/v1_3_0/ocr/OCR2Abstract.sol | 18 +- .../v0.8/functions/v1_3_0/ocr/OCR2Base.sol | 41 +- .../v1_3_0_zksync/FunctionsBilling.sol | 49 +- .../v1_3_0_zksync/FunctionsCoordinator.sol | 35 +- .../v1_3_0_zksync/ZKSyncFunctionsRouter.sol | 12 +- contracts/src/v0.8/keystone/BalanceReader.sol | 4 +- .../v0.8/keystone/CapabilitiesRegistry.sol | 134 +++--- .../v0.8/keystone/KeystoneFeedsConsumer.sol | 12 +- .../KeystoneFeedsPermissionHandler.sol | 16 +- .../src/v0.8/keystone/KeystoneForwarder.sol | 44 +- .../src/v0.8/keystone/OCR3Capability.sol | 9 +- .../interfaces/ICapabilityConfiguration.sol | 4 +- .../keystone/interfaces/INodeInfoProvider.sol | 8 +- .../src/v0.8/keystone/interfaces/IRouter.sol | 8 +- .../src/v0.8/keystone/ocr/OCR2Abstract.sol | 18 +- .../src/v0.8/keystone/test/BaseTest.t.sol | 23 +- ...bilitiesRegistry_AddCapabilitiesTest.t.sol | 28 +- .../CapabilitiesRegistry_AddDONTest.t.sol | 76 ++- ...ilitiesRegistry_AddNodeOperatorsTest.t.sol | 20 +- .../CapabilitiesRegistry_AddNodesTest.t.sol | 2 +- ...esRegistry_DeprecateCapabilitiesTest.t.sol | 26 +- ...bilitiesRegistry_GetCapabilitiesTest.t.sol | 11 +- ...apabilitiesRegistry_GetNextDONIdTest.t.sol | 12 +- ...ilitiesRegistry_GetNodeOperatorsTest.t.sol | 2 +- .../CapabilitiesRegistry_GetNodesTest.t.sol | 2 +- .../CapabilitiesRegistry_RemoveDONsTest.t.sol | 8 +- ...tiesRegistry_RemoveNodeOperatorsTest.t.sol | 12 +- ...CapabilitiesRegistry_RemoveNodesTest.t.sol | 14 +- .../CapabilitiesRegistry_UpdateDONTest.t.sol | 54 +-- ...tiesRegistry_UpdateNodeOperatorsTest.t.sol | 26 +- ...CapabilitiesRegistry_UpdateNodesTest.t.sol | 18 +- .../test/KeystoneForwarderBaseTest.t.sol | 14 +- .../test/KeystoneForwarder_ReportTest.t.sol | 53 +-- .../KeystoneForwarder_SetConfigTest.t.sol | 2 +- .../test/KeystoneRouter_AccessTest.t.sol | 4 +- .../mocks/CapabilityConfigurationContract.sol | 8 +- .../mocks/MaliciousConfigurationContract.sol | 17 +- .../test/mocks/MaliciousReportReceiver.sol | 7 +- .../test/mocks/MaliciousRevertingReceiver.sol | 6 +- .../src/v0.8/keystone/test/mocks/Receiver.sol | 7 +- .../src/v0.8/l2ep/CrossDomainOwnable.sol | 16 +- contracts/src/v0.8/l2ep/Flags.sol | 40 +- .../arbitrum/ArbitrumCrossDomainForwarder.sol | 4 +- .../arbitrum/ArbitrumCrossDomainGovernor.sol | 7 +- .../arbitrum/ArbitrumSequencerUptimeFeed.sol | 38 +- .../v0.8/l2ep/arbitrum/ArbitrumValidator.sol | 55 ++- .../l2ep/base/BaseSequencerUptimeFeed.sol | 34 +- .../src/v0.8/l2ep/base/BaseValidator.sol | 4 +- .../l2ep/interfaces/ICrossDomainOwnable.sol | 4 +- contracts/src/v0.8/l2ep/interfaces/IFlags.sol | 32 +- .../optimism/OptimismCrossDomainForwarder.sol | 6 +- .../optimism/OptimismCrossDomainGovernor.sol | 6 +- .../optimism/OptimismSequencerUptimeFeed.sol | 9 +- .../scroll/ScrollCrossDomainForwarder.sol | 2 +- .../l2ep/scroll/ScrollCrossDomainGovernor.sol | 5 +- .../l2ep/scroll/ScrollSequencerUptimeFeed.sol | 9 +- .../src/v0.8/l2ep/scroll/ScrollValidator.sol | 6 +- contracts/src/v0.8/l2ep/test/FeedConsumer.sol | 18 +- contracts/src/v0.8/l2ep/test/Greeter.sol | 8 +- .../l2ep/test/mocks/MockAggregatorV2V3.sol | 14 +- .../l2ep/test/mocks/MockArbitrumInbox.sol | 62 +-- .../mocks/MockBaseSequencerUptimeFeed.sol | 4 +- .../l2ep/test/mocks/MockBaseValidator.sol | 6 +- .../MockOptimismL2CrossDomainMessenger.sol | 4 +- .../optimism/MockOVMCrossDomainMessenger.sol | 11 +- .../scroll/MockScrollCrossDomainMessenger.sol | 8 +- .../scroll/MockScrollL1MessageQueueV2.sol | 38 +- .../MockScrollL2CrossDomainMessenger.sol | 4 +- .../test/mocks/zksync/MockZKSyncL1Bridge.sol | 52 ++- .../src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol | 19 +- .../ArbitrumCrossDomainForwarder.t.sol | 6 +- .../ArbitrumCrossDomainGovernor.t.sol | 12 +- .../ArbitrumSequencerUptimeFeed.t.sol | 17 +- .../v1_0_0/arbitrum/ArbitrumValidator.t.sol | 3 +- .../OptimismCrossDomainForwarder.t.sol | 8 +- .../OptimismCrossDomainGovernor.t.sol | 6 +- .../OptimismSequencerUptimeFeed.t.sol | 18 +- .../v1_0_0/optimism/OptimismValidator.t.sol | 14 +- .../scroll/ScrollCrossDomainForwarder.t.sol | 2 +- .../scroll/ScrollCrossDomainGovernor.t.sol | 5 +- .../scroll/ScrollSequencerUptimeFeed.t.sol | 27 +- .../test/v1_0_0/scroll/ScrollValidator.t.sol | 25 +- .../shared/BaseSequencerUptimeFeed.t.sol | 20 +- .../test/v1_0_0/shared/BaseValidator.t.sol | 6 +- .../zksync/ZKSyncSequencerUptimeFeed.t.sol | 10 +- .../test/v1_0_0/zksync/ZKSyncValidator.t.sol | 24 +- .../l2ep/zksync/ZKSyncSequencerUptimeFeed.sol | 4 +- .../src/v0.8/l2ep/zksync/ZKSyncValidator.sol | 20 +- .../src/v0.8/llo-feeds/libraries/Common.sol | 16 +- .../libraries/test/ByteUtilTest.t.sol | 2 +- .../src/v0.8/llo-feeds/v0.3.0/FeeManager.sol | 77 ++- .../v0.8/llo-feeds/v0.3.0/RewardManager.sol | 25 +- .../src/v0.8/llo-feeds/v0.3.0/Verifier.sol | 52 +-- .../v0.8/llo-feeds/v0.3.0/VerifierProxy.sol | 52 ++- .../v0.3.0/interfaces/IFeeManager.sol | 12 +- .../v0.3.0/interfaces/IRewardManager.sol | 10 +- .../llo-feeds/v0.3.0/interfaces/IVerifier.sol | 10 +- .../v0.3.0/interfaces/IVerifierFeeManager.sol | 2 +- .../v0.3.0/interfaces/IVerifierProxy.sol | 22 +- .../test/fee-manager/BaseFeeManager.t.sol | 112 +++-- .../FeeManager.getFeeAndReward.t.sol | 13 +- .../fee-manager/FeeManager.processFee.t.sol | 40 +- .../FeeManager.processFeeBulk.t.sol | 20 +- .../v0.3.0/test/gas/Gas_VerifierTest.t.sol | 26 +- .../v0.3.0/test/mocks/ErroredVerifier.sol | 22 +- .../v0.3.0/test/mocks/ExposedVerifier.sol | 25 +- .../v0.3.0/test/mocks/FeeManagerProxy.sol | 4 +- .../reward-manager/BaseRewardManager.t.sol | 13 +- .../reward-manager/RewardManager.claim.t.sol | 23 +- .../RewardManager.general.t.sol | 4 +- .../RewardManager.payRecipients.t.sol | 7 +- .../RewardManager.setRecipients.t.sol | 2 +- ...RewardManager.updateRewardRecipients.t.sol | 17 +- .../test/verifier/BaseVerifierTest.t.sol | 210 ++++----- .../verifier/VerifierActivateConfigTest.t.sol | 11 +- .../verifier/VerifierDeactivateFeedTest.t.sol | 32 +- .../VerifierProxyConstructorTest.t.sol | 4 +- .../VerifierProxyInitializeVerifierTest.t.sol | 2 +- ...VerifierProxySetAccessControllerTest.t.sol | 2 +- .../VerifierProxySetVerifierTest.t.sol | 11 +- .../test/verifier/VerifierProxyTest.t.sol | 4 +- .../VerifierProxyUnsetVerifierTest.t.sol | 4 +- .../VerifierSetConfigFromSourceTest.t.sol | 8 +- .../test/verifier/VerifierSetConfigTest.t.sol | 10 +- .../v0.3.0/test/verifier/VerifierTest.t.sol | 2 +- .../verifier/VerifierTestBillingReport.t.sol | 48 +- .../verifier/VerifierUnsetConfigTest.t.sol | 12 +- .../test/verifier/VerifierVerifyTest.t.sol | 104 ++--- .../v0.4.0/DestinationFeeManager.sol | 110 +++-- .../v0.4.0/DestinationRewardManager.sol | 29 +- .../llo-feeds/v0.4.0/DestinationVerifier.sol | 87 ++-- .../v0.4.0/DestinationVerifierProxy.sol | 14 +- .../interfaces/IDestinationFeeManager.sol | 24 +- .../interfaces/IDestinationRewardManager.sol | 14 +- .../interfaces/IDestinationVerifier.sol | 8 +- .../IDestinationVerifierFeeManager.sol | 2 +- .../interfaces/IDestinationVerifierProxy.sol | 4 +- .../BaseDestinationFeeManager.t.sol | 120 ++--- ...estinationFeeManager.getFeeAndReward.t.sol | 13 +- .../DestinationFeeManager.processFee.t.sol | 40 +- ...DestinationFeeManager.processFeeBulk.t.sol | 20 +- .../test/mocks/DestinationFeeManagerProxy.sol | 4 +- .../BaseDestinationRewardManager.t.sol | 13 +- .../DestinationRewardManager.claim.t.sol | 23 +- .../DestinationRewardManager.general.t.sol | 4 +- ...stinationRewardManager.payRecipients.t.sol | 7 +- ...stinationRewardManager.setRecipients.t.sol | 2 +- ...RewardManager.updateRewardRecipients.t.sol | 17 +- .../BaseDestinationVerifierTest.t.sol | 103 ++-- .../DestinationVerifierInterfacesTest.t.sol | 12 +- .../DestinationVerifierProxyTest.t.sol | 7 +- ...nationVerifierRemoveLatestConfigTest.t.sol | 6 +- .../DestinationVerifierSetConfigTest.t.sol | 21 +- ...DestinationVerifierSetFeeManagerTest.t.sol | 2 +- .../verifier/DestinationVerifierTest.t.sol | 6 +- ...DestinationVerifierTestBillingReport.t.sol | 55 +-- .../DestinationVerifierTestRewards.t.sol | 35 +- ...erTestRewardsMultiVefifierFeeManager.t.sol | 35 +- .../DestinationVerifierVerifyBulkTest.t.sol | 13 +- .../DestinationVerifierVerifyTest.t.sol | 30 +- .../src/v0.8/llo-feeds/v0.5.0/FeeManager.sol | 77 ++- .../v0.8/llo-feeds/v0.5.0/RewardManager.sol | 25 +- .../src/v0.8/llo-feeds/v0.5.0/Verifier.sol | 35 +- .../v0.8/llo-feeds/v0.5.0/VerifierProxy.sol | 52 ++- .../configuration/ChannelConfigStore.sol | 7 +- .../v0.5.0/configuration/Configurator.sol | 23 +- .../test/ChannelConfigStore.t.sol | 5 +- .../configurator/BaseConfiguratorTest.t.sol | 15 +- ...ConfiguratorPromoteStagingConfigTest.t.sol | 18 +- .../ConfiguratorSetProductionConfigTest.t.sol | 101 +--- .../ConfiguratorSetStagingConfigTest.t.sol | 98 +--- .../test/configurator/ConfiguratorTest.t.sol | 2 +- .../test/mocks/ExposedChannelConfigStore.sol | 4 +- .../test/mocks/ExposedConfigurator.sol | 29 +- .../v0.5.0/interfaces/IFeeManager.sol | 12 +- .../v0.5.0/interfaces/IRewardManager.sol | 10 +- .../llo-feeds/v0.5.0/interfaces/IVerifier.sol | 14 +- .../v0.5.0/interfaces/IVerifierFeeManager.sol | 2 +- .../v0.5.0/interfaces/IVerifierProxy.sol | 22 +- .../test/fee-manager/BaseFeeManager.t.sol | 112 +++-- .../FeeManager.getFeeAndReward.t.sol | 13 +- .../fee-manager/FeeManager.processFee.t.sol | 40 +- .../FeeManager.processFeeBulk.t.sol | 20 +- .../v0.5.0/test/gas/Gas_VerifierTest.t.sol | 18 +- .../v0.5.0/test/mocks/ErroredVerifier.sol | 18 +- .../v0.5.0/test/mocks/ExposedVerifier.sol | 25 +- .../v0.5.0/test/mocks/FeeManagerProxy.sol | 4 +- .../v0.5.0/test/mocks/MockFeeManager.sol | 46 +- .../reward-manager/BaseRewardManager.t.sol | 13 +- .../reward-manager/RewardManager.claim.t.sol | 23 +- .../RewardManager.general.t.sol | 4 +- .../RewardManager.payRecipients.t.sol | 7 +- .../RewardManager.setRecipients.t.sol | 2 +- ...RewardManager.updateRewardRecipients.t.sol | 17 +- .../test/verifier/BaseVerifierTest.t.sol | 223 ++++----- .../verifier/VerifierActivateConfigTest.t.sol | 11 +- .../VerifierProxyConstructorTest.t.sol | 4 +- .../VerifierProxyInitializeVerifierTest.t.sol | 2 +- ...VerifierProxySetAccessControllerTest.t.sol | 2 +- .../VerifierProxySetVerifierTest.t.sol | 7 +- .../test/verifier/VerifierProxyTest.t.sol | 4 +- .../VerifierProxyUnsetVerifierTest.t.sol | 2 +- .../test/verifier/VerifierSetConfigTest.t.sol | 16 +- .../v0.5.0/test/verifier/VerifierTest.t.sol | 2 +- .../verifier/VerifierTestBillingReport.t.sol | 48 +- .../verifier/VerifierUnsetConfigTest.t.sol | 2 +- .../test/verifier/VerifierVerifyTest.t.sol | 94 ++-- .../operatorforwarder/AuthorizedReceiver.sol | 8 +- .../src/v0.8/operatorforwarder/Chainlink.sol | 2 +- .../operatorforwarder/ChainlinkClient.sol | 28 +- .../operatorforwarder/LinkTokenReceiver.sol | 6 +- .../src/v0.8/operatorforwarder/Operator.sol | 57 ++- .../operatorforwarder/OperatorFactory.sol | 10 +- .../interfaces/ENSInterface.sol | 12 +- .../interfaces/IAuthorizedReceiver.sol | 8 +- .../interfaces/OperatorInterface.sol | 2 +- .../v0.8/operatorforwarder/test/Broken.sol | 4 +- .../v0.8/operatorforwarder/test/Factory.t.sol | 2 +- .../operatorforwarder/test/Forwarder.t.sol | 6 +- .../operatorforwarder/test/operator.t.sol | 22 +- .../test/testhelpers/Callback.sol | 8 +- .../testhelpers/ChainlinkClientHelper.sol | 8 +- .../test/testhelpers/Chainlinked.sol | 10 +- .../test/testhelpers/Consumer.sol | 8 +- .../test/testhelpers/Deployer.t.sol | 4 +- .../test/testhelpers/EmptyOracle.sol | 6 +- .../test/testhelpers/GasGuzzlingConsumer.sol | 10 +- .../test/testhelpers/GetterSetter.sol | 12 +- .../test/testhelpers/MaliciousChainlink.sol | 2 +- .../test/testhelpers/MaliciousChainlinked.sol | 86 ++-- .../test/testhelpers/MaliciousConsumer.sol | 4 +- .../MaliciousMultiWordConsumer.sol | 4 +- .../test/testhelpers/MaliciousRequester.sol | 24 +- .../test/testhelpers/MockReceiver.sol | 4 +- .../test/testhelpers/MultiWordConsumer.sol | 23 +- .../v0.8/shared/access/AuthorizedCallers.sol | 12 +- .../src/v0.8/shared/access/ConfirmedOwner.sol | 4 +- .../access/ConfirmedOwnerWithProposal.sol | 8 +- .../src/v0.8/shared/access/Ownable2Step.sol | 8 +- .../access/SimpleWriteAccessController.sol | 10 +- .../src/v0.8/shared/call/CallWithExactGas.sol | 4 +- .../shared/call/CallWithExactGasZKSync.sol | 10 +- .../enumerable/EnumerableSetWithBytes16.sol | 40 +- .../shared/interfaces/AggregatorInterface.sol | 8 +- .../src/v0.8/shared/interfaces/IOwnable.sol | 4 +- .../src/v0.8/shared/interfaces/IWERC20.sol | 4 +- .../shared/interfaces/LinkTokenInterface.sol | 4 +- contracts/src/v0.8/shared/mocks/ERC20Mock.sol | 4 +- .../v0.8/shared/mocks/MockV3Aggregator.sol | 4 +- .../src/v0.8/shared/mocks/WERC20Mock.sol | 4 +- contracts/src/v0.8/shared/ocr2/OCR2Base.sol | 38 +- .../test/access/AuthorizedCallers.t.sol | 6 +- .../shared/test/call/CallWithExactGas.t.sol | 86 ++-- .../test/call/CallWithExactGasZKSync.t.sol | 33 +- .../test/helpers/BurnMintERC20WithDrip.sol | 4 +- .../shared/test/helpers/ChainReaderTester.sol | 35 +- .../v0.8/shared/test/helpers/LogEmitter.sol | 12 +- .../shared/test/helpers/VRFLogEmitter.sol | 9 +- .../shared/test/mocks/MockSystemContext.sol | 24 +- .../shared/test/testhelpers/GasConsumer.sol | 4 +- .../test/testhelpers/GenericReceiver.sol | 12 +- ...RC20PausableFreezableTransparentTest.t.sol | 21 +- ...rnMintERC20PausableFreezableUUPSTest.t.sol | 17 +- ...BurnMintERC20PausableTransparentTest.t.sol | 15 +- .../BurnMintERC20PausableUUPS.upgrade.t.sol | 14 +- .../BurnMintERC20PausableUUPSTest.t.sol | 9 +- .../BurnMintERC20TransparentTest.t.sol | 51 +- .../BurnMintERC20UUPSTest.t.sol | 57 +-- .../ERC20UpgradableBaseTest.approve.t.sol | 4 +- .../ERC20UpgradableBaseTest.burn.t.sol | 4 +- .../ERC20UpgradableBaseTest.burnFrom.t.sol | 4 +- ...C20UpgradableBaseTest.burnFrom_alias.t.sol | 4 +- .../ERC20UpgradableBaseTest.freeze.t.sol | 11 +- .../ERC20UpgradableBaseTest.mint.t.sol | 4 +- .../ERC20UpgradableBaseTest.pausing.t.sol | 35 +- .../ERC20UpgradableBaseTest.roles.t.sol | 8 +- ...UpgradableBaseTest.supportsInterface.t.sol | 4 +- .../upgradeable/ERC20UpgradableBaseTest.t.sol | 20 +- .../ERC20UpgradableBaseTest.unfreeze.t.sol | 16 +- .../test/token/ERC677/BurnMintERC677.t.sol | 4 +- .../test/util/SortedSetValidationUtil.t.sol | 2 +- .../v0.8/shared/token/ERC20/BurnMintERC20.sol | 25 +- .../shared/token/ERC20/IBurnMintERC20.sol | 4 +- ...nMintERC20PausableFreezableTransparent.sol | 12 +- .../BurnMintERC20PausableFreezableUUPS.sol | 12 +- .../BurnMintERC20PausableTransparent.sol | 3 +- .../upgradeable/BurnMintERC20PausableUUPS.sol | 3 +- .../upgradeable/BurnMintERC20Transparent.sol | 26 +- .../ERC20/upgradeable/BurnMintERC20UUPS.sol | 34 +- .../upgradeable/IBurnMintERC20Upgradeable.sol | 4 +- .../shared/token/ERC20/zksync/WETH9ZKSync.sol | 6 +- .../shared/token/ERC677/BurnMintERC677.sol | 53 ++- .../src/v0.8/shared/token/ERC677/ERC677.sol | 2 +- .../v0.8/shared/util/ChainSpecificUtil.sol | 46 +- .../shared/util/SortedSetValidationUtil.sol | 4 +- contracts/src/v0.8/vrf/AuthorizedReceiver.sol | 10 +- .../src/v0.8/vrf/BatchBlockhashStore.sol | 26 +- .../src/v0.8/vrf/BatchVRFCoordinatorV2.sol | 14 +- .../src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol | 46 +- contracts/src/v0.8/vrf/KeepersVRFConsumer.sol | 18 +- contracts/src/v0.8/vrf/VRF.sol | 378 +++++++-------- contracts/src/v0.8/vrf/VRFConsumerBase.sol | 3 +- contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol | 8 +- contracts/src/v0.8/vrf/VRFCoordinatorV2.sol | 132 +++--- contracts/src/v0.8/vrf/VRFOwner.sol | 85 ++-- contracts/src/v0.8/vrf/VRFV2Wrapper.sol | 50 +- .../src/v0.8/vrf/VRFV2WrapperConsumerBase.sol | 3 +- contracts/src/v0.8/vrf/dev/ArbitrumL1Fees.sol | 6 +- .../vrf/dev/BatchVRFCoordinatorV2Plus.sol | 14 +- contracts/src/v0.8/vrf/dev/BlockhashStore.sol | 10 +- contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol | 28 +- .../src/v0.8/vrf/dev/SubscriptionAPI.sol | 79 +++- .../v0.8/vrf/dev/TrustedBlockhashStore.sol | 10 +- .../v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol | 13 +- .../vrf/dev/VRFConsumerBaseV2Upgradeable.sol | 9 +- .../src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol | 101 ++-- .../vrf/dev/VRFCoordinatorV2_5_Arbitrum.sol | 15 +- .../vrf/dev/VRFCoordinatorV2_5_Optimism.sol | 10 +- .../vrf/dev/VRFSubscriptionBalanceMonitor.sol | 52 ++- .../src/v0.8/vrf/dev/VRFV2PlusWrapper.sol | 88 ++-- .../vrf/dev/VRFV2PlusWrapperConsumerBase.sol | 13 +- .../dev/interfaces/IVRFCoordinatorV2Plus.sol | 4 +- .../IVRFCoordinatorV2PlusInternal.sol | 11 +- .../IVRFCoordinatorV2PlusMigration.sol | 4 +- .../IVRFMigratableConsumerV2Plus.sol | 4 +- .../dev/interfaces/IVRFSubscriptionV2Plus.sol | 12 +- .../vrf/dev/libraries/VRFV2PlusClient.sol | 5 +- .../testhelpers/ExposedVRFCoordinatorV2_5.sol | 34 +- .../ExposedVRFCoordinatorV2_5_Arbitrum.sol | 8 +- .../ExposedVRFCoordinatorV2_5_Optimism.sol | 8 +- .../VRFConsumerV2PlusUpgradeableExample.sol | 18 +- .../testhelpers/VRFCoordinatorTestV2_5.sol | 97 ++-- .../VRFCoordinatorV2PlusUpgradedVersion.sol | 106 +++-- .../VRFCoordinatorV2Plus_V2Example.sol | 41 +- .../VRFMaliciousConsumerV2Plus.sol | 12 +- .../src/v0.8/vrf/dev/testhelpers/VRFOld.sol | 378 +++++++-------- .../testhelpers/VRFV2PlusConsumerExample.sol | 30 +- .../VRFV2PlusLoadTestWithMetrics.sol | 25 +- .../VRFV2PlusMaliciousMigrator.sol | 10 +- .../testhelpers/VRFV2PlusRevertingExample.sol | 12 +- .../VRFV2PlusSingleConsumerExample.sol | 13 +- .../VRFV2PlusWrapperConsumerExample.sol | 16 +- .../VRFV2PlusWrapperLoadTestConsumer.sol | 32 +- .../interfaces/BlockhashStoreInterface.sol | 4 +- .../vrf/interfaces/IAuthorizedReceiver.sol | 8 +- .../interfaces/VRFCoordinatorV2Interface.sol | 8 +- .../vrf/interfaces/VRFV2WrapperInterface.sol | 4 +- .../src/v0.8/vrf/mocks/VRFCoordinatorMock.sol | 6 +- .../v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol | 33 +- .../v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol | 18 +- contracts/src/v0.8/vrf/test/BaseTest.t.sol | 6 +- .../vrf/test/BatchVRFCoordinatorV2Plus.t.sol | 17 +- .../src/v0.8/vrf/test/ChainSpecificUtil.t.sol | 37 +- .../vrf/test/FixtureVRFCoordinatorV2_5.t.sol | 12 +- .../v0.8/vrf/test/TrustedBlockhashStore.t.sol | 2 +- .../v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol | 58 +-- .../test/VRFCoordinatorV2Plus_Migration.t.sol | 48 +- .../vrf/test/VRFCoordinatorV2_5Mock.t.sol | 47 +- .../test/VRFCoordinatorV2_5_Arbitrum.t.sol | 38 +- .../test/VRFCoordinatorV2_5_Optimism.t.sol | 63 ++- contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol | 224 ++++----- .../vrf/test/VRFV2PlusSubscriptionAPI.t.sol | 15 +- .../src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol | 57 +-- .../vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol | 12 +- .../vrf/test/VRFV2PlusWrapper_Migration.t.sol | 34 +- .../vrf/test/VRFV2PlusWrapper_Optimism.t.sol | 34 +- .../testhelpers/ChainSpecificUtilHelper.sol | 12 +- .../src/v0.8/vrf/testhelpers/VRFConsumer.sol | 2 +- .../v0.8/vrf/testhelpers/VRFConsumerV2.sol | 15 +- .../vrf/testhelpers/VRFConsumerV2Plus.sol | 20 +- .../VRFConsumerV2UpgradeableExample.sol | 15 +- .../vrf/testhelpers/VRFCoordinatorTestV2.sol | 127 ++--- .../VRFCoordinatorV2TestHelper.sol | 15 +- .../VRFExternalSubOwnerExample.sol | 7 +- .../VRFLoadTestExternalSubOwner.sol | 4 +- .../VRFLoadTestOwnerlessConsumer.sol | 2 +- .../testhelpers/VRFMaliciousConsumerV2.sol | 15 +- .../testhelpers/VRFMockETHLINKAggregator.sol | 8 +- .../VRFOwnerlessConsumerExample.sol | 4 +- .../testhelpers/VRFSingleConsumerExample.sol | 34 +- .../v0.8/vrf/testhelpers/VRFTestHelper.sol | 25 +- .../testhelpers/VRFV2LoadTestWithMetrics.sol | 27 +- .../testhelpers/VRFV2OwnerTestConsumer.sol | 28 +- .../v0.8/vrf/testhelpers/VRFV2ProxyAdmin.sol | 2 +- .../vrf/testhelpers/VRFV2RevertingExample.sol | 15 +- .../VRFV2WrapperConsumerExample.sol | 7 +- .../VRFV2WrapperLoadTestConsumer.sol | 6 +- .../VRFV2WrapperOutOfGasConsumerExample.sol | 4 +- .../VRFV2WrapperRevertingConsumerExample.sol | 4 +- .../v0.8/vrf/testhelpers/VRFv2Consumer.sol | 14 +- 556 files changed, 8261 insertions(+), 7978 deletions(-) diff --git a/contracts/src/v0.8/automation/AutomationCompatibleUtils.sol b/contracts/src/v0.8/automation/AutomationCompatibleUtils.sol index 58d68fc61e..63f2e619de 100644 --- a/contracts/src/v0.8/automation/AutomationCompatibleUtils.sol +++ b/contracts/src/v0.8/automation/AutomationCompatibleUtils.sol @@ -1,17 +1,27 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {Log} from "./interfaces/ILogAutomation.sol"; import {IAutomationV21PlusCommon} from "./interfaces/IAutomationV21PlusCommon.sol"; +import {Log} from "./interfaces/ILogAutomation.sol"; contract AutomationCompatibleUtils { - function _report(IAutomationV21PlusCommon.Report memory) external {} + function _report( + IAutomationV21PlusCommon.Report memory + ) external {} - function _logTriggerConfig(IAutomationV21PlusCommon.LogTriggerConfig memory) external {} + function _logTriggerConfig( + IAutomationV21PlusCommon.LogTriggerConfig memory + ) external {} - function _logTrigger(IAutomationV21PlusCommon.LogTrigger memory) external {} + function _logTrigger( + IAutomationV21PlusCommon.LogTrigger memory + ) external {} - function _conditionalTrigger(IAutomationV21PlusCommon.ConditionalTrigger memory) external {} + function _conditionalTrigger( + IAutomationV21PlusCommon.ConditionalTrigger memory + ) external {} - function _log(Log memory) external {} + function _log( + Log memory + ) external {} } diff --git a/contracts/src/v0.8/automation/AutomationForwarder.sol b/contracts/src/v0.8/automation/AutomationForwarder.sol index 58707e9627..184ab23a55 100644 --- a/contracts/src/v0.8/automation/AutomationForwarder.sol +++ b/contracts/src/v0.8/automation/AutomationForwarder.sol @@ -39,19 +39,13 @@ contract AutomationForwarder { assembly { let g := gas() // Compute g -= PERFORM_GAS_CUSHION and check for underflow - if lt(g, PERFORM_GAS_CUSHION) { - revert(0, 0) - } + if lt(g, PERFORM_GAS_CUSHION) { revert(0, 0) } g := sub(g, PERFORM_GAS_CUSHION) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call with exact gas success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) } @@ -81,12 +75,8 @@ contract AutomationForwarder { switch result // delegatecall returns 0 on error. - case 0 { - revert(0, returndatasize()) - } - default { - return(0, returndatasize()) - } + case 0 { revert(0, returndatasize()) } + default { return(0, returndatasize()) } } } } diff --git a/contracts/src/v0.8/automation/AutomationForwarderLogic.sol b/contracts/src/v0.8/automation/AutomationForwarderLogic.sol index d8236f3d7f..a3b0aae594 100644 --- a/contracts/src/v0.8/automation/AutomationForwarderLogic.sol +++ b/contracts/src/v0.8/automation/AutomationForwarderLogic.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.16; -import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol"; import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; +import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol"; contract AutomationForwarderLogic is ITypeAndVersion { IAutomationRegistryConsumer private s_registry; @@ -13,7 +13,9 @@ contract AutomationForwarderLogic is ITypeAndVersion { * @notice updateRegistry is called by the registry during migrations * @param newRegistry is the registry that this forwarder is being migrated to */ - function updateRegistry(address newRegistry) external { + function updateRegistry( + address newRegistry + ) external { if (msg.sender != address(s_registry)) revert(); s_registry = IAutomationRegistryConsumer(newRegistry); } diff --git a/contracts/src/v0.8/automation/Chainable.sol b/contracts/src/v0.8/automation/Chainable.sol index 469ea91aff..d0c2129b7d 100644 --- a/contracts/src/v0.8/automation/Chainable.sol +++ b/contracts/src/v0.8/automation/Chainable.sol @@ -15,7 +15,9 @@ contract Chainable { /** * @param fallbackAddress the address of the next contract in the chain */ - constructor(address fallbackAddress) { + constructor( + address fallbackAddress + ) { i_FALLBACK_ADDRESS = fallbackAddress; } @@ -50,12 +52,8 @@ contract Chainable { switch result // delegatecall returns 0 on error. - case 0 { - revert(0, returndatasize()) - } - default { - return(0, returndatasize()) - } + case 0 { revert(0, returndatasize()) } + default { return(0, returndatasize()) } } } } diff --git a/contracts/src/v0.8/automation/KeeperBase.sol b/contracts/src/v0.8/automation/KeeperBase.sol index 0e050d4aff..1507aea7f5 100644 --- a/contracts/src/v0.8/automation/KeeperBase.sol +++ b/contracts/src/v0.8/automation/KeeperBase.sol @@ -4,4 +4,5 @@ */ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import + import {AutomationBase as KeeperBase} from "./AutomationBase.sol"; diff --git a/contracts/src/v0.8/automation/KeeperCompatible.sol b/contracts/src/v0.8/automation/KeeperCompatible.sol index 6379fe526b..0e724b0b98 100644 --- a/contracts/src/v0.8/automation/KeeperCompatible.sol +++ b/contracts/src/v0.8/automation/KeeperCompatible.sol @@ -4,8 +4,10 @@ */ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import + import {AutomationCompatible as KeeperCompatible} from "./AutomationCompatible.sol"; // solhint-disable-next-line no-unused-import import {AutomationBase as KeeperBase} from "./AutomationBase.sol"; // solhint-disable-next-line no-unused-import -import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./interfaces/AutomationCompatibleInterface.sol"; +import {AutomationCompatibleInterface as KeeperCompatibleInterface} from + "./interfaces/AutomationCompatibleInterface.sol"; diff --git a/contracts/src/v0.8/automation/ZKSyncAutomationForwarder.sol b/contracts/src/v0.8/automation/ZKSyncAutomationForwarder.sol index f4616ba132..f4c03651f3 100644 --- a/contracts/src/v0.8/automation/ZKSyncAutomationForwarder.sol +++ b/contracts/src/v0.8/automation/ZKSyncAutomationForwarder.sol @@ -45,19 +45,13 @@ contract ZKSyncAutomationForwarder { assembly { let g := gas() // Compute g -= PERFORM_GAS_CUSHION and check for underflow - if lt(g, PERFORM_GAS_CUSHION) { - revert(0, 0) - } + if lt(g, PERFORM_GAS_CUSHION) { revert(0, 0) } g := sub(g, PERFORM_GAS_CUSHION) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } } bytes memory returnData; @@ -96,12 +90,8 @@ contract ZKSyncAutomationForwarder { switch result // delegatecall returns 0 on error. - case 0 { - revert(0, returndatasize()) - } - default { - return(0, returndatasize()) - } + case 0 { revert(0, returndatasize()) } + default { return(0, returndatasize()) } } } } diff --git a/contracts/src/v0.8/automation/chains/ArbitrumModule.sol b/contracts/src/v0.8/automation/chains/ArbitrumModule.sol index 2ad6fdddc8..ed82f0b8f8 100644 --- a/contracts/src/v0.8/automation/chains/ArbitrumModule.sol +++ b/contracts/src/v0.8/automation/chains/ArbitrumModule.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {ChainModuleBase} from "./ChainModuleBase.sol"; contract ArbitrumModule is ChainModuleBase { @@ -19,7 +19,9 @@ contract ArbitrumModule is ChainModuleBase { uint256 private constant FIXED_GAS_OVERHEAD = 5000; uint256 private constant PER_CALLDATA_BYTE_GAS_OVERHEAD = 0; - function blockHash(uint256 n) external view override returns (bytes32) { + function blockHash( + uint256 n + ) external view override returns (bytes32) { uint256 blockNum = ARB_SYS.arbBlockNumber(); if (n >= blockNum || blockNum - n > 256) { return ""; @@ -31,12 +33,16 @@ contract ArbitrumModule is ChainModuleBase { return ARB_SYS.arbBlockNumber(); } - function getCurrentL1Fee(uint256) external view override returns (uint256) { + function getCurrentL1Fee( + uint256 + ) external view override returns (uint256) { return ARB_GAS.getCurrentTxL1GasFees(); } - function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) { - (, uint256 perL1CalldataByte, , , , ) = ARB_GAS.getPricesInWei(); + function getMaxL1Fee( + uint256 dataSize + ) external view override returns (uint256) { + (, uint256 perL1CalldataByte,,,,) = ARB_GAS.getPricesInWei(); return perL1CalldataByte * dataSize; } diff --git a/contracts/src/v0.8/automation/chains/ChainModuleBase.sol b/contracts/src/v0.8/automation/chains/ChainModuleBase.sol index c595dbd640..d9b937f711 100644 --- a/contracts/src/v0.8/automation/chains/ChainModuleBase.sol +++ b/contracts/src/v0.8/automation/chains/ChainModuleBase.sol @@ -11,18 +11,24 @@ contract ChainModuleBase is IChainModule { return block.number; } - function blockHash(uint256 n) external view virtual returns (bytes32) { + function blockHash( + uint256 n + ) external view virtual returns (bytes32) { if (n >= block.number || block.number - n > 256) { return ""; } return blockhash(n); } - function getCurrentL1Fee(uint256) external view virtual returns (uint256 l1Fee) { + function getCurrentL1Fee( + uint256 + ) external view virtual returns (uint256 l1Fee) { return 0; } - function getMaxL1Fee(uint256) external view virtual returns (uint256 maxL1Fee) { + function getMaxL1Fee( + uint256 + ) external view virtual returns (uint256 maxL1Fee) { return 0; } diff --git a/contracts/src/v0.8/automation/chains/OptimismModule.sol b/contracts/src/v0.8/automation/chains/OptimismModule.sol index 7a46429496..a4302d2481 100644 --- a/contracts/src/v0.8/automation/chains/OptimismModule.sol +++ b/contracts/src/v0.8/automation/chains/OptimismModule.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import {OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; import {ChainModuleBase} from "./ChainModuleBase.sol"; /** @@ -21,11 +22,15 @@ contract OptimismModule is ChainModuleBase { uint256 private constant PER_CALLDATA_BYTE_GAS_OVERHEAD = 270; // @dev This will be updated to use the new function introduced by OP team - function getCurrentL1Fee(uint256 dataSize) external view override returns (uint256) { + function getCurrentL1Fee( + uint256 dataSize + ) external view override returns (uint256) { return _getL1Fee(dataSize); } - function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) { + function getMaxL1Fee( + uint256 dataSize + ) external view override returns (uint256) { return _getL1Fee(dataSize); } @@ -35,7 +40,9 @@ contract OptimismModule is ChainModuleBase { * @param dataSize the size of calldata * @return l1Fee the L1 fee */ - function _getL1Fee(uint256 dataSize) internal view returns (uint256) { + function _getL1Fee( + uint256 dataSize + ) internal view returns (uint256) { // fee is 4 per 0 byte, 16 per non-zero byte. Worst case we can have all non zero-bytes. // Instead of setting bytes to non-zero, we initialize 'new bytes' of length 4*dataSize to cover for zero bytes. bytes memory txCallData = new bytes(4 * dataSize); diff --git a/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol b/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol index 772b66cdf9..e363665cbe 100644 --- a/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol +++ b/contracts/src/v0.8/automation/chains/OptimismModuleV2.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {GasPriceOracle as OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; -import {ChainModuleBase} from "./ChainModuleBase.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {GasPriceOracle as OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; +import {ChainModuleBase} from "./ChainModuleBase.sol"; /** * @notice OptimismModuleV2 provides a cost-efficient way to get L1 fee on OP stack. @@ -12,6 +13,7 @@ import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; */ contract OptimismModuleV2 is ChainModuleBase, ConfirmedOwner { error InvalidL1FeeCoefficient(uint8 coefficient); + event L1FeeCoefficientSet(uint8 coefficient); /// @dev OVM_GASPRICEORACLE_ADDR is the address of the OVM_GasPriceOracle precompile on Optimism. @@ -28,11 +30,15 @@ contract OptimismModuleV2 is ChainModuleBase, ConfirmedOwner { constructor() ConfirmedOwner(msg.sender) {} - function getCurrentL1Fee(uint256 dataSize) external view override returns (uint256) { + function getCurrentL1Fee( + uint256 dataSize + ) external view override returns (uint256) { return (s_l1FeeCoefficient * _getL1Fee(dataSize)) / 100; } - function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) { + function getMaxL1Fee( + uint256 dataSize + ) external view override returns (uint256) { return _getL1Fee(dataSize); } @@ -42,7 +48,9 @@ contract OptimismModuleV2 is ChainModuleBase, ConfirmedOwner { * @param dataSize the size of calldata * @return l1Fee the L1 fee */ - function _getL1Fee(uint256 dataSize) internal view returns (uint256) { + function _getL1Fee( + uint256 dataSize + ) internal view returns (uint256) { return OVM_GASPRICEORACLE.getL1FeeUpperBound(dataSize); } @@ -59,7 +67,9 @@ contract OptimismModuleV2 is ChainModuleBase, ConfirmedOwner { * @dev this function can only be invoked by contract owner * @param coefficient the new coefficient */ - function setL1FeeCalculation(uint8 coefficient) external onlyOwner { + function setL1FeeCalculation( + uint8 coefficient + ) external onlyOwner { if (coefficient > 100) { revert InvalidL1FeeCoefficient(coefficient); } diff --git a/contracts/src/v0.8/automation/chains/ScrollModule.sol b/contracts/src/v0.8/automation/chains/ScrollModule.sol index 30fdc908d4..8362620abb 100644 --- a/contracts/src/v0.8/automation/chains/ScrollModule.sol +++ b/contracts/src/v0.8/automation/chains/ScrollModule.sol @@ -1,12 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {IScrollL1GasPriceOracle} from "../../vendor/@scroll-tech/contracts/src/L2/predeploys/IScrollL1GasPriceOracle.sol"; -import {ChainModuleBase} from "./ChainModuleBase.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {IScrollL1GasPriceOracle} from + "../../vendor/@scroll-tech/contracts/src/L2/predeploys/IScrollL1GasPriceOracle.sol"; +import {ChainModuleBase} from "./ChainModuleBase.sol"; contract ScrollModule is ChainModuleBase, ConfirmedOwner { error InvalidL1FeeCoefficient(uint8 coefficient); + event L1FeeCoefficientSet(uint8 coefficient); /// @dev SCROLL_L1_FEE_DATA_PADDING includes 140 bytes for L1 data padding for Scroll @@ -26,11 +28,15 @@ contract ScrollModule is ChainModuleBase, ConfirmedOwner { constructor() ConfirmedOwner(msg.sender) {} - function getCurrentL1Fee(uint256 dataSize) external view override returns (uint256) { + function getCurrentL1Fee( + uint256 dataSize + ) external view override returns (uint256) { return (s_l1FeeCoefficient * _getL1Fee(dataSize)) / 100; } - function getMaxL1Fee(uint256 dataSize) external view override returns (uint256) { + function getMaxL1Fee( + uint256 dataSize + ) external view override returns (uint256) { return _getL1Fee(dataSize); } @@ -38,7 +44,9 @@ contract ScrollModule is ChainModuleBase, ConfirmedOwner { * @param dataSize the size of calldata * @return l1Fee the L1 fee */ - function _getL1Fee(uint256 dataSize) internal view returns (uint256 l1Fee) { + function _getL1Fee( + uint256 dataSize + ) internal view returns (uint256 l1Fee) { // fee is 4 per 0 byte, 16 per non-zero byte. Worst case we can have all non zero-bytes. // Instead of setting bytes to non-zero, we initialize 'new bytes' of length 4*dataSize to cover for zero bytes. // this is the same as OP. @@ -59,7 +67,9 @@ contract ScrollModule is ChainModuleBase, ConfirmedOwner { * @dev this function can only be invoked by contract owner * @param coefficient the new coefficient */ - function setL1FeeCalculation(uint8 coefficient) external onlyOwner { + function setL1FeeCalculation( + uint8 coefficient + ) external onlyOwner { if (coefficient > 100) { revert InvalidL1FeeCoefficient(coefficient); } diff --git a/contracts/src/v0.8/automation/dev/MercuryRegistry.sol b/contracts/src/v0.8/automation/dev/MercuryRegistry.sol index 9035f0af92..82daeb1a5a 100644 --- a/contracts/src/v0.8/automation/dev/MercuryRegistry.sol +++ b/contracts/src/v0.8/automation/dev/MercuryRegistry.sol @@ -1,9 +1,10 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; + +import {ChainSpecificUtil} from "../../shared/util/ChainSpecificUtil.sol"; import {AutomationCompatibleInterface} from "../interfaces/AutomationCompatibleInterface.sol"; import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ChainSpecificUtil} from "../../shared/util/ChainSpecificUtil.sol"; /*--------------------------------------------------------------------------------------------------------------------+ | Mercury + Automation | @@ -92,7 +93,9 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea } // Returns a user-defined batch of feed data, based on the on-chain state. - function getLatestFeedData(string[] memory feedIds) external view returns (Feed[] memory) { + function getLatestFeedData( + string[] memory feedIds + ) external view returns (Feed[] memory) { Feed[] memory feeds = new Feed[](feedIds.length); for (uint256 i = 0; i < feedIds.length; i++) { feeds[i] = s_feedMapping[feedIds[i]]; @@ -102,13 +105,17 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea } // Invoke a feed lookup through the checkUpkeep function. Expected to run on a cron schedule. - function checkUpkeep(bytes calldata /* data */) external view override returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata /* data */ + ) external view override returns (bool, bytes memory) { string[] memory feeds = s_feeds; return revertForFeedLookup(feeds); } // Extracted from `checkUpkeep` for batching purposes. - function revertForFeedLookup(string[] memory feeds) public view returns (bool, bytes memory) { + function revertForFeedLookup( + string[] memory feeds + ) public view returns (bool, bytes memory) { uint256 blockNumber = ChainSpecificUtil._getBlockNumber(); revert StreamsLookup(FEED_PARAM_KEY, feeds, TIME_PARAM_KEY, blockNumber, ""); } @@ -126,8 +133,8 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea string memory feedId = _bytes32ToHexString(abi.encodePacked(report.feedId)); Feed memory feed = s_feedMapping[feedId]; if ( - (report.observationsTimestamp - feed.observationsTimestamp > feed.stalenessSeconds) || - deviationExceedsThreshold(feed.price, report.price, feed.deviationPercentagePPM) + (report.observationsTimestamp - feed.observationsTimestamp > feed.stalenessSeconds) + || deviationExceedsThreshold(feed.price, report.price, feed.deviationPercentagePPM) ) { filteredValues[count] = values[i]; count++; @@ -145,7 +152,7 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea } function checkErrorHandler( - uint256 /* errCode */, + uint256, /* errCode */ bytes memory /* extraData */ ) external view override returns (bool upkeepNeeded, bytes memory performData) { // dummy function with default values @@ -153,8 +160,10 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea } // Use deviated off-chain values to update on-chain state. - function performUpkeep(bytes calldata performData) external override { - (bytes[] memory values /* bytes memory lookupData */, ) = abi.decode(performData, (bytes[], bytes)); + function performUpkeep( + bytes calldata performData + ) external override { + (bytes[] memory values, /* bytes memory lookupData */ ) = abi.decode(performData, (bytes[], bytes)); for (uint256 i = 0; i < values.length; i++) { // Verify and decode the Mercury report. Report memory report = abi.decode(s_verifier.verify(values[i]), (Report)); @@ -187,7 +196,9 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea } // Decodes a mercury respone into an on-chain object. Thanks @mikestone!! - function _getReport(bytes memory signedReport) internal pure returns (Report memory) { + function _getReport( + bytes memory signedReport + ) internal pure returns (Report memory) { /* * bytes32[3] memory reportContext, * bytes memory reportData, @@ -195,7 +206,7 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea * bytes32[] memory ss, * bytes32 rawVs **/ - (, bytes memory reportData, , , ) = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); + (, bytes memory reportData,,,) = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); Report memory report = abi.decode(reportData, (Report)); return report; @@ -222,7 +233,9 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea // Helper function to reconcile a difference in formatting: // - Automation passes feedId into their off-chain lookup function as a string. // - Mercury stores feedId in their reports as a bytes32. - function _bytes32ToHexString(bytes memory buffer) internal pure returns (string memory) { + function _bytes32ToHexString( + bytes memory buffer + ) internal pure returns (string memory) { bytes memory converted = new bytes(buffer.length * 2); bytes memory _base = "0123456789abcdef"; for (uint256 i = 0; i < buffer.length; i++) { @@ -285,7 +298,9 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea s_feedMapping[feedId].feedId = feedId; } - function setVerifier(address verifier) external onlyOwner { + function setVerifier( + address verifier + ) external onlyOwner { s_verifier = IVerifierProxy(verifier); } @@ -316,5 +331,7 @@ interface IVerifierProxy { * report and any metadata for billing. * @return verifiedReport The encoded report from the verifier. */ - function verify(bytes calldata payload) external payable returns (bytes memory verifiedReport); + function verify( + bytes calldata payload + ) external payable returns (bytes memory verifiedReport); } diff --git a/contracts/src/v0.8/automation/dev/MercuryRegistryBatchUpkeep.sol b/contracts/src/v0.8/automation/dev/MercuryRegistryBatchUpkeep.sol index 2d3daeae19..1347325aea 100644 --- a/contracts/src/v0.8/automation/dev/MercuryRegistryBatchUpkeep.sol +++ b/contracts/src/v0.8/automation/dev/MercuryRegistryBatchUpkeep.sol @@ -9,6 +9,7 @@ contract MercuryRegistryBatchUpkeep is ConfirmedOwner, AutomationCompatibleInter error BatchSizeTooLarge(uint256 batchsize, uint256 maxBatchSize); // Use a reasonable maximum batch size. Every Mercury report is ~750 bytes, too many reports // passed into a single batch could exceed the calldata or transaction size limit for some blockchains. + uint256 public constant MAX_BATCH_SIZE = 50; MercuryRegistry public immutable i_registry; // master registry, where feed data is stored @@ -23,7 +24,9 @@ contract MercuryRegistryBatchUpkeep is ConfirmedOwner, AutomationCompatibleInter } // Invoke a feed lookup for the feeds this upkeep is responsible for. - function checkUpkeep(bytes calldata /* data */) external view override returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata /* data */ + ) external view override returns (bool, bytes memory) { uint256 start = s_batchStart; uint256 end = s_batchEnd; string[] memory feeds = new string[](end - start); @@ -35,7 +38,7 @@ contract MercuryRegistryBatchUpkeep is ConfirmedOwner, AutomationCompatibleInter // So, the batch will be partially empty. try i_registry.s_feeds(i) returns (string memory f) { feedId = f; - } catch (bytes memory /* data */) { + } catch (bytes memory) /* data */ { break; } @@ -62,7 +65,7 @@ contract MercuryRegistryBatchUpkeep is ConfirmedOwner, AutomationCompatibleInter } function checkErrorHandler( - uint256 /* errCode */, + uint256, /* errCode */ bytes memory /* extraData */ ) external view override returns (bool upkeepNeeded, bytes memory performData) { // dummy function with default values @@ -70,7 +73,9 @@ contract MercuryRegistryBatchUpkeep is ConfirmedOwner, AutomationCompatibleInter } // Use the master registry to update state. - function performUpkeep(bytes calldata performData) external override { + function performUpkeep( + bytes calldata performData + ) external override { i_registry.performUpkeep(performData); } diff --git a/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol b/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol index ae920822c3..030a4f3e6a 100644 --- a/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol +++ b/contracts/src/v0.8/automation/interfaces/AutomationCompatibleInterface.sol @@ -20,7 +20,9 @@ interface AutomationCompatibleInterface { * upkeep is needed. If you would like to encode data to decode later, try * `abi.encode`. */ - function checkUpkeep(bytes calldata checkData) external returns (bool upkeepNeeded, bytes memory performData); + function checkUpkeep( + bytes calldata checkData + ) external returns (bool upkeepNeeded, bytes memory performData); /** * @notice method that is actually executed by the keepers, via the registry. @@ -38,5 +40,7 @@ interface AutomationCompatibleInterface { * calling `abi.decode`. This data should not be trusted, and should be * validated against the contract's current state. */ - function performUpkeep(bytes calldata performData) external; + function performUpkeep( + bytes calldata performData + ) external; } diff --git a/contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol b/contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol index 0a53de697a..5ceb6648f1 100644 --- a/contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol +++ b/contracts/src/v0.8/automation/interfaces/IAutomationForwarder.sol @@ -7,7 +7,9 @@ import {IAutomationRegistryConsumer} from "./IAutomationRegistryConsumer.sol"; interface IAutomationForwarder is ITypeAndVersion { function forward(uint256 gasAmount, bytes memory data) external returns (bool success, uint256 gasUsed); - function updateRegistry(address newRegistry) external; + function updateRegistry( + address newRegistry + ) external; function getRegistry() external view returns (IAutomationRegistryConsumer); diff --git a/contracts/src/v0.8/automation/interfaces/IAutomationRegistryConsumer.sol b/contracts/src/v0.8/automation/interfaces/IAutomationRegistryConsumer.sol index bea3e950cf..326598e7df 100644 --- a/contracts/src/v0.8/automation/interfaces/IAutomationRegistryConsumer.sol +++ b/contracts/src/v0.8/automation/interfaces/IAutomationRegistryConsumer.sol @@ -8,15 +8,25 @@ pragma solidity ^0.8.4; * @dev Functions can be added to this interface, but not removed. */ interface IAutomationRegistryConsumer { - function getBalance(uint256 id) external view returns (uint96 balance); + function getBalance( + uint256 id + ) external view returns (uint96 balance); - function getMinBalance(uint256 id) external view returns (uint96 minBalance); + function getMinBalance( + uint256 id + ) external view returns (uint96 minBalance); - function cancelUpkeep(uint256 id) external; + function cancelUpkeep( + uint256 id + ) external; - function pauseUpkeep(uint256 id) external; + function pauseUpkeep( + uint256 id + ) external; - function unpauseUpkeep(uint256 id) external; + function unpauseUpkeep( + uint256 id + ) external; function addFunds(uint256 id, uint96 amount) external; diff --git a/contracts/src/v0.8/automation/interfaces/IAutomationV21PlusCommon.sol b/contracts/src/v0.8/automation/interfaces/IAutomationV21PlusCommon.sol index 6e3d0d72f7..4002d77621 100644 --- a/contracts/src/v0.8/automation/interfaces/IAutomationV21PlusCommon.sol +++ b/contracts/src/v0.8/automation/interfaces/IAutomationV21PlusCommon.sol @@ -42,12 +42,7 @@ interface IAutomationV21PlusCommon { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); @@ -242,13 +237,25 @@ interface IAutomationV21PlusCommon { ) external view returns (bool upkeepNeeded, bytes memory performData, uint8 upkeepFailureReason, uint256 gasUsed); function typeAndVersion() external view returns (string memory); function addFunds(uint256 id, uint96 amount) external; - function cancelUpkeep(uint256 id) external; + function cancelUpkeep( + uint256 id + ) external; - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory); - function hasDedupKey(bytes32 dedupKey) external view returns (bool); - function getUpkeepTriggerConfig(uint256 upkeepId) external view returns (bytes memory); - function getUpkeep(uint256 id) external view returns (UpkeepInfoLegacy memory upkeepInfo); - function getMinBalance(uint256 id) external view returns (uint96); + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool); + function getUpkeepTriggerConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function getUpkeep( + uint256 id + ) external view returns (UpkeepInfoLegacy memory upkeepInfo); + function getMinBalance( + uint256 id + ) external view returns (uint96); function getState() external view @@ -261,12 +268,18 @@ interface IAutomationV21PlusCommon { ); function setUpkeepGasLimit(uint256 id, uint32 gasLimit) external; function setUpkeepPrivilegeConfig(uint256 upkeepId, bytes memory newPrivilegeConfig) external; - function pauseUpkeep(uint256 id) external; - function unpauseUpkeep(uint256 id) external; + function pauseUpkeep( + uint256 id + ) external; + function unpauseUpkeep( + uint256 id + ) external; function getActiveUpkeepIDs(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); function pause() external; function setUpkeepCheckData(uint256 id, bytes memory newCheckData) external; function setUpkeepTriggerConfig(uint256 id, bytes memory triggerConfig) external; function owner() external view returns (address); - function getTriggerType(uint256 upkeepId) external pure returns (uint8); + function getTriggerType( + uint256 upkeepId + ) external pure returns (uint8); } diff --git a/contracts/src/v0.8/automation/interfaces/IChainModule.sol b/contracts/src/v0.8/automation/interfaces/IChainModule.sol index 15e84f7984..46110518c8 100644 --- a/contracts/src/v0.8/automation/interfaces/IChainModule.sol +++ b/contracts/src/v0.8/automation/interfaces/IChainModule.sol @@ -13,7 +13,9 @@ interface IChainModule { * @param blockNumber the block number * @return blockHash the block hash of the input block number */ - function blockHash(uint256 blockNumber) external view returns (bytes32 blockHash); + function blockHash( + uint256 blockNumber + ) external view returns (bytes32 blockHash); /* @notice this function provides the L1 fee of current transaction. * @dev retrieve the L1 data fee for a L2 transaction. it should return 0 for L1 chains. it should @@ -21,7 +23,9 @@ interface IChainModule { * @param dataSize the calldata size of the current transaction * @return l1Fee the L1 fee in wei incurred by calldata of this data size */ - function getCurrentL1Fee(uint256 dataSize) external view returns (uint256 l1Fee); + function getCurrentL1Fee( + uint256 dataSize + ) external view returns (uint256 l1Fee); /* @notice this function provides the max possible L1 fee of current transaction. * @dev retrieve the max possible L1 data fee for a L2 transaction. it should return 0 for L1 chains. it should @@ -29,7 +33,9 @@ interface IChainModule { * @param dataSize the calldata size of the current transaction * @return maxL1Fee the max possible L1 fee in wei incurred by calldata of this data size */ - function getMaxL1Fee(uint256 dataSize) external view returns (uint256 maxL1Fee); + function getMaxL1Fee( + uint256 dataSize + ) external view returns (uint256 maxL1Fee); /* @notice this function provides the overheads of calling this chain module. * @return chainModuleFixedOverhead the fixed overhead incurred by calling this chain module diff --git a/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol b/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol index 20a41f473b..f09eb7e37d 100644 --- a/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol +++ b/contracts/src/v0.8/automation/interfaces/ILogAutomation.sol @@ -60,5 +60,7 @@ interface ILogAutomation { * calling `abi.decode`. This data should not be trusted, and should be * validated against the contract's current state. */ - function performUpkeep(bytes calldata performData) external; + function performUpkeep( + bytes calldata performData + ) external; } diff --git a/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol b/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol index b5ba8196c7..eeb1cd64da 100644 --- a/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol +++ b/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol @@ -4,4 +4,5 @@ */ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import + import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./AutomationCompatibleInterface.sol"; diff --git a/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterface.sol b/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterface.sol index d279d93984..1feb262c3c 100644 --- a/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterface.sol +++ b/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterface.sol @@ -17,7 +17,9 @@ interface MigratableKeeperRegistryInterface { * @notice Called by other registries when migrating upkeeps. Only callable by other registries. * @param encodedUpkeeps abi encoding of upkeeps to import - decoded by the transcoder */ - function receiveUpkeeps(bytes calldata encodedUpkeeps) external; + function receiveUpkeeps( + bytes calldata encodedUpkeeps + ) external; /** * @notice Specifies the version of upkeep data that this registry requires in order to import diff --git a/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterfaceV2.sol b/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterfaceV2.sol index d6dcc03dd2..c4d22ed263 100644 --- a/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterfaceV2.sol +++ b/contracts/src/v0.8/automation/interfaces/MigratableKeeperRegistryInterfaceV2.sol @@ -15,7 +15,9 @@ interface MigratableKeeperRegistryInterfaceV2 { * @notice Called by other registries when migrating upkeeps. Only callable by other registries. * @param encodedUpkeeps abi encoding of upkeeps to import - decoded by the transcoder */ - function receiveUpkeeps(bytes calldata encodedUpkeeps) external; + function receiveUpkeeps( + bytes calldata encodedUpkeeps + ) external; /** * @notice Specifies the version of upkeep data that this registry requires in order to import diff --git a/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol index b3f8751949..f77d815887 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol @@ -56,6 +56,7 @@ interface IKeeperRegistryMaster { error UpkeepNotCanceled(); error UpkeepNotNeeded(); error ValueNotChanged(); + event AdminPrivilegeConfigSet(address indexed admin, bytes privilegeConfig); event CancelledUpkeepReport(uint256 indexed id, bytes trigger); event ConfigSet( @@ -94,18 +95,14 @@ interface IKeeperRegistryMaster { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); event UpkeepRegistered(uint256 indexed id, uint32 performGas, address admin); event UpkeepTriggerConfigSet(uint256 indexed id, bytes triggerConfig); event UpkeepUnpaused(uint256 indexed id); + fallback() external; function acceptOwnership() external; function fallbackTo() external view returns (address); @@ -133,7 +130,9 @@ interface IKeeperRegistryMaster { uint256 id, bytes memory performData ) external view returns (bool success, uint256 gasUsed); - function transferOwnership(address to) external; + function transferOwnership( + address to + ) external; function transmit( bytes32[3] memory reportContext, bytes memory rawReport, @@ -144,7 +143,9 @@ interface IKeeperRegistryMaster { function typeAndVersion() external view returns (string memory); function addFunds(uint256 id, uint96 amount) external; - function cancelUpkeep(uint256 id) external; + function cancelUpkeep( + uint256 id + ) external; function checkCallback( uint256 id, bytes[] memory values, @@ -184,7 +185,9 @@ interface IKeeperRegistryMaster { bytes memory payload ) external returns (bool upkeepNeeded, bytes memory performData, uint8 upkeepFailureReason, uint256 gasUsed); function migrateUpkeeps(uint256[] memory ids, address destination) external; - function receiveUpkeeps(bytes memory encodedUpkeeps) external; + function receiveUpkeeps( + bytes memory encodedUpkeeps + ) external; function registerUpkeep( address target, uint32 gasLimit, @@ -203,27 +206,45 @@ interface IKeeperRegistryMaster { ) external returns (uint256 id); function setUpkeepTriggerConfig(uint256 id, bytes memory triggerConfig) external; - function acceptPayeeship(address transmitter) external; - function acceptUpkeepAdmin(uint256 id) external; + function acceptPayeeship( + address transmitter + ) external; + function acceptUpkeepAdmin( + uint256 id + ) external; function getActiveUpkeepIDs(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory); + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory); function getAutomationForwarderLogic() external view returns (address); - function getBalance(uint256 id) external view returns (uint96 balance); + function getBalance( + uint256 id + ) external view returns (uint96 balance); function getCancellationDelay() external pure returns (uint256); function getConditionalGasOverhead() external pure returns (uint256); function getFastGasFeedAddress() external view returns (address); - function getForwarder(uint256 upkeepID) external view returns (address); + function getForwarder( + uint256 upkeepID + ) external view returns (address); function getLinkAddress() external view returns (address); function getLinkNativeFeedAddress() external view returns (address); function getLogGasOverhead() external pure returns (uint256); function getMaxPaymentForGas(uint8 triggerType, uint32 gasLimit) external view returns (uint96 maxPayment); - function getMinBalance(uint256 id) external view returns (uint96); - function getMinBalanceForUpkeep(uint256 id) external view returns (uint96 minBalance); + function getMinBalance( + uint256 id + ) external view returns (uint96); + function getMinBalanceForUpkeep( + uint256 id + ) external view returns (uint96 minBalance); function getMode() external view returns (uint8); - function getPeerRegistryMigrationPermission(address peer) external view returns (uint8); + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (uint8); function getPerPerformByteGasOverhead() external pure returns (uint256); function getPerSignerGasOverhead() external pure returns (uint256); - function getSignerInfo(address query) external view returns (bool active, uint8 index); + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index); function getState() external view @@ -237,16 +258,30 @@ interface IKeeperRegistryMaster { function getTransmitterInfo( address query ) external view returns (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee); - function getTriggerType(uint256 upkeepId) external pure returns (uint8); - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory); - function getUpkeepTriggerConfig(uint256 upkeepId) external view returns (bytes memory); - function hasDedupKey(bytes32 dedupKey) external view returns (bool); + function getTriggerType( + uint256 upkeepId + ) external pure returns (uint8); + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function getUpkeepTriggerConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool); function pause() external; - function pauseUpkeep(uint256 id) external; + function pauseUpkeep( + uint256 id + ) external; function recoverFunds() external; function setAdminPrivilegeConfig(address admin, bytes memory newPrivilegeConfig) external; - function setPayees(address[] memory payees) external; + function setPayees( + address[] memory payees + ) external; function setPeerRegistryMigrationPermission(address peer, uint8 permission) external; function setUpkeepCheckData(uint256 id, bytes memory newCheckData) external; function setUpkeepGasLimit(uint256 id, uint32 gasLimit) external; @@ -255,7 +290,9 @@ interface IKeeperRegistryMaster { function transferPayeeship(address transmitter, address proposed) external; function transferUpkeepAdmin(uint256 id, address proposed) external; function unpause() external; - function unpauseUpkeep(uint256 id) external; + function unpauseUpkeep( + uint256 id + ) external; function upkeepTranscoderVersion() external pure returns (uint8); function upkeepVersion() external pure returns (uint8); function withdrawFunds(uint256 id, address to) external; diff --git a/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol index edd8443363..9d6e2c72c5 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol @@ -55,6 +55,7 @@ interface IAutomationRegistryMaster { error UpkeepNotCanceled(); error UpkeepNotNeeded(); error ValueNotChanged(); + event AdminPrivilegeConfigSet(address indexed admin, bytes privilegeConfig); event CancelledUpkeepReport(uint256 indexed id, bytes trigger); event ChainSpecificModuleUpdated(address newModule); @@ -94,18 +95,14 @@ interface IAutomationRegistryMaster { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); event UpkeepRegistered(uint256 indexed id, uint32 performGas, address admin); event UpkeepTriggerConfigSet(uint256 indexed id, bytes triggerConfig); event UpkeepUnpaused(uint256 indexed id); + fallback() external; function acceptOwnership() external; function fallbackTo() external view returns (address); @@ -133,7 +130,9 @@ interface IAutomationRegistryMaster { uint256 id, bytes memory performData ) external view returns (bool success, uint256 gasUsed); - function transferOwnership(address to) external; + function transferOwnership( + address to + ) external; function transmit( bytes32[3] memory reportContext, bytes memory rawReport, @@ -144,7 +143,9 @@ interface IAutomationRegistryMaster { function typeAndVersion() external view returns (string memory); function addFunds(uint256 id, uint96 amount) external; - function cancelUpkeep(uint256 id) external; + function cancelUpkeep( + uint256 id + ) external; function checkCallback( uint256 id, bytes[] memory values, @@ -184,7 +185,9 @@ interface IAutomationRegistryMaster { bytes memory payload ) external returns (bool upkeepNeeded, bytes memory performData, uint8 upkeepFailureReason, uint256 gasUsed); function migrateUpkeeps(uint256[] memory ids, address destination) external; - function receiveUpkeeps(bytes memory encodedUpkeeps) external; + function receiveUpkeeps( + bytes memory encodedUpkeeps + ) external; function registerUpkeep( address target, uint32 gasLimit, @@ -203,29 +206,47 @@ interface IAutomationRegistryMaster { ) external returns (uint256 id); function setUpkeepTriggerConfig(uint256 id, bytes memory triggerConfig) external; - function acceptPayeeship(address transmitter) external; - function acceptUpkeepAdmin(uint256 id) external; + function acceptPayeeship( + address transmitter + ) external; + function acceptUpkeepAdmin( + uint256 id + ) external; function getActiveUpkeepIDs(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory); + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory); function getAllowedReadOnlyAddress() external view returns (address); function getAutomationForwarderLogic() external view returns (address); - function getBalance(uint256 id) external view returns (uint96 balance); + function getBalance( + uint256 id + ) external view returns (uint96 balance); function getCancellationDelay() external pure returns (uint256); function getChainModule() external view returns (address chainModule); function getConditionalGasOverhead() external pure returns (uint256); function getFastGasFeedAddress() external view returns (address); - function getForwarder(uint256 upkeepID) external view returns (address); + function getForwarder( + uint256 upkeepID + ) external view returns (address); function getLinkAddress() external view returns (address); function getLinkNativeFeedAddress() external view returns (address); function getLogGasOverhead() external pure returns (uint256); function getMaxPaymentForGas(uint8 triggerType, uint32 gasLimit) external view returns (uint96 maxPayment); - function getMinBalance(uint256 id) external view returns (uint96); - function getMinBalanceForUpkeep(uint256 id) external view returns (uint96 minBalance); - function getPeerRegistryMigrationPermission(address peer) external view returns (uint8); + function getMinBalance( + uint256 id + ) external view returns (uint96); + function getMinBalanceForUpkeep( + uint256 id + ) external view returns (uint96 minBalance); + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (uint8); function getPerPerformByteGasOverhead() external pure returns (uint256); function getPerSignerGasOverhead() external pure returns (uint256); function getReorgProtectionEnabled() external view returns (bool reorgProtectionEnabled); - function getSignerInfo(address query) external view returns (bool active, uint8 index); + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index); function getState() external view @@ -241,16 +262,30 @@ interface IAutomationRegistryMaster { function getTransmitterInfo( address query ) external view returns (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee); - function getTriggerType(uint256 upkeepId) external pure returns (uint8); - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory); - function getUpkeepTriggerConfig(uint256 upkeepId) external view returns (bytes memory); - function hasDedupKey(bytes32 dedupKey) external view returns (bool); + function getTriggerType( + uint256 upkeepId + ) external pure returns (uint8); + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function getUpkeepTriggerConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool); function pause() external; - function pauseUpkeep(uint256 id) external; + function pauseUpkeep( + uint256 id + ) external; function recoverFunds() external; function setAdminPrivilegeConfig(address admin, bytes memory newPrivilegeConfig) external; - function setPayees(address[] memory payees) external; + function setPayees( + address[] memory payees + ) external; function setPeerRegistryMigrationPermission(address peer, uint8 permission) external; function setUpkeepCheckData(uint256 id, bytes memory newCheckData) external; function setUpkeepGasLimit(uint256 id, uint32 gasLimit) external; @@ -259,7 +294,9 @@ interface IAutomationRegistryMaster { function transferPayeeship(address transmitter, address proposed) external; function transferUpkeepAdmin(uint256 id, address proposed) external; function unpause() external; - function unpauseUpkeep(uint256 id) external; + function unpauseUpkeep( + uint256 id + ) external; function upkeepTranscoderVersion() external pure returns (uint8); function upkeepVersion() external pure returns (uint8); function withdrawFunds(uint256 id, address to) external; diff --git a/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol b/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol index 7477c02f12..0332378584 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol @@ -61,6 +61,7 @@ interface IAutomationRegistryMaster2_3 { error UpkeepNotNeeded(); error ValueNotChanged(); error ZeroAddressNotAllowed(); + event AdminPrivilegeConfigSet(address indexed admin, bytes privilegeConfig); event BillingConfigOverridden(uint256 indexed id, AutomationRegistryBase2_3.BillingOverrides overrides); event BillingConfigOverrideRemoved(uint256 indexed id); @@ -105,18 +106,14 @@ interface IAutomationRegistryMaster2_3 { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); event UpkeepRegistered(uint256 indexed id, uint32 performGas, address admin); event UpkeepTriggerConfigSet(uint256 indexed id, bytes triggerConfig); event UpkeepUnpaused(uint256 indexed id); + fallback() external payable; function acceptOwnership() external; function fallbackTo() external view returns (address); @@ -141,7 +138,9 @@ interface IAutomationRegistryMaster2_3 { address[] memory billingTokens, AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs ) external; - function transferOwnership(address to) external; + function transferOwnership( + address to + ) external; function transmit( bytes32[3] memory reportContext, bytes memory rawReport, @@ -151,10 +150,14 @@ interface IAutomationRegistryMaster2_3 { ) external; function typeAndVersion() external view returns (string memory); - function cancelUpkeep(uint256 id) external; + function cancelUpkeep( + uint256 id + ) external; function migrateUpkeeps(uint256[] memory ids, address destination) external; function onTokenTransfer(address sender, uint256 amount, bytes memory data) external; - function receiveUpkeeps(bytes memory encodedUpkeeps) external; + function receiveUpkeeps( + bytes memory encodedUpkeeps + ) external; function registerUpkeep( address target, uint32 gasLimit, @@ -166,7 +169,9 @@ interface IAutomationRegistryMaster2_3 { bytes memory offchainConfig ) external returns (uint256 id); - function acceptUpkeepAdmin(uint256 id) external; + function acceptUpkeepAdmin( + uint256 id + ) external; function addFunds(uint256 id, uint96 amount) external payable; function checkCallback( uint256 id, @@ -206,8 +211,12 @@ interface IAutomationRegistryMaster2_3 { uint256 id, bytes memory payload ) external returns (bool upkeepNeeded, bytes memory performData, uint8 upkeepFailureReason, uint256 gasUsed); - function pauseUpkeep(uint256 id) external; - function removeBillingOverrides(uint256 id) external; + function pauseUpkeep( + uint256 id + ) external; + function removeBillingOverrides( + uint256 id + ) external; function setBillingOverrides(uint256 id, AutomationRegistryBase2_3.BillingOverrides memory billingOverrides) external; function setUpkeepCheckData(uint256 id, bytes memory newCheckData) external; function setUpkeepGasLimit(uint256 id, uint32 gasLimit) external; @@ -218,28 +227,44 @@ interface IAutomationRegistryMaster2_3 { bytes memory performData ) external view returns (bool success, uint256 gasUsed); function transferUpkeepAdmin(uint256 id, address proposed) external; - function unpauseUpkeep(uint256 id) external; + function unpauseUpkeep( + uint256 id + ) external; function withdrawERC20Fees(address asset, address to, uint256 amount) external; function withdrawFunds(uint256 id, address to) external; function withdrawLink(address to, uint256 amount) external; - function acceptPayeeship(address transmitter) external; + function acceptPayeeship( + address transmitter + ) external; function disableOffchainPayments() external; function getActiveUpkeepIDs(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory); + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory); function getAllowedReadOnlyAddress() external view returns (address); function getAutomationForwarderLogic() external view returns (address); - function getAvailableERC20ForPayment(address billingToken) external view returns (uint256); - function getBalance(uint256 id) external view returns (uint96 balance); + function getAvailableERC20ForPayment( + address billingToken + ) external view returns (uint256); + function getBalance( + uint256 id + ) external view returns (uint96 balance); function getBillingConfig( address billingToken ) external view returns (AutomationRegistryBase2_3.BillingConfig memory); function getBillingOverrides( uint256 upkeepID ) external view returns (AutomationRegistryBase2_3.BillingOverrides memory); - function getBillingOverridesEnabled(uint256 upkeepID) external view returns (bool); - function getBillingToken(uint256 upkeepID) external view returns (address); - function getBillingTokenConfig(address token) external view returns (AutomationRegistryBase2_3.BillingConfig memory); + function getBillingOverridesEnabled( + uint256 upkeepID + ) external view returns (bool); + function getBillingToken( + uint256 upkeepID + ) external view returns (address); + function getBillingTokenConfig( + address token + ) external view returns (AutomationRegistryBase2_3.BillingConfig memory); function getBillingTokens() external view returns (address[] memory); function getCancellationDelay() external pure returns (uint256); function getChainModule() external view returns (address chainModule); @@ -247,7 +272,9 @@ interface IAutomationRegistryMaster2_3 { function getConfig() external view returns (AutomationRegistryBase2_3.OnchainConfig memory); function getFallbackNativePrice() external view returns (uint256); function getFastGasFeedAddress() external view returns (address); - function getForwarder(uint256 upkeepID) external view returns (address); + function getForwarder( + uint256 upkeepID + ) external view returns (address); function getHotVars() external view returns (AutomationRegistryBase2_3.HotVars memory); function getLinkAddress() external view returns (address); function getLinkUSDFeedAddress() external view returns (address); @@ -258,17 +285,27 @@ interface IAutomationRegistryMaster2_3 { uint32 gasLimit, address billingToken ) external view returns (uint96 maxPayment); - function getMinBalance(uint256 id) external view returns (uint96); - function getMinBalanceForUpkeep(uint256 id) external view returns (uint96 minBalance); + function getMinBalance( + uint256 id + ) external view returns (uint96); + function getMinBalanceForUpkeep( + uint256 id + ) external view returns (uint96 minBalance); function getNativeUSDFeedAddress() external view returns (address); function getNumUpkeeps() external view returns (uint256); function getPayoutMode() external view returns (uint8); - function getPeerRegistryMigrationPermission(address peer) external view returns (uint8); + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (uint8); function getPerPerformByteGasOverhead() external pure returns (uint256); function getPerSignerGasOverhead() external pure returns (uint256); function getReorgProtectionEnabled() external view returns (bool reorgProtectionEnabled); - function getReserveAmount(address billingToken) external view returns (uint256); - function getSignerInfo(address query) external view returns (bool active, uint8 index); + function getReserveAmount( + address billingToken + ) external view returns (uint256); + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index); function getState() external view @@ -286,20 +323,34 @@ interface IAutomationRegistryMaster2_3 { address query ) external view returns (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee); function getTransmittersWithPayees() external view returns (AutomationRegistryBase2_3.TransmitterPayeeInfo[] memory); - function getTriggerType(uint256 upkeepId) external pure returns (uint8); - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory); - function getUpkeepTriggerConfig(uint256 upkeepId) external view returns (bytes memory); + function getTriggerType( + uint256 upkeepId + ) external pure returns (uint8); + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function getUpkeepTriggerConfig( + uint256 upkeepId + ) external view returns (bytes memory); function getWrappedNativeTokenAddress() external view returns (address); - function hasDedupKey(bytes32 dedupKey) external view returns (bool); + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool); function linkAvailableForPayment() external view returns (int256); function pause() external; function setAdminPrivilegeConfig(address admin, bytes memory newPrivilegeConfig) external; - function setPayees(address[] memory payees) external; + function setPayees( + address[] memory payees + ) external; function setPeerRegistryMigrationPermission(address peer, uint8 permission) external; function setUpkeepPrivilegeConfig(uint256 upkeepId, bytes memory newPrivilegeConfig) external; function settleNOPsOffchain() external; - function supportsBillingToken(address token) external view returns (bool); + function supportsBillingToken( + address token + ) external view returns (bool); function transferPayeeship(address transmitter, address proposed) external; function unpause() external; function upkeepVersion() external pure returns (uint8); diff --git a/contracts/src/v0.8/automation/interfaces/v2_3/IWrappedNative.sol b/contracts/src/v0.8/automation/interfaces/v2_3/IWrappedNative.sol index 566eb2179e..15f9c16970 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_3/IWrappedNative.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_3/IWrappedNative.sol @@ -6,5 +6,7 @@ import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC2 interface IWrappedNative is IERC20 { function deposit() external payable; - function withdraw(uint256 wad) external; + function withdraw( + uint256 wad + ) external; } diff --git a/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol b/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol index 8943721559..db56d251c6 100644 --- a/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol +++ b/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol @@ -62,6 +62,7 @@ interface IZKSyncAutomationRegistryMaster2_3 { error UpkeepNotNeeded(); error ValueNotChanged(); error ZeroAddressNotAllowed(); + event AdminPrivilegeConfigSet(address indexed admin, bytes privilegeConfig); event BillingConfigOverridden(uint256 indexed id, ZKSyncAutomationRegistryBase2_3.BillingOverrides overrides); event BillingConfigOverrideRemoved(uint256 indexed id); @@ -106,18 +107,14 @@ interface IZKSyncAutomationRegistryMaster2_3 { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); event UpkeepRegistered(uint256 indexed id, uint32 performGas, address admin); event UpkeepTriggerConfigSet(uint256 indexed id, bytes triggerConfig); event UpkeepUnpaused(uint256 indexed id); + fallback() external payable; function acceptOwnership() external; function fallbackTo() external view returns (address); @@ -142,7 +139,9 @@ interface IZKSyncAutomationRegistryMaster2_3 { address[] memory billingTokens, ZKSyncAutomationRegistryBase2_3.BillingConfig[] memory billingConfigs ) external; - function transferOwnership(address to) external; + function transferOwnership( + address to + ) external; function transmit( bytes32[3] memory reportContext, bytes memory rawReport, @@ -152,10 +151,14 @@ interface IZKSyncAutomationRegistryMaster2_3 { ) external; function typeAndVersion() external view returns (string memory); - function cancelUpkeep(uint256 id) external; + function cancelUpkeep( + uint256 id + ) external; function migrateUpkeeps(uint256[] memory ids, address destination) external; function onTokenTransfer(address sender, uint256 amount, bytes memory data) external; - function receiveUpkeeps(bytes memory encodedUpkeeps) external; + function receiveUpkeeps( + bytes memory encodedUpkeeps + ) external; function registerUpkeep( address target, uint32 gasLimit, @@ -167,7 +170,9 @@ interface IZKSyncAutomationRegistryMaster2_3 { bytes memory offchainConfig ) external returns (uint256 id); - function acceptUpkeepAdmin(uint256 id) external; + function acceptUpkeepAdmin( + uint256 id + ) external; function addFunds(uint256 id, uint96 amount) external payable; function checkCallback( uint256 id, @@ -207,8 +212,12 @@ interface IZKSyncAutomationRegistryMaster2_3 { uint256 id, bytes memory payload ) external returns (bool upkeepNeeded, bytes memory performData, uint8 upkeepFailureReason, uint256 gasUsed); - function pauseUpkeep(uint256 id) external; - function removeBillingOverrides(uint256 id) external; + function pauseUpkeep( + uint256 id + ) external; + function removeBillingOverrides( + uint256 id + ) external; function setBillingOverrides( uint256 id, ZKSyncAutomationRegistryBase2_3.BillingOverrides memory billingOverrides @@ -222,27 +231,41 @@ interface IZKSyncAutomationRegistryMaster2_3 { bytes memory performData ) external view returns (bool success, uint256 gasUsed); function transferUpkeepAdmin(uint256 id, address proposed) external; - function unpauseUpkeep(uint256 id) external; + function unpauseUpkeep( + uint256 id + ) external; function withdrawERC20Fees(address asset, address to, uint256 amount) external; function withdrawFunds(uint256 id, address to) external; function withdrawLink(address to, uint256 amount) external; - function acceptPayeeship(address transmitter) external; + function acceptPayeeship( + address transmitter + ) external; function disableOffchainPayments() external; function getActiveUpkeepIDs(uint256 startIndex, uint256 maxCount) external view returns (uint256[] memory); - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory); + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory); function getAllowedReadOnlyAddress() external view returns (address); function getAutomationForwarderLogic() external view returns (address); - function getAvailableERC20ForPayment(address billingToken) external view returns (uint256); - function getBalance(uint256 id) external view returns (uint96 balance); + function getAvailableERC20ForPayment( + address billingToken + ) external view returns (uint256); + function getBalance( + uint256 id + ) external view returns (uint96 balance); function getBillingConfig( address billingToken ) external view returns (ZKSyncAutomationRegistryBase2_3.BillingConfig memory); function getBillingOverrides( uint256 upkeepID ) external view returns (ZKSyncAutomationRegistryBase2_3.BillingOverrides memory); - function getBillingOverridesEnabled(uint256 upkeepID) external view returns (bool); - function getBillingToken(uint256 upkeepID) external view returns (address); + function getBillingOverridesEnabled( + uint256 upkeepID + ) external view returns (bool); + function getBillingToken( + uint256 upkeepID + ) external view returns (address); function getBillingTokenConfig( address token ) external view returns (ZKSyncAutomationRegistryBase2_3.BillingConfig memory); @@ -253,7 +276,9 @@ interface IZKSyncAutomationRegistryMaster2_3 { function getConfig() external view returns (ZKSyncAutomationRegistryBase2_3.OnchainConfig memory); function getFallbackNativePrice() external view returns (uint256); function getFastGasFeedAddress() external view returns (address); - function getForwarder(uint256 upkeepID) external view returns (address); + function getForwarder( + uint256 upkeepID + ) external view returns (address); function getHotVars() external view returns (ZKSyncAutomationRegistryBase2_3.HotVars memory); function getLinkAddress() external view returns (address); function getLinkUSDFeedAddress() external view returns (address); @@ -264,16 +289,26 @@ interface IZKSyncAutomationRegistryMaster2_3 { uint32 gasLimit, address billingToken ) external view returns (uint96 maxPayment); - function getMinBalance(uint256 id) external view returns (uint96); - function getMinBalanceForUpkeep(uint256 id) external view returns (uint96 minBalance); + function getMinBalance( + uint256 id + ) external view returns (uint96); + function getMinBalanceForUpkeep( + uint256 id + ) external view returns (uint96 minBalance); function getNativeUSDFeedAddress() external view returns (address); function getNumUpkeeps() external view returns (uint256); function getPayoutMode() external view returns (uint8); - function getPeerRegistryMigrationPermission(address peer) external view returns (uint8); + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (uint8); function getPerSignerGasOverhead() external pure returns (uint256); function getReorgProtectionEnabled() external view returns (bool reorgProtectionEnabled); - function getReserveAmount(address billingToken) external view returns (uint256); - function getSignerInfo(address query) external view returns (bool active, uint8 index); + function getReserveAmount( + address billingToken + ) external view returns (uint256); + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index); function getState() external view @@ -292,20 +327,34 @@ interface IZKSyncAutomationRegistryMaster2_3 { external view returns (ZKSyncAutomationRegistryBase2_3.TransmitterPayeeInfo[] memory); - function getTriggerType(uint256 upkeepId) external pure returns (uint8); - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory); - function getUpkeepTriggerConfig(uint256 upkeepId) external view returns (bytes memory); + function getTriggerType( + uint256 upkeepId + ) external pure returns (uint8); + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo); + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory); + function getUpkeepTriggerConfig( + uint256 upkeepId + ) external view returns (bytes memory); function getWrappedNativeTokenAddress() external view returns (address); - function hasDedupKey(bytes32 dedupKey) external view returns (bool); + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool); function linkAvailableForPayment() external view returns (int256); function pause() external; function setAdminPrivilegeConfig(address admin, bytes memory newPrivilegeConfig) external; - function setPayees(address[] memory payees) external; + function setPayees( + address[] memory payees + ) external; function setPeerRegistryMigrationPermission(address peer, uint8 permission) external; function setUpkeepPrivilegeConfig(uint256 upkeepId, bytes memory newPrivilegeConfig) external; function settleNOPsOffchain() external; - function supportsBillingToken(address token) external view returns (bool); + function supportsBillingToken( + address token + ) external view returns (bool); function transferPayeeship(address transmitter, address proposed) external; function unpause() external; function upkeepVersion() external pure returns (uint8); diff --git a/contracts/src/v0.8/automation/libraries/external/Cron.sol b/contracts/src/v0.8/automation/libraries/external/Cron.sol index 1539dbf0c8..f3ec0560a0 100644 --- a/contracts/src/v0.8/automation/libraries/external/Cron.sol +++ b/contracts/src/v0.8/automation/libraries/external/Cron.sol @@ -21,7 +21,9 @@ library Cron { * @param spec the spec to evaluate * @return the next tick */ - function nextTick(Spec calldata spec) public view returns (uint256) { + function nextTick( + Spec calldata spec + ) public view returns (uint256) { return spec.nextTick(); } @@ -32,7 +34,9 @@ library Cron { * @param spec the spec to evaluate * @return the next tick */ - function lastTick(Spec calldata spec) public view returns (uint256) { + function lastTick( + Spec calldata spec + ) public view returns (uint256) { return spec.lastTick(); } @@ -52,7 +56,9 @@ library Cron { * @param cronString the cron string * @return the spec struct */ - function toSpec(string calldata cronString) public pure returns (Spec memory) { + function toSpec( + string calldata cronString + ) public pure returns (Spec memory) { return cronString.toSpec(); } @@ -62,7 +68,9 @@ library Cron { * @param cronString the cron string * @return the abi-encoded spec */ - function toEncodedSpec(string calldata cronString) public pure returns (bytes memory) { + function toEncodedSpec( + string calldata cronString + ) public pure returns (bytes memory) { return cronString.toEncodedSpec(); } @@ -72,7 +80,9 @@ library Cron { * @param spec the cron spec * @return the corresponding cron string */ - function toCronString(Spec calldata spec) public pure returns (string memory) { + function toCronString( + Spec calldata spec + ) public pure returns (string memory) { return spec.toCronString(); } } diff --git a/contracts/src/v0.8/automation/libraries/internal/Cron.sol b/contracts/src/v0.8/automation/libraries/internal/Cron.sol index aa2ab66d03..e7bb72474b 100644 --- a/contracts/src/v0.8/automation/libraries/internal/Cron.sol +++ b/contracts/src/v0.8/automation/libraries/internal/Cron.sol @@ -33,8 +33,8 @@ pragma solidity ^0.8.6; -import "../../../vendor/Strings.sol"; import "../../../vendor/DateTime.sol"; +import "../../../vendor/Strings.sol"; // The fields of a cron spec, by name string constant MINUTE = "minute"; @@ -96,7 +96,9 @@ library Cron { * @return the next tick * @dev this is the internal version of the library. There is also an external version. */ - function nextTick(Spec memory spec) internal view returns (uint256) { + function nextTick( + Spec memory spec + ) internal view returns (uint256) { uint16 year = DateTime.getYear(block.timestamp); uint8 month = DateTime.getMonth(block.timestamp); uint8 day = DateTime.getDay(block.timestamp); @@ -152,7 +154,9 @@ library Cron { * @param spec the spec to evaluate * @return the next tick */ - function lastTick(Spec memory spec) internal view returns (uint256) { + function lastTick( + Spec memory spec + ) internal view returns (uint256) { uint16 year = DateTime.getYear(block.timestamp); uint8 month = DateTime.getMonth(block.timestamp); uint8 day = DateTime.getDay(block.timestamp); @@ -221,11 +225,8 @@ library Cron { */ function matches(Spec memory spec, uint256 timestamp) internal view returns (bool) { DateTime._DateTime memory dt = DateTime.parseTimestamp(timestamp); - return - matches(spec.month, dt.month) && - matches(spec.day, dt.day) && - matches(spec.hour, dt.hour) && - matches(spec.minute, dt.minute); + return matches(spec.month, dt.month) && matches(spec.day, dt.day) && matches(spec.hour, dt.hour) + && matches(spec.minute, dt.minute); } /** @@ -234,7 +235,9 @@ library Cron { * @param cronString the cron string * @return the spec struct */ - function toSpec(string memory cronString) internal pure returns (Spec memory) { + function toSpec( + string memory cronString + ) internal pure returns (Spec memory) { strings.slice memory space = strings.toSlice(" "); strings.slice memory cronSlice = strings.toSlice(cronString); if (cronSlice.count(space) != 4) { @@ -248,24 +251,20 @@ library Cron { // The cronSlice now contains the last section of the cron job, // which corresponds to the day of week if ( - minuteSlice.len() == 0 || - hourSlice.len() == 0 || - daySlice.len() == 0 || - monthSlice.len() == 0 || - cronSlice.len() == 0 + minuteSlice.len() == 0 || hourSlice.len() == 0 || daySlice.len() == 0 || monthSlice.len() == 0 + || cronSlice.len() == 0 ) { revert InvalidSpec("some fields missing"); } - return - validate( - Spec({ - minute: sliceToField(minuteSlice), - hour: sliceToField(hourSlice), - day: sliceToField(daySlice), - month: sliceToField(monthSlice), - dayOfWeek: sliceToField(cronSlice) - }) - ); + return validate( + Spec({ + minute: sliceToField(minuteSlice), + hour: sliceToField(hourSlice), + day: sliceToField(daySlice), + month: sliceToField(monthSlice), + dayOfWeek: sliceToField(cronSlice) + }) + ); } /** @@ -274,7 +273,9 @@ library Cron { * @param cronString the cron string * @return the abi-encoded spec */ - function toEncodedSpec(string memory cronString) internal pure returns (bytes memory) { + function toEncodedSpec( + string memory cronString + ) internal pure returns (bytes memory) { return abi.encode(toSpec(cronString)); } @@ -284,21 +285,22 @@ library Cron { * @param spec the cron spec * @return the corresponding cron string */ - function toCronString(Spec memory spec) internal pure returns (string memory) { - return - string( - bytes.concat( - fieldToBstring(spec.minute), - " ", - fieldToBstring(spec.hour), - " ", - fieldToBstring(spec.day), - " ", - fieldToBstring(spec.month), - " ", - fieldToBstring(spec.dayOfWeek) - ) - ); + function toCronString( + Spec memory spec + ) internal pure returns (string memory) { + return string( + bytes.concat( + fieldToBstring(spec.minute), + " ", + fieldToBstring(spec.hour), + " ", + fieldToBstring(spec.day), + " ", + fieldToBstring(spec.month), + " ", + fieldToBstring(spec.dayOfWeek) + ) + ); } /** @@ -335,7 +337,9 @@ library Cron { * @param spec the spec to validate * @return the original spec */ - function validate(Spec memory spec) private pure returns (Spec memory) { + function validate( + Spec memory spec + ) private pure returns (Spec memory) { validateField(spec.dayOfWeek, DAY_OF_WEEK, 0, 6); validateField(spec.month, MONTH, 1, 12); uint8 maxDay = maxDayForMonthField(spec.month); @@ -357,32 +361,28 @@ library Cron { return; } else if (field.fieldType == FieldType.EXACT) { if (field.singleValue < min || field.singleValue > max) { - string memory reason = string( - bytes.concat("value must be >=,", uintToBString(min), " and <=", uintToBString(max)) - ); + string memory reason = + string(bytes.concat("value must be >=,", uintToBString(min), " and <=", uintToBString(max))); revert InvalidField(fieldName, reason); } } else if (field.fieldType == FieldType.INTERVAL) { if (field.interval < 1 || field.interval > max) { - string memory reason = string( - bytes.concat("inverval must be */(", uintToBString(1), "-", uintToBString(max), ")") - ); + string memory reason = + string(bytes.concat("inverval must be */(", uintToBString(1), "-", uintToBString(max), ")")); revert InvalidField(fieldName, reason); } } else if (field.fieldType == FieldType.RANGE) { if (field.rangeEnd > max || field.rangeEnd <= field.rangeStart) { - string memory reason = string( - bytes.concat("inverval must be within ", uintToBString(min), "-", uintToBString(max)) - ); + string memory reason = + string(bytes.concat("inverval must be within ", uintToBString(min), "-", uintToBString(max))); revert InvalidField(fieldName, reason); } } else if (field.fieldType == FieldType.LIST) { if (field.listLength < 2) { revert InvalidField(fieldName, "lists must have at least 2 items"); } - string memory reason = string( - bytes.concat("items in list must be within ", uintToBString(min), "-", uintToBString(max)) - ); + string memory reason = + string(bytes.concat("items in list must be within ", uintToBString(min), "-", uintToBString(max))); uint8 listItem; for (uint256 idx = 0; idx < field.listLength; idx++) { listItem = field.list[idx]; @@ -400,7 +400,9 @@ library Cron { * @param month the month field * @return the max day */ - function maxDayForMonthField(Field memory month) private pure returns (uint8) { + function maxDayForMonthField( + Field memory month + ) private pure returns (uint8) { // DEV: ranges are always safe because any two consecutive months will always // contain a month with 31 days if (month.fieldType == FieldType.WILD || month.fieldType == FieldType.RANGE) { @@ -437,7 +439,9 @@ library Cron { * @param fieldSlice the slice of a string representing the field of a cron job * @return the field */ - function sliceToField(strings.slice memory fieldSlice) private pure returns (Field memory) { + function sliceToField( + strings.slice memory fieldSlice + ) private pure returns (Field memory) { strings.slice memory star = strings.toSlice("*"); strings.slice memory dash = strings.toSlice("-"); strings.slice memory slash = strings.toSlice("/"); @@ -478,7 +482,9 @@ library Cron { * @param field the field to stringify * @return bytes representing the string, ex: bytes("*") */ - function fieldToBstring(Field memory field) private pure returns (bytes memory) { + function fieldToBstring( + Field memory field + ) private pure returns (bytes memory) { if (field.fieldType == FieldType.WILD) { return "*"; } else if (field.fieldType == FieldType.EXACT) { @@ -502,7 +508,9 @@ library Cron { * @param n the number to stringify * @return bytes representing the string, ex: bytes("1") */ - function uintToBString(uint256 n) private pure returns (bytes memory) { + function uintToBString( + uint256 n + ) private pure returns (bytes memory) { if (n == 0) { return "0"; } @@ -529,7 +537,9 @@ library Cron { * @param slice the string slice to convert to a uint8 * @return the number that the string represents ex: "20" --> 20 */ - function sliceToUint8(strings.slice memory slice) private pure returns (uint8) { + function sliceToUint8( + strings.slice memory slice + ) private pure returns (uint8) { bytes memory b = bytes(slice.toString()); uint8 i; uint8 result = 0; diff --git a/contracts/src/v0.8/automation/mocks/MockArbSys.sol b/contracts/src/v0.8/automation/mocks/MockArbSys.sol index f4b6cbe2bc..eece6d14e3 100644 --- a/contracts/src/v0.8/automation/mocks/MockArbSys.sol +++ b/contracts/src/v0.8/automation/mocks/MockArbSys.sol @@ -11,7 +11,9 @@ contract MockArbSys { return block.number; } - function arbBlockHash(uint256 arbBlockNum) external view returns (bytes32) { + function arbBlockHash( + uint256 arbBlockNum + ) external view returns (bytes32) { return blockhash(arbBlockNum); } } diff --git a/contracts/src/v0.8/automation/mocks/MockKeeperRegistry2_1.sol b/contracts/src/v0.8/automation/mocks/MockKeeperRegistry2_1.sol index 2f21780c11..c2102745b4 100644 --- a/contracts/src/v0.8/automation/mocks/MockKeeperRegistry2_1.sol +++ b/contracts/src/v0.8/automation/mocks/MockKeeperRegistry2_1.sol @@ -9,19 +9,29 @@ contract MockKeeperRegistry2_1 is IAutomationRegistryConsumer { constructor() {} - function getBalance(uint256 id) external view override returns (uint96) { + function getBalance( + uint256 id + ) external view override returns (uint96) { return balance; } - function getMinBalance(uint256 id) external view override returns (uint96) { + function getMinBalance( + uint256 id + ) external view override returns (uint96) { return minBalance; } - function cancelUpkeep(uint256 id) external override {} + function cancelUpkeep( + uint256 id + ) external override {} - function pauseUpkeep(uint256 id) external override {} + function pauseUpkeep( + uint256 id + ) external override {} - function unpauseUpkeep(uint256 id) external override {} + function unpauseUpkeep( + uint256 id + ) external override {} function updateCheckData(uint256 id, bytes calldata newCheckData) external {} diff --git a/contracts/src/v0.8/automation/mocks/MockUpkeep.sol b/contracts/src/v0.8/automation/mocks/MockUpkeep.sol index 17899f4cad..6a1ec63476 100644 --- a/contracts/src/v0.8/automation/mocks/MockUpkeep.sol +++ b/contracts/src/v0.8/automation/mocks/MockUpkeep.sol @@ -10,41 +10,58 @@ contract MockUpkeep { uint256 public performGasToBurn; event UpkeepPerformedWith(bytes upkeepData); + error CheckRevert(); error PerformRevert(); - function setShouldCheckRevert(bool value) public { + function setShouldCheckRevert( + bool value + ) public { shouldCheckRevert = value; } - function setShouldPerformRevert(bool value) public { + function setShouldPerformRevert( + bool value + ) public { shouldPerformRevert = value; } - function setCheckResult(bool value) public { + function setCheckResult( + bool value + ) public { checkResult = value; } - function setPerformData(bytes calldata data) public { + function setPerformData( + bytes calldata data + ) public { performData = data; } - function setCheckGasToBurn(uint256 value) public { + function setCheckGasToBurn( + uint256 value + ) public { checkGasToBurn = value; } - function setPerformGasToBurn(uint256 value) public { + function setPerformGasToBurn( + uint256 value + ) public { performGasToBurn = value; } - function checkUpkeep(bytes calldata) external view returns (bool callable, bytes memory executedata) { + function checkUpkeep( + bytes calldata + ) external view returns (bool callable, bytes memory executedata) { if (shouldCheckRevert) revert CheckRevert(); uint256 startGas = gasleft(); while (startGas - gasleft() < checkGasToBurn) {} // burn gas return (checkResult, performData); } - function performUpkeep(bytes calldata data) external { + function performUpkeep( + bytes calldata data + ) external { if (shouldPerformRevert) revert PerformRevert(); uint256 startGas = gasleft(); while (startGas - gasleft() < performGasToBurn) {} // burn gas diff --git a/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol b/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol index d9a8c3bcfd..939476cee8 100644 --- a/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol +++ b/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import {AutomationForwarder} from "../AutomationForwarder.sol"; import {AutomationForwarderLogic} from "../AutomationForwarderLogic.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import "forge-std/Test.sol"; // in contracts directory, run diff --git a/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol b/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol index f3eafc0d9a..c538daa9b1 100644 --- a/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol +++ b/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol @@ -2,13 +2,14 @@ pragma solidity 0.8.19; import {AutomationForwarderLogic} from "../AutomationForwarderLogic.sol"; -import {BaseTest} from "./BaseTest.t.sol"; + +import {ChainModuleBase} from "../chains/ChainModuleBase.sol"; +import {IAutomationRegistryMaster} from "../interfaces/v2_2/IAutomationRegistryMaster.sol"; import {AutomationRegistry2_2} from "../v2_2/AutomationRegistry2_2.sol"; import {AutomationRegistryBase2_2} from "../v2_2/AutomationRegistryBase2_2.sol"; import {AutomationRegistryLogicA2_2} from "../v2_2/AutomationRegistryLogicA2_2.sol"; import {AutomationRegistryLogicB2_2} from "../v2_2/AutomationRegistryLogicB2_2.sol"; -import {IAutomationRegistryMaster} from "../interfaces/v2_2/IAutomationRegistryMaster.sol"; -import {ChainModuleBase} from "../chains/ChainModuleBase.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract AutomationRegistry2_2_SetUp is BaseTest { address internal constant LINK_ETH_FEED = 0x1111111111111111111111111111111111111110; @@ -47,17 +48,11 @@ contract AutomationRegistry2_2_SetUp is BaseTest { s_registrars[0] = 0x3a0eDE26aa188BFE00b9A0C9A431A1a0CA5f7966; AutomationForwarderLogic forwarderLogic = new AutomationForwarderLogic(); - AutomationRegistryLogicB2_2 logicB2_2 = new AutomationRegistryLogicB2_2( - LINK_TOKEN, - LINK_ETH_FEED, - FAST_GAS_FEED, - address(forwarderLogic), - ZERO_ADDRESS - ); + AutomationRegistryLogicB2_2 logicB2_2 = + new AutomationRegistryLogicB2_2(LINK_TOKEN, LINK_ETH_FEED, FAST_GAS_FEED, address(forwarderLogic), ZERO_ADDRESS); AutomationRegistryLogicA2_2 logicA2_2 = new AutomationRegistryLogicA2_2(logicB2_2); - registryMaster = IAutomationRegistryMaster( - address(new AutomationRegistry2_2(AutomationRegistryLogicB2_2(address(logicA2_2)))) - ); + registryMaster = + IAutomationRegistryMaster(address(new AutomationRegistry2_2(AutomationRegistryLogicB2_2(address(logicA2_2))))); } } @@ -96,7 +91,7 @@ contract AutomationRegistry2_2_SetConfig is AutomationRegistry2_2_SetUp { ); function testSetConfigSuccess() public { - (uint32 configCount, , ) = registryMaster.latestConfigDetails(); + (uint32 configCount,,) = registryMaster.latestConfigDetails(); assertEq(configCount, 0); ChainModuleBase module = new ChainModuleBase(); @@ -150,15 +145,10 @@ contract AutomationRegistry2_2_SetConfig is AutomationRegistry2_2_SetUp { ); registryMaster.setConfig( - s_valid_signers, - s_valid_transmitters, - F, - onchainConfigBytes, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + s_valid_signers, s_valid_transmitters, F, onchainConfigBytes, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registryMaster.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registryMaster.getState(); assertEq(signers, s_valid_signers); assertEq(transmitters, s_valid_transmitters); diff --git a/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol b/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol index 4018c769f9..e970cd5ac6 100644 --- a/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol +++ b/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol @@ -1,9 +1,9 @@ pragma solidity ^0.8.0; -import {Test} from "forge-std/Test.sol"; import "../dev/MercuryRegistry.sol"; import "../dev/MercuryRegistryBatchUpkeep.sol"; import "../interfaces/StreamsLookupCompatibleInterface.sol"; +import {Test} from "forge-std/Test.sol"; contract MercuryRegistryTest is Test { address internal constant OWNER = 0x00007e64E1fB0C487F25dd6D3601ff6aF8d32e4e; @@ -51,7 +51,7 @@ contract MercuryRegistryTest is Test { // Set owner, and fork Arbitrum Goerli Testnet (chain ID 421613). // The fork is only used with the `FORK_TEST` flag enabeld, as to not disrupt CI. For CI, a mock verifier is used instead. vm.startPrank(OWNER); - try vm.envBool("FORK_TEST") returns (bool /* fork testing enabled */) { + try vm.envBool("FORK_TEST") returns (bool /* fork testing enabled */ ) { vm.selectFork(vm.createFork("https://goerli-rollup.arbitrum.io/rpc")); } catch { s_verifier = address(new MockVerifierProxy()); @@ -194,10 +194,7 @@ contract MercuryRegistryTest is Test { // Ensure stale reports cannot be included. vm.expectRevert( abi.encodeWithSelector( - MercuryRegistry.StaleReport.selector, - feedIds[0], - feeds[0].observationsTimestamp, - oldObservationsTimestamp + MercuryRegistry.StaleReport.selector, feedIds[0], feeds[0].observationsTimestamp, oldObservationsTimestamp ) ); s_testRegistry.performUpkeep(oldPerformData); @@ -329,8 +326,10 @@ contract MercuryRegistryTest is Test { } contract MockVerifierProxy is IVerifierProxy { - function verify(bytes calldata payload) external payable override returns (bytes memory) { - (, bytes memory reportData, , , ) = abi.decode(payload, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); + function verify( + bytes calldata payload + ) external payable override returns (bytes memory) { + (, bytes memory reportData,,,) = abi.decode(payload, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); return reportData; } } diff --git a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistrar2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistrar2_3.t.sol index de50336925..542d6a0735 100644 --- a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistrar2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistrar2_3.t.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {IAutomationRegistryMaster2_3} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; + +import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol"; -import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {AutomationRegistryBase2_3 as AutoBase} from "../../v2_3/AutomationRegistryBase2_3.sol"; -import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; +import {BaseTest} from "./BaseTest.t.sol"; +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; // forge test --match-path src/v0.8/automation/test/v2_3/AutomationRegistrar2_3.t.sol diff --git a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol index 7daa247a19..58fcef7c05 100644 --- a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol @@ -1,14 +1,20 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {Vm} from "forge-std/Test.sol"; -import {BaseTest} from "./BaseTest.t.sol"; -import {AutomationRegistryBase2_3 as AutoBase} from "../../v2_3/AutomationRegistryBase2_3.sol"; -import {AutomationRegistrar2_3 as Registrar} from "../../v2_3/AutomationRegistrar2_3.sol"; -import {IAutomationRegistryMaster2_3 as Registry, AutomationRegistryBase2_3, IAutomationV21PlusCommon} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; import {ChainModuleBase} from "../../chains/ChainModuleBase.sol"; -import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import { + AutomationRegistryBase2_3, + IAutomationRegistryMaster2_3 as Registry, + IAutomationV21PlusCommon +} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; + import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; +import {AutomationRegistrar2_3 as Registrar} from "../../v2_3/AutomationRegistrar2_3.sol"; +import {AutomationRegistryBase2_3 as AutoBase} from "../../v2_3/AutomationRegistryBase2_3.sol"; +import {BaseTest} from "./BaseTest.t.sol"; + +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import {Vm} from "forge-std/Test.sol"; // forge test --match-path src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol @@ -30,7 +36,7 @@ contract SetUp is BaseTest { function setUp() public virtual override { super.setUp(); - (registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); config = registry.getConfig(); vm.startPrank(OWNER); @@ -51,58 +57,23 @@ contract SetUp is BaseTest { vm.stopPrank(); linkUpkeepID = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); linkUpkeepID2 = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); usdUpkeepID18 = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(usdToken18), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(usdToken18), "", "", "" ); usdUpkeepID6 = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(usdToken6), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(usdToken6), "", "", "" ); nativeUpkeepID = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(weth), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(weth), "", "", "" ); vm.startPrank(OWNER); @@ -352,8 +323,7 @@ contract Withdraw is SetUp { _transmit(usdUpkeepID18, registry); // adds USD token to finance withdrawable, and gives NOPs a LINK balance require(registry.linkAvailableForPayment() < 0, "linkAvailableForPayment should be negative"); require( - registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, - "ERC20AvailableForPayment should be positive" + registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, "ERC20AvailableForPayment should be positive" ); vm.expectRevert(Registry.InsufficientLinkLiquidity.selector); vm.prank(FINANCE_ADMIN); @@ -365,7 +335,7 @@ contract Withdraw is SetUp { function test_WithdrawERC20Fees_InOffChainMode_Happy() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); @@ -421,28 +391,27 @@ contract SetConfig is SetUp { address module = address(new ChainModuleBase()); - AutomationRegistryBase2_3.OnchainConfig cfg = - AutomationRegistryBase2_3.OnchainConfig({ - checkGasLimit: 5_000_000, - stalenessSeconds: 90_000, - gasCeilingMultiplier: 0, - maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, - fallbackGasPrice: 20_000_000_000, - fallbackLinkPrice: 2_000_000_000, // $20 - fallbackNativePrice: 400_000_000_000, // $4,000 - transcoder: 0xB1e66855FD67f6e85F0f0fA38cd6fBABdf00923c, - registrars: _getRegistrars(), - upkeepPrivilegeManager: PRIVILEGE_MANAGER, - chainModule: module, - reorgProtectionEnabled: true, - financeAdmin: FINANCE_ADMIN - }); + AutomationRegistryBase2_3.OnchainConfig cfg = AutomationRegistryBase2_3.OnchainConfig({ + checkGasLimit: 5_000_000, + stalenessSeconds: 90_000, + gasCeilingMultiplier: 0, + maxPerformGas: 10_000_000, + maxCheckDataSize: 5_000, + maxPerformDataSize: 5_000, + maxRevertDataSize: 5_000, + fallbackGasPrice: 20_000_000_000, + fallbackLinkPrice: 2_000_000_000, // $20 + fallbackNativePrice: 400_000_000_000, // $4,000 + transcoder: 0xB1e66855FD67f6e85F0f0fA38cd6fBABdf00923c, + registrars: _getRegistrars(), + upkeepPrivilegeManager: PRIVILEGE_MANAGER, + chainModule: module, + reorgProtectionEnabled: true, + financeAdmin: FINANCE_ADMIN + }); function testSetConfigSuccess() public { - (uint32 configCount, uint32 blockNumber, ) = registry.latestConfigDetails(); + (uint32 configCount, uint32 blockNumber,) = registry.latestConfigDetails(); assertEq(configCount, 1); address billingTokenAddress = address(usdToken18); @@ -488,15 +457,10 @@ contract SetConfig is SetUp { ); registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, TRANSMITTERS); @@ -513,7 +477,7 @@ contract SetConfig is SetUp { } function testSetConfigMultipleBillingConfigsSuccess() public { - (uint32 configCount, , ) = registry.latestConfigDetails(); + (uint32 configCount,,) = registry.latestConfigDetails(); assertEq(configCount, 1); address billingTokenAddress1 = address(linkToken); @@ -543,15 +507,10 @@ contract SetConfig is SetUp { bytes memory onchainConfigBytesWithBilling = abi.encode(cfg, billingTokens, billingConfigs); registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, TRANSMITTERS); @@ -576,7 +535,7 @@ contract SetConfig is SetUp { } function testSetConfigTwiceAndLastSetOverwrites() public { - (uint32 configCount, , ) = registry.latestConfigDetails(); + (uint32 configCount,,) = registry.latestConfigDetails(); assertEq(configCount, 1); // BillingConfig1 @@ -599,15 +558,10 @@ contract SetConfig is SetUp { // set config once registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling1, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling1, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, IAutomationV21PlusCommon.OnchainConfigLegacy memory onchainConfig1, , , ) = registry.getState(); + (, IAutomationV21PlusCommon.OnchainConfigLegacy memory onchainConfig1,,,) = registry.getState(); assertEq(onchainConfig1.registrars.length, 2); // BillingConfig2 @@ -655,12 +609,7 @@ contract SetConfig is SetUp { // set config twice registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling2, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling2, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); ( @@ -691,7 +640,7 @@ contract SetConfig is SetUp { } function testSetConfigDuplicateBillingConfigFailure() public { - (uint32 configCount, , ) = registry.latestConfigDetails(); + (uint32 configCount,,) = registry.latestConfigDetails(); assertEq(configCount, 1); address billingTokenAddress1 = address(linkToken); @@ -723,12 +672,7 @@ contract SetConfig is SetUp { // expect revert because of duplicate tokens vm.expectRevert(abi.encodeWithSelector(Registry.DuplicateEntry.selector)); registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); } @@ -751,14 +695,7 @@ contract SetConfig is SetUp { vm.expectRevert(abi.encodeWithSelector(Registry.InvalidToken.selector)); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); } @@ -778,21 +715,13 @@ contract SetConfig is SetUp { vm.expectRevert(abi.encodeWithSelector(Registry.InvalidToken.selector)); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); } function testSetConfigOnTransmittersAndPayees() public { registry.setPayees(PAYEES); - AutomationRegistryBase2_3.TransmitterPayeeInfo[] memory transmitterPayeeInfos = registry - .getTransmittersWithPayees(); + AutomationRegistryBase2_3.TransmitterPayeeInfo[] memory transmitterPayeeInfos = registry.getTransmittersWithPayees(); assertEq(transmitterPayeeInfos.length, TRANSMITTERS.length); for (uint256 i = 0; i < transmitterPayeeInfos.length; i++) { @@ -810,7 +739,7 @@ contract SetConfig is SetUp { function testSetConfigWithNewTransmittersSuccess() public { registry = deployRegistry(AutoBase.PayoutMode.OFF_CHAIN); - (uint32 configCount, uint32 blockNumber, ) = registry.latestConfigDetails(); + (uint32 configCount, uint32 blockNumber,) = registry.latestConfigDetails(); assertEq(configCount, 0); address billingTokenAddress = address(usdToken18); @@ -855,21 +784,14 @@ contract SetConfig is SetUp { ); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); - (, , address[] memory signers, address[] memory transmitters, ) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters,) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, TRANSMITTERS); - (configCount, blockNumber, ) = registry.latestConfigDetails(); + (configCount, blockNumber,) = registry.latestConfigDetails(); configDigest = _configDigestFromConfigData( block.chainid, address(registry), @@ -896,17 +818,10 @@ contract SetConfig is SetUp { ); registry.setConfigTypeSafe( - SIGNERS, - NEW_TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, NEW_TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); - (, , signers, transmitters, ) = registry.getState(); + (,, signers, transmitters,) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, NEW_TRANSMITTERS); } @@ -956,14 +871,14 @@ contract NOPsSettlement is SetUp { event PaymentWithdrawn(address indexed transmitter, uint256 indexed amount, address indexed to, address payee); function testSettleNOPsOffchainRevertDueToUnauthorizedCaller() public { - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); vm.expectRevert(abi.encodeWithSelector(Registry.OnlyFinanceAdmin.selector)); registry.settleNOPsOffchain(); } function testSettleNOPsOffchainRevertDueToOffchainSettlementDisabled() public { - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); vm.prank(registry.owner()); registry.disableOffchainPayments(); @@ -975,7 +890,7 @@ contract NOPsSettlement is SetUp { function testSettleNOPsOffchainSuccess() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); uint256[] memory payments = new uint256[](TRANSMITTERS.length); @@ -992,7 +907,7 @@ contract NOPsSettlement is SetUp { // 1. transmitter balance zeroed after settlement, 2. admin can withdraw ERC20, 3. switch to onchain mode, 4. link amount owed to NOPs stays the same function testSettleNOPsOffchainSuccessWithERC20MultiSteps() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); // register an upkeep and add funds @@ -1008,7 +923,7 @@ contract NOPsSettlement is SetUp { // verify transmitters have positive balances uint256[] memory payments = new uint256[](TRANSMITTERS.length); for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, uint96 lastCollected, ) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance, uint96 lastCollected,) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertTrue(balance > 0); @@ -1025,7 +940,7 @@ contract NOPsSettlement is SetUp { // verify that transmitters balance has been zeroed out for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, , ) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance,,) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertEq(0, balance); @@ -1095,9 +1010,8 @@ contract NOPsSettlement is SetUp { address[] memory expectedPayees = new address[](6); uint256[] memory expectedPayments = new uint256[](6); for (uint256 i = 0; i < NEW_TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = registry.getTransmitterInfo( - NEW_TRANSMITTERS[i] - ); + (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = + registry.getTransmitterInfo(NEW_TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertTrue(lastCollected > 0); @@ -1105,9 +1019,8 @@ contract NOPsSettlement is SetUp { expectedPayees[i] = payee; } for (uint256 i = 2; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = registry.getTransmitterInfo( - TRANSMITTERS[i] - ); + (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = + registry.getTransmitterInfo(TRANSMITTERS[i]); assertFalse(active); assertEq(i, index); assertTrue(balance > 0); @@ -1140,26 +1053,26 @@ contract NOPsSettlement is SetUp { // the last 2 payees and payments for TRANSMITTERS[2] and TRANSMITTERS[3] and they are not ordered assertTrue( - (actualPayments[5] == expectedPayments[5] && - actualPayees[5] == expectedPayees[5] && - actualPayments[4] == expectedPayments[4] && - actualPayees[4] == expectedPayees[4]) || - (actualPayments[5] == expectedPayments[4] && - actualPayees[5] == expectedPayees[4] && - actualPayments[4] == expectedPayments[5] && - actualPayees[4] == expectedPayees[5]) + ( + actualPayments[5] == expectedPayments[5] && actualPayees[5] == expectedPayees[5] + && actualPayments[4] == expectedPayments[4] && actualPayees[4] == expectedPayees[4] + ) + || ( + actualPayments[5] == expectedPayments[4] && actualPayees[5] == expectedPayees[4] + && actualPayments[4] == expectedPayments[5] && actualPayees[4] == expectedPayees[5] + ) ); // verify that new transmitters balance has been zeroed out for (uint256 i = 0; i < NEW_TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, , ) = registry.getTransmitterInfo(NEW_TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance,,) = registry.getTransmitterInfo(NEW_TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertEq(0, balance); } // verify that deactivated transmitters (TRANSMITTERS[2] and TRANSMITTERS[3]) balance has been zeroed out for (uint256 i = 2; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, , ) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance,,) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertFalse(active); assertEq(i, index); assertEq(0, balance); @@ -1170,7 +1083,7 @@ contract NOPsSettlement is SetUp { } function testDisableOffchainPaymentsRevertDueToUnauthorizedCaller() public { - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); vm.startPrank(FINANCE_ADMIN); vm.expectRevert(bytes("Only callable by owner")); @@ -1178,7 +1091,7 @@ contract NOPsSettlement is SetUp { } function testDisableOffchainPaymentsSuccess() public { - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); vm.startPrank(registry.owner()); registry.disableOffchainPayments(); @@ -1188,7 +1101,7 @@ contract NOPsSettlement is SetUp { function testSinglePerformAndNodesCanWithdrawOnchain() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); // register an upkeep and add funds @@ -1208,7 +1121,7 @@ contract NOPsSettlement is SetUp { // payees should be able to withdraw onchain for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (, , uint96 balance, , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (,, uint96 balance,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); vm.prank(payee); vm.expectEmit(); emit PaymentWithdrawn(TRANSMITTERS[i], balance, payee, payee); @@ -1227,7 +1140,7 @@ contract NOPsSettlement is SetUp { function testMultiplePerformsAndNodesCanWithdrawOnchain() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); // register an upkeep and add funds @@ -1256,7 +1169,7 @@ contract NOPsSettlement is SetUp { // payees should be able to withdraw onchain for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (, , uint96 balance, , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (,, uint96 balance,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); vm.prank(payee); vm.expectEmit(); emit PaymentWithdrawn(TRANSMITTERS[i], balance, payee, payee); @@ -1285,8 +1198,8 @@ contract NOPsSettlement is SetUp { billingTokenAddresses[i] = address(billingTokens[i]); } - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); billingTokenConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ gasFeePPB: 10_000_000, // 15% flatFeeMilliCents: 2_000, // 2 cents @@ -1319,14 +1232,7 @@ contract NOPsSettlement is SetUp { }); registry.setConfigTypeSafe( - SIGNERS, - NEW_TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - "", - billingTokenAddresses, - billingTokenConfigs + SIGNERS, NEW_TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, "", billingTokenAddresses, billingTokenConfigs ); registry.setPayees(NEW_PAYEES); @@ -1347,28 +1253,14 @@ contract RegisterUpkeep is SetUp { registry.pause(); vm.expectRevert(Registry.RegistryPaused.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } function test_RevertsWhen_TargetIsNotAContract() public { vm.expectRevert(Registry.NotAContract.selector); registry.registerUpkeep( - randomAddress(), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + randomAddress(), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } @@ -1376,14 +1268,7 @@ contract RegisterUpkeep is SetUp { vm.prank(STRANGER); vm.expectRevert(Registry.OnlyCallableByOwnerOrRegistrar.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } @@ -1404,28 +1289,14 @@ contract RegisterUpkeep is SetUp { function test_RevertsWhen_ExecuteGasIsTooHigh() public { vm.expectRevert(Registry.GasLimitOutsideRange.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas + 1, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas + 1, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } function test_RevertsWhen_TheBillingTokenIsNotConfigured() public { vm.expectRevert(Registry.InvalidToken.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - randomAddress(), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), randomAddress(), "", "", "" ); } @@ -1552,20 +1423,16 @@ contract BillingOverrides is SetUp { event BillingConfigOverrideRemoved(uint256 indexed id); function test_RevertsWhen_NotPrivilegeManager() public { - AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = AutomationRegistryBase2_3.BillingOverrides({ - gasFeePPB: 5_000, - flatFeeMilliCents: 20_000 - }); + AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); vm.expectRevert(Registry.OnlyCallableByUpkeepPrivilegeManager.selector); registry.setBillingOverrides(linkUpkeepID, billingOverrides); } function test_RevertsWhen_UpkeepCancelled() public { - AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = AutomationRegistryBase2_3.BillingOverrides({ - gasFeePPB: 5_000, - flatFeeMilliCents: 20_000 - }); + AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); registry.cancelUpkeep(linkUpkeepID); @@ -1575,10 +1442,8 @@ contract BillingOverrides is SetUp { } function test_Happy_SetBillingOverrides() public { - AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = AutomationRegistryBase2_3.BillingOverrides({ - gasFeePPB: 5_000, - flatFeeMilliCents: 20_000 - }); + AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); vm.startPrank(PRIVILEGE_MANAGER); @@ -1638,12 +1503,7 @@ contract Transmit is SetUp { bytes32 exampleRawVs = bytes32(0x1234561234561234561234561234561234561234561234561234561234561234); bytes memory transmitData = abi.encodeWithSelector( - registry.transmit.selector, - exampleReportContext, - exampleRawReport, - exampleRs, - exampleSs, - exampleRawVs + registry.transmit.selector, exampleReportContext, exampleRawReport, exampleRs, exampleSs, exampleRawVs ); bytes memory badTransmitData = bytes.concat(transmitData, bytes1(0x00)); // add extra data vm.startPrank(TRANSMITTERS[0]); @@ -1663,16 +1523,13 @@ contract Transmit is SetUp { uint96 nativeUSD; uint96 billingUSD; } + event ReorgedUpkeepReport(uint256 indexed id, bytes trigger); event UpkeepCharged(uint256 indexed id, PaymentReceipt receipt); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); + function test_whenFirstUpkeepFails_subsequentUpkeepsPerform() external { // the first and second upkeeps use LINK as billing token and the third uses WETH // the first upkeep fails the pre perform check due to incorrect block number in its trigger @@ -1724,8 +1581,7 @@ contract Transmit is SetUp { "link reserve amount should have increased" ); // link reserve amount increases in value equal to the decrease of the other reserve amounts require( - prevReserveBalances[1] > registry.getReserveAmount(address(weth)), - "native reserve amount should have decreased" + prevReserveBalances[1] > registry.getReserveAmount(address(weth)), "native reserve amount should have decreased" ); } @@ -1778,8 +1634,7 @@ contract Transmit is SetUp { assertEq(prevTokenBalances[1], linkToken.balanceOf(address(registry))); // assert reserve amounts have adjusted accordingly require( - prevReserveBalances[0] > registry.getReserveAmount(address(weth)), - "native reserve amount should have decreased" + prevReserveBalances[0] > registry.getReserveAmount(address(weth)), "native reserve amount should have decreased" ); // link reserve amount increases in value equal to the decrease of the other reserve amounts require( prevReserveBalances[1] < registry.getReserveAmount(address(linkToken)), @@ -1814,8 +1669,7 @@ contract Transmit is SetUp { // withdraw-able by the finance team should be positive require( - registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, - "ERC20AvailableForPayment should be positive" + registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, "ERC20AvailableForPayment should be positive" ); require(registry.getAvailableERC20ForPayment(address(weth)) > 0, "ERC20AvailableForPayment should be positive"); @@ -1837,26 +1691,17 @@ contract Transmit is SetUp { "usd reserve amount should have decreased" ); require( - prevReserveBalances[2] > registry.getReserveAmount(address(weth)), - "native reserve amount should have decreased" + prevReserveBalances[2] > registry.getReserveAmount(address(weth)), "native reserve amount should have decreased" ); } function test_handlesInsufficientBalanceWithUSDToken18() external { // deploy and configure a registry with ON_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); // register an upkeep and add funds - uint256 upkeepID = registry.registerUpkeep( - address(TARGET1), - 1000000, - UPKEEP_ADMIN, - 0, - address(usdToken18), - "", - "", - "" - ); + uint256 upkeepID = + registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1871,8 +1716,7 @@ contract Transmit is SetUp { assertEq(entries.length, 3); Vm.Log memory l1 = entries[1]; assertEq( - l1.topics[0], - keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") + l1.topics[0], keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") ); ( uint96 gasChargeInBillingToken, @@ -1893,19 +1737,11 @@ contract Transmit is SetUp { function test_handlesInsufficientBalanceWithUSDToken6() external { // deploy and configure a registry with ON_CHAIN payout - (Registry registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); // register an upkeep and add funds - uint256 upkeepID = registry.registerUpkeep( - address(TARGET1), - 1000000, - UPKEEP_ADMIN, - 0, - address(usdToken6), - "", - "", - "" - ); + uint256 upkeepID = + registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken6), "", "", ""); vm.prank(OWNER); usdToken6.mint(UPKEEP_ADMIN, 1e20); @@ -1922,8 +1758,7 @@ contract Transmit is SetUp { assertEq(entries.length, 3); Vm.Log memory l1 = entries[1]; assertEq( - l1.topics[0], - keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") + l1.topics[0], keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") ); ( uint96 gasChargeInBillingToken, @@ -1950,7 +1785,7 @@ contract MigrateReceive is SetUp { function setUp() public override { super.setUp(); - (newRegistry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (newRegistry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); idsToMigrate.push(linkUpkeepID); idsToMigrate.push(linkUpkeepID2); idsToMigrate.push(usdUpkeepID18); @@ -2085,8 +1920,7 @@ contract MigrateReceive is SetUp { prevReserveBalances[1] - registry.getReserveAmount(address(usdToken18)) ); assertEq( - newRegistry.getReserveAmount(address(weth)), - prevReserveBalances[2] - registry.getReserveAmount(address(weth)) + newRegistry.getReserveAmount(address(weth)), prevReserveBalances[2] - registry.getReserveAmount(address(weth)) ); // assert token have been transferred @@ -2097,10 +1931,7 @@ contract MigrateReceive is SetUp { assertEq(usdToken18.balanceOf(address(newRegistry)), newRegistry.getBalance(usdUpkeepID18)); assertEq(weth.balanceOf(address(newRegistry)), newRegistry.getBalance(nativeUpkeepID)); assertEq(linkToken.balanceOf(address(registry)), prevTokenBalances[0] - linkToken.balanceOf(address(newRegistry))); - assertEq( - usdToken18.balanceOf(address(registry)), - prevTokenBalances[1] - usdToken18.balanceOf(address(newRegistry)) - ); + assertEq(usdToken18.balanceOf(address(registry)), prevTokenBalances[1] - usdToken18.balanceOf(address(newRegistry))); assertEq(weth.balanceOf(address(registry)), prevTokenBalances[2] - weth.balanceOf(address(newRegistry))); // assert upkeep data matches @@ -2128,7 +1959,7 @@ contract Pause is SetUp { vm.startPrank(registry.owner()); registry.pause(); - (IAutomationV21PlusCommon.StateLegacy memory state, , , , ) = registry.getState(); + (IAutomationV21PlusCommon.StateLegacy memory state,,,,) = registry.getState(); assertTrue(state.paused); } @@ -2153,11 +1984,11 @@ contract Unpause is SetUp { function test_CalledByOwner_success() external { vm.startPrank(registry.owner()); registry.pause(); - (IAutomationV21PlusCommon.StateLegacy memory state1, , , , ) = registry.getState(); + (IAutomationV21PlusCommon.StateLegacy memory state1,,,,) = registry.getState(); assertTrue(state1.paused); registry.unpause(); - (IAutomationV21PlusCommon.StateLegacy memory state2, , , , ) = registry.getState(); + (IAutomationV21PlusCommon.StateLegacy memory state2,,,,) = registry.getState(); assertFalse(state2.paused); } } @@ -2740,7 +2571,7 @@ contract TransferPayeeship is SetUp { registry.transferPayeeship(TRANSMITTERS[0], randomAddress()); - (, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); + (,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); assertEq(PAYEES[0], payee); } @@ -2789,7 +2620,7 @@ contract AcceptPayeeship is SetUp { emit PayeeshipTransferred(TRANSMITTERS[0], PAYEES[0], newPayee); registry.acceptPayeeship(TRANSMITTERS[0]); - (, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); + (,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); assertEq(newPayee, payee); } } @@ -2821,10 +2652,10 @@ contract SetPayees is SetUp { } function test_SetPayees_WhenExistingPayeesAreEmpty() external { - (registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertEq(address(0), payee); } @@ -2834,7 +2665,7 @@ contract SetPayees is SetUp { emit PayeesUpdated(TRANSMITTERS, PAYEES); registry.setPayees(PAYEES); for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (bool active, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertTrue(active); assertEq(PAYEES[i], payee); } @@ -2842,15 +2673,15 @@ contract SetPayees is SetUp { function test_DotNotSetPayeesToIgnoredAddress() external { address IGNORE_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF; - (registry, ) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); PAYEES[0] = IGNORE_ADDRESS; registry.setPayees(PAYEES); - (bool active, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); + (bool active,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); assertTrue(active); assertEq(address(0), payee); - (active, , , , payee) = registry.getTransmitterInfo(TRANSMITTERS[1]); + (active,,,, payee) = registry.getTransmitterInfo(TRANSMITTERS[1]); assertTrue(active); assertEq(PAYEES[1], payee); } diff --git a/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol b/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol index e714f734c3..88f09d9b42 100644 --- a/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol @@ -3,24 +3,30 @@ pragma solidity 0.8.19; import "forge-std/Test.sol"; -import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol"; -import {MockV3Aggregator} from "../../../shared/mocks/MockV3Aggregator.sol"; import {ERC20Mock} from "../../../shared/mocks/ERC20Mock.sol"; +import {MockV3Aggregator} from "../../../shared/mocks/MockV3Aggregator.sol"; +import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol"; + import {AutomationForwarderLogic} from "../../AutomationForwarderLogic.sol"; -import {UpkeepTranscoder5_0 as Transcoder} from "../../v2_3/UpkeepTranscoder5_0.sol"; + +import {ChainModuleBase} from "../../chains/ChainModuleBase.sol"; +import { + AutomationRegistryBase2_3, + IAutomationRegistryMaster2_3 as Registry +} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; + +import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; +import {MockUpkeep} from "../../mocks/MockUpkeep.sol"; +import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol"; import {AutomationRegistry2_3} from "../../v2_3/AutomationRegistry2_3.sol"; import {AutomationRegistryBase2_3 as AutoBase} from "../../v2_3/AutomationRegistryBase2_3.sol"; import {AutomationRegistryLogicA2_3} from "../../v2_3/AutomationRegistryLogicA2_3.sol"; import {AutomationRegistryLogicB2_3} from "../../v2_3/AutomationRegistryLogicB2_3.sol"; import {AutomationRegistryLogicC2_3} from "../../v2_3/AutomationRegistryLogicC2_3.sol"; -import {IAutomationRegistryMaster2_3 as Registry, AutomationRegistryBase2_3} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; -import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol"; -import {ChainModuleBase} from "../../chains/ChainModuleBase.sol"; -import {MockUpkeep} from "../../mocks/MockUpkeep.sol"; -import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; +import {UpkeepTranscoder5_0 as Transcoder} from "../../v2_3/UpkeepTranscoder5_0.sol"; -import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {WETH9} from "../../../vendor/canonical-weth/WETH9.sol"; +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; /** * @title BaseTest provides basic test setup procedures and dependencies for use by other @@ -146,7 +152,9 @@ contract BaseTest is Test { } /// @notice deploys the component parts of a registry, but nothing more - function deployRegistry(AutoBase.PayoutMode payoutMode) internal returns (Registry) { + function deployRegistry( + AutoBase.PayoutMode payoutMode + ) internal returns (Registry) { AutomationForwarderLogic forwarderLogic = new AutomationForwarderLogic(); AutomationRegistryLogicC2_3 logicC2_3 = new AutomationRegistryLogicC2_3( address(linkToken), @@ -183,8 +191,8 @@ contract BaseTest is Test { for (uint256 i = 0; i < billingTokens.length; i++) { billingTokenAddresses[i] = address(billingTokens[i]); } - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); billingTokenConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ gasFeePPB: DEFAULT_GAS_FEE_PPB, // 15% flatFeeMilliCents: DEFAULT_FLAT_FEE_MILLI_CENTS, // 2 cents @@ -229,8 +237,8 @@ contract BaseTest is Test { } // deploy registrar - AutomationRegistrar2_3.InitialTriggerConfig[] - memory triggerConfigs = new AutomationRegistrar2_3.InitialTriggerConfig[](2); + AutomationRegistrar2_3.InitialTriggerConfig[] memory triggerConfigs = + new AutomationRegistrar2_3.InitialTriggerConfig[](2); triggerConfigs[0] = AutomationRegistrar2_3.InitialTriggerConfig({ triggerType: 0, // condition autoApproveType: AutomationRegistrar2_3.AutoApproveType.DISABLED, @@ -242,12 +250,7 @@ contract BaseTest is Test { autoApproveMaxAllowed: 0 }); AutomationRegistrar2_3 registrar = new AutomationRegistrar2_3( - address(linkToken), - registry, - triggerConfigs, - billingTokens, - minRegistrationFees, - IWrappedNative(address(weth)) + address(linkToken), registry, triggerConfigs, billingTokens, minRegistrationFees, IWrappedNative(address(weth)) ); address[] memory registrars; @@ -274,14 +277,7 @@ contract BaseTest is Test { }); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - "", - billingTokenAddresses, - billingTokenConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, "", billingTokenAddresses, billingTokenConfigs ); return (registry, registrar); } @@ -293,12 +289,12 @@ contract BaseTest is Test { address billingToken, AutomationRegistryBase2_3.BillingConfig memory newConfig ) internal { - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); AutomationRegistryBase2_3.OnchainConfig memory config = registry.getConfig(); address[] memory billingTokens = registry.getBillingTokens(); - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); bool found = false; for (uint256 i = 0; i < billingTokens.length; i++) { @@ -312,26 +308,19 @@ contract BaseTest is Test { require(found, "could not find billing token provided on registry"); registry.setConfigTypeSafe( - signers, - transmitters, - f, - config, - OFFCHAIN_CONFIG_VERSION, - "", - billingTokens, - billingTokenConfigs + signers, transmitters, f, config, OFFCHAIN_CONFIG_VERSION, "", billingTokens, billingTokenConfigs ); } /// @notice this function removes a billing token from the registry function _removeBillingTokenConfig(Registry registry, address billingToken) internal { - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); AutomationRegistryBase2_3.OnchainConfig memory config = registry.getConfig(); address[] memory billingTokens = registry.getBillingTokens(); address[] memory newBillingTokens = new address[](billingTokens.length - 1); - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length - 1); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length - 1); uint256 j = 0; for (uint256 i = 0; i < billingTokens.length; i++) { @@ -344,14 +333,7 @@ contract BaseTest is Test { } registry.setConfigTypeSafe( - signers, - transmitters, - f, - config, - OFFCHAIN_CONFIG_VERSION, - "", - newBillingTokens, - billingTokenConfigs + signers, transmitters, f, config, OFFCHAIN_CONFIG_VERSION, "", newBillingTokens, billingTokenConfigs ); } @@ -392,18 +374,12 @@ contract BaseTest is Test { } } - AutoBase.Report memory report = AutoBase.Report( - uint256(1000000000), - uint256(2000000000), - upkeepIds, - gasLimits, - triggers, - performDatas - ); + AutoBase.Report memory report = + AutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); reportBytes = _encodeReport(report); } - (, , bytes32 configDigest) = registry.latestConfigDetails(); + (,, bytes32 configDigest) = registry.latestConfigDetails(); bytes32[3] memory reportContext = [configDigest, configDigest, configDigest]; uint256[] memory signerPKs = new uint256[](2); signerPKs[0] = SIGNING_KEY0; @@ -444,18 +420,12 @@ contract BaseTest is Test { } } - AutoBase.Report memory report = AutoBase.Report( - uint256(1000000000), - uint256(2000000000), - upkeepIds, - gasLimits, - triggers, - performDatas - ); + AutoBase.Report memory report = + AutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); reportBytes = _encodeReport(report); } - (, , bytes32 configDigest) = registry.latestConfigDetails(); + (,, bytes32 configDigest) = registry.latestConfigDetails(); bytes32[3] memory reportContext = [configDigest, configDigest, configDigest]; uint256[] memory signerPKs = new uint256[](2); signerPKs[0] = SIGNING_KEY0; @@ -498,7 +468,9 @@ contract BaseTest is Test { return (rs, ss, bytes32(vs)); } - function _encodeReport(AutoBase.Report memory report) internal pure returns (bytes memory reportBytes) { + function _encodeReport( + AutoBase.Report memory report + ) internal pure returns (bytes memory reportBytes) { return abi.encode(report); } @@ -537,7 +509,9 @@ contract BaseTest is Test { } /// @dev returns a pseudo-random byte array - function randomBytes(uint256 length) internal returns (bytes memory) { + function randomBytes( + uint256 length + ) internal returns (bytes memory) { bytes memory result = new bytes(length); bytes32 entropy; for (uint256 i = 0; i < length; i++) { diff --git a/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol b/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol index f90bd9b086..2d55e97c89 100644 --- a/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol @@ -3,26 +3,30 @@ pragma solidity 0.8.19; import "forge-std/Test.sol"; -import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol"; +import {ERC20Mock} from "../../../shared/mocks/ERC20Mock.sol"; import {MockV3Aggregator} from "../../../shared/mocks/MockV3Aggregator.sol"; +import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol"; import {AutomationForwarderLogic} from "../../AutomationForwarderLogic.sol"; +import {ChainModuleBase} from "../../chains/ChainModuleBase.sol"; +import { + AutomationRegistryBase2_3, + IAutomationRegistryMaster2_3 as Registry +} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; + +import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; +import {MockGasBoundCaller} from "../../mocks/MockGasBoundCaller.sol"; +import {MockUpkeep} from "../../mocks/MockUpkeep.sol"; +import {MockZKSyncSystemContext} from "../../mocks/MockZKSyncSystemContext.sol"; +import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol"; import {UpkeepTranscoder5_0 as Transcoder} from "../../v2_3/UpkeepTranscoder5_0.sol"; import {ZKSyncAutomationRegistry2_3} from "../../v2_3_zksync/ZKSyncAutomationRegistry2_3.sol"; +import {ZKSyncAutomationRegistryBase2_3 as ZKSyncAutoBase} from "../../v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol"; import {ZKSyncAutomationRegistryLogicA2_3} from "../../v2_3_zksync/ZKSyncAutomationRegistryLogicA2_3.sol"; import {ZKSyncAutomationRegistryLogicB2_3} from "../../v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol"; import {ZKSyncAutomationRegistryLogicC2_3} from "../../v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol"; -import {ZKSyncAutomationRegistryBase2_3 as ZKSyncAutoBase} from "../../v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol"; -import {IAutomationRegistryMaster2_3 as Registry, AutomationRegistryBase2_3} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; -import {AutomationRegistrar2_3} from "../../v2_3/AutomationRegistrar2_3.sol"; -import {ChainModuleBase} from "../../chains/ChainModuleBase.sol"; -import {MockUpkeep} from "../../mocks/MockUpkeep.sol"; -import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; -import {MockGasBoundCaller} from "../../mocks/MockGasBoundCaller.sol"; -import {MockZKSyncSystemContext} from "../../mocks/MockZKSyncSystemContext.sol"; -import {ERC20Mock} from "../../../shared/mocks/ERC20Mock.sol"; -import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {WETH9} from "../../../vendor/canonical-weth/WETH9.sol"; +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; /** * @title BaseTest provides basic test setup procedures and dependencies for use by other @@ -158,7 +162,9 @@ contract BaseTest is Test { } /// @notice deploys the component parts of a registry, but nothing more - function deployZKSyncRegistry(ZKSyncAutoBase.PayoutMode payoutMode) internal returns (Registry) { + function deployZKSyncRegistry( + ZKSyncAutoBase.PayoutMode payoutMode + ) internal returns (Registry) { AutomationForwarderLogic forwarderLogic = new AutomationForwarderLogic(); ZKSyncAutomationRegistryLogicC2_3 logicC2_3 = new ZKSyncAutomationRegistryLogicC2_3( address(linkToken), @@ -195,8 +201,8 @@ contract BaseTest is Test { for (uint256 i = 0; i < billingTokens.length; i++) { billingTokenAddresses[i] = address(billingTokens[i]); } - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); billingTokenConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ gasFeePPB: DEFAULT_GAS_FEE_PPB, // 15% flatFeeMilliCents: DEFAULT_FLAT_FEE_MILLI_CENTS, // 2 cents @@ -241,8 +247,8 @@ contract BaseTest is Test { } // deploy registrar - AutomationRegistrar2_3.InitialTriggerConfig[] - memory triggerConfigs = new AutomationRegistrar2_3.InitialTriggerConfig[](2); + AutomationRegistrar2_3.InitialTriggerConfig[] memory triggerConfigs = + new AutomationRegistrar2_3.InitialTriggerConfig[](2); triggerConfigs[0] = AutomationRegistrar2_3.InitialTriggerConfig({ triggerType: 0, // condition autoApproveType: AutomationRegistrar2_3.AutoApproveType.DISABLED, @@ -254,12 +260,7 @@ contract BaseTest is Test { autoApproveMaxAllowed: 0 }); AutomationRegistrar2_3 registrar = new AutomationRegistrar2_3( - address(linkToken), - registry, - triggerConfigs, - billingTokens, - minRegistrationFees, - IWrappedNative(address(weth)) + address(linkToken), registry, triggerConfigs, billingTokens, minRegistrationFees, IWrappedNative(address(weth)) ); address[] memory registrars; @@ -286,14 +287,7 @@ contract BaseTest is Test { }); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - "", - billingTokenAddresses, - billingTokenConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, "", billingTokenAddresses, billingTokenConfigs ); return (registry, registrar); } @@ -305,12 +299,12 @@ contract BaseTest is Test { address billingToken, AutomationRegistryBase2_3.BillingConfig memory newConfig ) internal { - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); AutomationRegistryBase2_3.OnchainConfig memory config = registry.getConfig(); address[] memory billingTokens = registry.getBillingTokens(); - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); bool found = false; for (uint256 i = 0; i < billingTokens.length; i++) { @@ -324,26 +318,19 @@ contract BaseTest is Test { require(found, "could not find billing token provided on registry"); registry.setConfigTypeSafe( - signers, - transmitters, - f, - config, - OFFCHAIN_CONFIG_VERSION, - "", - billingTokens, - billingTokenConfigs + signers, transmitters, f, config, OFFCHAIN_CONFIG_VERSION, "", billingTokens, billingTokenConfigs ); } /// @notice this function removes a billing token from the registry function _removeBillingTokenConfig(Registry registry, address billingToken) internal { - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); AutomationRegistryBase2_3.OnchainConfig memory config = registry.getConfig(); address[] memory billingTokens = registry.getBillingTokens(); address[] memory newBillingTokens = new address[](billingTokens.length - 1); - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length - 1); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length - 1); uint256 j = 0; for (uint256 i = 0; i < billingTokens.length; i++) { @@ -356,14 +343,7 @@ contract BaseTest is Test { } registry.setConfigTypeSafe( - signers, - transmitters, - f, - config, - OFFCHAIN_CONFIG_VERSION, - "", - newBillingTokens, - billingTokenConfigs + signers, transmitters, f, config, OFFCHAIN_CONFIG_VERSION, "", newBillingTokens, billingTokenConfigs ); } @@ -393,18 +373,12 @@ contract BaseTest is Test { revert("not implemented"); } } - ZKSyncAutoBase.Report memory report = ZKSyncAutoBase.Report( - uint256(1000000000), - uint256(2000000000), - upkeepIds, - gasLimits, - triggers, - performDatas - ); + ZKSyncAutoBase.Report memory report = + ZKSyncAutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); reportBytes = _encodeReport(report); } - (, , bytes32 configDigest) = registry.latestConfigDetails(); + (,, bytes32 configDigest) = registry.latestConfigDetails(); bytes32[3] memory reportContext = [configDigest, configDigest, configDigest]; uint256[] memory signerPKs = new uint256[](2); signerPKs[0] = SIGNING_KEY0; @@ -444,18 +418,12 @@ contract BaseTest is Test { } } - ZKSyncAutoBase.Report memory report = ZKSyncAutoBase.Report( - uint256(1000000000), - uint256(2000000000), - upkeepIds, - gasLimits, - triggers, - performDatas - ); + ZKSyncAutoBase.Report memory report = + ZKSyncAutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); reportBytes = _encodeReport(report); } - (, , bytes32 configDigest) = registry.latestConfigDetails(); + (,, bytes32 configDigest) = registry.latestConfigDetails(); bytes32[3] memory reportContext = [configDigest, configDigest, configDigest]; uint256[] memory signerPKs = new uint256[](2); signerPKs[0] = SIGNING_KEY0; @@ -495,7 +463,9 @@ contract BaseTest is Test { return (rs, ss, bytes32(vs)); } - function _encodeReport(ZKSyncAutoBase.Report memory report) internal pure returns (bytes memory reportBytes) { + function _encodeReport( + ZKSyncAutoBase.Report memory report + ) internal pure returns (bytes memory reportBytes) { return abi.encode(report); } @@ -534,7 +504,9 @@ contract BaseTest is Test { } /// @dev returns a pseudo-random byte array - function randomBytes(uint256 length) internal returns (bytes memory) { + function randomBytes( + uint256 length + ) internal returns (bytes memory) { bytes memory result = new bytes(length); bytes32 entropy; for (uint256 i = 0; i < length; i++) { diff --git a/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol index d7d87935e3..cf950da11b 100644 --- a/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol @@ -1,14 +1,20 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {Vm} from "forge-std/Test.sol"; -import {BaseTest} from "./BaseTest.t.sol"; -import {ZKSyncAutomationRegistryBase2_3 as AutoBase} from "../../v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol"; -import {AutomationRegistrar2_3 as Registrar} from "../../v2_3/AutomationRegistrar2_3.sol"; -import {IAutomationRegistryMaster2_3 as Registry, AutomationRegistryBase2_3, IAutomationV21PlusCommon} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; import {ChainModuleBase} from "../../chains/ChainModuleBase.sol"; -import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import { + AutomationRegistryBase2_3, + IAutomationRegistryMaster2_3 as Registry, + IAutomationV21PlusCommon +} from "../../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; + import {IWrappedNative} from "../../interfaces/v2_3/IWrappedNative.sol"; +import {AutomationRegistrar2_3 as Registrar} from "../../v2_3/AutomationRegistrar2_3.sol"; +import {ZKSyncAutomationRegistryBase2_3 as AutoBase} from "../../v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol"; +import {BaseTest} from "./BaseTest.t.sol"; + +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import {Vm} from "forge-std/Test.sol"; // forge test --match-path src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol --match-test @@ -30,7 +36,7 @@ contract SetUp is BaseTest { function setUp() public virtual override { super.setUp(); - (registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); config = registry.getConfig(); vm.startPrank(OWNER); @@ -51,58 +57,23 @@ contract SetUp is BaseTest { vm.stopPrank(); linkUpkeepID = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); linkUpkeepID2 = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); usdUpkeepID18 = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(usdToken18), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(usdToken18), "", "", "" ); usdUpkeepID6 = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(usdToken6), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(usdToken6), "", "", "" ); nativeUpkeepID = registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(weth), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(weth), "", "", "" ); vm.startPrank(OWNER); @@ -352,8 +323,7 @@ contract Withdraw is SetUp { _transmit(usdUpkeepID18, registry, bytes4(0)); // adds USD token to finance withdrawable, and gives NOPs a LINK balance require(registry.linkAvailableForPayment() < 0, "linkAvailableForPayment should be negative"); require( - registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, - "ERC20AvailableForPayment should be positive" + registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, "ERC20AvailableForPayment should be positive" ); vm.expectRevert(Registry.InsufficientLinkLiquidity.selector); vm.prank(FINANCE_ADMIN); @@ -365,7 +335,7 @@ contract Withdraw is SetUp { function test_WithdrawERC20Fees_InOffChainMode_Happy() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); @@ -421,28 +391,27 @@ contract SetConfig is SetUp { address module = address(new ChainModuleBase()); - AutomationRegistryBase2_3.OnchainConfig cfg = - AutomationRegistryBase2_3.OnchainConfig({ - checkGasLimit: 5_000_000, - stalenessSeconds: 90_000, - gasCeilingMultiplier: 0, - maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, - fallbackGasPrice: 20_000_000_000, - fallbackLinkPrice: 2_000_000_000, // $20 - fallbackNativePrice: 400_000_000_000, // $4,000 - transcoder: 0xB1e66855FD67f6e85F0f0fA38cd6fBABdf00923c, - registrars: _getRegistrars(), - upkeepPrivilegeManager: PRIVILEGE_MANAGER, - chainModule: module, - reorgProtectionEnabled: true, - financeAdmin: FINANCE_ADMIN - }); + AutomationRegistryBase2_3.OnchainConfig cfg = AutomationRegistryBase2_3.OnchainConfig({ + checkGasLimit: 5_000_000, + stalenessSeconds: 90_000, + gasCeilingMultiplier: 0, + maxPerformGas: 10_000_000, + maxCheckDataSize: 5_000, + maxPerformDataSize: 5_000, + maxRevertDataSize: 5_000, + fallbackGasPrice: 20_000_000_000, + fallbackLinkPrice: 2_000_000_000, // $20 + fallbackNativePrice: 400_000_000_000, // $4,000 + transcoder: 0xB1e66855FD67f6e85F0f0fA38cd6fBABdf00923c, + registrars: _getRegistrars(), + upkeepPrivilegeManager: PRIVILEGE_MANAGER, + chainModule: module, + reorgProtectionEnabled: true, + financeAdmin: FINANCE_ADMIN + }); function testSetConfigSuccess() public { - (uint32 configCount, uint32 blockNumber, ) = registry.latestConfigDetails(); + (uint32 configCount, uint32 blockNumber,) = registry.latestConfigDetails(); assertEq(configCount, 1); address billingTokenAddress = address(usdToken18); @@ -488,15 +457,10 @@ contract SetConfig is SetUp { ); registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, TRANSMITTERS); @@ -513,7 +477,7 @@ contract SetConfig is SetUp { } function testSetConfigMultipleBillingConfigsSuccess() public { - (uint32 configCount, , ) = registry.latestConfigDetails(); + (uint32 configCount,,) = registry.latestConfigDetails(); assertEq(configCount, 1); address billingTokenAddress1 = address(linkToken); @@ -543,15 +507,10 @@ contract SetConfig is SetUp { bytes memory onchainConfigBytesWithBilling = abi.encode(cfg, billingTokens, billingConfigs); registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, , address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters, uint8 f) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, TRANSMITTERS); @@ -576,7 +535,7 @@ contract SetConfig is SetUp { } function testSetConfigTwiceAndLastSetOverwrites() public { - (uint32 configCount, , ) = registry.latestConfigDetails(); + (uint32 configCount,,) = registry.latestConfigDetails(); assertEq(configCount, 1); // BillingConfig1 @@ -599,15 +558,10 @@ contract SetConfig is SetUp { // set config once registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling1, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling1, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); - (, IAutomationV21PlusCommon.OnchainConfigLegacy memory onchainConfig1, , , ) = registry.getState(); + (, IAutomationV21PlusCommon.OnchainConfigLegacy memory onchainConfig1,,,) = registry.getState(); assertEq(onchainConfig1.registrars.length, 2); // BillingConfig2 @@ -655,12 +609,7 @@ contract SetConfig is SetUp { // set config twice registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling2, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling2, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); ( @@ -691,7 +640,7 @@ contract SetConfig is SetUp { } function testSetConfigDuplicateBillingConfigFailure() public { - (uint32 configCount, , ) = registry.latestConfigDetails(); + (uint32 configCount,,) = registry.latestConfigDetails(); assertEq(configCount, 1); address billingTokenAddress1 = address(linkToken); @@ -723,12 +672,7 @@ contract SetConfig is SetUp { // expect revert because of duplicate tokens vm.expectRevert(abi.encodeWithSelector(Registry.DuplicateEntry.selector)); registry.setConfig( - SIGNERS, - TRANSMITTERS, - F, - onchainConfigBytesWithBilling, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes + SIGNERS, TRANSMITTERS, F, onchainConfigBytesWithBilling, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes ); } @@ -751,14 +695,7 @@ contract SetConfig is SetUp { vm.expectRevert(abi.encodeWithSelector(Registry.InvalidToken.selector)); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); } @@ -778,21 +715,13 @@ contract SetConfig is SetUp { vm.expectRevert(abi.encodeWithSelector(Registry.InvalidToken.selector)); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); } function testSetConfigOnTransmittersAndPayees() public { registry.setPayees(PAYEES); - AutomationRegistryBase2_3.TransmitterPayeeInfo[] memory transmitterPayeeInfos = registry - .getTransmittersWithPayees(); + AutomationRegistryBase2_3.TransmitterPayeeInfo[] memory transmitterPayeeInfos = registry.getTransmittersWithPayees(); assertEq(transmitterPayeeInfos.length, TRANSMITTERS.length); for (uint256 i = 0; i < transmitterPayeeInfos.length; i++) { @@ -810,7 +739,7 @@ contract SetConfig is SetUp { function testSetConfigWithNewTransmittersSuccess() public { registry = deployZKSyncRegistry(AutoBase.PayoutMode.OFF_CHAIN); - (uint32 configCount, uint32 blockNumber, ) = registry.latestConfigDetails(); + (uint32 configCount, uint32 blockNumber,) = registry.latestConfigDetails(); assertEq(configCount, 0); address billingTokenAddress = address(usdToken18); @@ -855,21 +784,14 @@ contract SetConfig is SetUp { ); registry.setConfigTypeSafe( - SIGNERS, - TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); - (, , address[] memory signers, address[] memory transmitters, ) = registry.getState(); + (,, address[] memory signers, address[] memory transmitters,) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, TRANSMITTERS); - (configCount, blockNumber, ) = registry.latestConfigDetails(); + (configCount, blockNumber,) = registry.latestConfigDetails(); configDigest = _configDigestFromConfigData( block.chainid, address(registry), @@ -896,17 +818,10 @@ contract SetConfig is SetUp { ); registry.setConfigTypeSafe( - SIGNERS, - NEW_TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - offchainConfigBytes, - billingTokens, - billingConfigs + SIGNERS, NEW_TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, offchainConfigBytes, billingTokens, billingConfigs ); - (, , signers, transmitters, ) = registry.getState(); + (,, signers, transmitters,) = registry.getState(); assertEq(signers, SIGNERS); assertEq(transmitters, NEW_TRANSMITTERS); } @@ -956,14 +871,14 @@ contract NOPsSettlement is SetUp { event PaymentWithdrawn(address indexed transmitter, uint256 indexed amount, address indexed to, address payee); function testSettleNOPsOffchainRevertDueToUnauthorizedCaller() public { - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); vm.expectRevert(abi.encodeWithSelector(Registry.OnlyFinanceAdmin.selector)); registry.settleNOPsOffchain(); } function testSettleNOPsOffchainRevertDueToOffchainSettlementDisabled() public { - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); vm.prank(registry.owner()); registry.disableOffchainPayments(); @@ -975,7 +890,7 @@ contract NOPsSettlement is SetUp { function testSettleNOPsOffchainSuccess() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); uint256[] memory payments = new uint256[](TRANSMITTERS.length); @@ -992,7 +907,7 @@ contract NOPsSettlement is SetUp { // 1. transmitter balance zeroed after settlement, 2. admin can withdraw ERC20, 3. switch to onchain mode, 4. link amount owed to NOPs stays the same function testSettleNOPsOffchainSuccessWithERC20MultiSteps() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); // register an upkeep and add funds @@ -1008,7 +923,7 @@ contract NOPsSettlement is SetUp { // verify transmitters have positive balances uint256[] memory payments = new uint256[](TRANSMITTERS.length); for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, uint96 lastCollected, ) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance, uint96 lastCollected,) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertTrue(balance > 0); @@ -1025,7 +940,7 @@ contract NOPsSettlement is SetUp { // verify that transmitters balance has been zeroed out for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, , ) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance,,) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertEq(0, balance); @@ -1073,9 +988,8 @@ contract NOPsSettlement is SetUp { function testSettleNOPsOffchainForDeactivatedTransmittersSuccess() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, Registrar registrar) = deployAndConfigureZKSyncRegistryAndRegistrar( - AutoBase.PayoutMode.OFF_CHAIN - ); + (Registry registry, Registrar registrar) = + deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); @@ -1097,9 +1011,8 @@ contract NOPsSettlement is SetUp { address[] memory expectedPayees = new address[](6); uint256[] memory expectedPayments = new uint256[](6); for (uint256 i = 0; i < NEW_TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = registry.getTransmitterInfo( - NEW_TRANSMITTERS[i] - ); + (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = + registry.getTransmitterInfo(NEW_TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertTrue(lastCollected > 0); @@ -1107,9 +1020,8 @@ contract NOPsSettlement is SetUp { expectedPayees[i] = payee; } for (uint256 i = 2; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = registry.getTransmitterInfo( - TRANSMITTERS[i] - ); + (bool active, uint8 index, uint96 balance, uint96 lastCollected, address payee) = + registry.getTransmitterInfo(TRANSMITTERS[i]); assertFalse(active); assertEq(i, index); assertTrue(balance > 0); @@ -1142,26 +1054,26 @@ contract NOPsSettlement is SetUp { // the last 2 payees and payments for TRANSMITTERS[2] and TRANSMITTERS[3] and they are not ordered assertTrue( - (actualPayments[5] == expectedPayments[5] && - actualPayees[5] == expectedPayees[5] && - actualPayments[4] == expectedPayments[4] && - actualPayees[4] == expectedPayees[4]) || - (actualPayments[5] == expectedPayments[4] && - actualPayees[5] == expectedPayees[4] && - actualPayments[4] == expectedPayments[5] && - actualPayees[4] == expectedPayees[5]) + ( + actualPayments[5] == expectedPayments[5] && actualPayees[5] == expectedPayees[5] + && actualPayments[4] == expectedPayments[4] && actualPayees[4] == expectedPayees[4] + ) + || ( + actualPayments[5] == expectedPayments[4] && actualPayees[5] == expectedPayees[4] + && actualPayments[4] == expectedPayments[5] && actualPayees[4] == expectedPayees[5] + ) ); // verify that new transmitters balance has been zeroed out for (uint256 i = 0; i < NEW_TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, , ) = registry.getTransmitterInfo(NEW_TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance,,) = registry.getTransmitterInfo(NEW_TRANSMITTERS[i]); assertTrue(active); assertEq(i, index); assertEq(0, balance); } // verify that deactivated transmitters (TRANSMITTERS[2] and TRANSMITTERS[3]) balance has been zeroed out for (uint256 i = 2; i < TRANSMITTERS.length; i++) { - (bool active, uint8 index, uint96 balance, , ) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active, uint8 index, uint96 balance,,) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertFalse(active); assertEq(i, index); assertEq(0, balance); @@ -1172,7 +1084,7 @@ contract NOPsSettlement is SetUp { } function testDisableOffchainPaymentsRevertDueToUnauthorizedCaller() public { - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); vm.startPrank(FINANCE_ADMIN); vm.expectRevert(bytes("Only callable by owner")); @@ -1180,7 +1092,7 @@ contract NOPsSettlement is SetUp { } function testDisableOffchainPaymentsSuccess() public { - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); vm.startPrank(registry.owner()); registry.disableOffchainPayments(); @@ -1190,7 +1102,7 @@ contract NOPsSettlement is SetUp { function testSinglePerformAndNodesCanWithdrawOnchain() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); // register an upkeep and add funds @@ -1210,7 +1122,7 @@ contract NOPsSettlement is SetUp { // payees should be able to withdraw onchain for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (, , uint96 balance, , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (,, uint96 balance,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); vm.prank(payee); vm.expectEmit(); emit PaymentWithdrawn(TRANSMITTERS[i], balance, payee, payee); @@ -1229,7 +1141,7 @@ contract NOPsSettlement is SetUp { function testMultiplePerformsAndNodesCanWithdrawOnchain() public { // deploy and configure a registry with OFF_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); registry.setPayees(PAYEES); // register an upkeep and add funds @@ -1258,7 +1170,7 @@ contract NOPsSettlement is SetUp { // payees should be able to withdraw onchain for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (, , uint96 balance, , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (,, uint96 balance,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); vm.prank(payee); vm.expectEmit(); emit PaymentWithdrawn(TRANSMITTERS[i], balance, payee, payee); @@ -1287,8 +1199,8 @@ contract NOPsSettlement is SetUp { billingTokenAddresses[i] = address(billingTokens[i]); } - AutomationRegistryBase2_3.BillingConfig[] - memory billingTokenConfigs = new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); + AutomationRegistryBase2_3.BillingConfig[] memory billingTokenConfigs = + new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); billingTokenConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ gasFeePPB: 10_000_000, // 15% flatFeeMilliCents: 2_000, // 2 cents @@ -1321,14 +1233,7 @@ contract NOPsSettlement is SetUp { }); registry.setConfigTypeSafe( - SIGNERS, - NEW_TRANSMITTERS, - F, - cfg, - OFFCHAIN_CONFIG_VERSION, - "", - billingTokenAddresses, - billingTokenConfigs + SIGNERS, NEW_TRANSMITTERS, F, cfg, OFFCHAIN_CONFIG_VERSION, "", billingTokenAddresses, billingTokenConfigs ); registry.setPayees(NEW_PAYEES); @@ -1349,28 +1254,14 @@ contract RegisterUpkeep is SetUp { registry.pause(); vm.expectRevert(Registry.RegistryPaused.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } function test_RevertsWhen_TargetIsNotAContract() public { vm.expectRevert(Registry.NotAContract.selector); registry.registerUpkeep( - randomAddress(), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + randomAddress(), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } @@ -1378,14 +1269,7 @@ contract RegisterUpkeep is SetUp { vm.prank(STRANGER); vm.expectRevert(Registry.OnlyCallableByOwnerOrRegistrar.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } @@ -1406,28 +1290,14 @@ contract RegisterUpkeep is SetUp { function test_RevertsWhen_ExecuteGasIsTooHigh() public { vm.expectRevert(Registry.GasLimitOutsideRange.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas + 1, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas + 1, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } function test_RevertsWhen_TheBillingTokenIsNotConfigured() public { vm.expectRevert(Registry.InvalidToken.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - randomAddress(), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), randomAddress(), "", "", "" ); } @@ -1554,20 +1424,16 @@ contract BillingOverrides is SetUp { event BillingConfigOverrideRemoved(uint256 indexed id); function test_RevertsWhen_NotPrivilegeManager() public { - AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = AutomationRegistryBase2_3.BillingOverrides({ - gasFeePPB: 5_000, - flatFeeMilliCents: 20_000 - }); + AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); vm.expectRevert(Registry.OnlyCallableByUpkeepPrivilegeManager.selector); registry.setBillingOverrides(linkUpkeepID, billingOverrides); } function test_RevertsWhen_UpkeepCancelled() public { - AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = AutomationRegistryBase2_3.BillingOverrides({ - gasFeePPB: 5_000, - flatFeeMilliCents: 20_000 - }); + AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); registry.cancelUpkeep(linkUpkeepID); @@ -1577,10 +1443,8 @@ contract BillingOverrides is SetUp { } function test_Happy_SetBillingOverrides() public { - AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = AutomationRegistryBase2_3.BillingOverrides({ - gasFeePPB: 5_000, - flatFeeMilliCents: 20_000 - }); + AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); vm.startPrank(PRIVILEGE_MANAGER); @@ -1640,12 +1504,7 @@ contract Transmit is SetUp { bytes32 exampleRawVs = bytes32(0x1234561234561234561234561234561234561234561234561234561234561234); bytes memory transmitData = abi.encodeWithSelector( - registry.transmit.selector, - exampleReportContext, - exampleRawReport, - exampleRs, - exampleSs, - exampleRawVs + registry.transmit.selector, exampleReportContext, exampleRawReport, exampleRs, exampleSs, exampleRawVs ); bytes memory badTransmitData = bytes.concat(transmitData, bytes1(0x00)); // add extra data vm.startPrank(TRANSMITTERS[0]); @@ -1665,16 +1524,13 @@ contract Transmit is SetUp { uint96 nativeUSD; uint96 billingUSD; } + event ReorgedUpkeepReport(uint256 indexed id, bytes trigger); event UpkeepCharged(uint256 indexed id, PaymentReceipt receipt); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); + function test_whenFirstUpkeepFails_subsequentUpkeepsPerformZK() external { // the first and second upkeeps use LINK as billing token and the third uses WETH // the first upkeep fails the pre perform check due to incorrect block number in its trigger @@ -1726,8 +1582,7 @@ contract Transmit is SetUp { "link reserve amount should have increased" ); // link reserve amount increases in value equal to the decrease of the other reserve amounts require( - prevReserveBalances[1] > registry.getReserveAmount(address(weth)), - "native reserve amount should have decreased" + prevReserveBalances[1] > registry.getReserveAmount(address(weth)), "native reserve amount should have decreased" ); } @@ -1780,8 +1635,7 @@ contract Transmit is SetUp { assertEq(prevTokenBalances[1], linkToken.balanceOf(address(registry))); // assert reserve amounts have adjusted accordingly require( - prevReserveBalances[0] > registry.getReserveAmount(address(weth)), - "native reserve amount should have decreased" + prevReserveBalances[0] > registry.getReserveAmount(address(weth)), "native reserve amount should have decreased" ); // link reserve amount increases in value equal to the decrease of the other reserve amounts require( prevReserveBalances[1] < registry.getReserveAmount(address(linkToken)), @@ -1816,8 +1670,7 @@ contract Transmit is SetUp { // withdraw-able by the finance team should be positive require( - registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, - "ERC20AvailableForPayment should be positive" + registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, "ERC20AvailableForPayment should be positive" ); require(registry.getAvailableERC20ForPayment(address(weth)) > 0, "ERC20AvailableForPayment should be positive"); @@ -1839,26 +1692,17 @@ contract Transmit is SetUp { "usd reserve amount should have decreased" ); require( - prevReserveBalances[2] > registry.getReserveAmount(address(weth)), - "native reserve amount should have decreased" + prevReserveBalances[2] > registry.getReserveAmount(address(weth)), "native reserve amount should have decreased" ); } function test_handlesInsufficientBalanceWithUSDToken18() external { // deploy and configure a registry with ON_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); // register an upkeep and add funds - uint256 upkeepID = registry.registerUpkeep( - address(TARGET1), - 1000000, - UPKEEP_ADMIN, - 0, - address(usdToken18), - "", - "", - "" - ); + uint256 upkeepID = + registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1873,8 +1717,7 @@ contract Transmit is SetUp { assertEq(entries.length, 3); Vm.Log memory l1 = entries[1]; assertEq( - l1.topics[0], - keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") + l1.topics[0], keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") ); ( uint96 gasChargeInBillingToken, @@ -1895,19 +1738,11 @@ contract Transmit is SetUp { function test_handlesInsufficientBalanceWithUSDToken6() external { // deploy and configure a registry with ON_CHAIN payout - (Registry registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); // register an upkeep and add funds - uint256 upkeepID = registry.registerUpkeep( - address(TARGET1), - 1000000, - UPKEEP_ADMIN, - 0, - address(usdToken6), - "", - "", - "" - ); + uint256 upkeepID = + registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken6), "", "", ""); vm.prank(OWNER); usdToken6.mint(UPKEEP_ADMIN, 1e20); @@ -1924,8 +1759,7 @@ contract Transmit is SetUp { assertEq(entries.length, 3); Vm.Log memory l1 = entries[1]; assertEq( - l1.topics[0], - keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") + l1.topics[0], keccak256("UpkeepCharged(uint256,(uint96,uint96,uint96,uint96,address,uint96,uint96,uint96))") ); ( uint96 gasChargeInBillingToken, @@ -1952,7 +1786,7 @@ contract MigrateReceive is SetUp { function setUp() public override { super.setUp(); - (newRegistry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (newRegistry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); idsToMigrate.push(linkUpkeepID); idsToMigrate.push(linkUpkeepID2); idsToMigrate.push(usdUpkeepID18); @@ -2087,8 +1921,7 @@ contract MigrateReceive is SetUp { prevReserveBalances[1] - registry.getReserveAmount(address(usdToken18)) ); assertEq( - newRegistry.getReserveAmount(address(weth)), - prevReserveBalances[2] - registry.getReserveAmount(address(weth)) + newRegistry.getReserveAmount(address(weth)), prevReserveBalances[2] - registry.getReserveAmount(address(weth)) ); // assert token have been transferred @@ -2099,10 +1932,7 @@ contract MigrateReceive is SetUp { assertEq(usdToken18.balanceOf(address(newRegistry)), newRegistry.getBalance(usdUpkeepID18)); assertEq(weth.balanceOf(address(newRegistry)), newRegistry.getBalance(nativeUpkeepID)); assertEq(linkToken.balanceOf(address(registry)), prevTokenBalances[0] - linkToken.balanceOf(address(newRegistry))); - assertEq( - usdToken18.balanceOf(address(registry)), - prevTokenBalances[1] - usdToken18.balanceOf(address(newRegistry)) - ); + assertEq(usdToken18.balanceOf(address(registry)), prevTokenBalances[1] - usdToken18.balanceOf(address(newRegistry))); assertEq(weth.balanceOf(address(registry)), prevTokenBalances[2] - weth.balanceOf(address(newRegistry))); // assert upkeep data matches @@ -2130,7 +1960,7 @@ contract Pause is SetUp { vm.startPrank(registry.owner()); registry.pause(); - (IAutomationV21PlusCommon.StateLegacy memory state, , , , ) = registry.getState(); + (IAutomationV21PlusCommon.StateLegacy memory state,,,,) = registry.getState(); assertTrue(state.paused); } @@ -2140,14 +1970,7 @@ contract Pause is SetUp { vm.expectRevert(Registry.RegistryPaused.selector); registry.registerUpkeep( - address(TARGET1), - config.maxPerformGas, - UPKEEP_ADMIN, - uint8(Trigger.CONDITION), - address(linkToken), - "", - "", - "" + address(TARGET1), config.maxPerformGas, UPKEEP_ADMIN, uint8(Trigger.CONDITION), address(linkToken), "", "", "" ); } @@ -2172,11 +1995,11 @@ contract Unpause is SetUp { function test_CalledByOwner_success() external { vm.startPrank(registry.owner()); registry.pause(); - (IAutomationV21PlusCommon.StateLegacy memory state1, , , , ) = registry.getState(); + (IAutomationV21PlusCommon.StateLegacy memory state1,,,,) = registry.getState(); assertTrue(state1.paused); registry.unpause(); - (IAutomationV21PlusCommon.StateLegacy memory state2, , , , ) = registry.getState(); + (IAutomationV21PlusCommon.StateLegacy memory state2,,,,) = registry.getState(); assertFalse(state2.paused); } } @@ -2755,7 +2578,7 @@ contract TransferPayeeship is SetUp { registry.transferPayeeship(TRANSMITTERS[0], randomAddress()); - (, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); + (,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); assertEq(PAYEES[0], payee); } @@ -2804,7 +2627,7 @@ contract AcceptPayeeship is SetUp { emit PayeeshipTransferred(TRANSMITTERS[0], PAYEES[0], newPayee); registry.acceptPayeeship(TRANSMITTERS[0]); - (, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); + (,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); assertEq(newPayee, payee); } } @@ -2836,10 +2659,10 @@ contract SetPayees is SetUp { } function test_SetPayees_WhenExistingPayeesAreEmpty() external { - (registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertEq(address(0), payee); } @@ -2849,7 +2672,7 @@ contract SetPayees is SetUp { emit PayeesUpdated(TRANSMITTERS, PAYEES); registry.setPayees(PAYEES); for (uint256 i = 0; i < TRANSMITTERS.length; i++) { - (bool active, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); + (bool active,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[i]); assertTrue(active); assertEq(PAYEES[i], payee); } @@ -2857,15 +2680,15 @@ contract SetPayees is SetUp { function test_DotNotSetPayeesToIgnoredAddress() external { address IGNORE_ADDRESS = 0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF; - (registry, ) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); + (registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.ON_CHAIN); PAYEES[0] = IGNORE_ADDRESS; registry.setPayees(PAYEES); - (bool active, , , , address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); + (bool active,,,, address payee) = registry.getTransmitterInfo(TRANSMITTERS[0]); assertTrue(active); assertEq(address(0), payee); - (active, , , , payee) = registry.getTransmitterInfo(TRANSMITTERS[1]); + (active,,,, payee) = registry.getTransmitterInfo(TRANSMITTERS[1]); assertTrue(active); assertEq(PAYEES[1], payee); } diff --git a/contracts/src/v0.8/automation/testhelpers/AutomationConsumerBenchmark.sol b/contracts/src/v0.8/automation/testhelpers/AutomationConsumerBenchmark.sol index e85521a6e2..a76f7c23ae 100644 --- a/contracts/src/v0.8/automation/testhelpers/AutomationConsumerBenchmark.sol +++ b/contracts/src/v0.8/automation/testhelpers/AutomationConsumerBenchmark.sol @@ -13,7 +13,9 @@ contract AutomationConsumerBenchmark { deployedAt = block.number; } - function checkUpkeep(bytes calldata checkData) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata checkData + ) external view returns (bool, bytes memory) { ( uint256 id, uint256 interval, @@ -35,7 +37,9 @@ contract AutomationConsumerBenchmark { return (eligible(id, range, firstEligibleBuffer), checkData); } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { ( uint256 id, uint256 interval, @@ -61,15 +65,16 @@ contract AutomationConsumerBenchmark { } } - function getCountPerforms(uint256 id) public view returns (uint256) { + function getCountPerforms( + uint256 id + ) public view returns (uint256) { return count[id]; } function eligible(uint256 id, uint256 range, uint256 firstEligibleBuffer) internal view returns (bool) { - return - initialCall[id] == 0 - ? block.number >= firstEligibleBuffer + deployedAt - : (block.number - initialCall[id] < range && block.number > nextEligible[id]); + return initialCall[id] == 0 + ? block.number >= firstEligibleBuffer + deployedAt + : (block.number - initialCall[id] < range && block.number > nextEligible[id]); } function checkEligible(uint256 id, uint256 range, uint256 firstEligibleBuffer) public view returns (bool) { diff --git a/contracts/src/v0.8/automation/testhelpers/CronTestHelper.sol b/contracts/src/v0.8/automation/testhelpers/CronTestHelper.sol index 12ff4106a8..846fd992a7 100644 --- a/contracts/src/v0.8/automation/testhelpers/CronTestHelper.sol +++ b/contracts/src/v0.8/automation/testhelpers/CronTestHelper.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.6; -import {Cron as CronInternal, Spec} from "../libraries/internal/Cron.sol"; import {Cron as CronExternal} from "../libraries/external/Cron.sol"; +import {Cron as CronInternal, Spec} from "../libraries/internal/Cron.sol"; /** * @title The CronInternalTestHelper contract @@ -17,7 +17,9 @@ contract CronInternalTestHelper { * @param cronString the cron string to convert and encode * @return the abi encoding of the Spec struct representing the cron string */ - function encodeCronString(string memory cronString) external pure returns (bytes memory) { + function encodeCronString( + string memory cronString + ) external pure returns (bytes memory) { return CronInternal.toEncodedSpec(cronString); } @@ -26,7 +28,9 @@ contract CronInternalTestHelper { * encoded spec back into a string. There is limited or no use for this outside * of tests. */ - function encodedSpecToString(bytes memory encodedSpec) public pure returns (string memory) { + function encodedSpecToString( + bytes memory encodedSpec + ) public pure returns (string memory) { Spec memory spec = abi.decode(encodedSpec, (Spec)); return CronInternal.toCronString(spec); } @@ -37,7 +41,9 @@ contract CronInternalTestHelper { * @param cronString the cron string to consider * @return the timestamp in UTC of the next "tick" */ - function calculateNextTick(string memory cronString) external view returns (uint256) { + function calculateNextTick( + string memory cronString + ) external view returns (uint256) { return CronInternal.nextTick(CronInternal.toSpec(cronString)); } @@ -47,7 +53,9 @@ contract CronInternalTestHelper { * @param cronString the cron string to consider * @return the timestamp in UTC of the last "tick" */ - function calculateLastTick(string memory cronString) external view returns (uint256) { + function calculateLastTick( + string memory cronString + ) external view returns (uint256) { return CronInternal.lastTick(CronInternal.toSpec(cronString)); } } @@ -64,7 +72,9 @@ contract CronExternalTestHelper { * @param cronString the cron string to convert and encode * @return the abi encoding of the Spec struct representing the cron string */ - function encodeCronString(string memory cronString) external pure returns (bytes memory) { + function encodeCronString( + string memory cronString + ) external pure returns (bytes memory) { return CronExternal.toEncodedSpec(cronString); } @@ -73,7 +83,9 @@ contract CronExternalTestHelper { * encoded spec back into a string. There is limited or no use for this outside * of tests. */ - function encodedSpecToString(bytes memory encodedSpec) public pure returns (string memory) { + function encodedSpecToString( + bytes memory encodedSpec + ) public pure returns (string memory) { Spec memory spec = abi.decode(encodedSpec, (Spec)); return CronExternal.toCronString(spec); } @@ -84,7 +96,9 @@ contract CronExternalTestHelper { * @param cronString the cron string to consider * @return the timestamp in UTC of the next "tick" */ - function calculateNextTick(string memory cronString) external view returns (uint256) { + function calculateNextTick( + string memory cronString + ) external view returns (uint256) { return CronExternal.nextTick(CronExternal.toSpec(cronString)); } @@ -94,7 +108,9 @@ contract CronExternalTestHelper { * @param cronString the cron string to consider * @return the timestamp in UTC of the last "tick" */ - function calculateLastTick(string memory cronString) external view returns (uint256) { + function calculateLastTick( + string memory cronString + ) external view returns (uint256) { return CronExternal.lastTick(CronExternal.toSpec(cronString)); } } diff --git a/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol b/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol index 4e86ec2375..3489371556 100644 --- a/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol +++ b/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol @@ -36,10 +36,7 @@ contract DummyProtocol { * @param targetContract the address of contract where events will be emitted from * @param t0 the signature of the event to listen to */ - function getBasicLogTriggerConfig( - address targetContract, - bytes32 t0 - ) external view returns (bytes memory logTrigger) { + function getBasicLogTriggerConfig(address targetContract, bytes32 t0) external view returns (bytes memory logTrigger) { LogTriggerConfig memory cfg = LogTriggerConfig({ contractAddress: targetContract, filterSelector: 0, diff --git a/contracts/src/v0.8/automation/testhelpers/KeeperCompatibleTestHelper.sol b/contracts/src/v0.8/automation/testhelpers/KeeperCompatibleTestHelper.sol index 3c71dc2f84..dd31ad95f2 100644 --- a/contracts/src/v0.8/automation/testhelpers/KeeperCompatibleTestHelper.sol +++ b/contracts/src/v0.8/automation/testhelpers/KeeperCompatibleTestHelper.sol @@ -4,9 +4,13 @@ pragma solidity ^0.8.0; import "../KeeperCompatible.sol"; contract KeeperCompatibleTestHelper is KeeperCompatible { - function checkUpkeep(bytes calldata) external override returns (bool, bytes memory) {} + function checkUpkeep( + bytes calldata + ) external override returns (bool, bytes memory) {} - function performUpkeep(bytes calldata) external override {} + function performUpkeep( + bytes calldata + ) external override {} function verifyCannotExecute() public view cannotExecute {} } diff --git a/contracts/src/v0.8/automation/testhelpers/KeeperConsumer.sol b/contracts/src/v0.8/automation/testhelpers/KeeperConsumer.sol index fb492f376c..6cb0dacfb0 100644 --- a/contracts/src/v0.8/automation/testhelpers/KeeperConsumer.sol +++ b/contracts/src/v0.8/automation/testhelpers/KeeperConsumer.sol @@ -1,14 +1,16 @@ pragma solidity 0.8.16; -import "../interfaces/KeeperCompatibleInterface.sol"; import "../KeeperBase.sol"; +import "../interfaces/KeeperCompatibleInterface.sol"; contract KeeperConsumer is KeeperCompatibleInterface, KeeperBase { - uint public counter; - uint public immutable interval; - uint public lastTimeStamp; + uint256 public counter; + uint256 public immutable interval; + uint256 public lastTimeStamp; - constructor(uint updateInterval) public { + constructor( + uint256 updateInterval + ) public { interval = updateInterval; lastTimeStamp = block.timestamp; counter = 0; @@ -20,7 +22,9 @@ contract KeeperConsumer is KeeperCompatibleInterface, KeeperBase { return (true, checkData); } - function performUpkeep(bytes calldata performData) external override { + function performUpkeep( + bytes calldata performData + ) external override { counter = counter + 1; } } diff --git a/contracts/src/v0.8/automation/testhelpers/KeeperConsumerPerformance.sol b/contracts/src/v0.8/automation/testhelpers/KeeperConsumerPerformance.sol index 5b7f57e116..c98570759a 100644 --- a/contracts/src/v0.8/automation/testhelpers/KeeperConsumerPerformance.sol +++ b/contracts/src/v0.8/automation/testhelpers/KeeperConsumerPerformance.sol @@ -25,7 +25,9 @@ contract KeeperConsumerPerformance { performGasToBurn = _performGasToBurn; } - function checkUpkeep(bytes calldata data) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata data + ) external view returns (bool, bytes memory) { uint256 startGas = gasleft(); bool dummy; // burn gas @@ -35,7 +37,9 @@ contract KeeperConsumerPerformance { return (eligible(), abi.encode(dummy)); } - function performUpkeep(bytes calldata data) external { + function performUpkeep( + bytes calldata data + ) external { uint256 startGas = gasleft(); bool eligible = eligible(); uint256 blockNum = block.number; @@ -52,11 +56,15 @@ contract KeeperConsumerPerformance { } } - function setCheckGasToBurn(uint256 value) public { + function setCheckGasToBurn( + uint256 value + ) public { checkGasToBurn = value; } - function setPerformGasToBurn(uint256 value) public { + function setPerformGasToBurn( + uint256 value + ) public { performGasToBurn = value; } diff --git a/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol index d0b89b37b3..a33f425574 100644 --- a/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol +++ b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; import "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; interface IVerifierProxy { /** @@ -12,7 +12,9 @@ interface IVerifierProxy { * @param signedReport The encoded data to be verified. * @return verifierResponse The encoded response from the verifier. */ - function verify(bytes memory signedReport) external returns (bytes memory verifierResponse); + function verify( + bytes memory signedReport + ) external returns (bytes memory verifierResponse); } contract LogTriggeredStreamsLookup is ILogAutomation, StreamsLookupCompatibleInterface { @@ -57,15 +59,21 @@ contract LogTriggeredStreamsLookup is ILogAutomation, StreamsLookupCompatibleInt emit LimitOrderExecuted(1, 100, address(0x0)); } - function setTimeParamKey(string memory timeParam) external { + function setTimeParamKey( + string memory timeParam + ) external { timeParamKey = timeParam; } - function setFeedParamKey(string memory feedParam) external { + function setFeedParamKey( + string memory feedParam + ) external { feedParamKey = feedParam; } - function setFeedsHex(string[] memory newFeeds) external { + function setFeedsHex( + string[] memory newFeeds + ) external { feedsHex = newFeeds; } @@ -86,26 +94,22 @@ contract LogTriggeredStreamsLookup is ILogAutomation, StreamsLookupCompatibleInt address exchange = abi.decode(t3, (address)); revert StreamsLookup( - feedParamKey, - feedsHex, - timeParamKey, - blockNum, - abi.encode(orderId, amount, exchange, executedSig) + feedParamKey, feedsHex, timeParamKey, blockNum, abi.encode(orderId, amount, exchange, executedSig) ); } revert("could not find matching event sig"); } - function performUpkeep(bytes calldata performData) external override { + function performUpkeep( + bytes calldata performData + ) external override { if (performData.length == 0) { emit IgnoringErrorHandlerData(); return; } (bytes[] memory values, bytes memory extraData) = abi.decode(performData, (bytes[], bytes)); - (uint256 orderId, uint256 amount, address exchange, bytes32 logTopic0) = abi.decode( - extraData, - (uint256, uint256, address, bytes32) - ); + (uint256 orderId, uint256 amount, address exchange, bytes32 logTopic0) = + abi.decode(extraData, (uint256, uint256, address, bytes32)); bytes memory verifiedResponse = ""; if (verify) { @@ -117,15 +121,7 @@ contract LogTriggeredStreamsLookup is ILogAutomation, StreamsLookupCompatibleInt emit LimitOrderExecuted(1, 100, address(0x0)); } - emit PerformingLogTriggerUpkeep( - tx.origin, - orderId, - amount, - exchange, - getBlockNumber(), - values[0], - verifiedResponse - ); + emit PerformingLogTriggerUpkeep(tx.origin, orderId, amount, exchange, getBlockNumber(), values[0], verifiedResponse); } function checkCallback( diff --git a/contracts/src/v0.8/automation/testhelpers/MockETHUSDAggregator.sol b/contracts/src/v0.8/automation/testhelpers/MockETHUSDAggregator.sol index 10f6732c99..2b2c121dc1 100644 --- a/contracts/src/v0.8/automation/testhelpers/MockETHUSDAggregator.sol +++ b/contracts/src/v0.8/automation/testhelpers/MockETHUSDAggregator.sol @@ -7,7 +7,9 @@ contract MockETHUSDAggregator is AggregatorV3Interface { int256 public answer; uint256 private blockTimestampDeduction = 0; - constructor(int256 _answer) { + constructor( + int256 _answer + ) { answer = _answer; } @@ -47,7 +49,9 @@ contract MockETHUSDAggregator is AggregatorV3Interface { return block.timestamp - blockTimestampDeduction; } - function setBlockTimestampDeduction(uint256 _blockTimestampDeduction) external { + function setBlockTimestampDeduction( + uint256 _blockTimestampDeduction + ) external { blockTimestampDeduction = _blockTimestampDeduction; } } diff --git a/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol b/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol index fb36312b43..fda40e941b 100644 --- a/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol +++ b/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol @@ -2,11 +2,15 @@ pragma solidity ^0.8.19; contract MockOVMGasPriceOracle { - function getL1Fee(bytes memory) public pure returns (uint256) { + function getL1Fee( + bytes memory + ) public pure returns (uint256) { return 2000000; } - function getL1FeeUpperBound(uint256) public pure returns (uint256) { + function getL1FeeUpperBound( + uint256 + ) public pure returns (uint256) { return 2000000; } } diff --git a/contracts/src/v0.8/automation/testhelpers/PerformDataChecker.sol b/contracts/src/v0.8/automation/testhelpers/PerformDataChecker.sol index 268942f931..19b6db3876 100644 --- a/contracts/src/v0.8/automation/testhelpers/PerformDataChecker.sol +++ b/contracts/src/v0.8/automation/testhelpers/PerformDataChecker.sol @@ -7,11 +7,15 @@ contract PerformDataChecker is KeeperCompatibleInterface { uint256 public counter; bytes public s_expectedData; - constructor(bytes memory expectedData) { + constructor( + bytes memory expectedData + ) { s_expectedData = expectedData; } - function setExpectedData(bytes calldata expectedData) external { + function setExpectedData( + bytes calldata expectedData + ) external { s_expectedData = expectedData; } @@ -21,7 +25,9 @@ contract PerformDataChecker is KeeperCompatibleInterface { return (keccak256(checkData) == keccak256(s_expectedData), checkData); } - function performUpkeep(bytes calldata performData) external override { + function performUpkeep( + bytes calldata performData + ) external override { if (keccak256(performData) == keccak256(s_expectedData)) { counter++; } diff --git a/contracts/src/v0.8/automation/testhelpers/StreamsLookupUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/StreamsLookupUpkeep.sol index aaf35b5c59..a04ac8a31f 100644 --- a/contracts/src/v0.8/automation/testhelpers/StreamsLookupUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/StreamsLookupUpkeep.sol @@ -1,8 +1,8 @@ pragma solidity 0.8.16; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import "../interfaces/AutomationCompatibleInterface.sol"; import "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; interface IVerifierProxy { /** @@ -11,7 +11,9 @@ interface IVerifierProxy { * @param signedReport The encoded data to be verified. * @return verifierResponse The encoded response from the verifier. */ - function verify(bytes memory signedReport) external returns (bytes memory verifierResponse); + function verify( + bytes memory signedReport + ) external returns (bytes memory verifierResponse); } contract StreamsLookupUpkeep is AutomationCompatibleInterface, StreamsLookupCompatibleInterface { @@ -63,15 +65,21 @@ contract StreamsLookupUpkeep is AutomationCompatibleInterface, StreamsLookupComp timeParamKey = _timeParamKey; } - function setFeeds(string[] memory _feeds) external { + function setFeeds( + string[] memory _feeds + ) external { feeds = _feeds; } - function setShouldRevertCallback(bool value) public { + function setShouldRevertCallback( + bool value + ) public { shouldRevertCallback = value; } - function setCallbackReturnBool(bool value) public { + function setCallbackReturnBool( + bool value + ) public { callbackReturnBool = value; } @@ -96,7 +104,9 @@ contract StreamsLookupUpkeep is AutomationCompatibleInterface, StreamsLookupComp return (false, new bytes(0)); } - function checkUpkeep(bytes calldata data) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata data + ) external view returns (bool, bytes memory) { if (!eligible()) { return (false, data); } @@ -117,7 +127,9 @@ contract StreamsLookupUpkeep is AutomationCompatibleInterface, StreamsLookupComp revert StreamsLookup(feedParamKey, feeds, timeParamKey, timeParam, abi.encodePacked(address(ARB_SYS))); } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { uint256 blockNumber; if (useArbBlock) { blockNumber = ARB_SYS.arbBlockNumber(); diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepAutoFunder.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepAutoFunder.sol index 90544688f7..714a97beae 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepAutoFunder.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepAutoFunder.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {AutomationCompatible} from "../AutomationCompatible.sol"; -import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {AutomationCompatible} from "../AutomationCompatible.sol"; + import {IAutomationRegistryMaster2_3} from "../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; contract UpkeepAutoFunder is AutomationCompatible, ConfirmedOwner { @@ -24,19 +25,27 @@ contract UpkeepAutoFunder is AutomationCompatible, ConfirmedOwner { s_autoFundLink = 0; } - function setShouldCancel(bool value) external onlyOwner { + function setShouldCancel( + bool value + ) external onlyOwner { s_shouldCancel = value; } - function setIsEligible(bool value) external onlyOwner { + function setIsEligible( + bool value + ) external onlyOwner { s_isEligible = value; } - function setAutoFundLink(uint96 value) external onlyOwner { + function setAutoFundLink( + uint96 value + ) external onlyOwner { s_autoFundLink = value; } - function setUpkeepId(uint256 value) external onlyOwner { + function setUpkeepId( + uint256 value + ) external onlyOwner { s_upkeepId = value; } @@ -46,7 +55,9 @@ contract UpkeepAutoFunder is AutomationCompatible, ConfirmedOwner { return (s_isEligible, data); } - function performUpkeep(bytes calldata data) external override { + function performUpkeep( + bytes calldata data + ) external override { require(s_isEligible, "Upkeep should be eligible"); s_isEligible = false; // Allow upkeep only once until it is set again diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepCounter.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepCounter.sol index 24a8b1f901..7f07f71389 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepCounter.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepCounter.sol @@ -3,11 +3,7 @@ pragma solidity 0.8.16; contract UpkeepCounter { event PerformingUpkeep( - address indexed from, - uint256 initialTimestamp, - uint256 lastTimestamp, - uint256 previousBlock, - uint256 counter + address indexed from, uint256 initialTimestamp, uint256 lastTimestamp, uint256 previousBlock, uint256 counter ); uint256 public testRange; @@ -26,11 +22,15 @@ contract UpkeepCounter { counter = 0; } - function checkUpkeep(bytes calldata data) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata data + ) external view returns (bool, bytes memory) { return (eligible(), data); } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { if (initialTimestamp == 0) { initialTimestamp = block.timestamp; } diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol index 76b3877689..10a049dc78 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol @@ -3,12 +3,9 @@ pragma solidity 0.8.16; contract UpkeepCounterNew { event PerformingUpkeep( - address indexed from, - uint256 initialTimestamp, - uint256 lastTimestamp, - uint256 previousBlock, - uint256 counter + address indexed from, uint256 initialTimestamp, uint256 lastTimestamp, uint256 previousBlock, uint256 counter ); + error InvalidCaller(address caller, address forwarder); uint256 public testRange; @@ -41,31 +38,45 @@ contract UpkeepCounterNew { performGasToBurn = 7700000; } - function setPerformGasToBurn(uint256 _performGasToBurn) external { + function setPerformGasToBurn( + uint256 _performGasToBurn + ) external { performGasToBurn = _performGasToBurn; } - function setCheckGasToBurn(uint256 _checkGasToBurn) external { + function setCheckGasToBurn( + uint256 _checkGasToBurn + ) external { checkGasToBurn = _checkGasToBurn; } - function setUseMoreCheckGas(bool _useMoreCheckGas) external { + function setUseMoreCheckGas( + bool _useMoreCheckGas + ) external { useMoreCheckGas = _useMoreCheckGas; } - function setUseMorePerformGas(bool _useMorePerformGas) external { + function setUseMorePerformGas( + bool _useMorePerformGas + ) external { useMorePerformGas = _useMorePerformGas; } - function setUseMorePerformData(bool _useMorePerformData) external { + function setUseMorePerformData( + bool _useMorePerformData + ) external { useMorePerformData = _useMorePerformData; } - function setData(bytes calldata _data) external { + function setData( + bytes calldata _data + ) external { data = _data; } - function checkUpkeep(bytes calldata) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata + ) external view returns (bool, bytes memory) { if (useMoreCheckGas) { uint256 startGas = gasleft(); while (startGas - gasleft() < checkGasToBurn) {} // burn gas @@ -77,11 +88,15 @@ contract UpkeepCounterNew { return (eligible(), ""); } - function setTrickSimulation(bool _trickSimulation) external { + function setTrickSimulation( + bool _trickSimulation + ) external { trickSimulation = _trickSimulation; } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { if (trickSimulation && tx.origin == address(0)) { return; } @@ -120,7 +135,9 @@ contract UpkeepCounterNew { counter = 0; } - function setForwarder(address _forwarder) external { + function setForwarder( + address _forwarder + ) external { forwarder = _forwarder; } } diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepMock.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepMock.sol index 392700ea3d..08dea210c5 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepMock.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepMock.sol @@ -17,27 +17,39 @@ contract UpkeepMock is AutomationCompatible { event UpkeepPerformedWith(bytes upkeepData); - function setShouldRevertCheck(bool value) public { + function setShouldRevertCheck( + bool value + ) public { shouldRevertCheck = value; } - function setPerformData(bytes calldata data) public { + function setPerformData( + bytes calldata data + ) public { performData = data; } - function setCanCheck(bool value) public { + function setCanCheck( + bool value + ) public { canCheck = value; } - function setCanPerform(bool value) public { + function setCanPerform( + bool value + ) public { canPerform = value; } - function setCheckRevertReason(string calldata value) public { + function setCheckRevertReason( + string calldata value + ) public { checkRevertReason = value; } - function setCheckGasToBurn(uint256 value) public { + function setCheckGasToBurn( + uint256 value + ) public { require(value > checkGasBuffer || value == 0, "checkGasToBurn must be 0 (disabled) or greater than buffer"); if (value > 0) { checkGasToBurn = value - checkGasBuffer; @@ -46,7 +58,9 @@ contract UpkeepMock is AutomationCompatible { } } - function setPerformGasToBurn(uint256 value) public { + function setPerformGasToBurn( + uint256 value + ) public { require(value > performGasBuffer || value == 0, "performGasToBurn must be 0 (disabled) or greater than buffer"); if (value > 0) { performGasToBurn = value - performGasBuffer; @@ -69,7 +83,9 @@ contract UpkeepMock is AutomationCompatible { return (couldCheck, performData); } - function performUpkeep(bytes calldata data) external override { + function performUpkeep( + bytes calldata data + ) external override { uint256 startGas = gasleft(); require(canPerform, "Cannot perform"); diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepPerformCounterRestrictive.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepPerformCounterRestrictive.sol index 3aa345ab45..1972f30adf 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepPerformCounterRestrictive.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepPerformCounterRestrictive.sol @@ -18,7 +18,9 @@ contract UpkeepPerformCounterRestrictive { averageEligibilityCadence = _averageEligibilityCadence; } - function checkUpkeep(bytes calldata data) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata data + ) external view returns (bool, bytes memory) { uint256 startGas = gasleft(); uint256 blockNum = block.number - 1; bool dummy; @@ -30,7 +32,9 @@ contract UpkeepPerformCounterRestrictive { return (eligible(), abi.encode(dummy)); } - function performUpkeep(bytes calldata) external { + function performUpkeep( + bytes calldata + ) external { uint256 startGas = gasleft(); bool eligible = eligible(); uint256 blockNum = block.number; @@ -49,11 +53,15 @@ contract UpkeepPerformCounterRestrictive { } } - function setCheckGasToBurn(uint256 value) public { + function setCheckGasToBurn( + uint256 value + ) public { checkGasToBurn = value; } - function setPerformGasToBurn(uint256 value) public { + function setPerformGasToBurn( + uint256 value + ) public { performGasToBurn = value; } diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepReverter.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepReverter.sol index 1d140ccf6d..b8ad59f7dd 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepReverter.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepReverter.sol @@ -11,7 +11,9 @@ contract UpkeepReverter is AutomationCompatible { return (true, data); } - function performUpkeep(bytes calldata) external pure override { + function performUpkeep( + bytes calldata + ) external pure override { require(false, "!working"); } } diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol index fbf790a84f..ca89f5e800 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol @@ -1,19 +1,21 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.16; -import "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {IKeeperRegistryMaster, IAutomationV21PlusCommon} from "../interfaces/v2_1/IKeeperRegistryMaster.sol"; import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {IAutomationV21PlusCommon, IKeeperRegistryMaster} from "../interfaces/v2_1/IKeeperRegistryMaster.sol"; import "../v2_1/AutomationRegistrar2_1.sol"; import {LogTriggerConfig} from "../v2_1/AutomationUtils2_1.sol"; +import "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; abstract contract VerifiableLoadBase is ConfirmedOwner { error IndexOutOfRange(); + event LogEmitted(uint256 indexed upkeepId, uint256 indexed blockNum, address indexed addr); event LogEmittedAgain(uint256 indexed upkeepId, uint256 indexed blockNum, address indexed addr); event UpkeepTopUp(uint256 upkeepId, uint96 amount, uint256 blockNum); using EnumerableSet for EnumerableSet.UintSet; + ArbSys internal constant ARB_SYS = ArbSys(0x0000000000000000000000000000000000000064); //bytes32 public constant emittedSig = 0x97009585a4d2440f981ab6f6eec514343e1e6b2aa9b991a26998e6806f41bf08; //keccak256(LogEmitted(uint256,uint256,address)) bytes32 public immutable emittedSig = LogEmitted.selector; @@ -65,7 +67,7 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { */ constructor(AutomationRegistrar2_1 _registrar, bool _useArb) ConfirmedOwner(msg.sender) { registrar = _registrar; - (address registryAddress, ) = registrar.getConfig(); + (address registryAddress,) = registrar.getConfig(); registry = IKeeperRegistryMaster(payable(address(registryAddress))); linkToken = registrar.LINK(); useArbitrumBlockNum = _useArb; @@ -78,7 +80,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { timeParamKey = _timeParamKey; } - function setFeeds(string[] memory _feeds) external { + function setFeeds( + string[] memory _feeds + ) external { feedsHex = _feeds; } @@ -102,9 +106,11 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { * @notice sets registrar, registry, and link token address. * @param newRegistrar the new registrar address */ - function setConfig(AutomationRegistrar2_1 newRegistrar) external { + function setConfig( + AutomationRegistrar2_1 newRegistrar + ) external { registrar = newRegistrar; - (address registryAddress, ) = registrar.getConfig(); + (address registryAddress,) = registrar.getConfig(); registry = IKeeperRegistryMaster(payable(address(registryAddress))); linkToken = registrar.LINK(); } @@ -149,7 +155,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { * @param params a registration params struct * @return an upkeep ID */ - function _registerUpkeep(AutomationRegistrar2_1.RegistrationParams memory params) private returns (uint256) { + function _registerUpkeep( + AutomationRegistrar2_1.RegistrationParams memory params + ) private returns (uint256) { uint256 upkeepId = registrar.registerUpkeep(params); s_upkeepIDs.add(upkeepId); gasLimits[upkeepId] = params.gasLimit; @@ -217,14 +225,8 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { if (log != 0) { sig = emittedAgainSig; } - bytes memory triggerCfg = this.getLogTriggerConfig( - address(this), - selector, - sig, - bytes32(abi.encode(upkeepId)), - bytes32(0), - bytes32(0) - ); + bytes memory triggerCfg = + this.getLogTriggerConfig(address(this), selector, sig, bytes32(abi.encode(upkeepId)), bytes32(0), bytes32(0)); registry.setUpkeepTriggerConfig(upkeepId, triggerCfg); } } @@ -301,19 +303,27 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } } - function getMinBalanceForUpkeep(uint256 upkeepId) external view returns (uint96) { + function getMinBalanceForUpkeep( + uint256 upkeepId + ) external view returns (uint96) { return registry.getMinBalanceForUpkeep(upkeepId); } - function getForwarder(uint256 upkeepID) external view returns (address) { + function getForwarder( + uint256 upkeepID + ) external view returns (address) { return registry.getForwarder(upkeepID); } - function getBalance(uint256 id) external view returns (uint96 balance) { + function getBalance( + uint256 id + ) external view returns (uint96 balance) { return registry.getBalance(id); } - function getTriggerType(uint256 upkeepId) external view returns (uint8) { + function getTriggerType( + uint256 upkeepId + ) external view returns (uint8) { return registry.getTriggerType(upkeepId); } @@ -343,11 +353,15 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { registry.setUpkeepCheckData(upkeepId, pipelineData); } - function withdrawLinks(uint256 upkeepId) external { + function withdrawLinks( + uint256 upkeepId + ) external { registry.withdrawFunds(upkeepId, address(this)); } - function batchWithdrawLinks(uint256[] calldata upkeepIds) external { + function batchWithdrawLinks( + uint256[] calldata upkeepIds + ) external { uint256 len = upkeepIds.length; for (uint32 i = 0; i < len; i++) { this.withdrawLinks(upkeepIds[i]); @@ -358,7 +372,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { * @notice batch canceling upkeeps. * @param upkeepIds an array of upkeep IDs */ - function batchCancelUpkeeps(uint256[] calldata upkeepIds) external { + function batchCancelUpkeeps( + uint256[] calldata upkeepIds + ) external { uint256 len = upkeepIds.length; for (uint8 i = 0; i < len; i++) { registry.cancelUpkeep(upkeepIds[i]); @@ -366,7 +382,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } } - function eligible(uint256 upkeepId) public view returns (bool) { + function eligible( + uint256 upkeepId + ) public view returns (bool) { if (firstPerformBlocks[upkeepId] == 0) { return true; } @@ -435,7 +453,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { * @notice batch updating pipeline data for all upkeeps. * @param upkeepIds an array of upkeep IDs */ - function batchUpdatePipelineData(uint256[] calldata upkeepIds) external { + function batchUpdatePipelineData( + uint256[] calldata upkeepIds + ) external { uint256 len = upkeepIds.length; for (uint256 i = 0; i < len; i++) { uint256 upkeepId = upkeepIds[i]; @@ -446,7 +466,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { /** * @notice finds all log trigger upkeeps and emits logs to serve as the initial trigger for upkeeps */ - function batchSendLogs(uint8 log) external { + function batchSendLogs( + uint8 log + ) external { uint256[] memory upkeepIds = this.getActiveUpkeepIDsDeployedByThisContract(0, 0); uint256 len = upkeepIds.length; uint256 blockNum = getBlockNumber(); @@ -463,15 +485,21 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } } - function getUpkeepInfo(uint256 upkeepId) public view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory) { + function getUpkeepInfo( + uint256 upkeepId + ) public view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory) { return registry.getUpkeep(upkeepId); } - function getUpkeepTriggerConfig(uint256 upkeepId) public view returns (bytes memory) { + function getUpkeepTriggerConfig( + uint256 upkeepId + ) public view returns (bytes memory) { return registry.getUpkeepTriggerConfig(upkeepId); } - function getUpkeepPrivilegeConfig(uint256 upkeepId) public view returns (bytes memory) { + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) public view returns (bytes memory) { return registry.getUpkeepPrivilegeConfig(upkeepId); } @@ -488,11 +516,15 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } } - function getDelaysLength(uint256 upkeepId) public view returns (uint256) { + function getDelaysLength( + uint256 upkeepId + ) public view returns (uint256) { return delays[upkeepId].length; } - function getBucketedDelaysLength(uint256 upkeepId) public view returns (uint256) { + function getBucketedDelaysLength( + uint256 upkeepId + ) public view returns (uint256) { uint16 currentBucket = buckets[upkeepId]; uint256 len = 0; for (uint16 i = 0; i <= currentBucket; i++) { @@ -501,7 +533,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { return len; } - function getDelays(uint256 upkeepId) public view returns (uint256[] memory) { + function getDelays( + uint256 upkeepId + ) public view returns (uint256[] memory) { return delays[upkeepId]; } @@ -527,7 +561,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } uint256 sum = 0; - for (i = 0; i < n; i++) sum = sum + delays[len - i - 1]; + for (i = 0; i < n; i++) { + sum = sum + delays[len - i - 1]; + } return (sum, n); } @@ -543,7 +579,9 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } uint256[] memory subArr = new uint256[](n); - for (i = 0; i < n; i++) subArr[i] = (delays[len - i - 1]); + for (i = 0; i < n; i++) { + subArr[i] = (delays[len - i - 1]); + } quickSort(subArr, int256(0), int256(subArr.length - 1)); if (p == 100) { diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol index 400ddd0c96..c8a79a0ac5 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import "./VerifiableLoadBase.sol"; import "../interfaces/ILogAutomation.sol"; import "../interfaces/StreamsLookupCompatibleInterface.sol"; +import "./VerifiableLoadBase.sol"; contract VerifiableLoadLogTriggerUpkeep is VerifiableLoadBase, StreamsLookupCompatibleInterface, ILogAutomation { bool public useMercury; @@ -23,7 +23,9 @@ contract VerifiableLoadLogTriggerUpkeep is VerifiableLoadBase, StreamsLookupComp logNum = 0; } - function setLog(uint8 _log) external { + function setLog( + uint8 _log + ) external { logNum = _log; } @@ -74,7 +76,9 @@ contract VerifiableLoadLogTriggerUpkeep is VerifiableLoadBase, StreamsLookupComp revert("unexpected event sig"); } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { uint256 startGas = gasleft(); (bytes[] memory values, bytes memory extraData) = abi.decode(performData, (bytes[], bytes)); (uint256 upkeepId, uint256 logBlockNumber, address addr) = abi.decode(extraData, (uint256, uint256, address)); diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol index 97be9ebc81..122b9c1801 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.16; -import "./VerifiableLoadBase.sol"; import "../interfaces/StreamsLookupCompatibleInterface.sol"; +import "./VerifiableLoadBase.sol"; contract VerifiableLoadStreamsLookupUpkeep is VerifiableLoadBase, StreamsLookupCompatibleInterface { constructor(AutomationRegistrar2_1 _registrar, bool _useArb) VerifiableLoadBase(_registrar, _useArb) {} @@ -24,7 +24,9 @@ contract VerifiableLoadStreamsLookupUpkeep is VerifiableLoadBase, StreamsLookupC return (false, new bytes(0)); } - function checkUpkeep(bytes calldata checkData) external returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata checkData + ) external returns (bool, bytes memory) { uint256 startGas = gasleft(); uint256 upkeepId = abi.decode(checkData, (uint256)); @@ -53,7 +55,9 @@ contract VerifiableLoadStreamsLookupUpkeep is VerifiableLoadBase, StreamsLookupC revert StreamsLookup(feedParamKey, feedsHex, timeParamKey, timeParam, abi.encode(upkeepId)); } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { uint256 startGas = gasleft(); (bytes[] memory values, bytes memory extraData) = abi.decode(performData, (bytes[], bytes)); uint256 upkeepId = abi.decode(extraData, (uint256)); diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol index bab75e9613..d75234b190 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol @@ -6,7 +6,9 @@ import "./VerifiableLoadBase.sol"; contract VerifiableLoadUpkeep is VerifiableLoadBase { constructor(AutomationRegistrar2_1 _registrar, bool _useArb) VerifiableLoadBase(_registrar, _useArb) {} - function checkUpkeep(bytes calldata checkData) external returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata checkData + ) external returns (bool, bytes memory) { uint256 startGas = gasleft(); uint256 upkeepId = abi.decode(checkData, (uint256)); @@ -22,9 +24,11 @@ contract VerifiableLoadUpkeep is VerifiableLoadBase { return (needed, pData); } - function performUpkeep(bytes calldata performData) external { + function performUpkeep( + bytes calldata performData + ) external { uint256 startGas = gasleft(); - (uint256 upkeepId, ) = abi.decode(performData, (uint256, bytes)); + (uint256 upkeepId,) = abi.decode(performData, (uint256, bytes)); uint256 firstPerformBlock = firstPerformBlocks[upkeepId]; uint256 previousPerformBlock = previousPerformBlocks[upkeepId]; uint256 blockNum = getBlockNumber(); diff --git a/contracts/src/v0.8/automation/upkeeps/CronUpkeep.sol b/contracts/src/v0.8/automation/upkeeps/CronUpkeep.sol index 1634a74c93..c08bc458c7 100644 --- a/contracts/src/v0.8/automation/upkeeps/CronUpkeep.sol +++ b/contracts/src/v0.8/automation/upkeeps/CronUpkeep.sol @@ -1,31 +1,31 @@ // SPDX-License-Identifier: MIT /** - The Cron contract is a chainlink keepers-powered cron job runner for smart contracts. - The contract enables developers to trigger actions on various targets using cron - strings to specify the cadence. For example, a user may have 3 tasks that require - regular service in their dapp ecosystem: - 1) 0xAB..CD, update(1), "0 0 * * *" --> runs update(1) on 0xAB..CD daily at midnight - 2) 0xAB..CD, update(2), "30 12 * * 0-4" --> runs update(2) on 0xAB..CD weekdays at 12:30 - 3) 0x12..34, trigger(), "0 * * * *" --> runs trigger() on 0x12..34 hourly - - To use this contract, a user first deploys this contract and registers it on the chainlink - keeper registry. Then the user adds cron jobs by following these steps: - 1) Convert a cron string to an encoded cron spec by calling encodeCronString() - 2) Take the encoding, target, and handler, and create a job by sending a tx to createCronJob() - 3) Cron job is running :) -*/ - + * The Cron contract is a chainlink keepers-powered cron job runner for smart contracts. + * The contract enables developers to trigger actions on various targets using cron + * strings to specify the cadence. For example, a user may have 3 tasks that require + * regular service in their dapp ecosystem: + * 1) 0xAB..CD, update(1), "0 0 * * *" --> runs update(1) on 0xAB..CD daily at midnight + * 2) 0xAB..CD, update(2), "30 12 * * 0-4" --> runs update(2) on 0xAB..CD weekdays at 12:30 + * 3) 0x12..34, trigger(), "0 * * * *" --> runs trigger() on 0x12..34 hourly + * + * To use this contract, a user first deploys this contract and registers it on the chainlink + * keeper registry. Then the user adds cron jobs by following these steps: + * 1) Convert a cron string to an encoded cron spec by calling encodeCronString() + * 2) Take the encoding, target, and handler, and create a job by sending a tx to createCronJob() + * 3) Cron job is running :) + */ pragma solidity ^0.8.6; -import {Pausable} from "@openzeppelin/contracts@4.8.3/security/Pausable.sol"; -import {Proxy} from "@openzeppelin/contracts@4.9.6/proxy/Proxy.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {KeeperBase as KeeperBase} from "../KeeperBase.sol"; import {KeeperCompatibleInterface as KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; -import {Cron as CronInternal, Spec} from "../libraries/internal/Cron.sol"; + import {Cron as CronExternal} from "../libraries/external/Cron.sol"; +import {Cron as CronInternal, Spec} from "../libraries/internal/Cron.sol"; +import {Pausable} from "@openzeppelin/contracts@4.8.3/security/Pausable.sol"; +import {Proxy} from "@openzeppelin/contracts@4.9.6/proxy/Proxy.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @title The CronUpkeep contract @@ -78,14 +78,14 @@ contract CronUpkeep is KeeperCompatibleInterface, KeeperBase, ConfirmedOwner, Pa * @notice Executes the cron job with id encoded in performData * @param performData abi encoding of cron job ID and the cron job's next run-at datetime */ - function performUpkeep(bytes calldata performData) external override whenNotPaused { - (uint256 id, uint256 tickTime, address target, bytes memory handler) = abi.decode( - performData, - (uint256, uint256, address, bytes) - ); + function performUpkeep( + bytes calldata performData + ) external override whenNotPaused { + (uint256 id, uint256 tickTime, address target, bytes memory handler) = + abi.decode(performData, (uint256, uint256, address, bytes)); validate(id, tickTime, target, handler); s_lastRuns[id] = block.timestamp; - (bool success, ) = target.call(handler); + (bool success,) = target.call(handler); emit CronJobExecuted(id, success); } @@ -133,7 +133,9 @@ contract CronUpkeep is KeeperCompatibleInterface, KeeperBase, ConfirmedOwner, Pa * the id is not found. * @param id the id of the cron job to delete */ - function deleteCronJob(uint256 id) external onlyOwner onlyValidCronID(id) { + function deleteCronJob( + uint256 id + ) external onlyOwner onlyValidCronID(id) { delete s_lastRuns[id]; delete s_specs[id]; delete s_targets[id]; @@ -162,7 +164,9 @@ contract CronUpkeep is KeeperCompatibleInterface, KeeperBase, ConfirmedOwner, Pa * @return upkeepNeeded signals if upkeep is needed, performData is an abi encoding * of the id and "next tick" of the elligible cron job */ - function checkUpkeep(bytes calldata) external override whenNotPaused cannotExecute returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata + ) external override whenNotPaused cannotExecute returns (bool, bytes memory) { _delegate(s_delegate); } @@ -183,9 +187,9 @@ contract CronUpkeep is KeeperCompatibleInterface, KeeperBase, ConfirmedOwner, Pa * @notice gets a cron job * @param id the cron job ID * @return target - the address a cron job forwards the eth tx to - handler - the encoded function sig to execute when forwarding a tx - cronString - the string representing the cron job - nextTick - the timestamp of the next time the cron job will run + * handler - the encoded function sig to execute when forwarding a tx + * cronString - the string representing the cron job + * nextTick - the timestamp of the next time the cron job will run */ function getCronJob( uint256 id @@ -254,7 +258,9 @@ contract CronUpkeep is KeeperCompatibleInterface, KeeperBase, ConfirmedOwner, Pa return keccak256(abi.encodePacked(target, handler)); } - modifier onlyValidCronID(uint256 id) { + modifier onlyValidCronID( + uint256 id + ) { if (!s_activeCronJobIDs.contains(id)) { revert CronJobIDNotFound(id); } diff --git a/contracts/src/v0.8/automation/upkeeps/CronUpkeepDelegate.sol b/contracts/src/v0.8/automation/upkeeps/CronUpkeepDelegate.sol index 950041076e..5a27b413ae 100644 --- a/contracts/src/v0.8/automation/upkeeps/CronUpkeepDelegate.sol +++ b/contracts/src/v0.8/automation/upkeeps/CronUpkeepDelegate.sol @@ -2,8 +2,8 @@ pragma solidity ^0.8.6; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; import {Cron, Spec} from "../libraries/internal/Cron.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @title The CronUpkeepDelegate contract @@ -29,7 +29,9 @@ contract CronUpkeepDelegate { * @return upkeepNeeded signals if upkeep is needed, performData is an abi encoding * of the id and "next tick" of the eligible cron job */ - function checkUpkeep(bytes calldata) external view returns (bool, bytes memory) { + function checkUpkeep( + bytes calldata + ) external view returns (bool, bytes memory) { // DEV: start at a random spot in the list so that checks are // spread evenly among cron jobs uint256 numCrons = s_activeCronJobIDs.length(); diff --git a/contracts/src/v0.8/automation/upkeeps/CronUpkeepFactory.sol b/contracts/src/v0.8/automation/upkeeps/CronUpkeepFactory.sol index 7a9e4f3e7d..f900e2d62e 100644 --- a/contracts/src/v0.8/automation/upkeeps/CronUpkeepFactory.sol +++ b/contracts/src/v0.8/automation/upkeeps/CronUpkeepFactory.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.6; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {Cron as CronExternal, Spec} from "../libraries/external/Cron.sol"; import {CronUpkeep} from "./CronUpkeep.sol"; import {CronUpkeepDelegate} from "./CronUpkeepDelegate.sol"; -import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {Spec, Cron as CronExternal} from "../libraries/external/Cron.sol"; /** * @title The CronUpkeepFactory contract @@ -33,14 +33,18 @@ contract CronUpkeepFactory is ConfirmedOwner { /** * @notice Creates a new CronUpkeep contract, with msg.sender as the owner, and registers a cron job */ - function newCronUpkeepWithJob(bytes memory encodedJob) public { + function newCronUpkeepWithJob( + bytes memory encodedJob + ) public { emit NewCronUpkeepCreated(address(new CronUpkeep(msg.sender, s_cronDelegate, s_maxJobs, encodedJob)), msg.sender); } /** * @notice Sets the max job limit on new cron upkeeps */ - function setMaxJobs(uint256 maxJobs) external onlyOwner { + function setMaxJobs( + uint256 maxJobs + ) external onlyOwner { s_maxJobs = maxJobs; } @@ -58,7 +62,9 @@ contract CronUpkeepFactory is ConfirmedOwner { * @param cronString the cron string to convert and encode * @return the abi encoding of the Spec struct representing the cron string */ - function encodeCronString(string memory cronString) external pure returns (bytes memory) { + function encodeCronString( + string memory cronString + ) external pure returns (bytes memory) { return CronExternal.toEncodedSpec(cronString); } diff --git a/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol index f0c7074e23..0717fa7613 100644 --- a/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol @@ -66,9 +66,8 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf uint96[] calldata topUpLevels ) external onlyOwner { if ( - addresses.length != minBalances.length || - addresses.length != topUpLevels.length || - addresses.length > MAX_WATCHLIST_SIZE + addresses.length != minBalances.length || addresses.length != topUpLevels.length + || addresses.length > MAX_WATCHLIST_SIZE ) { revert InvalidWatchList(); } @@ -86,12 +85,8 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf if (topUpLevels[idx] <= minBalances[idx]) { revert InvalidWatchList(); } - s_targets[addresses[idx]] = Target({ - isActive: true, - minBalance: minBalances[idx], - topUpLevel: topUpLevels[idx], - lastTopUpTimestamp: 0 - }); + s_targets[addresses[idx]] = + Target({isActive: true, minBalance: minBalances[idx], topUpLevel: topUpLevels[idx], lastTopUpTimestamp: 0}); } s_watchList = addresses; emit WatchlistUpdated(oldWatchList, addresses); @@ -112,9 +107,8 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf target = s_targets[watchList[idx]]; uint256 targetTokenBalance = s_erc20Token.balanceOf(watchList[idx]); if ( - target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp && - targetTokenBalance < target.minBalance && - contractBalance >= (target.topUpLevel - targetTokenBalance) + target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp && targetTokenBalance < target.minBalance + && contractBalance >= (target.topUpLevel - targetTokenBalance) ) { uint256 topUpAmount = target.topUpLevel - targetTokenBalance; needsFunding[count] = watchList[idx]; @@ -134,7 +128,9 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf * @notice Send funds to the subscriptions provided. * @param needsFunding the list of subscriptions to fund */ - function topUp(address[] memory needsFunding) public whenNotPaused { + function topUp( + address[] memory needsFunding + ) public whenNotPaused { uint256 minWaitPeriodSeconds = s_minWaitPeriodSeconds; Target memory target; uint256 contractBalance = s_erc20Token.balanceOf(address(this)); @@ -142,10 +138,8 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf target = s_targets[needsFunding[idx]]; uint256 targetTokenBalance = s_erc20Token.balanceOf(needsFunding[idx]); if ( - target.isActive && - target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp && - targetTokenBalance < target.minBalance && - contractBalance >= (target.topUpLevel - targetTokenBalance) + target.isActive && target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp + && targetTokenBalance < target.minBalance && contractBalance >= (target.topUpLevel - targetTokenBalance) ) { uint256 topUpAmount = target.topUpLevel - targetTokenBalance; s_targets[needsFunding[idx]].lastTopUpTimestamp = uint56(block.timestamp); @@ -176,7 +170,9 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf * @notice Called by the keeper to send funds to underfunded addresses. * @param performData the abi encoded list of addresses to fund */ - function performUpkeep(bytes calldata performData) external override onlyKeeperRegistry whenNotPaused { + function performUpkeep( + bytes calldata performData + ) external override onlyKeeperRegistry whenNotPaused { address[] memory needsFunding = abi.decode(performData, (address[])); topUp(needsFunding); } @@ -195,7 +191,9 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf /** * @notice Sets the ERC20 token address. */ - function setERC20TokenAddress(address erc20TokenAddress) public onlyOwner { + function setERC20TokenAddress( + address erc20TokenAddress + ) public onlyOwner { require(erc20TokenAddress != address(0)); emit ERC20TokenAddressUpdated(address(s_erc20Token), erc20TokenAddress); s_erc20Token = IERC20(erc20TokenAddress); @@ -204,7 +202,9 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf /** * @notice Sets the keeper registry address. */ - function setKeeperRegistryAddress(address keeperRegistryAddress) public onlyOwner { + function setKeeperRegistryAddress( + address keeperRegistryAddress + ) public onlyOwner { require(keeperRegistryAddress != address(0)); emit KeeperRegistryAddressUpdated(s_keeperRegistryAddress, keeperRegistryAddress); s_keeperRegistryAddress = keeperRegistryAddress; @@ -213,7 +213,9 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf /** * @notice Sets the minimum wait period (in seconds) for subscription ids between funding. */ - function setMinWaitPeriodSeconds(uint256 period) public onlyOwner { + function setMinWaitPeriodSeconds( + uint256 period + ) public onlyOwner { emit MinWaitPeriodUpdated(s_minWaitPeriodSeconds, period); s_minWaitPeriodSeconds = period; } diff --git a/contracts/src/v0.8/automation/upkeeps/EthBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/EthBalanceMonitor.sol index 3cfe6196bf..0ce300a60a 100644 --- a/contracts/src/v0.8/automation/upkeeps/EthBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/EthBalanceMonitor.sol @@ -98,9 +98,8 @@ contract EthBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterfac for (uint256 idx = 0; idx < watchList.length; idx++) { target = s_targets[watchList[idx]]; if ( - target.lastTopUpTimestamp + minWaitPeriod <= block.timestamp && - balance >= target.topUpAmountWei && - watchList[idx].balance < target.minBalanceWei + target.lastTopUpTimestamp + minWaitPeriod <= block.timestamp && balance >= target.topUpAmountWei + && watchList[idx].balance < target.minBalanceWei ) { needsFunding[count] = watchList[idx]; count++; @@ -119,15 +118,16 @@ contract EthBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterfac * @notice Send funds to the addresses provided * @param needsFunding the list of addresses to fund (addresses must be pre-approved) */ - function topUp(address[] memory needsFunding) public whenNotPaused { + function topUp( + address[] memory needsFunding + ) public whenNotPaused { uint256 minWaitPeriodSeconds = s_minWaitPeriodSeconds; Target memory target; for (uint256 idx = 0; idx < needsFunding.length; idx++) { target = s_targets[needsFunding[idx]]; if ( - target.isActive && - target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp && - needsFunding[idx].balance < target.minBalanceWei + target.isActive && target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp + && needsFunding[idx].balance < target.minBalanceWei ) { bool success = payable(needsFunding[idx]).send(target.topUpAmountWei); if (success) { @@ -160,7 +160,9 @@ contract EthBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterfac * @notice Called by keeper to send funds to underfunded addresses * @param performData The abi encoded list of addresses to fund */ - function performUpkeep(bytes calldata performData) external override onlyKeeperRegistry whenNotPaused { + function performUpkeep( + bytes calldata performData + ) external override onlyKeeperRegistry whenNotPaused { address[] memory needsFunding = abi.decode(performData, (address[])); topUp(needsFunding); } @@ -186,7 +188,9 @@ contract EthBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterfac /** * @notice Sets the keeper registry address */ - function setKeeperRegistryAddress(address keeperRegistryAddress) public onlyOwner { + function setKeeperRegistryAddress( + address keeperRegistryAddress + ) public onlyOwner { require(keeperRegistryAddress != address(0)); emit KeeperRegistryAddressUpdated(s_keeperRegistryAddress, keeperRegistryAddress); s_keeperRegistryAddress = keeperRegistryAddress; @@ -195,7 +199,9 @@ contract EthBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterfac /** * @notice Sets the minimum wait period (in seconds) for addresses between funding */ - function setMinWaitPeriodSeconds(uint256 period) public onlyOwner { + function setMinWaitPeriodSeconds( + uint256 period + ) public onlyOwner { emit MinWaitPeriodUpdated(s_minWaitPeriodSeconds, period); s_minWaitPeriodSeconds = period; } diff --git a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol index d3d06875ab..334981ecd2 100644 --- a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol @@ -4,10 +4,11 @@ pragma solidity 0.8.19; import {AutomationCompatibleInterface} from "../interfaces/AutomationCompatibleInterface.sol"; import {AccessControl} from "@openzeppelin/contracts@4.8.3/access/AccessControl.sol"; + +import {Pausable} from "@openzeppelin/contracts@4.8.3/security/Pausable.sol"; +import {IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/IERC20.sol"; import {EnumerableMap} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableMap.sol"; import {EnumerableSet} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableSet.sol"; -import {IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/IERC20.sol"; -import {Pausable} from "@openzeppelin/contracts@4.8.3/security/Pausable.sol"; interface IAggregatorProxy { function aggregator() external view returns (address); @@ -133,9 +134,8 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter uint64[] calldata dstChainSelectors ) external onlyAdminOrExecutor { if ( - addresses.length != minBalances.length || - addresses.length != topUpAmounts.length || - addresses.length != dstChainSelectors.length + addresses.length != minBalances.length || addresses.length != topUpAmounts.length + || addresses.length != dstChainSelectors.length ) { revert InvalidWatchList(); } @@ -147,7 +147,7 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter // s_onRampAddresses is not the same length as s_watchList, so it has // to be clean in a separate loop for (uint256 idx = s_onRampAddresses.length(); idx > 0; idx--) { - (uint256 key, ) = s_onRampAddresses.at(idx - 1); + (uint256 key,) = s_onRampAddresses.at(idx - 1); s_onRampAddresses.remove(key); } for (uint256 idx = 0; idx < addresses.length; idx++) { @@ -207,7 +207,9 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter /// @notice Delete an address from the watchlist and sets the target to inactive /// @param targetAddress the address to be deleted - function removeFromWatchList(address targetAddress) public onlyAdminOrExecutor returns (bool) { + function removeFromWatchList( + address targetAddress + ) public onlyAdminOrExecutor returns (bool) { if (s_watchList.remove(targetAddress)) { delete s_targets[targetAddress]; return true; @@ -232,14 +234,11 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter address[] memory targetsToFund = new address[](maxPerform); MonitoredAddress memory contractToFund; address targetAddress; - for ( - uint256 numChecked = 0; - numChecked < numToCheck; - (idx, numChecked) = ((idx + 1) % numTargets, numChecked + 1) - ) { + for (uint256 numChecked = 0; numChecked < numToCheck; (idx, numChecked) = ((idx + 1) % numTargets, numChecked + 1)) + { targetAddress = s_watchList.at(idx); contractToFund = s_targets[targetAddress]; - (bool fundingNeeded, ) = _needsFunding( + (bool fundingNeeded,) = _needsFunding( targetAddress, contractToFund.lastTopUpTimestamp + minWaitPeriod, contractToFund.minBalance, @@ -263,7 +262,9 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter /// @notice tries to fund an array of target addresses, checking if they're underfunded in the process /// @param targetAddresses is an array of contract addresses to be funded in case they're underfunded - function topUp(address[] memory targetAddresses) public whenNotPaused nonReentrant { + function topUp( + address[] memory targetAddresses + ) public whenNotPaused nonReentrant { MonitoredAddress memory contractToFund; uint256 minWaitPeriod = s_minWaitPeriodSeconds; uint256 localBalance = i_linkToken.balanceOf(address(this)); @@ -353,7 +354,9 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter /// @notice Called by the keeper to send funds to underfunded addresses. /// @param performData the abi encoded list of addresses to fund - function performUpkeep(bytes calldata performData) external override { + function performUpkeep( + bytes calldata performData + ) external override { address[] memory needsFunding = abi.decode(performData, (address[])); topUp(needsFunding); } @@ -388,25 +391,33 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter } /// @notice Update s_maxPerform - function setMaxPerform(uint16 maxPerform) public onlyRole(ADMIN_ROLE) { + function setMaxPerform( + uint16 maxPerform + ) public onlyRole(ADMIN_ROLE) { emit MaxPerformSet(s_maxPerform, maxPerform); s_maxPerform = maxPerform; } /// @notice Update s_maxCheck - function setMaxCheck(uint16 maxCheck) public onlyRole(ADMIN_ROLE) { + function setMaxCheck( + uint16 maxCheck + ) public onlyRole(ADMIN_ROLE) { emit MaxCheckSet(s_maxCheck, maxCheck); s_maxCheck = maxCheck; } /// @notice Sets the minimum wait period (in seconds) for addresses between funding - function setMinWaitPeriodSeconds(uint256 minWaitPeriodSeconds) public onlyRole(ADMIN_ROLE) { + function setMinWaitPeriodSeconds( + uint256 minWaitPeriodSeconds + ) public onlyRole(ADMIN_ROLE) { emit MinWaitPeriodSet(s_minWaitPeriodSeconds, minWaitPeriodSeconds); s_minWaitPeriodSeconds = minWaitPeriodSeconds; } /// @notice Update s_upkeepInterval - function setUpkeepInterval(uint8 upkeepInterval) public onlyRole(ADMIN_ROLE) { + function setUpkeepInterval( + uint8 upkeepInterval + ) public onlyRole(ADMIN_ROLE) { if (upkeepInterval > 255) revert InvalidUpkeepInterval(upkeepInterval); emit UpkeepIntervalSet(s_upkeepInterval, upkeepInterval); s_upkeepInterval = upkeepInterval; @@ -438,7 +449,9 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter } /// @notice Gets the onRamp address with the specified dstChainSelector - function getOnRampAddressAtChainSelector(uint64 dstChainSelector) external view returns (address) { + function getOnRampAddressAtChainSelector( + uint64 dstChainSelector + ) external view returns (address) { if (dstChainSelector == 0) revert InvalidChainSelector(); return s_onRampAddresses.get(dstChainSelector); } diff --git a/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol index f4d5178dce..8a6d61af9f 100644 --- a/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol @@ -3,8 +3,9 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol"; + import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {IAutomationRegistryConsumer} from "../interfaces/IAutomationRegistryConsumer.sol"; import {Pausable} from "@openzeppelin/contracts@4.9.6/security/Pausable.sol"; import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; @@ -124,8 +125,9 @@ contract UpkeepBalanceMonitor is ConfirmedOwner, Pausable { uint96[] memory topUpAmounts ) public whenNotPaused { if (msg.sender != address(s_forwarderAddress) && msg.sender != owner()) revert OnlyForwarderOrOwner(); - if (upkeepIDs.length != registryAddresses.length || upkeepIDs.length != topUpAmounts.length) + if (upkeepIDs.length != registryAddresses.length || upkeepIDs.length != topUpAmounts.length) { revert InvalidTopUpData(); + } for (uint256 i = 0; i < upkeepIDs.length; i++) { try LINK_TOKEN.transferAndCall(registryAddresses[i], topUpAmounts[i], abi.encode(upkeepIDs[i])) returns ( bool success @@ -145,12 +147,11 @@ contract UpkeepBalanceMonitor is ConfirmedOwner, Pausable { /// @notice Gets list of upkeeps ids that are underfunded and returns a keeper-compatible payload. /// @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need funds - function checkUpkeep(bytes calldata) external view returns (bool upkeepNeeded, bytes memory performData) { - ( - uint256[] memory needsFunding, - address[] memory registryAddresses, - uint96[] memory topUpAmounts - ) = getUnderfundedUpkeeps(); + function checkUpkeep( + bytes calldata + ) external view returns (bool upkeepNeeded, bytes memory performData) { + (uint256[] memory needsFunding, address[] memory registryAddresses, uint96[] memory topUpAmounts) = + getUnderfundedUpkeeps(); upkeepNeeded = needsFunding.length > 0; if (upkeepNeeded) { performData = abi.encode(needsFunding, registryAddresses, topUpAmounts); @@ -160,11 +161,11 @@ contract UpkeepBalanceMonitor is ConfirmedOwner, Pausable { /// @notice Called by the keeper to send funds to underfunded addresses. /// @param performData the abi encoded list of addresses to fund - function performUpkeep(bytes calldata performData) external { - (uint256[] memory upkeepIDs, address[] memory registryAddresses, uint96[] memory topUpAmounts) = abi.decode( - performData, - (uint256[], address[], uint96[]) - ); + function performUpkeep( + bytes calldata performData + ) external { + (uint256[] memory upkeepIDs, address[] memory registryAddresses, uint96[] memory topUpAmounts) = + abi.decode(performData, (uint256[], address[], uint96[])); topUp(upkeepIDs, registryAddresses, topUpAmounts); } @@ -211,12 +212,12 @@ contract UpkeepBalanceMonitor is ConfirmedOwner, Pausable { /// @notice Sets the contract config /// @param config the new config - function setConfig(Config memory config) public onlyOwner { + function setConfig( + Config memory config + ) public onlyOwner { if ( - config.maxBatchSize == 0 || - config.minPercentage < 100 || - config.targetPercentage <= config.minPercentage || - config.maxTopUpAmount == 0 + config.maxBatchSize == 0 || config.minPercentage < 100 || config.targetPercentage <= config.minPercentage + || config.maxTopUpAmount == 0 ) { revert InvalidConfig(); } @@ -227,7 +228,9 @@ contract UpkeepBalanceMonitor is ConfirmedOwner, Pausable { /// @notice Sets the upkeep's forwarder contract /// @param forwarderAddress the new forwarder /// @dev this should only need to be called once, after registering the contract with the registry - function setForwarder(address forwarderAddress) external onlyOwner { + function setForwarder( + address forwarderAddress + ) external onlyOwner { s_forwarderAddress = forwarderAddress; emit ForwarderSet(forwarderAddress); } diff --git a/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol b/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol index 503f16bbe4..58f1b492bb 100644 --- a/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {IKeeperRegistryMaster} from "../interfaces/v2_1/IKeeperRegistryMaster.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {IKeeperRegistryMaster} from "../interfaces/v2_1/IKeeperRegistryMaster.sol"; /** * @notice Contract to accept requests for upkeep registrations @@ -153,9 +153,7 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei setConfig(keeperRegistry, minLINKJuels); for (uint256 idx = 0; idx < triggerConfigs.length; idx++) { setTriggerConfig( - triggerConfigs[idx].triggerType, - triggerConfigs[idx].autoApproveType, - triggerConfigs[idx].autoApproveMaxAllowed + triggerConfigs[idx].triggerType, triggerConfigs[idx].autoApproveType, triggerConfigs[idx].autoApproveMaxAllowed ); } } @@ -210,7 +208,9 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice Allows external users to register upkeeps; assumes amount is approved for transfer by the contract * @param requestParams struct of all possible registration parameters */ - function registerUpkeep(RegistrationParams calldata requestParams) external returns (uint256) { + function registerUpkeep( + RegistrationParams calldata requestParams + ) external returns (uint256) { if (requestParams.amount < s_config.minLINKJuels) { revert InsufficientPayment(); } @@ -266,7 +266,9 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice cancel will remove a registration request and return the refunds to the request.admin * @param hash the request hash */ - function cancel(bytes32 hash) external { + function cancel( + bytes32 hash + ) external { PendingRequest memory request = s_pendingRequests[hash]; if (!(msg.sender == request.admin || msg.sender == owner())) { revert OnlyAdminOrOwner(); @@ -323,7 +325,9 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice read the allowlist status of senderAddress * @param senderAddress address to read the allowlist status for */ - function getAutoApproveAllowedSender(address senderAddress) external view returns (bool) { + function getAutoApproveAllowedSender( + address senderAddress + ) external view returns (bool) { return s_autoApproveAllowedSenders[senderAddress]; } @@ -339,14 +343,18 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice read the config for this upkeep type * @param triggerType upkeep type to read config for */ - function getTriggerRegistrationDetails(uint8 triggerType) external view returns (TriggerRegistrationStorage memory) { + function getTriggerRegistrationDetails( + uint8 triggerType + ) external view returns (TriggerRegistrationStorage memory) { return s_triggerRegistrations[triggerType]; } /** * @notice gets the admin address and the current balance of a registration request */ - function getPendingRequest(bytes32 hash) external view returns (address, uint96) { + function getPendingRequest( + bytes32 hash + ) external view returns (address, uint96) { PendingRequest memory request = s_pendingRequests[hash]; return (request.admin, request.balance); } @@ -372,7 +380,7 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei if (amount < s_config.minLINKJuels) { revert InsufficientPayment(); } - (bool success, ) = address(this).delegatecall(data); + (bool success,) = address(this).delegatecall(data); // calls register if (!success) { revert RegistrationRequestFailed(); @@ -484,7 +492,9 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @dev Reverts if the given data does not begin with the `register` function selector * @param _data The data payload of the request */ - modifier permittedFunctionsForLINK(bytes memory _data) { + modifier permittedFunctionsForLINK( + bytes memory _data + ) { bytes4 funcSelector; assembly { // solhint-disable-next-line avoid-low-level-calls @@ -503,10 +513,8 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei */ modifier isActualAmount(uint256 expected, bytes calldata data) { // decode register function arguments to get actual amount - (, , , , , , , , , uint96 amount, ) = abi.decode( - data[4:], - (string, bytes, address, uint32, address, uint8, bytes, bytes, bytes, uint96, address) - ); + (,,,,,,,,, uint96 amount,) = + abi.decode(data[4:], (string, bytes, address, uint32, address, uint8, bytes, bytes, bytes, uint96, address)); if (expected != amount) { revert AmountMismatch(); } @@ -520,10 +528,8 @@ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Recei */ modifier isActualSender(address expected, bytes calldata data) { // decode register function arguments to get actual sender - (, , , , , , , , , , address sender) = abi.decode( - data[4:], - (string, bytes, address, uint32, address, uint8, bytes, bytes, bytes, uint96, address) - ); + (,,,,,,,,,, address sender) = + abi.decode(data[4:], (string, bytes, address, uint32, address, uint8, bytes, bytes, bytes, uint96, address)); if (expected != sender) { revert SenderMismatch(); } diff --git a/contracts/src/v0.8/automation/v2_1/AutomationUtils2_1.sol b/contracts/src/v0.8/automation/v2_1/AutomationUtils2_1.sol index 76483c8986..e1cd5e40bd 100644 --- a/contracts/src/v0.8/automation/v2_1/AutomationUtils2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/AutomationUtils2_1.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; -import {Log} from "../interfaces/ILogAutomation.sol"; import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {Log} from "../interfaces/ILogAutomation.sol"; +import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; /** * @notice this file exposes structs that are otherwise internal to the automation registry @@ -27,15 +27,27 @@ contract AutomationUtils2_1 { /** * @dev this can be removed as OnchainConfig is now exposed directly from the registry */ - function _onChainConfig(IAutomationV21PlusCommon.OnchainConfigLegacy memory) external {} // 0x2ff92a81 + function _onChainConfig( + IAutomationV21PlusCommon.OnchainConfigLegacy memory + ) external {} // 0x2ff92a81 - function _report(KeeperRegistryBase2_1.Report memory) external {} // 0xe65d6546 + function _report( + KeeperRegistryBase2_1.Report memory + ) external {} // 0xe65d6546 - function _logTriggerConfig(LogTriggerConfig memory) external {} // 0x21f373d7 + function _logTriggerConfig( + LogTriggerConfig memory + ) external {} // 0x21f373d7 - function _logTrigger(KeeperRegistryBase2_1.LogTrigger memory) external {} // 0x1c8d8260 + function _logTrigger( + KeeperRegistryBase2_1.LogTrigger memory + ) external {} // 0x1c8d8260 - function _conditionalTrigger(KeeperRegistryBase2_1.ConditionalTrigger memory) external {} // 0x4b6df294 + function _conditionalTrigger( + KeeperRegistryBase2_1.ConditionalTrigger memory + ) external {} // 0x4b6df294 - function _log(Log memory) external {} // 0xe9720a49 + function _log( + Log memory + ) external {} // 0xe9720a49 } diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistry2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistry2_1.sol index d546a5792b..cd6f169ffa 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistry2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistry2_1.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; -import {KeeperRegistryLogicB2_1} from "./KeeperRegistryLogicB2_1.sol"; -import {Chainable} from "../Chainable.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; +import {Chainable} from "../Chainable.sol"; import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; +import {KeeperRegistryLogicB2_1} from "./KeeperRegistryLogicB2_1.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Registry for adding work for Chainlink Keepers to perform on client @@ -22,7 +22,7 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, IE /** * @notice versions: * - KeeperRegistry 2.1.0: introduces support for log, cron, and ready triggers - : removes the need for "wrapped perform data" + * : removes the need for "wrapped perform data" * - KeeperRegistry 2.0.2: pass revert bytes as performData when target contract reverts * : fixes issue with arbitrum block number * : does an early return in case of stale report instead of revert @@ -98,11 +98,8 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, IE report.linkNative, true ); - (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = _prePerformChecks( - report.upkeepIds[i], - report.triggers[i], - upkeepTransmitInfo[i] - ); + (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = + _prePerformChecks(report.upkeepIds[i], report.triggers[i], upkeepTransmitInfo[i]); if (upkeepTransmitInfo[i].earlyChecksPassed) { numUpkeepsPassedChecks += 1; @@ -111,11 +108,8 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, IE } // Actually perform the target upkeep - (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = _performUpkeep( - upkeepTransmitInfo[i].upkeep.forwarder, - report.gasLimits[i], - report.performDatas[i] - ); + (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = + _performUpkeep(upkeepTransmitInfo[i].upkeep.forwarder, report.gasLimits[i], report.performDatas[i]); // Deduct that gasUsed by upkeep from our running counter gasOverhead -= upkeepTransmitInfo[i].gasUsed; @@ -131,10 +125,8 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, IE // This is the overall gas overhead that will be split across performed upkeeps // Take upper bound of 16 gas per callData bytes, which is approximated to be reportLength // Rest of msg.data is accounted for in accounting overheads - gasOverhead = - (gasOverhead - gasleft() + 16 * rawReport.length) + - ACCOUNTING_FIXED_GAS_OVERHEAD + - (ACCOUNTING_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)); + gasOverhead = (gasOverhead - gasleft() + 16 * rawReport.length) + ACCOUNTING_FIXED_GAS_OVERHEAD + + (ACCOUNTING_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)); gasOverhead = gasOverhead / numUpkeepsPassedChecks + ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD; uint96 totalReimbursement; @@ -145,10 +137,7 @@ contract KeeperRegistry2_1 is KeeperRegistryBase2_1, OCR2Abstract, Chainable, IE for (uint256 i = 0; i < report.upkeepIds.length; i++) { if (upkeepTransmitInfo[i].earlyChecksPassed) { upkeepTransmitInfo[i].gasOverhead = _getCappedGasOverhead( - gasOverhead, - upkeepTransmitInfo[i].triggerType, - uint32(report.performDatas[i].length), - hotVars.f + gasOverhead, upkeepTransmitInfo[i].triggerType, uint32(report.performDatas[i].length), hotVars.f ); (reimbursement, premium) = _postPerformPayment( diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol index 18f215a390..008d32fc92 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol @@ -1,20 +1,23 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import {OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; -import {ExecutionPrevention} from "../ExecutionPrevention.sol"; -import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; -import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; -import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import {ExecutionPrevention} from "../ExecutionPrevention.sol"; + +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; + import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Base Keeper Registry contract, contains shared logic between @@ -204,8 +207,8 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { uint96 amountSpent; uint96 balance; uint32 lastPerformedBlockNumber; - // 2 bytes left in 2nd EVM word - written in transmit path } + // 2 bytes left in 2nd EVM word - written in transmit path /// @dev Config + State storage struct which is on hot transmit path struct HotVars { @@ -218,7 +221,7 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { bool reentrancyGuard; // guard against reentrancy uint96 totalPremium; // total historical payment to oracles for premium uint32 latestEpoch; // latest epoch for which a report was transmitted - // 1 EVM word full + // 1 EVM word full } /// @dev Config + State storage struct which is not on hot transmit path @@ -238,7 +241,7 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { uint32 maxPerformDataSize; // max length of performData bytes uint32 maxRevertDataSize; // max length of revertData bytes address upkeepPrivilegeManager; // address which can set privilege for upkeeps - // 3 EVM word full + // 3 EVM word full } /// @dev Report transmitted by OCR to transmit function @@ -330,12 +333,7 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); @@ -387,8 +385,9 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { ) internal { if (s_hotVars.paused) revert RegistryPaused(); if (checkData.length > s_storage.maxCheckDataSize) revert CheckDataExceedsLimit(); - if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) + if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) { revert GasLimitOutsideRange(); + } if (address(s_upkeep[id].forwarder) != address(0)) revert UpkeepAlreadyExists(); s_upkeep[id] = upkeep; s_upkeepAdmin[id] = admin; @@ -411,11 +410,12 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { * @dev we add the "identifying" part in the middle so that it is mostly hidden from users who usually only * see the first 4 and last 4 hex values ex 0x1234...ABCD */ - function _createID(Trigger triggerType) internal view returns (uint256) { + function _createID( + Trigger triggerType + ) internal view returns (uint256) { bytes1 empty; - bytes memory idBytes = abi.encodePacked( - keccak256(abi.encode(_blockHash(_blockNum() - 1), address(this), s_storage.nonce)) - ); + bytes memory idBytes = + abi.encodePacked(keccak256(abi.encode(_blockHash(_blockNum() - 1), address(this), s_storage.nonce))); for (uint256 idx = 4; idx < 15; idx++) { idBytes[idx] = empty; } @@ -429,12 +429,14 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { * for gas it takes the min of gas price in the transaction or the fast gas * price in order to reduce costs for the upkeep clients. */ - function _getFeedData(HotVars memory hotVars) internal view returns (uint256 gasWei, uint256 linkNative) { + function _getFeedData( + HotVars memory hotVars + ) internal view returns (uint256 gasWei, uint256 linkNative) { uint32 stalenessSeconds = hotVars.stalenessSeconds; bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 feedValue; - (, feedValue, , timestamp, ) = i_fastGasFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_fastGasFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -442,7 +444,7 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { } else { gasWei = uint256(feedValue); } - (, feedValue, , timestamp, ) = i_linkNativeFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_linkNativeFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -495,7 +497,7 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { } else { // fee is 4 per 0 byte, 16 per non-zero byte - we assume all non-zero and // max data size to calculate max payment - (, uint256 perL1CalldataUnit, , , , ) = ARB_NITRO_ORACLE.getPricesInWei(); + (, uint256 perL1CalldataUnit,,,,) = ARB_NITRO_ORACLE.getPricesInWei(); l1CostWei = perL1CalldataUnit * s_storage.maxPerformDataSize * 16; } } @@ -507,10 +509,8 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { l1CostWei = l1CostWei / numBatchedUpkeeps; uint256 gasPayment = ((gasWei * (gasLimit + gasOverhead) + l1CostWei) * 1e18) / linkNative; - uint256 premium = (((gasWei * gasLimit) + l1CostWei) * 1e9 * hotVars.paymentPremiumPPB) / - linkNative + - uint256(hotVars.flatFeeMicroLink) * - 1e12; + uint256 premium = (((gasWei * gasLimit) + l1CostWei) * 1e9 * hotVars.paymentPremiumPPB) / linkNative + + uint256(hotVars.flatFeeMicroLink) * 1e12; // LINK_TOTAL_SUPPLY < UINT96_MAX if (gasPayment + premium > LINK_TOTAL_SUPPLY) revert PaymentGreaterThanAllLINK(); return (uint96(gasPayment), uint96(premium)); @@ -555,10 +555,8 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { } else { revert InvalidTriggerType(); } - return - baseOverhead + - (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (f + 1)) + - (REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD * performDataLength); + return baseOverhead + (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (f + 1)) + + (REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD * performDataLength); } /** @@ -585,7 +583,9 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { /** * @dev gets the trigger type from an upkeepID (trigger type is encoded in the middle of the ID) */ - function _getTriggerType(uint256 upkeepId) internal pure returns (Trigger) { + function _getTriggerType( + uint256 upkeepId + ) internal pure returns (Trigger) { bytes32 rawID = bytes32(upkeepId); bytes1 empty = bytes1(0); for (uint256 idx = 4; idx < 15; idx++) { @@ -614,13 +614,14 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { /** * @dev _decodeReport decodes a serialized report into a Report struct */ - function _decodeReport(bytes calldata rawReport) internal pure returns (Report memory) { + function _decodeReport( + bytes calldata rawReport + ) internal pure returns (Report memory) { Report memory report = abi.decode(rawReport, (Report)); uint256 expectedLength = report.upkeepIds.length; if ( - report.gasLimits.length != expectedLength || - report.triggers.length != expectedLength || - report.performDatas.length != expectedLength + report.gasLimits.length != expectedLength || report.triggers.length != expectedLength + || report.performDatas.length != expectedLength ) { revert InvalidReport(); } @@ -676,8 +677,8 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { return false; } if ( - (trigger.blockHash != bytes32("") && _blockHash(trigger.blockNum) != trigger.blockHash) || - trigger.blockNum >= _blockNum() + (trigger.blockHash != bytes32("") && _blockHash(trigger.blockNum) != trigger.blockHash) + || trigger.blockNum >= _blockNum() ) { // There are two cases of reorged report // 1. trigger block number is in future: this is an edge case during extreme deep reorgs of chain @@ -699,8 +700,8 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { LogTrigger memory trigger = abi.decode(rawTrigger, (LogTrigger)); bytes32 dedupID = keccak256(abi.encodePacked(upkeepId, trigger.logBlockHash, trigger.txHash, trigger.logIndex)); if ( - (trigger.blockHash != bytes32("") && _blockHash(trigger.blockNum) != trigger.blockHash) || - trigger.blockNum >= _blockNum() + (trigger.blockHash != bytes32("") && _blockHash(trigger.blockNum) != trigger.blockHash) + || trigger.blockNum >= _blockNum() ) { // Reorg protection is same as conditional trigger upkeeps emit ReorgedUpkeepReport(upkeepId, rawTrigger); @@ -816,7 +817,9 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { /** * @dev ensures the upkeep is not cancelled and the caller is the upkeep admin */ - function _requireAdminAndNotCancelled(uint256 upkeepId) internal view { + function _requireAdminAndNotCancelled( + uint256 upkeepId + ) internal view { if (msg.sender != s_upkeepAdmin[upkeepId]) revert OnlyCallableByAdmin(); if (s_upkeep[upkeepId].maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); } @@ -837,7 +840,9 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { * @param n the blocknumber to retrieve the blockhash for * @return blockhash the blockhash of block number n, or 0 if n is out queryable of range */ - function _blockHash(uint256 n) internal view returns (bytes32) { + function _blockHash( + uint256 n + ) internal view returns (bytes32) { if (i_mode == Mode.ARBITRUM) { uint256 blockNum = ARB_SYS.arbBlockNumber(); if (n >= blockNum || blockNum - n > 256) { diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol index d8d8d9f855..94a80794a1 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol @@ -1,15 +1,16 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; -import {KeeperRegistryLogicB2_1} from "./KeeperRegistryLogicB2_1.sol"; -import {Chainable} from "../Chainable.sol"; import {AutomationForwarder} from "../AutomationForwarder.sol"; +import {Chainable} from "../Chainable.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; -import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; + import {MigratableKeeperRegistryInterfaceV2} from "../interfaces/MigratableKeeperRegistryInterfaceV2.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; +import {KeeperRegistryLogicB2_1} from "./KeeperRegistryLogicB2_1.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Logic contract, works in tandem with KeeperRegistry as a proxy @@ -65,19 +66,14 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { Upkeep memory upkeep = s_upkeep[id]; if (hotVars.paused) return (false, bytes(""), UpkeepFailureReason.REGISTRY_PAUSED, 0, upkeep.performGas, 0, 0); - if (upkeep.maxValidBlocknumber != UINT32_MAX) + if (upkeep.maxValidBlocknumber != UINT32_MAX) { return (false, bytes(""), UpkeepFailureReason.UPKEEP_CANCELLED, 0, upkeep.performGas, 0, 0); + } if (upkeep.paused) return (false, bytes(""), UpkeepFailureReason.UPKEEP_PAUSED, 0, upkeep.performGas, 0, 0); (fastGasWei, linkNative) = _getFeedData(hotVars); uint96 maxLinkPayment = _getMaxLinkPayment( - hotVars, - triggerType, - upkeep.performGas, - s_storage.maxPerformDataSize, - fastGasWei, - linkNative, - false + hotVars, triggerType, upkeep.performGas, s_storage.maxPerformDataSize, fastGasWei, linkNative, false ); if (upkeep.balance < maxLinkPayment) { return (false, bytes(""), UpkeepFailureReason.INSUFFICIENT_BALANCE, 0, upkeep.performGas, 0, 0); @@ -114,18 +110,12 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { } (upkeepNeeded, performData) = abi.decode(result, (bool, bytes)); - if (!upkeepNeeded) - return ( - false, - bytes(""), - UpkeepFailureReason.UPKEEP_NOT_NEEDED, - gasUsed, - upkeep.performGas, - fastGasWei, - linkNative - ); + if (!upkeepNeeded) { + return + (false, bytes(""), UpkeepFailureReason.UPKEEP_NOT_NEEDED, gasUsed, upkeep.performGas, fastGasWei, linkNative); + } - if (performData.length > s_storage.maxPerformDataSize) + if (performData.length > s_storage.maxPerformDataSize) { return ( false, bytes(""), @@ -135,6 +125,7 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { fastGasWei, linkNative ); + } return (upkeepNeeded, performData, upkeepFailureReason, gasUsed, upkeep.performGas, fastGasWei, linkNative); } @@ -233,9 +224,8 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { if (msg.sender != owner() && !s_registrars.contains(msg.sender)) revert OnlyCallableByOwnerOrRegistrar(); if (!target.isContract()) revert NotAContract(); id = _createID(triggerType); - IAutomationForwarder forwarder = IAutomationForwarder( - address(new AutomationForwarder(target, address(this), i_automationForwarderLogic)) - ); + IAutomationForwarder forwarder = + IAutomationForwarder(address(new AutomationForwarder(target, address(this), i_automationForwarderLogic))); _createUpkeep( id, Upkeep({ @@ -280,7 +270,9 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { * @dev if a user cancels an upkeep, their funds are locked for CANCELLATION_DELAY blocks to * allow any pending performUpkeep txs time to get confirmed */ - function cancelUpkeep(uint256 id) external { + function cancelUpkeep( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; bool canceled = upkeep.maxValidBlocknumber != UINT32_MAX; bool isOwner = msg.sender == owner(); @@ -335,8 +327,8 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { */ function migrateUpkeeps(uint256[] calldata ids, address destination) external { if ( - s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING && - s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING + && s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); if (s_storage.transcoder == ZERO_ADDRESS) revert TranscoderNotSet(); if (ids.length == 0) revert ArrayHasNoEntries(); @@ -369,20 +361,11 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { emit UpkeepMigrated(id, upkeep.balance, destination); } s_expectedLinkBalance = s_expectedLinkBalance - totalBalanceRemaining; - bytes memory encodedUpkeeps = abi.encode( - ids, - upkeeps, - new address[](ids.length), - admins, - checkDatas, - triggerConfigs, - offchainConfigs - ); + bytes memory encodedUpkeeps = + abi.encode(ids, upkeeps, new address[](ids.length), admins, checkDatas, triggerConfigs, offchainConfigs); MigratableKeeperRegistryInterfaceV2(destination).receiveUpkeeps( UpkeepTranscoderInterfaceV2(s_storage.transcoder).transcodeUpkeeps( - UPKEEP_VERSION_BASE, - MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), - encodedUpkeeps + UPKEEP_VERSION_BASE, MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), encodedUpkeeps ) ); i_link.transfer(destination, totalBalanceRemaining); @@ -393,10 +376,12 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { * @param encodedUpkeeps the raw upkeep data to import * @dev this function is never called directly, it is only called by another registry's migrate function */ - function receiveUpkeeps(bytes calldata encodedUpkeeps) external { + function receiveUpkeeps( + bytes calldata encodedUpkeeps + ) external { if ( - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING && - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING + && s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); ( uint256[] memory ids, @@ -414,12 +399,7 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { ); } _createUpkeep( - ids[idx], - upkeeps[idx], - upkeepAdmins[idx], - checkDatas[idx], - triggerConfigs[idx], - offchainConfigs[idx] + ids[idx], upkeeps[idx], upkeepAdmins[idx], checkDatas[idx], triggerConfigs[idx], offchainConfigs[idx] ); emit UpkeepReceived(ids[idx], upkeeps[idx].balance, msg.sender); } diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol index 3954a853f1..1eb7750329 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.16; -import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; +import {KeeperRegistryBase2_1} from "./KeeperRegistryBase2_1.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { using Address for address; @@ -44,7 +44,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice accepts the transfer of an upkeep admin */ - function acceptUpkeepAdmin(uint256 id) external { + function acceptUpkeepAdmin( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; if (upkeep.maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); if (s_proposedAdmin[id] != msg.sender) revert OnlyCallableByProposedAdmin(); @@ -58,7 +60,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice pauses an upkeep - an upkeep will be neither checked nor performed while paused */ - function pauseUpkeep(uint256 id) external { + function pauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (upkeep.paused) revert OnlyUnpausedUpkeep(); @@ -70,7 +74,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice unpauses an upkeep */ - function unpauseUpkeep(uint256 id) external { + function unpauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (!upkeep.paused) revert OnlyPausedUpkeep(); @@ -145,7 +151,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice accepts the transfer of the payee */ - function acceptPayeeship(address transmitter) external { + function acceptPayeeship( + address transmitter + ) external { if (s_proposedPayee[transmitter] != msg.sender) revert OnlyCallableByProposedPayee(); address past = s_transmitterPayees[transmitter]; s_transmitterPayees[transmitter] = msg.sender; @@ -204,7 +212,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice sets the payees for the transmitters */ - function setPayees(address[] calldata payees) external onlyOwner { + function setPayees( + address[] calldata payees + ) external onlyOwner { if (s_transmittersList.length != payees.length) revert ParameterLengthError(); for (uint256 i = 0; i < s_transmittersList.length; i++) { address transmitter = s_transmittersList[i]; @@ -314,7 +324,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { * @dev this function may be deprecated in a future version of automation in favor of individual * getters for each field */ - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { Upkeep memory reg = s_upkeep[id]; address target = address(reg.forwarder) == address(0) ? address(0) : reg.forwarder.getTarget(); upkeepInfo = IAutomationV21PlusCommon.UpkeepInfoLegacy({ @@ -354,14 +366,18 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice returns the upkeep's trigger type */ - function getTriggerType(uint256 upkeepId) external pure returns (Trigger) { + function getTriggerType( + uint256 upkeepId + ) external pure returns (Trigger) { return _getTriggerType(upkeepId); } /** * @notice returns the trigger config for an upkeeep */ - function getUpkeepTriggerConfig(uint256 upkeepId) public view returns (bytes memory) { + function getUpkeepTriggerConfig( + uint256 upkeepId + ) public view returns (bytes memory) { return s_upkeepTriggerConfig[upkeepId]; } @@ -391,7 +407,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice read the current info about any signer address */ - function getSignerInfo(address query) external view returns (bool active, uint8 index) { + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index) { Signer memory signer = s_signers[query]; return (signer.active, signer.index); } @@ -448,7 +466,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getBalance(uint256 id) external view returns (uint96 balance) { + function getBalance( + uint256 id + ) external view returns (uint96 balance) { return s_upkeep[id].balance; } @@ -456,7 +476,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getMinBalance(uint256 id) external view returns (uint96) { + function getMinBalance( + uint256 id + ) external view returns (uint96) { return getMinBalanceForUpkeep(id); } @@ -465,7 +487,9 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { * @param id the upkeep id to calculate minimum balance for * @dev this will be deprecated in a future version in favor of getMinBalance */ - function getMinBalanceForUpkeep(uint256 id) public view returns (uint96 minBalance) { + function getMinBalanceForUpkeep( + uint256 id + ) public view returns (uint96 minBalance) { return getMaxPaymentForGas(_getTriggerType(id), s_upkeep[id].performGas); } @@ -483,35 +507,45 @@ contract KeeperRegistryLogicB2_1 is KeeperRegistryBase2_1 { /** * @notice retrieves the migration permission for a peer registry */ - function getPeerRegistryMigrationPermission(address peer) external view returns (MigrationPermission) { + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (MigrationPermission) { return s_peerRegistryMigrationPermission[peer]; } /** * @notice returns the upkeep privilege config */ - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) { + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory) { return s_upkeepPrivilegeConfig[upkeepId]; } /** * @notice returns the upkeep privilege config */ - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory) { + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory) { return s_adminPrivilegeConfig[admin]; } /** * @notice returns the upkeep's forwarder contract */ - function getForwarder(uint256 upkeepID) external view returns (IAutomationForwarder) { + function getForwarder( + uint256 upkeepID + ) external view returns (IAutomationForwarder) { return s_upkeep[upkeepID].forwarder; } /** * @notice returns the upkeep's forwarder contract */ - function hasDedupKey(bytes32 dedupKey) external view returns (bool) { + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool) { return s_dedupKeys[dedupKey]; } } diff --git a/contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol b/contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol index 41f50de093..744ac72533 100644 --- a/contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol +++ b/contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol @@ -2,10 +2,11 @@ pragma solidity 0.8.16; -import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {KeeperRegistryBase2_1 as R21} from "./KeeperRegistryBase2_1.sol"; + import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {KeeperRegistryBase2_1 as R21} from "./KeeperRegistryBase2_1.sol"; enum RegistryVersion { V12, @@ -83,10 +84,8 @@ contract UpkeepTranscoder4_0 is UpkeepTranscoderInterfaceV2, ITypeAndVersion { ) external view override returns (bytes memory) { // v1.2 => v2.1 if (fromVersion == uint8(RegistryVersion.V12)) { - (uint256[] memory ids, UpkeepV12[] memory upkeepsV12, bytes[] memory checkDatas) = abi.decode( - encodedUpkeeps, - (uint256[], UpkeepV12[], bytes[]) - ); + (uint256[] memory ids, UpkeepV12[] memory upkeepsV12, bytes[] memory checkDatas) = + abi.decode(encodedUpkeeps, (uint256[], UpkeepV12[], bytes[])); if (ids.length != upkeepsV12.length || ids.length != checkDatas.length) { revert InvalidTranscoding(); } @@ -112,10 +111,8 @@ contract UpkeepTranscoder4_0 is UpkeepTranscoderInterfaceV2, ITypeAndVersion { } // v1.3 => v2.1 if (fromVersion == uint8(RegistryVersion.V13)) { - (uint256[] memory ids, UpkeepV13[] memory upkeepsV13, bytes[] memory checkDatas) = abi.decode( - encodedUpkeeps, - (uint256[], UpkeepV13[], bytes[]) - ); + (uint256[] memory ids, UpkeepV13[] memory upkeepsV13, bytes[] memory checkDatas) = + abi.decode(encodedUpkeeps, (uint256[], UpkeepV13[], bytes[])); if (ids.length != upkeepsV13.length || ids.length != checkDatas.length) { revert InvalidTranscoding(); } @@ -141,8 +138,8 @@ contract UpkeepTranscoder4_0 is UpkeepTranscoderInterfaceV2, ITypeAndVersion { } // v2.0 => v2.1 if (fromVersion == uint8(RegistryVersion.V20)) { - (uint256[] memory ids, UpkeepV20[] memory upkeepsV20, bytes[] memory checkDatas, address[] memory admins) = abi - .decode(encodedUpkeeps, (uint256[], UpkeepV20[], bytes[], address[])); + (uint256[] memory ids, UpkeepV20[] memory upkeepsV20, bytes[] memory checkDatas, address[] memory admins) = + abi.decode(encodedUpkeeps, (uint256[], UpkeepV20[], bytes[], address[])); if (ids.length != upkeepsV20.length || ids.length != checkDatas.length) { revert InvalidTranscoding(); } diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol index eda9cbf19d..1d9159dd17 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; -import {AutomationRegistryLogicB2_2} from "./AutomationRegistryLogicB2_2.sol"; -import {Chainable} from "../Chainable.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; +import {Chainable} from "../Chainable.sol"; +import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; +import {AutomationRegistryLogicB2_2} from "./AutomationRegistryLogicB2_2.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Registry for adding work for Chainlink nodes to perform on client @@ -107,12 +107,8 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain function _handleReport(HotVars memory hotVars, Report memory report, uint256 gasOverhead) private { UpkeepTransmitInfo[] memory upkeepTransmitInfo = new UpkeepTransmitInfo[](report.upkeepIds.length); - TransmitVars memory transmitVars = TransmitVars({ - numUpkeepsPassedChecks: 0, - totalCalldataWeight: 0, - totalReimbursement: 0, - totalPremium: 0 - }); + TransmitVars memory transmitVars = + TransmitVars({numUpkeepsPassedChecks: 0, totalCalldataWeight: 0, totalReimbursement: 0, totalPremium: 0}); uint256 blocknumber = hotVars.chainModule.blockNumber(); uint256 l1Fee = hotVars.chainModule.getCurrentL1Fee(msg.data.length); @@ -121,13 +117,8 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain upkeepTransmitInfo[i].upkeep = s_upkeep[report.upkeepIds[i]]; upkeepTransmitInfo[i].triggerType = _getTriggerType(report.upkeepIds[i]); - (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = _prePerformChecks( - report.upkeepIds[i], - blocknumber, - report.triggers[i], - upkeepTransmitInfo[i], - hotVars - ); + (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = + _prePerformChecks(report.upkeepIds[i], blocknumber, report.triggers[i], upkeepTransmitInfo[i], hotVars); if (upkeepTransmitInfo[i].earlyChecksPassed) { transmitVars.numUpkeepsPassedChecks += 1; @@ -136,18 +127,13 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain } // Actually perform the target upkeep - (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = _performUpkeep( - upkeepTransmitInfo[i].upkeep.forwarder, - report.gasLimits[i], - report.performDatas[i] - ); + (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = + _performUpkeep(upkeepTransmitInfo[i].upkeep.forwarder, report.gasLimits[i], report.performDatas[i]); // To split L1 fee across the upkeeps, assign a weight to this upkeep based on the length // of the perform data and calldata overhead - upkeepTransmitInfo[i].calldataWeight = - report.performDatas[i].length + - TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + - (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); + upkeepTransmitInfo[i].calldataWeight = report.performDatas[i].length + TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + + (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); transmitVars.totalCalldataWeight += upkeepTransmitInfo[i].calldataWeight; // Deduct that gasUsed by upkeep from our running counter @@ -251,12 +237,7 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain bytes memory offchainConfig ) external override { setConfigTypeSafe( - signers, - transmitters, - f, - abi.decode(onchainConfigBytes, (OnchainConfig)), - offchainConfigVersion, - offchainConfig + signers, transmitters, f, abi.decode(onchainConfigBytes, (OnchainConfig)), offchainConfigVersion, offchainConfig ); } diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol index 00083229d7..f237992c0b 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol @@ -1,17 +1,18 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; -import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; + +import {IChainModule} from "../interfaces/IChainModule.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; -import {IChainModule} from "../interfaces/IChainModule.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Base Keeper Registry contract, contains shared logic between @@ -248,8 +249,8 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { uint96 amountSpent; uint96 balance; uint32 lastPerformedBlockNumber; - // 2 bytes left in 2nd EVM word - written in transmit path } + // 2 bytes left in 2nd EVM word - written in transmit path /// @dev Config + State storage struct which is on hot transmit path struct HotVars { @@ -283,7 +284,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { uint32 maxPerformDataSize; // max length of performData bytes uint32 maxRevertDataSize; // max length of revertData bytes address upkeepPrivilegeManager; // address which can set privilege for upkeeps - // 3 EVM word full + // 3 EVM word full } /// @dev Report transmitted by OCR to transmit function @@ -374,12 +375,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); event UpkeepReceived(uint256 indexed id, uint256 startingBalance, address importedFrom); @@ -432,8 +428,9 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { ) internal { if (s_hotVars.paused) revert RegistryPaused(); if (checkData.length > s_storage.maxCheckDataSize) revert CheckDataExceedsLimit(); - if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) + if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) { revert GasLimitOutsideRange(); + } if (address(s_upkeep[id].forwarder) != address(0)) revert UpkeepAlreadyExists(); s_upkeep[id] = upkeep; s_upkeepAdmin[id] = admin; @@ -456,7 +453,9 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { * @dev we add the "identifying" part in the middle so that it is mostly hidden from users who usually only * see the first 4 and last 4 hex values ex 0x1234...ABCD */ - function _createID(Trigger triggerType) internal view returns (uint256) { + function _createID( + Trigger triggerType + ) internal view returns (uint256) { bytes1 empty; IChainModule chainModule = s_hotVars.chainModule; bytes memory idBytes = abi.encodePacked( @@ -475,12 +474,14 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { * for gas it takes the min of gas price in the transaction or the fast gas * price in order to reduce costs for the upkeep clients. */ - function _getFeedData(HotVars memory hotVars) internal view returns (uint256 gasWei, uint256 linkNative) { + function _getFeedData( + HotVars memory hotVars + ) internal view returns (uint256 gasWei, uint256 linkNative) { uint32 stalenessSeconds = hotVars.stalenessSeconds; bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 feedValue; - (, feedValue, , timestamp, ) = i_fastGasFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_fastGasFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -488,7 +489,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { } else { gasWei = uint256(feedValue); } - (, feedValue, , timestamp, ) = i_linkNativeFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_linkNativeFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -523,10 +524,8 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { gasWei = tx.gasprice; } uint256 gasPayment = ((gasWei * (gasLimit + gasOverhead) + l1CostWei) * 1e18) / linkNative; - uint256 premium = (((gasWei * gasLimit) + l1CostWei) * 1e9 * hotVars.paymentPremiumPPB) / - linkNative + - uint256(hotVars.flatFeeMicroLink) * - 1e12; + uint256 premium = (((gasWei * gasLimit) + l1CostWei) * 1e9 * hotVars.paymentPremiumPPB) / linkNative + + uint256(hotVars.flatFeeMicroLink) * 1e12; // LINK_TOTAL_SUPPLY < UINT96_MAX if (gasPayment + premium > LINK_TOTAL_SUPPLY) revert PaymentGreaterThanAllLINK(); return (uint96(gasPayment), uint96(premium)); @@ -551,14 +550,12 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { } else { revert InvalidTriggerType(); } - uint256 maxCalldataSize = s_storage.maxPerformDataSize + - TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + - (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); + uint256 maxCalldataSize = s_storage.maxPerformDataSize + TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + + (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); (uint256 chainModuleFixedOverhead, uint256 chainModulePerByteOverhead) = s_hotVars.chainModule.getGasOverhead(); - maxGasOverhead += - (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)) + - ((REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD + chainModulePerByteOverhead) * maxCalldataSize) + - chainModuleFixedOverhead; + maxGasOverhead += (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)) + + ((REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD + chainModulePerByteOverhead) * maxCalldataSize) + + chainModuleFixedOverhead; uint256 maxL1Fee = hotVars.gasCeilingMultiplier * hotVars.chainModule.getMaxL1Fee(maxCalldataSize); @@ -599,7 +596,9 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { /** * @dev gets the trigger type from an upkeepID (trigger type is encoded in the middle of the ID) */ - function _getTriggerType(uint256 upkeepId) internal pure returns (Trigger) { + function _getTriggerType( + uint256 upkeepId + ) internal pure returns (Trigger) { bytes32 rawID = bytes32(upkeepId); bytes1 empty = bytes1(0); for (uint256 idx = 4; idx < 15; idx++) { @@ -628,13 +627,14 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { /** * @dev _decodeReport decodes a serialized report into a Report struct */ - function _decodeReport(bytes calldata rawReport) internal pure returns (Report memory) { + function _decodeReport( + bytes calldata rawReport + ) internal pure returns (Report memory) { Report memory report = abi.decode(rawReport, (Report)); uint256 expectedLength = report.upkeepIds.length; if ( - report.gasLimits.length != expectedLength || - report.triggers.length != expectedLength || - report.performDatas.length != expectedLength + report.gasLimits.length != expectedLength || report.triggers.length != expectedLength + || report.performDatas.length != expectedLength ) { revert InvalidReport(); } @@ -655,8 +655,9 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { ) internal returns (bool, bytes32) { bytes32 dedupID; if (transmitInfo.triggerType == Trigger.CONDITION) { - if (!_validateConditionalTrigger(upkeepId, blocknumber, rawTrigger, transmitInfo, hotVars)) + if (!_validateConditionalTrigger(upkeepId, blocknumber, rawTrigger, transmitInfo, hotVars)) { return (false, dedupID); + } } else if (transmitInfo.triggerType == Trigger.LOG) { bool valid; (valid, dedupID) = _validateLogTrigger(upkeepId, blocknumber, rawTrigger, hotVars); @@ -690,9 +691,10 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { return false; } if ( - (hotVars.reorgProtectionEnabled && - (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash)) || - trigger.blockNum >= blocknumber + ( + hotVars.reorgProtectionEnabled + && (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash) + ) || trigger.blockNum >= blocknumber ) { // There are two cases of reorged report // 1. trigger block number is in future: this is an edge case during extreme deep reorgs of chain @@ -715,9 +717,10 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { LogTrigger memory trigger = abi.decode(rawTrigger, (LogTrigger)); bytes32 dedupID = keccak256(abi.encodePacked(upkeepId, trigger.logBlockHash, trigger.txHash, trigger.logIndex)); if ( - (hotVars.reorgProtectionEnabled && - (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash)) || - trigger.blockNum >= blocknumber + ( + hotVars.reorgProtectionEnabled + && (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash) + ) || trigger.blockNum >= blocknumber ) { // Reorg protection is same as conditional trigger upkeeps emit ReorgedUpkeepReport(upkeepId, rawTrigger); @@ -834,7 +837,9 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { /** * @dev ensures the upkeep is not cancelled and the caller is the upkeep admin */ - function _requireAdminAndNotCancelled(uint256 upkeepId) internal view { + function _requireAdminAndNotCancelled( + uint256 upkeepId + ) internal view { if (msg.sender != s_upkeepAdmin[upkeepId]) revert OnlyCallableByAdmin(); if (s_upkeep[upkeepId].maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); } diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol index 2ed63ea38e..7f7a6c683a 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol @@ -1,15 +1,16 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; -import {AutomationRegistryLogicB2_2} from "./AutomationRegistryLogicB2_2.sol"; -import {Chainable} from "../Chainable.sol"; import {AutomationForwarder} from "../AutomationForwarder.sol"; +import {Chainable} from "../Chainable.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; -import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; + import {MigratableKeeperRegistryInterfaceV2} from "../interfaces/MigratableKeeperRegistryInterfaceV2.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; +import {AutomationRegistryLogicB2_2} from "./AutomationRegistryLogicB2_2.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Logic contract, works in tandem with AutomationRegistry as a proxy @@ -66,8 +67,9 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { Upkeep memory upkeep = s_upkeep[id]; if (hotVars.paused) return (false, bytes(""), UpkeepFailureReason.REGISTRY_PAUSED, 0, upkeep.performGas, 0, 0); - if (upkeep.maxValidBlocknumber != UINT32_MAX) + if (upkeep.maxValidBlocknumber != UINT32_MAX) { return (false, bytes(""), UpkeepFailureReason.UPKEEP_CANCELLED, 0, upkeep.performGas, 0, 0); + } if (upkeep.paused) return (false, bytes(""), UpkeepFailureReason.UPKEEP_PAUSED, 0, upkeep.performGas, 0, 0); (fastGasWei, linkNative) = _getFeedData(hotVars); @@ -108,18 +110,12 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { } (upkeepNeeded, performData) = abi.decode(result, (bool, bytes)); - if (!upkeepNeeded) - return ( - false, - bytes(""), - UpkeepFailureReason.UPKEEP_NOT_NEEDED, - gasUsed, - upkeep.performGas, - fastGasWei, - linkNative - ); + if (!upkeepNeeded) { + return + (false, bytes(""), UpkeepFailureReason.UPKEEP_NOT_NEEDED, gasUsed, upkeep.performGas, fastGasWei, linkNative); + } - if (performData.length > s_storage.maxPerformDataSize) + if (performData.length > s_storage.maxPerformDataSize) { return ( false, bytes(""), @@ -129,6 +125,7 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { fastGasWei, linkNative ); + } return (upkeepNeeded, performData, upkeepFailureReason, gasUsed, upkeep.performGas, fastGasWei, linkNative); } @@ -228,9 +225,8 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { if (msg.sender != owner() && !s_registrars.contains(msg.sender)) revert OnlyCallableByOwnerOrRegistrar(); if (!target.isContract()) revert NotAContract(); id = _createID(triggerType); - IAutomationForwarder forwarder = IAutomationForwarder( - address(new AutomationForwarder(target, address(this), i_automationForwarderLogic)) - ); + IAutomationForwarder forwarder = + IAutomationForwarder(address(new AutomationForwarder(target, address(this), i_automationForwarderLogic))); _createUpkeep( id, Upkeep({ @@ -275,7 +271,9 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { * @dev if a user cancels an upkeep, their funds are locked for CANCELLATION_DELAY blocks to * allow any pending performUpkeep txs time to get confirmed */ - function cancelUpkeep(uint256 id) external { + function cancelUpkeep( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; bool isOwner = msg.sender == owner(); @@ -330,8 +328,8 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { */ function migrateUpkeeps(uint256[] calldata ids, address destination) external { if ( - s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING && - s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING + && s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); if (s_storage.transcoder == ZERO_ADDRESS) revert TranscoderNotSet(); if (ids.length == 0) revert ArrayHasNoEntries(); @@ -364,20 +362,11 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { emit UpkeepMigrated(id, upkeep.balance, destination); } s_expectedLinkBalance = s_expectedLinkBalance - totalBalanceRemaining; - bytes memory encodedUpkeeps = abi.encode( - ids, - upkeeps, - new address[](ids.length), - admins, - checkDatas, - triggerConfigs, - offchainConfigs - ); + bytes memory encodedUpkeeps = + abi.encode(ids, upkeeps, new address[](ids.length), admins, checkDatas, triggerConfigs, offchainConfigs); MigratableKeeperRegistryInterfaceV2(destination).receiveUpkeeps( UpkeepTranscoderInterfaceV2(s_storage.transcoder).transcodeUpkeeps( - UPKEEP_VERSION_BASE, - MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), - encodedUpkeeps + UPKEEP_VERSION_BASE, MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), encodedUpkeeps ) ); i_link.transfer(destination, totalBalanceRemaining); @@ -388,10 +377,12 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { * @param encodedUpkeeps the raw upkeep data to import * @dev this function is never called directly, it is only called by another registry's migrate function */ - function receiveUpkeeps(bytes calldata encodedUpkeeps) external { + function receiveUpkeeps( + bytes calldata encodedUpkeeps + ) external { if ( - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING && - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING + && s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); ( uint256[] memory ids, @@ -409,12 +400,7 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { ); } _createUpkeep( - ids[idx], - upkeeps[idx], - upkeepAdmins[idx], - checkDatas[idx], - triggerConfigs[idx], - offchainConfigs[idx] + ids[idx], upkeeps[idx], upkeepAdmins[idx], checkDatas[idx], triggerConfigs[idx], offchainConfigs[idx] ); emit UpkeepReceived(ids[idx], upkeeps[idx].balance, msg.sender); } diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicB2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicB2_2.sol index 53defa05e9..0dd1ba9662 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicB2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicB2_2.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; -import {IChainModule} from "../interfaces/IChainModule.sol"; + import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {IChainModule} from "../interfaces/IChainModule.sol"; +import {UpkeepFormat} from "../interfaces/UpkeepTranscoderInterface.sol"; +import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { using Address for address; @@ -45,7 +46,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice accepts the transfer of an upkeep admin */ - function acceptUpkeepAdmin(uint256 id) external { + function acceptUpkeepAdmin( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; if (upkeep.maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); if (s_proposedAdmin[id] != msg.sender) revert OnlyCallableByProposedAdmin(); @@ -59,7 +62,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice pauses an upkeep - an upkeep will be neither checked nor performed while paused */ - function pauseUpkeep(uint256 id) external { + function pauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (upkeep.paused) revert OnlyUnpausedUpkeep(); @@ -71,7 +76,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice unpauses an upkeep */ - function unpauseUpkeep(uint256 id) external { + function unpauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (!upkeep.paused) revert OnlyPausedUpkeep(); @@ -146,7 +153,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice accepts the transfer of the payee */ - function acceptPayeeship(address transmitter) external { + function acceptPayeeship( + address transmitter + ) external { if (s_proposedPayee[transmitter] != msg.sender) revert OnlyCallableByProposedPayee(); address past = s_transmitterPayees[transmitter]; s_transmitterPayees[transmitter] = msg.sender; @@ -205,7 +214,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice sets the payees for the transmitters */ - function setPayees(address[] calldata payees) external onlyOwner { + function setPayees( + address[] calldata payees + ) external onlyOwner { if (s_transmittersList.length != payees.length) revert ParameterLengthError(); for (uint256 i = 0; i < s_transmittersList.length; i++) { address transmitter = s_transmittersList[i]; @@ -323,7 +334,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { * @dev this function may be deprecated in a future version of automation in favor of individual * getters for each field */ - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { Upkeep memory reg = s_upkeep[id]; address target = address(reg.forwarder) == address(0) ? address(0) : reg.forwarder.getTarget(); upkeepInfo = IAutomationV21PlusCommon.UpkeepInfoLegacy({ @@ -363,14 +376,18 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice returns the upkeep's trigger type */ - function getTriggerType(uint256 upkeepId) external pure returns (Trigger) { + function getTriggerType( + uint256 upkeepId + ) external pure returns (Trigger) { return _getTriggerType(upkeepId); } /** * @notice returns the trigger config for an upkeeep */ - function getUpkeepTriggerConfig(uint256 upkeepId) public view returns (bytes memory) { + function getUpkeepTriggerConfig( + uint256 upkeepId + ) public view returns (bytes memory) { return s_upkeepTriggerConfig[upkeepId]; } @@ -400,7 +417,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice read the current info about any signer address */ - function getSignerInfo(address query) external view returns (bool active, uint8 index) { + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index) { Signer memory signer = s_signers[query]; return (signer.active, signer.index); } @@ -472,7 +491,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getBalance(uint256 id) external view returns (uint96 balance) { + function getBalance( + uint256 id + ) external view returns (uint96 balance) { return s_upkeep[id].balance; } @@ -480,7 +501,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getMinBalance(uint256 id) external view returns (uint96) { + function getMinBalance( + uint256 id + ) external view returns (uint96) { return getMinBalanceForUpkeep(id); } @@ -489,7 +512,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { * @param id the upkeep id to calculate minimum balance for * @dev this will be deprecated in a future version in favor of getMinBalance */ - function getMinBalanceForUpkeep(uint256 id) public view returns (uint96 minBalance) { + function getMinBalanceForUpkeep( + uint256 id + ) public view returns (uint96 minBalance) { return getMaxPaymentForGas(_getTriggerType(id), s_upkeep[id].performGas); } @@ -506,35 +531,45 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { /** * @notice retrieves the migration permission for a peer registry */ - function getPeerRegistryMigrationPermission(address peer) external view returns (MigrationPermission) { + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (MigrationPermission) { return s_peerRegistryMigrationPermission[peer]; } /** * @notice returns the upkeep privilege config */ - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) { + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory) { return s_upkeepPrivilegeConfig[upkeepId]; } /** * @notice returns the upkeep privilege config */ - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory) { + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory) { return s_adminPrivilegeConfig[admin]; } /** * @notice returns the upkeep's forwarder contract */ - function getForwarder(uint256 upkeepID) external view returns (IAutomationForwarder) { + function getForwarder( + uint256 upkeepID + ) external view returns (IAutomationForwarder) { return s_upkeep[upkeepID].forwarder; } /** * @notice returns the upkeep's forwarder contract */ - function hasDedupKey(bytes32 dedupKey) external view returns (bool) { + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool) { return s_dedupKeys[dedupKey]; } } diff --git a/contracts/src/v0.8/automation/v2_2/AutomationUtils2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationUtils2_2.sol index abdabeb480..0ba4b8c029 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationUtils2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationUtils2_2.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; -import {Log} from "../interfaces/ILogAutomation.sol"; import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {Log} from "../interfaces/ILogAutomation.sol"; +import {AutomationRegistryBase2_2} from "./AutomationRegistryBase2_2.sol"; /** * @notice this file exposes structs that are otherwise internal to the automation registry @@ -27,15 +27,27 @@ contract AutomationUtils2_2 { /** * @dev this can be removed as OnchainConfig is now exposed directly from the registry */ - function _onChainConfig(IAutomationV21PlusCommon.OnchainConfigLegacy memory) external {} // 0x2ff92a81 + function _onChainConfig( + IAutomationV21PlusCommon.OnchainConfigLegacy memory + ) external {} // 0x2ff92a81 - function _report(AutomationRegistryBase2_2.Report memory) external {} // 0xe65d6546 + function _report( + AutomationRegistryBase2_2.Report memory + ) external {} // 0xe65d6546 - function _logTriggerConfig(LogTriggerConfig memory) external {} // 0x21f373d7 + function _logTriggerConfig( + LogTriggerConfig memory + ) external {} // 0x21f373d7 - function _logTrigger(AutomationRegistryBase2_2.LogTrigger memory) external {} // 0x1c8d8260 + function _logTrigger( + AutomationRegistryBase2_2.LogTrigger memory + ) external {} // 0x1c8d8260 - function _conditionalTrigger(AutomationRegistryBase2_2.ConditionalTrigger memory) external {} // 0x4b6df294 + function _conditionalTrigger( + AutomationRegistryBase2_2.ConditionalTrigger memory + ) external {} // 0x4b6df294 - function _log(Log memory) external {} // 0xe9720a49 + function _log( + Log memory + ) external {} // 0xe9720a49 } diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol index a1460b4211..735dec323f 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol @@ -1,15 +1,17 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {IAutomationRegistryMaster2_3} from "../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; -import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {IAutomationRegistryMaster2_3} from "../interfaces/v2_3/IAutomationRegistryMaster2_3.sol"; + import {IWrappedNative} from "../interfaces/v2_3/IWrappedNative.sol"; -import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; + import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; +import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; /** * @notice Contract to accept requests for upkeep registrations @@ -93,6 +95,7 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @member triggerConfig the config for the trigger * @member offchainConfig offchainConfig for upkeep in bytes */ + struct RegistrationParams { address upkeepContract; uint96 amount; @@ -177,9 +180,7 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei setConfig(registry, billingTokens, minRegistrationFees); for (uint256 idx = 0; idx < triggerConfigs.length; idx++) { setTriggerConfig( - triggerConfigs[idx].triggerType, - triggerConfigs[idx].autoApproveType, - triggerConfigs[idx].autoApproveMaxAllowed + triggerConfigs[idx].triggerType, triggerConfigs[idx].autoApproveType, triggerConfigs[idx].autoApproveMaxAllowed ); } } @@ -190,7 +191,9 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice Allows external users to register upkeeps; assumes amount is approved for transfer by the contract * @param requestParams struct of all possible registration parameters */ - function registerUpkeep(RegistrationParams memory requestParams) external payable returns (uint256) { + function registerUpkeep( + RegistrationParams memory requestParams + ) external payable returns (uint256) { if (requestParams.billingToken == IERC20(i_WRAPPED_NATIVE_TOKEN) && msg.value != 0) { requestParams.amount = SafeCast.toUint96(msg.value); // wrap and send native payment @@ -207,7 +210,9 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @dev register upkeep on AutomationRegistry contract and emit RegistrationApproved event * @param requestParams struct of all possible registration parameters */ - function approve(RegistrationParams calldata requestParams) external onlyOwner { + function approve( + RegistrationParams calldata requestParams + ) external onlyOwner { bytes32 hash = keccak256(abi.encode(requestParams)); PendingRequest memory request = s_pendingRequests[hash]; @@ -223,7 +228,9 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice cancel will remove a registration request from the pending request queue and return the refunds to the request.admin * @param hash the request hash */ - function cancel(bytes32 hash) external { + function cancel( + bytes32 hash + ) external { PendingRequest memory request = s_pendingRequests[hash]; if (!(msg.sender == request.admin || msg.sender == owner())) { @@ -289,7 +296,9 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice read the allowlist status of senderAddress * @param senderAddress address to read the allowlist status for */ - function getAutoApproveAllowedSender(address senderAddress) external view returns (bool) { + function getAutoApproveAllowedSender( + address senderAddress + ) external view returns (bool) { return s_autoApproveAllowedSenders[senderAddress]; } @@ -303,7 +312,9 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei /** * @notice get the minimum registration fee for a particular billing token */ - function getMinimumRegistrationAmount(IERC20 billingToken) external view returns (uint256) { + function getMinimumRegistrationAmount( + IERC20 billingToken + ) external view returns (uint256) { return s_minRegistrationAmounts[billingToken]; } @@ -311,14 +322,18 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei * @notice read the config for this upkeep type * @param triggerType upkeep type to read config for */ - function getTriggerRegistrationDetails(uint8 triggerType) external view returns (TriggerRegistrationStorage memory) { + function getTriggerRegistrationDetails( + uint8 triggerType + ) external view returns (TriggerRegistrationStorage memory) { return s_triggerRegistrations[triggerType]; } /** * @notice gets the admin address and the current balance of a registration request */ - function getPendingRequest(bytes32 hash) external view returns (address, uint96) { + function getPendingRequest( + bytes32 hash + ) external view returns (address, uint96) { PendingRequest memory request = s_pendingRequests[hash]; return (request.admin, request.balance); } @@ -382,11 +397,8 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei s_triggerRegistrations[params.triggerType].approvedCount++; upkeepId = _approve(params, hash); } else { - s_pendingRequests[hash] = PendingRequest({ - admin: params.adminAddress, - balance: params.amount, - billingToken: params.billingToken - }); + s_pendingRequests[hash] = + PendingRequest({admin: params.adminAddress, balance: params.amount, billingToken: params.billingToken}); } return upkeepId; diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol index 38368c1350..b2f72d6eef 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; +import {Chainable} from "../Chainable.sol"; import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; import {AutomationRegistryLogicA2_3} from "./AutomationRegistryLogicA2_3.sol"; import {AutomationRegistryLogicC2_3} from "./AutomationRegistryLogicC2_3.sol"; -import {Chainable} from "../Chainable.sol"; -import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; + import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Registry for adding work for Chainlink nodes to perform on client @@ -128,12 +129,8 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain */ function _handleReport(HotVars memory hotVars, Report memory report, uint256 gasOverhead) private { UpkeepTransmitInfo[] memory upkeepTransmitInfo = new UpkeepTransmitInfo[](report.upkeepIds.length); - TransmitVars memory transmitVars = TransmitVars({ - numUpkeepsPassedChecks: 0, - totalCalldataWeight: 0, - totalReimbursement: 0, - totalPremium: 0 - }); + TransmitVars memory transmitVars = + TransmitVars({numUpkeepsPassedChecks: 0, totalCalldataWeight: 0, totalReimbursement: 0, totalPremium: 0}); uint256 blocknumber = hotVars.chainModule.blockNumber(); uint256 l1Fee = hotVars.chainModule.getCurrentL1Fee(msg.data.length); @@ -142,13 +139,8 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain upkeepTransmitInfo[i].upkeep = s_upkeep[report.upkeepIds[i]]; upkeepTransmitInfo[i].triggerType = _getTriggerType(report.upkeepIds[i]); - (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = _prePerformChecks( - report.upkeepIds[i], - blocknumber, - report.triggers[i], - upkeepTransmitInfo[i], - hotVars - ); + (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = + _prePerformChecks(report.upkeepIds[i], blocknumber, report.triggers[i], upkeepTransmitInfo[i], hotVars); if (upkeepTransmitInfo[i].earlyChecksPassed) { transmitVars.numUpkeepsPassedChecks += 1; @@ -157,18 +149,13 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain } // Actually perform the target upkeep - (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = _performUpkeep( - upkeepTransmitInfo[i].upkeep.forwarder, - report.gasLimits[i], - report.performDatas[i] - ); + (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = + _performUpkeep(upkeepTransmitInfo[i].upkeep.forwarder, report.gasLimits[i], report.performDatas[i]); // To split L1 fee across the upkeeps, assign a weight to this upkeep based on the length // of the perform data and calldata overhead - upkeepTransmitInfo[i].calldataWeight = - report.performDatas[i].length + - TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + - (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); + upkeepTransmitInfo[i].calldataWeight = report.performDatas[i].length + TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + + (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); transmitVars.totalCalldataWeight += upkeepTransmitInfo[i].calldataWeight; // Deduct the gasUsed by upkeep from the overhead tally - upkeeps pay for their own gas individually @@ -246,20 +233,11 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain uint64 offchainConfigVersion, bytes memory offchainConfig ) external override { - (OnchainConfig memory config, IERC20[] memory billingTokens, BillingConfig[] memory billingConfigs) = abi.decode( - onchainConfigBytes, - (OnchainConfig, IERC20[], BillingConfig[]) - ); + (OnchainConfig memory config, IERC20[] memory billingTokens, BillingConfig[] memory billingConfigs) = + abi.decode(onchainConfigBytes, (OnchainConfig, IERC20[], BillingConfig[])); setConfigTypeSafe( - signers, - transmitters, - f, - config, - offchainConfigVersion, - offchainConfig, - billingTokens, - billingConfigs + signers, transmitters, f, config, offchainConfigVersion, offchainConfig, billingTokens, billingConfigs ); } diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol index 59c6c5763e..e406bf059e 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol @@ -1,19 +1,21 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; -import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; + import {IChainModule} from "../interfaces/IChainModule.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; +import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; + +import {IWrappedNative} from "../interfaces/v2_3/IWrappedNative.sol"; import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; -import {IWrappedNative} from "../interfaces/v2_3/IWrappedNative.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Base Keeper Registry contract, contains shared logic between @@ -262,8 +264,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint32 lastPerformedBlockNumber; // 0 bytes left in 2nd EVM word - written in transmit path IERC20 billingToken; - // 12 bytes left in 3rd EVM word - read in transmit path } + // 12 bytes left in 3rd EVM word - read in transmit path /// @dev Config + State storage struct which is on hot transmit path struct HotVars { @@ -293,7 +295,7 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { address financeAdmin; // address which can withdraw funds from the contract uint32 maxPerformDataSize; // max length of performData bytes uint32 maxRevertDataSize; // max length of revertData bytes - // 4 bytes left in 3rd EVM word + // 4 bytes left in 3rd EVM word } /// @dev Report transmitted by OCR to transmit function @@ -387,8 +389,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint256 fallbackPrice; // 2nd word only read if stale uint96 minSpend; - // 3rd word only read during cancellation } + // 3rd word only read during cancellation /** * @notice override-able billing params of a billing token @@ -453,8 +455,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { // third word ends uint96 nativeUSD; uint96 billingUSD; - // fourth word ends } + // fourth word ends event AdminPrivilegeConfigSet(address indexed admin, bytes privilegeConfig); event BillingConfigOverridden(uint256 indexed id, BillingOverrides overrides); @@ -484,12 +486,7 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepCharged(uint256 indexed id, PaymentReceipt receipt); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); @@ -554,8 +551,9 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { ) internal { if (s_hotVars.paused) revert RegistryPaused(); if (checkData.length > s_storage.maxCheckDataSize) revert CheckDataExceedsLimit(); - if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) + if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) { revert GasLimitOutsideRange(); + } if (address(s_upkeep[id].forwarder) != address(0)) revert UpkeepAlreadyExists(); if (address(s_billingConfigs[upkeep.billingToken].priceFeed) == address(0)) revert InvalidToken(); s_upkeep[id] = upkeep; @@ -579,7 +577,9 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { * @dev we add the "identifying" part in the middle so that it is mostly hidden from users who usually only * see the first 4 and last 4 hex values ex 0x1234...ABCD */ - function _createID(Trigger triggerType) internal view returns (uint256) { + function _createID( + Trigger triggerType + ) internal view returns (uint256) { bytes1 empty; IChainModule chainModule = s_hotVars.chainModule; bytes memory idBytes = abi.encodePacked( @@ -605,7 +605,7 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 feedValue; - (, feedValue, , timestamp, ) = i_fastGasFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_fastGasFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -613,7 +613,7 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { } else { gasWei = uint256(feedValue); } - (, feedValue, , timestamp, ) = i_linkUSDFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_linkUSDFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -629,12 +629,13 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { * in the future, all price data should be included in the report instead of * getting read during execution */ - function _getNativeUSD(HotVars memory hotVars) internal view returns (uint256) { - (, int256 feedValue, , uint256 timestamp, ) = i_nativeUSDFeed.latestRoundData(); + function _getNativeUSD( + HotVars memory hotVars + ) internal view returns (uint256) { + (, int256 feedValue,, uint256 timestamp,) = i_nativeUSDFeed.latestRoundData(); if ( - feedValue <= 0 || - block.timestamp < timestamp || - (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) + feedValue <= 0 || block.timestamp < timestamp + || (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) ) { return s_fallbackNativePrice; } else { @@ -653,11 +654,10 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { paymentParams.flatFeeMilliCents = config.flatFeeMilliCents; paymentParams.gasFeePPB = config.gasFeePPB; paymentParams.decimals = config.decimals; - (, int256 feedValue, , uint256 timestamp, ) = config.priceFeed.latestRoundData(); + (, int256 feedValue,, uint256 timestamp,) = config.priceFeed.latestRoundData(); if ( - feedValue <= 0 || - block.timestamp < timestamp || - (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) + feedValue <= 0 || block.timestamp < timestamp + || (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) ) { paymentParams.priceUSD = config.fallbackPrice; } else { @@ -692,28 +692,33 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint256 denominatorScalingFactor = decimals < 18 ? 10 ** (18 - decimals) : 1; // gas calculation - uint256 gasPaymentHexaicosaUSD = (gasWei * - (paymentParams.gasLimit + paymentParams.gasOverhead) + - paymentParams.l1CostWei) * paymentParams.nativeUSD; // gasPaymentHexaicosaUSD has an extra 8 zeros because of decimals on nativeUSD feed + uint256 gasPaymentHexaicosaUSD = ( + gasWei * (paymentParams.gasLimit + paymentParams.gasOverhead) + paymentParams.l1CostWei + ) * paymentParams.nativeUSD; // gasPaymentHexaicosaUSD has an extra 8 zeros because of decimals on nativeUSD feed // gasChargeInBillingToken is scaled by the billing token's decimals. Round up to ensure a minimum billing token is charged for gas receipt.gasChargeInBillingToken = SafeCast.toUint96( - ((gasPaymentHexaicosaUSD * numeratorScalingFactor) + - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1)) / - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) + ( + (gasPaymentHexaicosaUSD * numeratorScalingFactor) + + (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1) + ) / (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) ); // 18 decimals: 26 decimals / 8 decimals receipt.gasReimbursementInJuels = SafeCast.toUint96(gasPaymentHexaicosaUSD / paymentParams.linkUSD); // premium calculation uint256 flatFeeHexaicosaUSD = uint256(paymentParams.billingTokenParams.flatFeeMilliCents) * 1e21; // 1e13 for milliCents to attoUSD and 1e8 for attoUSD to hexaicosaUSD - uint256 premiumHexaicosaUSD = ((((gasWei * paymentParams.gasLimit) + paymentParams.l1CostWei) * - paymentParams.billingTokenParams.gasFeePPB * - paymentParams.nativeUSD) / 1e9) + flatFeeHexaicosaUSD; + uint256 premiumHexaicosaUSD = ( + ( + ((gasWei * paymentParams.gasLimit) + paymentParams.l1CostWei) * paymentParams.billingTokenParams.gasFeePPB + * paymentParams.nativeUSD + ) / 1e9 + ) + flatFeeHexaicosaUSD; // premium is scaled by the billing token's decimals. Round up to ensure at least minimum charge receipt.premiumInBillingToken = SafeCast.toUint96( - ((premiumHexaicosaUSD * numeratorScalingFactor) + - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1)) / - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) + ( + (premiumHexaicosaUSD * numeratorScalingFactor) + + (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1) + ) / (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) ); receipt.premiumInJuels = SafeCast.toUint96(premiumHexaicosaUSD / paymentParams.linkUSD); @@ -750,14 +755,12 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { } else { revert InvalidTriggerType(); } - uint256 maxCalldataSize = s_storage.maxPerformDataSize + - TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + - (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); + uint256 maxCalldataSize = s_storage.maxPerformDataSize + TRANSMIT_CALLDATA_FIXED_BYTES_OVERHEAD + + (TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD * (hotVars.f + 1)); (uint256 chainModuleFixedOverhead, uint256 chainModulePerByteOverhead) = s_hotVars.chainModule.getGasOverhead(); - maxGasOverhead += - (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)) + - ((REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD + chainModulePerByteOverhead) * maxCalldataSize) + - chainModuleFixedOverhead; + maxGasOverhead += (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)) + + ((REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD + chainModulePerByteOverhead) * maxCalldataSize) + + chainModuleFixedOverhead; maxL1Fee = hotVars.gasCeilingMultiplier * hotVars.chainModule.getMaxL1Fee(maxCalldataSize); } @@ -811,7 +814,9 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { /** * @dev gets the trigger type from an upkeepID (trigger type is encoded in the middle of the ID) */ - function _getTriggerType(uint256 upkeepId) internal pure returns (Trigger) { + function _getTriggerType( + uint256 upkeepId + ) internal pure returns (Trigger) { bytes32 rawID = bytes32(upkeepId); bytes1 empty = bytes1(0); for (uint256 idx = 4; idx < 15; idx++) { @@ -840,13 +845,14 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { /** * @dev _decodeReport decodes a serialized report into a Report struct */ - function _decodeReport(bytes calldata rawReport) internal pure returns (Report memory) { + function _decodeReport( + bytes calldata rawReport + ) internal pure returns (Report memory) { Report memory report = abi.decode(rawReport, (Report)); uint256 expectedLength = report.upkeepIds.length; if ( - report.gasLimits.length != expectedLength || - report.triggers.length != expectedLength || - report.performDatas.length != expectedLength + report.gasLimits.length != expectedLength || report.triggers.length != expectedLength + || report.performDatas.length != expectedLength ) { revert InvalidReport(); } @@ -867,8 +873,9 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { ) internal returns (bool, bytes32) { bytes32 dedupID; if (transmitInfo.triggerType == Trigger.CONDITION) { - if (!_validateConditionalTrigger(upkeepId, blocknumber, rawTrigger, transmitInfo, hotVars)) + if (!_validateConditionalTrigger(upkeepId, blocknumber, rawTrigger, transmitInfo, hotVars)) { return (false, dedupID); + } } else if (transmitInfo.triggerType == Trigger.LOG) { bool valid; (valid, dedupID) = _validateLogTrigger(upkeepId, blocknumber, rawTrigger, hotVars); @@ -902,9 +909,10 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { return false; } if ( - (hotVars.reorgProtectionEnabled && - (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash)) || - trigger.blockNum >= blocknumber + ( + hotVars.reorgProtectionEnabled + && (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash) + ) || trigger.blockNum >= blocknumber ) { // There are two cases of reorged report // 1. trigger block number is in future: this is an edge case during extreme deep reorgs of chain @@ -927,9 +935,10 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { LogTrigger memory trigger = abi.decode(rawTrigger, (LogTrigger)); bytes32 dedupID = keccak256(abi.encodePacked(upkeepId, trigger.logBlockHash, trigger.txHash, trigger.logIndex)); if ( - (hotVars.reorgProtectionEnabled && - (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash)) || - trigger.blockNum >= blocknumber + ( + hotVars.reorgProtectionEnabled + && (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash) + ) || trigger.blockNum >= blocknumber ) { // Reorg protection is same as conditional trigger upkeeps emit ReorgedUpkeepReport(upkeepId, rawTrigger); @@ -1035,8 +1044,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { // if the user can't cover the gas fee, then direct all of the payment to the transmitter and distribute no premium to the DON payment = balance; receipt.gasReimbursementInJuels = SafeCast.toUint96( - (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) / - (paymentParams.linkUSD * scalingFactor2) + (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) + / (paymentParams.linkUSD * scalingFactor2) ); receipt.premiumInJuels = 0; receipt.premiumInBillingToken = 0; @@ -1045,14 +1054,17 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { // if the user can cover the gas fee, but not the premium, then reduce the premium payment = balance; receipt.premiumInJuels = SafeCast.toUint96( - ((balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) / - (paymentParams.linkUSD * scalingFactor2)) - receipt.gasReimbursementInJuels + ( + (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) + / (paymentParams.linkUSD * scalingFactor2) + ) - receipt.gasReimbursementInJuels ); // round up receipt.premiumInBillingToken = SafeCast.toUint96( - ((receipt.premiumInJuels * paymentParams.linkUSD * scalingFactor2) + - (paymentParams.billingTokenParams.priceUSD * scalingFactor1 - 1)) / - (paymentParams.billingTokenParams.priceUSD * scalingFactor1) + ( + (receipt.premiumInJuels * paymentParams.linkUSD * scalingFactor2) + + (paymentParams.billingTokenParams.priceUSD * scalingFactor1 - 1) + ) / (paymentParams.billingTokenParams.priceUSD * scalingFactor1) ); } @@ -1067,7 +1079,9 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { /** * @dev ensures the upkeep is not cancelled and the caller is the upkeep admin */ - function _requireAdminAndNotCancelled(uint256 upkeepId) internal view { + function _requireAdminAndNotCancelled( + uint256 upkeepId + ) internal view { if (msg.sender != s_upkeepAdmin[upkeepId]) revert OnlyCallableByAdmin(); if (s_upkeep[upkeepId].maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); } @@ -1208,7 +1222,7 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { /** * @notice returns the size of the LINK liquidity pool - # @dev LINK max supply < 2^96, so casting to int256 is safe + * # @dev LINK max supply < 2^96, so casting to int256 is safe */ function _linkAvailableForPayment() internal view returns (int256) { return int256(i_link.balanceOf(address(this))) - int256(s_reserveAmounts[IERC20(address(i_link))]); diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicA2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicA2_3.sol index e4161693bc..870b3095ab 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicA2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicA2_3.sol @@ -1,19 +1,20 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; -import {AutomationRegistryLogicC2_3} from "./AutomationRegistryLogicC2_3.sol"; -import {AutomationRegistryLogicB2_3} from "./AutomationRegistryLogicB2_3.sol"; -import {Chainable} from "../Chainable.sol"; +import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; import {AutomationForwarder} from "../AutomationForwarder.sol"; +import {Chainable} from "../Chainable.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; -import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; import {MigratableKeeperRegistryInterfaceV2} from "../interfaces/MigratableKeeperRegistryInterfaceV2.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; +import {AutomationRegistryLogicB2_3} from "./AutomationRegistryLogicB2_3.sol"; +import {AutomationRegistryLogicC2_3} from "./AutomationRegistryLogicC2_3.sol"; + import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; -import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Logic contract, works in tandem with AutomationRegistry as a proxy @@ -90,9 +91,8 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable, IE if (msg.sender != owner() && !s_registrars.contains(msg.sender)) revert OnlyCallableByOwnerOrRegistrar(); if (!target.isContract()) revert NotAContract(); id = _createID(triggerType); - IAutomationForwarder forwarder = IAutomationForwarder( - address(new AutomationForwarder(target, address(this), i_automationForwarderLogic)) - ); + IAutomationForwarder forwarder = + IAutomationForwarder(address(new AutomationForwarder(target, address(this), i_automationForwarderLogic))); _createUpkeep( id, Upkeep({ @@ -125,7 +125,9 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable, IE * @dev if a user cancels an upkeep, their funds are locked for CANCELLATION_DELAY blocks to * allow any pending performUpkeep txs time to get confirmed */ - function cancelUpkeep(uint256 id) external { + function cancelUpkeep( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; bool isOwner = msg.sender == owner(); uint96 minSpend = s_billingConfigs[upkeep.billingToken].minSpend; @@ -168,8 +170,8 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable, IE */ function migrateUpkeeps(uint256[] calldata ids, address destination) external { if ( - s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING && - s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING + && s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); if (s_storage.transcoder == ZERO_ADDRESS) revert TranscoderNotSet(); if (ids.length == 0) revert ArrayHasNoEntries(); @@ -225,20 +227,11 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable, IE s_reserveAmounts[billingToken] = s_reserveAmounts[billingToken] - balanceToTransfer; billingToken.safeTransfer(destination, balanceToTransfer); - bytes memory encodedUpkeeps = abi.encode( - ids, - upkeeps, - new address[](ids.length), - admins, - checkDatas, - triggerConfigs, - offchainConfigs - ); + bytes memory encodedUpkeeps = + abi.encode(ids, upkeeps, new address[](ids.length), admins, checkDatas, triggerConfigs, offchainConfigs); MigratableKeeperRegistryInterfaceV2(destination).receiveUpkeeps( UpkeepTranscoderInterfaceV2(s_storage.transcoder).transcodeUpkeeps( - UPKEEP_VERSION_BASE, - MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), - encodedUpkeeps + UPKEEP_VERSION_BASE, MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), encodedUpkeeps ) ); } @@ -249,10 +242,12 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable, IE * @dev this function is never called directly, it is only called by another registry's migrate function * @dev s_billingOverrides and s_upkeepPrivilegeConfig are not handled in this function */ - function receiveUpkeeps(bytes calldata encodedUpkeeps) external { + function receiveUpkeeps( + bytes calldata encodedUpkeeps + ) external { if ( - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING && - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING + && s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); ( uint256[] memory ids, @@ -270,12 +265,7 @@ contract AutomationRegistryLogicA2_3 is AutomationRegistryBase2_3, Chainable, IE ); } _createUpkeep( - ids[idx], - upkeeps[idx], - upkeepAdmins[idx], - checkDatas[idx], - triggerConfigs[idx], - offchainConfigs[idx] + ids[idx], upkeeps[idx], upkeepAdmins[idx], checkDatas[idx], triggerConfigs[idx], offchainConfigs[idx] ); emit UpkeepReceived(ids[idx], upkeeps[idx].balance, msg.sender); } diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol index 76abbdffc1..20131ddd47 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; +import {Chainable} from "../Chainable.sol"; import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; import {AutomationRegistryLogicC2_3} from "./AutomationRegistryLogicC2_3.sol"; -import {Chainable} from "../Chainable.sol"; import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { using Address for address; @@ -73,20 +73,13 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { uint256 nativeUSD; uint96 maxPayment; if (hotVars.paused) return (false, bytes(""), UpkeepFailureReason.REGISTRY_PAUSED, 0, upkeep.performGas, 0, 0); - if (upkeep.maxValidBlocknumber != UINT32_MAX) + if (upkeep.maxValidBlocknumber != UINT32_MAX) { return (false, bytes(""), UpkeepFailureReason.UPKEEP_CANCELLED, 0, upkeep.performGas, 0, 0); + } if (upkeep.paused) return (false, bytes(""), UpkeepFailureReason.UPKEEP_PAUSED, 0, upkeep.performGas, 0, 0); (fastGasWei, linkUSD, nativeUSD) = _getFeedData(hotVars); - maxPayment = _getMaxPayment( - id, - hotVars, - triggerType, - upkeep.performGas, - fastGasWei, - linkUSD, - nativeUSD, - upkeep.billingToken - ); + maxPayment = + _getMaxPayment(id, hotVars, triggerType, upkeep.performGas, fastGasWei, linkUSD, nativeUSD, upkeep.billingToken); if (upkeep.balance < maxPayment) { return (false, bytes(""), UpkeepFailureReason.INSUFFICIENT_BALANCE, 0, upkeep.performGas, 0, 0); } @@ -113,21 +106,16 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { ); } return ( - upkeepNeeded, - result, - UpkeepFailureReason.TARGET_CHECK_REVERTED, - gasUsed, - upkeep.performGas, - fastGasWei, - linkUSD + upkeepNeeded, result, UpkeepFailureReason.TARGET_CHECK_REVERTED, gasUsed, upkeep.performGas, fastGasWei, linkUSD ); } (upkeepNeeded, performData) = abi.decode(result, (bool, bytes)); - if (!upkeepNeeded) + if (!upkeepNeeded) { return (false, bytes(""), UpkeepFailureReason.UPKEEP_NOT_NEEDED, gasUsed, upkeep.performGas, fastGasWei, linkUSD); + } - if (performData.length > s_storage.maxPerformDataSize) + if (performData.length > s_storage.maxPerformDataSize) { return ( false, bytes(""), @@ -137,6 +125,7 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { fastGasWei, linkUSD ); + } return (upkeepNeeded, performData, upkeepFailureReason, gasUsed, upkeep.performGas, fastGasWei, linkUSD); } @@ -284,7 +273,9 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { * @notice remove the overridden billing config for an upkeep * @param id the upkeepID */ - function removeBillingOverrides(uint256 id) external { + function removeBillingOverrides( + uint256 id + ) external { _onlyPrivilegeManagerAllowed(); s_upkeep[id].overridesEnabled = false; @@ -308,7 +299,9 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { /** * @notice accepts the transfer of an upkeep admin */ - function acceptUpkeepAdmin(uint256 id) external { + function acceptUpkeepAdmin( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; if (upkeep.maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); if (s_proposedAdmin[id] != msg.sender) revert OnlyCallableByProposedAdmin(); @@ -322,7 +315,9 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { /** * @notice pauses an upkeep - an upkeep will be neither checked nor performed while paused */ - function pauseUpkeep(uint256 id) external { + function pauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (upkeep.paused) revert OnlyUnpausedUpkeep(); @@ -334,7 +329,9 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { /** * @notice unpauses an upkeep */ - function unpauseUpkeep(uint256 id) external { + function unpauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (!upkeep.paused) revert OnlyPausedUpkeep(); diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol index 65cf523a65..4bfe71fe54 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; + +import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; import {IChainModule} from "../interfaces/IChainModule.sol"; +import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; -import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { using Address for address; @@ -59,7 +60,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { /** * @notice accepts the transfer of the payee */ - function acceptPayeeship(address transmitter) external { + function acceptPayeeship( + address transmitter + ) external { if (s_proposedPayee[transmitter] != msg.sender) revert OnlyCallableByProposedPayee(); address past = s_transmitterPayees[transmitter]; s_transmitterPayees[transmitter] = msg.sender; @@ -102,7 +105,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * @notice this is used by the owner to set the initial payees for newly added transmitters. The owner is not allowed to change payees for existing transmitters. * @dev the IGNORE_ADDRESS is a "helper" that makes it easier to construct a list of payees when you only care about setting the payee for a small number of transmitters. */ - function setPayees(address[] calldata payees) external onlyOwner { + function setPayees( + address[] calldata payees + ) external onlyOwner { if (s_transmittersList.length != payees.length) revert ParameterLengthError(); for (uint256 i = 0; i < s_transmittersList.length; i++) { address transmitter = s_transmittersList[i]; @@ -173,11 +178,8 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { for (uint256 i = 0; i < activeTransmittersLength; i++) { address transmitterAddr = s_transmittersList[i]; - uint96 balance = _updateTransmitterBalanceFromPool( - transmitterAddr, - totalPremium, - uint96(activeTransmittersLength) - ); + uint96 balance = + _updateTransmitterBalanceFromPool(transmitterAddr, totalPremium, uint96(activeTransmittersLength)); payments[i] = balance; payees[i] = s_transmitterPayees[transmitterAddr]; @@ -270,7 +272,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { return address(i_wrappedNativeToken); } - function getBillingToken(uint256 upkeepID) external view returns (IERC20) { + function getBillingToken( + uint256 upkeepID + ) external view returns (IERC20) { return s_upkeep[upkeepID].billingToken; } @@ -278,15 +282,21 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { return s_billingTokens; } - function supportsBillingToken(IERC20 token) external view returns (bool) { + function supportsBillingToken( + IERC20 token + ) external view returns (bool) { return address(s_billingConfigs[token].priceFeed) != address(0); } - function getBillingTokenConfig(IERC20 token) external view returns (BillingConfig memory) { + function getBillingTokenConfig( + IERC20 token + ) external view returns (BillingConfig memory) { return s_billingConfigs[token]; } - function getBillingOverridesEnabled(uint256 upkeepID) external view returns (bool) { + function getBillingOverridesEnabled( + uint256 upkeepID + ) external view returns (bool) { return s_upkeep[upkeepID].overridesEnabled; } @@ -310,7 +320,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * @dev this function may be deprecated in a future version of automation in favor of individual * getters for each field */ - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { Upkeep memory reg = s_upkeep[id]; address target = address(reg.forwarder) == address(0) ? address(0) : reg.forwarder.getTarget(); upkeepInfo = IAutomationV21PlusCommon.UpkeepInfoLegacy({ @@ -350,14 +362,18 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { /** * @notice returns the upkeep's trigger type */ - function getTriggerType(uint256 upkeepId) external pure returns (Trigger) { + function getTriggerType( + uint256 upkeepId + ) external pure returns (Trigger) { return _getTriggerType(upkeepId); } /** * @notice returns the trigger config for an upkeeep */ - function getUpkeepTriggerConfig(uint256 upkeepId) public view returns (bytes memory) { + function getUpkeepTriggerConfig( + uint256 upkeepId + ) public view returns (bytes memory) { return s_upkeepTriggerConfig[upkeepId]; } @@ -387,7 +403,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { /** * @notice read the current info about any signer address */ - function getSignerInfo(address query) external view returns (bool active, uint8 index) { + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index) { Signer memory signer = s_signers[query]; return (signer.active, signer.index); } @@ -398,25 +416,24 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * backwards compatibility matters! */ function getConfig() external view returns (OnchainConfig memory) { - return - OnchainConfig({ - checkGasLimit: s_storage.checkGasLimit, - stalenessSeconds: s_hotVars.stalenessSeconds, - gasCeilingMultiplier: s_hotVars.gasCeilingMultiplier, - maxPerformGas: s_storage.maxPerformGas, - maxCheckDataSize: s_storage.maxCheckDataSize, - maxPerformDataSize: s_storage.maxPerformDataSize, - maxRevertDataSize: s_storage.maxRevertDataSize, - fallbackGasPrice: s_fallbackGasPrice, - fallbackLinkPrice: s_fallbackLinkPrice, - fallbackNativePrice: s_fallbackNativePrice, - transcoder: s_storage.transcoder, - registrars: s_registrars.values(), - upkeepPrivilegeManager: s_storage.upkeepPrivilegeManager, - chainModule: s_hotVars.chainModule, - reorgProtectionEnabled: s_hotVars.reorgProtectionEnabled, - financeAdmin: s_storage.financeAdmin - }); + return OnchainConfig({ + checkGasLimit: s_storage.checkGasLimit, + stalenessSeconds: s_hotVars.stalenessSeconds, + gasCeilingMultiplier: s_hotVars.gasCeilingMultiplier, + maxPerformGas: s_storage.maxPerformGas, + maxCheckDataSize: s_storage.maxCheckDataSize, + maxPerformDataSize: s_storage.maxPerformDataSize, + maxRevertDataSize: s_storage.maxRevertDataSize, + fallbackGasPrice: s_fallbackGasPrice, + fallbackLinkPrice: s_fallbackLinkPrice, + fallbackNativePrice: s_fallbackNativePrice, + transcoder: s_storage.transcoder, + registrars: s_registrars.values(), + upkeepPrivilegeManager: s_storage.upkeepPrivilegeManager, + chainModule: s_hotVars.chainModule, + reorgProtectionEnabled: s_hotVars.reorgProtectionEnabled, + financeAdmin: s_storage.financeAdmin + }); } /** @@ -504,7 +521,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getBalance(uint256 id) external view returns (uint96 balance) { + function getBalance( + uint256 id + ) external view returns (uint96 balance) { return s_upkeep[id].balance; } @@ -512,7 +531,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getMinBalance(uint256 id) external view returns (uint96) { + function getMinBalance( + uint256 id + ) external view returns (uint96) { return getMinBalanceForUpkeep(id); } @@ -521,7 +542,9 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * @param id the upkeep id to calculate minimum balance for * @dev this will be deprecated in a future version in favor of getMinBalance */ - function getMinBalanceForUpkeep(uint256 id) public view returns (uint96 minBalance) { + function getMinBalanceForUpkeep( + uint256 id + ) public view returns (uint96 minBalance) { Upkeep memory upkeep = s_upkeep[id]; return getMaxPaymentForGas(id, _getTriggerType(id), upkeep.performGas, upkeep.billingToken); } @@ -544,35 +567,45 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { /** * @notice retrieves the migration permission for a peer registry */ - function getPeerRegistryMigrationPermission(address peer) external view returns (MigrationPermission) { + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (MigrationPermission) { return s_peerRegistryMigrationPermission[peer]; } /** * @notice returns the upkeep privilege config */ - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) { + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory) { return s_upkeepPrivilegeConfig[upkeepId]; } /** * @notice returns the admin's privilege config */ - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory) { + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory) { return s_adminPrivilegeConfig[admin]; } /** * @notice returns the upkeep's forwarder contract */ - function getForwarder(uint256 upkeepID) external view returns (IAutomationForwarder) { + function getForwarder( + uint256 upkeepID + ) external view returns (IAutomationForwarder) { return s_upkeep[upkeepID].forwarder; } /** * @notice returns if the dedupKey exists or not */ - function hasDedupKey(bytes32 dedupKey) external view returns (bool) { + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool) { return s_dedupKeys[dedupKey]; } @@ -587,14 +620,18 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { * @notice returns the amount of a particular token that is reserved as * user deposits / NOP payments */ - function getReserveAmount(IERC20 billingToken) external view returns (uint256) { + function getReserveAmount( + IERC20 billingToken + ) external view returns (uint256) { return s_reserveAmounts[billingToken]; } /** * @notice returns the amount of a particular token that is withdraw-able by finance admin */ - function getAvailableERC20ForPayment(IERC20 billingToken) external view returns (uint256) { + function getAvailableERC20ForPayment( + IERC20 billingToken + ) external view returns (uint256) { return billingToken.balanceOf(address(this)) - s_reserveAmounts[IERC20(address(billingToken))]; } @@ -608,14 +645,18 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { /** * @notice returns the BillingOverrides config for a given upkeep */ - function getBillingOverrides(uint256 upkeepID) external view returns (BillingOverrides memory) { + function getBillingOverrides( + uint256 upkeepID + ) external view returns (BillingOverrides memory) { return s_billingOverrides[upkeepID]; } /** * @notice returns the BillingConfig for a given billing token, this includes decimals and price feed etc */ - function getBillingConfig(IERC20 billingToken) external view returns (BillingConfig memory) { + function getBillingConfig( + IERC20 billingToken + ) external view returns (BillingConfig memory) { return s_billingConfigs[billingToken]; } diff --git a/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol index 59081b7f19..9a6130fc3e 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol @@ -8,10 +8,11 @@ import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; * doing this allows those structs to be encoded and decoded with type safety in offchain code * and tests because generated wrappers are made available */ - contract AutomationUtils2_3 { /** * @dev this uses the v2.3 Report, which uses linkUSD instead of linkNative (as in v2.2 and prior). This should be used only in typescript tests. */ - function _report(AutomationRegistryBase2_3.Report memory) external {} // 0xe65d6546 + function _report( + AutomationRegistryBase2_3.Report memory + ) external {} // 0xe65d6546 } diff --git a/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol b/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol index e0312588ed..c39e73567a 100644 --- a/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol +++ b/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol @@ -2,8 +2,8 @@ pragma solidity 0.8.19; -import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; enum RegistryVersion { V12, diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol index 69cac16a30..037e7dcfcd 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; +import {Chainable} from "../Chainable.sol"; import {ZKSyncAutomationRegistryBase2_3} from "./ZKSyncAutomationRegistryBase2_3.sol"; import {ZKSyncAutomationRegistryLogicA2_3} from "./ZKSyncAutomationRegistryLogicA2_3.sol"; import {ZKSyncAutomationRegistryLogicC2_3} from "./ZKSyncAutomationRegistryLogicC2_3.sol"; -import {Chainable} from "../Chainable.sol"; -import {OCR2Abstract} from "../../shared/ocr2/OCR2Abstract.sol"; + import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Registry for adding work for Chainlink nodes to perform on client @@ -125,11 +126,7 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs */ function _handleReport(HotVars memory hotVars, Report memory report) private { UpkeepTransmitInfo[] memory upkeepTransmitInfo = new UpkeepTransmitInfo[](report.upkeepIds.length); - TransmitVars memory transmitVars = TransmitVars({ - numUpkeepsPassedChecks: 0, - totalReimbursement: 0, - totalPremium: 0 - }); + TransmitVars memory transmitVars = TransmitVars({numUpkeepsPassedChecks: 0, totalReimbursement: 0, totalPremium: 0}); uint256 blocknumber = hotVars.chainModule.blockNumber(); uint256 gasOverhead; @@ -138,13 +135,8 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs upkeepTransmitInfo[i].upkeep = s_upkeep[report.upkeepIds[i]]; upkeepTransmitInfo[i].triggerType = _getTriggerType(report.upkeepIds[i]); - (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = _prePerformChecks( - report.upkeepIds[i], - blocknumber, - report.triggers[i], - upkeepTransmitInfo[i], - hotVars - ); + (upkeepTransmitInfo[i].earlyChecksPassed, upkeepTransmitInfo[i].dedupID) = + _prePerformChecks(report.upkeepIds[i], blocknumber, report.triggers[i], upkeepTransmitInfo[i], hotVars); if (upkeepTransmitInfo[i].earlyChecksPassed) { transmitVars.numUpkeepsPassedChecks += 1; @@ -153,11 +145,8 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs } // Actually perform the target upkeep - (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = _performUpkeep( - upkeepTransmitInfo[i].upkeep.forwarder, - report.gasLimits[i], - report.performDatas[i] - ); + (upkeepTransmitInfo[i].performSuccess, upkeepTransmitInfo[i].gasUsed) = + _performUpkeep(upkeepTransmitInfo[i].upkeep.forwarder, report.gasLimits[i], report.performDatas[i]); // Store last perform block number / deduping key for upkeep _updateTriggerMarker(report.upkeepIds[i], blocknumber, upkeepTransmitInfo[i]); @@ -176,10 +165,7 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs } gasOverhead += - 16 * - msg.data.length + - ACCOUNTING_FIXED_GAS_OVERHEAD + - (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)); + 16 * msg.data.length + ACCOUNTING_FIXED_GAS_OVERHEAD + (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)); gasOverhead = gasOverhead / transmitVars.numUpkeepsPassedChecks + ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD; { @@ -241,20 +227,11 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs uint64 offchainConfigVersion, bytes memory offchainConfig ) external override { - (OnchainConfig memory config, IERC20[] memory billingTokens, BillingConfig[] memory billingConfigs) = abi.decode( - onchainConfigBytes, - (OnchainConfig, IERC20[], BillingConfig[]) - ); + (OnchainConfig memory config, IERC20[] memory billingTokens, BillingConfig[] memory billingConfigs) = + abi.decode(onchainConfigBytes, (OnchainConfig, IERC20[], BillingConfig[])); setConfigTypeSafe( - signers, - transmitters, - f, - config, - offchainConfigVersion, - offchainConfig, - billingTokens, - billingConfigs + signers, transmitters, f, config, offchainConfigVersion, offchainConfig, billingTokens, billingConfigs ); } diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol index 58be0ef839..768c184ba7 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol @@ -1,19 +1,21 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; -import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; -import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; + import {IChainModule} from "../interfaces/IChainModule.sol"; +import {ILogAutomation, Log} from "../interfaces/ILogAutomation.sol"; +import {KeeperCompatibleInterface} from "../interfaces/KeeperCompatibleInterface.sol"; +import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; + +import {IWrappedNative} from "../interfaces/v2_3/IWrappedNative.sol"; import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; -import {IWrappedNative} from "../interfaces/v2_3/IWrappedNative.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Base Keeper Registry contract, contains shared logic between @@ -253,8 +255,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint32 lastPerformedBlockNumber; // 0 bytes left in 2nd EVM word - written in transmit path IERC20 billingToken; - // 12 bytes left in 3rd EVM word - read in transmit path } + // 12 bytes left in 3rd EVM word - read in transmit path /// @dev Config + State storage struct which is on hot transmit path struct HotVars { @@ -284,7 +286,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { address financeAdmin; // address which can withdraw funds from the contract uint32 maxPerformDataSize; // max length of performData bytes uint32 maxRevertDataSize; // max length of revertData bytes - // 4 bytes left in 3rd EVM word + // 4 bytes left in 3rd EVM word } /// @dev Report transmitted by OCR to transmit function @@ -376,8 +378,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint256 fallbackPrice; // 2nd word only read if stale uint96 minSpend; - // 3rd word only read during cancellation } + // 3rd word only read during cancellation /** * @notice override-able billing params of a billing token @@ -442,8 +444,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { // third word ends uint96 nativeUSD; uint96 billingUSD; - // fourth word ends } + // fourth word ends event AdminPrivilegeConfigSet(address indexed admin, bytes privilegeConfig); event BillingConfigOverridden(uint256 indexed id, BillingOverrides overrides); @@ -473,12 +475,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { event UpkeepOffchainConfigSet(uint256 indexed id, bytes offchainConfig); event UpkeepPaused(uint256 indexed id); event UpkeepPerformed( - uint256 indexed id, - bool indexed success, - uint96 totalPayment, - uint256 gasUsed, - uint256 gasOverhead, - bytes trigger + uint256 indexed id, bool indexed success, uint96 totalPayment, uint256 gasUsed, uint256 gasOverhead, bytes trigger ); event UpkeepCharged(uint256 indexed id, PaymentReceipt receipt); event UpkeepPrivilegeConfigSet(uint256 indexed id, bytes privilegeConfig); @@ -543,8 +540,9 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { ) internal { if (s_hotVars.paused) revert RegistryPaused(); if (checkData.length > s_storage.maxCheckDataSize) revert CheckDataExceedsLimit(); - if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) + if (upkeep.performGas < PERFORM_GAS_MIN || upkeep.performGas > s_storage.maxPerformGas) { revert GasLimitOutsideRange(); + } if (address(s_upkeep[id].forwarder) != address(0)) revert UpkeepAlreadyExists(); if (address(s_billingConfigs[upkeep.billingToken].priceFeed) == address(0)) revert InvalidToken(); s_upkeep[id] = upkeep; @@ -568,7 +566,9 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { * @dev we add the "identifying" part in the middle so that it is mostly hidden from users who usually only * see the first 4 and last 4 hex values ex 0x1234...ABCD */ - function _createID(Trigger triggerType) internal view returns (uint256) { + function _createID( + Trigger triggerType + ) internal view returns (uint256) { bytes1 empty; IChainModule chainModule = s_hotVars.chainModule; bytes memory idBytes = abi.encodePacked( @@ -594,7 +594,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 feedValue; - (, feedValue, , timestamp, ) = i_fastGasFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_fastGasFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -602,7 +602,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { } else { gasWei = uint256(feedValue); } - (, feedValue, , timestamp, ) = i_linkUSDFeed.latestRoundData(); + (, feedValue,, timestamp,) = i_linkUSDFeed.latestRoundData(); if ( feedValue <= 0 || block.timestamp < timestamp || (staleFallback && stalenessSeconds < block.timestamp - timestamp) ) { @@ -618,12 +618,13 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { * in the future, all price data should be included in the report instead of * getting read during execution */ - function _getNativeUSD(HotVars memory hotVars) internal view returns (uint256) { - (, int256 feedValue, , uint256 timestamp, ) = i_nativeUSDFeed.latestRoundData(); + function _getNativeUSD( + HotVars memory hotVars + ) internal view returns (uint256) { + (, int256 feedValue,, uint256 timestamp,) = i_nativeUSDFeed.latestRoundData(); if ( - feedValue <= 0 || - block.timestamp < timestamp || - (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) + feedValue <= 0 || block.timestamp < timestamp + || (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) ) { return s_fallbackNativePrice; } else { @@ -642,11 +643,10 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { paymentParams.flatFeeMilliCents = config.flatFeeMilliCents; paymentParams.gasFeePPB = config.gasFeePPB; paymentParams.decimals = config.decimals; - (, int256 feedValue, , uint256 timestamp, ) = config.priceFeed.latestRoundData(); + (, int256 feedValue,, uint256 timestamp,) = config.priceFeed.latestRoundData(); if ( - feedValue <= 0 || - block.timestamp < timestamp || - (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) + feedValue <= 0 || block.timestamp < timestamp + || (hotVars.stalenessSeconds > 0 && hotVars.stalenessSeconds < block.timestamp - timestamp) ) { paymentParams.priceUSD = config.fallbackPrice; } else { @@ -681,28 +681,33 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint256 denominatorScalingFactor = decimals < 18 ? 10 ** (18 - decimals) : 1; // gas calculation - uint256 gasPaymentHexaicosaUSD = (gasWei * - (paymentParams.gasLimit + paymentParams.gasOverhead) + - paymentParams.l1CostWei) * paymentParams.nativeUSD; // gasPaymentHexaicosaUSD has an extra 8 zeros because of decimals on nativeUSD feed + uint256 gasPaymentHexaicosaUSD = ( + gasWei * (paymentParams.gasLimit + paymentParams.gasOverhead) + paymentParams.l1CostWei + ) * paymentParams.nativeUSD; // gasPaymentHexaicosaUSD has an extra 8 zeros because of decimals on nativeUSD feed // gasChargeInBillingToken is scaled by the billing token's decimals. Round up to ensure a minimum billing token is charged for gas receipt.gasChargeInBillingToken = SafeCast.toUint96( - ((gasPaymentHexaicosaUSD * numeratorScalingFactor) + - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1)) / - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) + ( + (gasPaymentHexaicosaUSD * numeratorScalingFactor) + + (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1) + ) / (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) ); // 18 decimals: 26 decimals / 8 decimals receipt.gasReimbursementInJuels = SafeCast.toUint96(gasPaymentHexaicosaUSD / paymentParams.linkUSD); // premium calculation uint256 flatFeeHexaicosaUSD = uint256(paymentParams.billingTokenParams.flatFeeMilliCents) * 1e21; // 1e13 for milliCents to attoUSD and 1e8 for attoUSD to hexaicosaUSD - uint256 premiumHexaicosaUSD = ((((gasWei * paymentParams.gasLimit) + paymentParams.l1CostWei) * - paymentParams.billingTokenParams.gasFeePPB * - paymentParams.nativeUSD) / 1e9) + flatFeeHexaicosaUSD; + uint256 premiumHexaicosaUSD = ( + ( + ((gasWei * paymentParams.gasLimit) + paymentParams.l1CostWei) * paymentParams.billingTokenParams.gasFeePPB + * paymentParams.nativeUSD + ) / 1e9 + ) + flatFeeHexaicosaUSD; // premium is scaled by the billing token's decimals. Round up to ensure at least minimum charge receipt.premiumInBillingToken = SafeCast.toUint96( - ((premiumHexaicosaUSD * numeratorScalingFactor) + - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1)) / - (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) + ( + (premiumHexaicosaUSD * numeratorScalingFactor) + + (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor - 1) + ) / (paymentParams.billingTokenParams.priceUSD * denominatorScalingFactor) ); receipt.premiumInJuels = SafeCast.toUint96(premiumHexaicosaUSD / paymentParams.linkUSD); @@ -738,7 +743,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { } else { revert InvalidTriggerType(); } - (uint256 chainModuleFixedOverhead, ) = s_hotVars.chainModule.getGasOverhead(); + (uint256 chainModuleFixedOverhead,) = s_hotVars.chainModule.getGasOverhead(); maxGasOverhead += (REGISTRY_PER_SIGNER_GAS_OVERHEAD * (hotVars.f + 1)) + chainModuleFixedOverhead; } @@ -792,7 +797,9 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { /** * @dev gets the trigger type from an upkeepID (trigger type is encoded in the middle of the ID) */ - function _getTriggerType(uint256 upkeepId) internal pure returns (Trigger) { + function _getTriggerType( + uint256 upkeepId + ) internal pure returns (Trigger) { bytes32 rawID = bytes32(upkeepId); bytes1 empty = bytes1(0); for (uint256 idx = 4; idx < 15; idx++) { @@ -821,13 +828,14 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { /** * @dev _decodeReport decodes a serialized report into a Report struct */ - function _decodeReport(bytes calldata rawReport) internal pure returns (Report memory) { + function _decodeReport( + bytes calldata rawReport + ) internal pure returns (Report memory) { Report memory report = abi.decode(rawReport, (Report)); uint256 expectedLength = report.upkeepIds.length; if ( - report.gasLimits.length != expectedLength || - report.triggers.length != expectedLength || - report.performDatas.length != expectedLength + report.gasLimits.length != expectedLength || report.triggers.length != expectedLength + || report.performDatas.length != expectedLength ) { revert InvalidReport(); } @@ -848,8 +856,9 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { ) internal returns (bool, bytes32) { bytes32 dedupID; if (transmitInfo.triggerType == Trigger.CONDITION) { - if (!_validateConditionalTrigger(upkeepId, blocknumber, rawTrigger, transmitInfo, hotVars)) + if (!_validateConditionalTrigger(upkeepId, blocknumber, rawTrigger, transmitInfo, hotVars)) { return (false, dedupID); + } } else if (transmitInfo.triggerType == Trigger.LOG) { bool valid; (valid, dedupID) = _validateLogTrigger(upkeepId, blocknumber, rawTrigger, hotVars); @@ -883,9 +892,10 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { return false; } if ( - (hotVars.reorgProtectionEnabled && - (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash)) || - trigger.blockNum >= blocknumber + ( + hotVars.reorgProtectionEnabled + && (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash) + ) || trigger.blockNum >= blocknumber ) { // There are two cases of reorged report // 1. trigger block number is in future: this is an edge case during extreme deep reorgs of chain @@ -908,9 +918,10 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { LogTrigger memory trigger = abi.decode(rawTrigger, (LogTrigger)); bytes32 dedupID = keccak256(abi.encodePacked(upkeepId, trigger.logBlockHash, trigger.txHash, trigger.logIndex)); if ( - (hotVars.reorgProtectionEnabled && - (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash)) || - trigger.blockNum >= blocknumber + ( + hotVars.reorgProtectionEnabled + && (trigger.blockHash != bytes32("") && hotVars.chainModule.blockHash(trigger.blockNum) != trigger.blockHash) + ) || trigger.blockNum >= blocknumber ) { // Reorg protection is same as conditional trigger upkeeps emit ReorgedUpkeepReport(upkeepId, rawTrigger); @@ -1016,8 +1027,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { // if the user can't cover the gas fee, then direct all of the payment to the transmitter and distribute no premium to the DON payment = balance; receipt.gasReimbursementInJuels = SafeCast.toUint96( - (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) / - (paymentParams.linkUSD * scalingFactor2) + (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) + / (paymentParams.linkUSD * scalingFactor2) ); receipt.premiumInJuels = 0; receipt.premiumInBillingToken = 0; @@ -1026,14 +1037,17 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { // if the user can cover the gas fee, but not the premium, then reduce the premium payment = balance; receipt.premiumInJuels = SafeCast.toUint96( - ((balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) / - (paymentParams.linkUSD * scalingFactor2)) - receipt.gasReimbursementInJuels + ( + (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) + / (paymentParams.linkUSD * scalingFactor2) + ) - receipt.gasReimbursementInJuels ); // round up receipt.premiumInBillingToken = SafeCast.toUint96( - ((receipt.premiumInJuels * paymentParams.linkUSD * scalingFactor2) + - (paymentParams.billingTokenParams.priceUSD * scalingFactor1 - 1)) / - (paymentParams.billingTokenParams.priceUSD * scalingFactor1) + ( + (receipt.premiumInJuels * paymentParams.linkUSD * scalingFactor2) + + (paymentParams.billingTokenParams.priceUSD * scalingFactor1 - 1) + ) / (paymentParams.billingTokenParams.priceUSD * scalingFactor1) ); } @@ -1048,7 +1062,9 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { /** * @dev ensures the upkeep is not cancelled and the caller is the upkeep admin */ - function _requireAdminAndNotCancelled(uint256 upkeepId) internal view { + function _requireAdminAndNotCancelled( + uint256 upkeepId + ) internal view { if (msg.sender != s_upkeepAdmin[upkeepId]) revert OnlyCallableByAdmin(); if (s_upkeep[upkeepId].maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); } @@ -1189,7 +1205,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { /** * @notice returns the size of the LINK liquidity pool - # @dev LINK max supply < 2^96, so casting to int256 is safe + * # @dev LINK max supply < 2^96, so casting to int256 is safe */ function _linkAvailableForPayment() internal view returns (int256) { return int256(i_link.balanceOf(address(this))) - int256(s_reserveAmounts[IERC20(address(i_link))]); diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicA2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicA2_3.sol index 14faf7fa21..207a19448f 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicA2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicA2_3.sol @@ -1,19 +1,20 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; -import {ZKSyncAutomationRegistryBase2_3} from "./ZKSyncAutomationRegistryBase2_3.sol"; -import {ZKSyncAutomationRegistryLogicC2_3} from "./ZKSyncAutomationRegistryLogicC2_3.sol"; -import {ZKSyncAutomationRegistryLogicB2_3} from "./ZKSyncAutomationRegistryLogicB2_3.sol"; +import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; import {Chainable} from "../Chainable.sol"; import {ZKSyncAutomationForwarder} from "../ZKSyncAutomationForwarder.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; -import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; import {MigratableKeeperRegistryInterfaceV2} from "../interfaces/MigratableKeeperRegistryInterfaceV2.sol"; +import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfaceV2.sol"; +import {ZKSyncAutomationRegistryBase2_3} from "./ZKSyncAutomationRegistryBase2_3.sol"; +import {ZKSyncAutomationRegistryLogicB2_3} from "./ZKSyncAutomationRegistryLogicB2_3.sol"; +import {ZKSyncAutomationRegistryLogicC2_3} from "./ZKSyncAutomationRegistryLogicC2_3.sol"; + import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; -import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; /** * @notice Logic contract, works in tandem with AutomationRegistry as a proxy @@ -90,9 +91,8 @@ contract ZKSyncAutomationRegistryLogicA2_3 is ZKSyncAutomationRegistryBase2_3, C if (msg.sender != owner() && !s_registrars.contains(msg.sender)) revert OnlyCallableByOwnerOrRegistrar(); if (!target.isContract()) revert NotAContract(); id = _createID(triggerType); - IAutomationForwarder forwarder = IAutomationForwarder( - address(new ZKSyncAutomationForwarder(target, address(this), i_automationForwarderLogic)) - ); + IAutomationForwarder forwarder = + IAutomationForwarder(address(new ZKSyncAutomationForwarder(target, address(this), i_automationForwarderLogic))); _createUpkeep( id, Upkeep({ @@ -125,7 +125,9 @@ contract ZKSyncAutomationRegistryLogicA2_3 is ZKSyncAutomationRegistryBase2_3, C * @dev if a user cancels an upkeep, their funds are locked for CANCELLATION_DELAY blocks to * allow any pending performUpkeep txs time to get confirmed */ - function cancelUpkeep(uint256 id) external { + function cancelUpkeep( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; bool isOwner = msg.sender == owner(); uint96 minSpend = s_billingConfigs[upkeep.billingToken].minSpend; @@ -168,8 +170,8 @@ contract ZKSyncAutomationRegistryLogicA2_3 is ZKSyncAutomationRegistryBase2_3, C */ function migrateUpkeeps(uint256[] calldata ids, address destination) external { if ( - s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING && - s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[destination] != MigrationPermission.OUTGOING + && s_peerRegistryMigrationPermission[destination] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); if (s_storage.transcoder == ZERO_ADDRESS) revert TranscoderNotSet(); if (ids.length == 0) revert ArrayHasNoEntries(); @@ -225,20 +227,11 @@ contract ZKSyncAutomationRegistryLogicA2_3 is ZKSyncAutomationRegistryBase2_3, C s_reserveAmounts[billingToken] = s_reserveAmounts[billingToken] - balanceToTransfer; billingToken.safeTransfer(destination, balanceToTransfer); - bytes memory encodedUpkeeps = abi.encode( - ids, - upkeeps, - new address[](ids.length), - admins, - checkDatas, - triggerConfigs, - offchainConfigs - ); + bytes memory encodedUpkeeps = + abi.encode(ids, upkeeps, new address[](ids.length), admins, checkDatas, triggerConfigs, offchainConfigs); MigratableKeeperRegistryInterfaceV2(destination).receiveUpkeeps( UpkeepTranscoderInterfaceV2(s_storage.transcoder).transcodeUpkeeps( - UPKEEP_VERSION_BASE, - MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), - encodedUpkeeps + UPKEEP_VERSION_BASE, MigratableKeeperRegistryInterfaceV2(destination).upkeepVersion(), encodedUpkeeps ) ); } @@ -249,10 +242,12 @@ contract ZKSyncAutomationRegistryLogicA2_3 is ZKSyncAutomationRegistryBase2_3, C * @dev this function is never called directly, it is only called by another registry's migrate function * @dev s_billingOverrides and s_upkeepPrivilegeConfig are not handled in this function */ - function receiveUpkeeps(bytes calldata encodedUpkeeps) external { + function receiveUpkeeps( + bytes calldata encodedUpkeeps + ) external { if ( - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING && - s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL + s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.INCOMING + && s_peerRegistryMigrationPermission[msg.sender] != MigrationPermission.BIDIRECTIONAL ) revert MigrationNotPermitted(); ( uint256[] memory ids, @@ -270,12 +265,7 @@ contract ZKSyncAutomationRegistryLogicA2_3 is ZKSyncAutomationRegistryBase2_3, C ); } _createUpkeep( - ids[idx], - upkeeps[idx], - upkeepAdmins[idx], - checkDatas[idx], - triggerConfigs[idx], - offchainConfigs[idx] + ids[idx], upkeeps[idx], upkeepAdmins[idx], checkDatas[idx], triggerConfigs[idx], offchainConfigs[idx] ); emit UpkeepReceived(ids[idx], upkeeps[idx].balance, msg.sender); } diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol index 1883bd7807..1ac0954cbe 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; +import {Chainable} from "../Chainable.sol"; import {ZKSyncAutomationRegistryBase2_3} from "./ZKSyncAutomationRegistryBase2_3.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; import {ZKSyncAutomationRegistryLogicC2_3} from "./ZKSyncAutomationRegistryLogicC2_3.sol"; -import {Chainable} from "../Chainable.sol"; import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, Chainable { using Address for address; @@ -73,20 +73,13 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C uint256 nativeUSD; uint96 maxPayment; if (hotVars.paused) return (false, bytes(""), UpkeepFailureReason.REGISTRY_PAUSED, 0, upkeep.performGas, 0, 0); - if (upkeep.maxValidBlocknumber != UINT32_MAX) + if (upkeep.maxValidBlocknumber != UINT32_MAX) { return (false, bytes(""), UpkeepFailureReason.UPKEEP_CANCELLED, 0, upkeep.performGas, 0, 0); + } if (upkeep.paused) return (false, bytes(""), UpkeepFailureReason.UPKEEP_PAUSED, 0, upkeep.performGas, 0, 0); (fastGasWei, linkUSD, nativeUSD) = _getFeedData(hotVars); - maxPayment = _getMaxPayment( - id, - hotVars, - triggerType, - upkeep.performGas, - fastGasWei, - linkUSD, - nativeUSD, - upkeep.billingToken - ); + maxPayment = + _getMaxPayment(id, hotVars, triggerType, upkeep.performGas, fastGasWei, linkUSD, nativeUSD, upkeep.billingToken); if (upkeep.balance < maxPayment) { return (false, bytes(""), UpkeepFailureReason.INSUFFICIENT_BALANCE, 0, upkeep.performGas, 0, 0); } @@ -113,21 +106,16 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C ); } return ( - upkeepNeeded, - result, - UpkeepFailureReason.TARGET_CHECK_REVERTED, - gasUsed, - upkeep.performGas, - fastGasWei, - linkUSD + upkeepNeeded, result, UpkeepFailureReason.TARGET_CHECK_REVERTED, gasUsed, upkeep.performGas, fastGasWei, linkUSD ); } (upkeepNeeded, performData) = abi.decode(result, (bool, bytes)); - if (!upkeepNeeded) + if (!upkeepNeeded) { return (false, bytes(""), UpkeepFailureReason.UPKEEP_NOT_NEEDED, gasUsed, upkeep.performGas, fastGasWei, linkUSD); + } - if (performData.length > s_storage.maxPerformDataSize) + if (performData.length > s_storage.maxPerformDataSize) { return ( false, bytes(""), @@ -137,6 +125,7 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C fastGasWei, linkUSD ); + } return (upkeepNeeded, performData, upkeepFailureReason, gasUsed, upkeep.performGas, fastGasWei, linkUSD); } @@ -284,7 +273,9 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C * @notice remove the overridden billing config for an upkeep * @param id the upkeepID */ - function removeBillingOverrides(uint256 id) external { + function removeBillingOverrides( + uint256 id + ) external { _onlyPrivilegeManagerAllowed(); s_upkeep[id].overridesEnabled = false; @@ -308,7 +299,9 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C /** * @notice accepts the transfer of an upkeep admin */ - function acceptUpkeepAdmin(uint256 id) external { + function acceptUpkeepAdmin( + uint256 id + ) external { Upkeep memory upkeep = s_upkeep[id]; if (upkeep.maxValidBlocknumber != UINT32_MAX) revert UpkeepCancelled(); if (s_proposedAdmin[id] != msg.sender) revert OnlyCallableByProposedAdmin(); @@ -322,7 +315,9 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C /** * @notice pauses an upkeep - an upkeep will be neither checked nor performed while paused */ - function pauseUpkeep(uint256 id) external { + function pauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (upkeep.paused) revert OnlyUnpausedUpkeep(); @@ -334,7 +329,9 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C /** * @notice unpauses an upkeep */ - function unpauseUpkeep(uint256 id) external { + function unpauseUpkeep( + uint256 id + ) external { _requireAdminAndNotCancelled(id); Upkeep memory upkeep = s_upkeep[id]; if (!upkeep.paused) revert OnlyPausedUpkeep(); diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol index 9453f2cd30..1437a41c95 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity 0.8.19; -import {ZKSyncAutomationRegistryBase2_3} from "./ZKSyncAutomationRegistryBase2_3.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; + +import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; import {IChainModule} from "../interfaces/IChainModule.sol"; +import {ZKSyncAutomationRegistryBase2_3} from "./ZKSyncAutomationRegistryBase2_3.sol"; import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/IERC20Metadata.sol"; -import {IAutomationV21PlusCommon} from "../interfaces/IAutomationV21PlusCommon.sol"; +import {Address} from "@openzeppelin/contracts@4.9.6/utils/Address.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { using Address for address; @@ -59,7 +60,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { /** * @notice accepts the transfer of the payee */ - function acceptPayeeship(address transmitter) external { + function acceptPayeeship( + address transmitter + ) external { if (s_proposedPayee[transmitter] != msg.sender) revert OnlyCallableByProposedPayee(); address past = s_transmitterPayees[transmitter]; s_transmitterPayees[transmitter] = msg.sender; @@ -102,7 +105,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * @notice this is used by the owner to set the initial payees for newly added transmitters. The owner is not allowed to change payees for existing transmitters. * @dev the IGNORE_ADDRESS is a "helper" that makes it easier to construct a list of payees when you only care about setting the payee for a small number of transmitters. */ - function setPayees(address[] calldata payees) external onlyOwner { + function setPayees( + address[] calldata payees + ) external onlyOwner { if (s_transmittersList.length != payees.length) revert ParameterLengthError(); for (uint256 i = 0; i < s_transmittersList.length; i++) { address transmitter = s_transmittersList[i]; @@ -173,11 +178,8 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { for (uint256 i = 0; i < activeTransmittersLength; i++) { address transmitterAddr = s_transmittersList[i]; - uint96 balance = _updateTransmitterBalanceFromPool( - transmitterAddr, - totalPremium, - uint96(activeTransmittersLength) - ); + uint96 balance = + _updateTransmitterBalanceFromPool(transmitterAddr, totalPremium, uint96(activeTransmittersLength)); payments[i] = balance; payees[i] = s_transmitterPayees[transmitterAddr]; @@ -258,7 +260,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { return address(i_wrappedNativeToken); } - function getBillingToken(uint256 upkeepID) external view returns (IERC20) { + function getBillingToken( + uint256 upkeepID + ) external view returns (IERC20) { return s_upkeep[upkeepID].billingToken; } @@ -266,15 +270,21 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { return s_billingTokens; } - function supportsBillingToken(IERC20 token) external view returns (bool) { + function supportsBillingToken( + IERC20 token + ) external view returns (bool) { return address(s_billingConfigs[token].priceFeed) != address(0); } - function getBillingTokenConfig(IERC20 token) external view returns (BillingConfig memory) { + function getBillingTokenConfig( + IERC20 token + ) external view returns (BillingConfig memory) { return s_billingConfigs[token]; } - function getBillingOverridesEnabled(uint256 upkeepID) external view returns (bool) { + function getBillingOverridesEnabled( + uint256 upkeepID + ) external view returns (bool) { return s_upkeep[upkeepID].overridesEnabled; } @@ -298,7 +308,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * @dev this function may be deprecated in a future version of automation in favor of individual * getters for each field */ - function getUpkeep(uint256 id) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { + function getUpkeep( + uint256 id + ) external view returns (IAutomationV21PlusCommon.UpkeepInfoLegacy memory upkeepInfo) { Upkeep memory reg = s_upkeep[id]; address target = address(reg.forwarder) == address(0) ? address(0) : reg.forwarder.getTarget(); upkeepInfo = IAutomationV21PlusCommon.UpkeepInfoLegacy({ @@ -338,14 +350,18 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { /** * @notice returns the upkeep's trigger type */ - function getTriggerType(uint256 upkeepId) external pure returns (Trigger) { + function getTriggerType( + uint256 upkeepId + ) external pure returns (Trigger) { return _getTriggerType(upkeepId); } /** * @notice returns the trigger config for an upkeeep */ - function getUpkeepTriggerConfig(uint256 upkeepId) public view returns (bytes memory) { + function getUpkeepTriggerConfig( + uint256 upkeepId + ) public view returns (bytes memory) { return s_upkeepTriggerConfig[upkeepId]; } @@ -375,7 +391,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { /** * @notice read the current info about any signer address */ - function getSignerInfo(address query) external view returns (bool active, uint8 index) { + function getSignerInfo( + address query + ) external view returns (bool active, uint8 index) { Signer memory signer = s_signers[query]; return (signer.active, signer.index); } @@ -386,25 +404,24 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * backwards compatibility matters! */ function getConfig() external view returns (OnchainConfig memory) { - return - OnchainConfig({ - checkGasLimit: s_storage.checkGasLimit, - stalenessSeconds: s_hotVars.stalenessSeconds, - gasCeilingMultiplier: s_hotVars.gasCeilingMultiplier, - maxPerformGas: s_storage.maxPerformGas, - maxCheckDataSize: s_storage.maxCheckDataSize, - maxPerformDataSize: s_storage.maxPerformDataSize, - maxRevertDataSize: s_storage.maxRevertDataSize, - fallbackGasPrice: s_fallbackGasPrice, - fallbackLinkPrice: s_fallbackLinkPrice, - fallbackNativePrice: s_fallbackNativePrice, - transcoder: s_storage.transcoder, - registrars: s_registrars.values(), - upkeepPrivilegeManager: s_storage.upkeepPrivilegeManager, - chainModule: s_hotVars.chainModule, - reorgProtectionEnabled: s_hotVars.reorgProtectionEnabled, - financeAdmin: s_storage.financeAdmin - }); + return OnchainConfig({ + checkGasLimit: s_storage.checkGasLimit, + stalenessSeconds: s_hotVars.stalenessSeconds, + gasCeilingMultiplier: s_hotVars.gasCeilingMultiplier, + maxPerformGas: s_storage.maxPerformGas, + maxCheckDataSize: s_storage.maxCheckDataSize, + maxPerformDataSize: s_storage.maxPerformDataSize, + maxRevertDataSize: s_storage.maxRevertDataSize, + fallbackGasPrice: s_fallbackGasPrice, + fallbackLinkPrice: s_fallbackLinkPrice, + fallbackNativePrice: s_fallbackNativePrice, + transcoder: s_storage.transcoder, + registrars: s_registrars.values(), + upkeepPrivilegeManager: s_storage.upkeepPrivilegeManager, + chainModule: s_hotVars.chainModule, + reorgProtectionEnabled: s_hotVars.reorgProtectionEnabled, + financeAdmin: s_storage.financeAdmin + }); } /** @@ -492,7 +509,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getBalance(uint256 id) external view returns (uint96 balance) { + function getBalance( + uint256 id + ) external view returns (uint96 balance) { return s_upkeep[id].balance; } @@ -500,7 +519,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * @notice calculates the minimum balance required for an upkeep to remain eligible * @param id the upkeep id to calculate minimum balance for */ - function getMinBalance(uint256 id) external view returns (uint96) { + function getMinBalance( + uint256 id + ) external view returns (uint96) { return getMinBalanceForUpkeep(id); } @@ -509,7 +530,9 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * @param id the upkeep id to calculate minimum balance for * @dev this will be deprecated in a future version in favor of getMinBalance */ - function getMinBalanceForUpkeep(uint256 id) public view returns (uint96 minBalance) { + function getMinBalanceForUpkeep( + uint256 id + ) public view returns (uint96 minBalance) { Upkeep memory upkeep = s_upkeep[id]; return getMaxPaymentForGas(id, _getTriggerType(id), upkeep.performGas, upkeep.billingToken); } @@ -532,35 +555,45 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { /** * @notice retrieves the migration permission for a peer registry */ - function getPeerRegistryMigrationPermission(address peer) external view returns (MigrationPermission) { + function getPeerRegistryMigrationPermission( + address peer + ) external view returns (MigrationPermission) { return s_peerRegistryMigrationPermission[peer]; } /** * @notice returns the upkeep privilege config */ - function getUpkeepPrivilegeConfig(uint256 upkeepId) external view returns (bytes memory) { + function getUpkeepPrivilegeConfig( + uint256 upkeepId + ) external view returns (bytes memory) { return s_upkeepPrivilegeConfig[upkeepId]; } /** * @notice returns the admin's privilege config */ - function getAdminPrivilegeConfig(address admin) external view returns (bytes memory) { + function getAdminPrivilegeConfig( + address admin + ) external view returns (bytes memory) { return s_adminPrivilegeConfig[admin]; } /** * @notice returns the upkeep's forwarder contract */ - function getForwarder(uint256 upkeepID) external view returns (IAutomationForwarder) { + function getForwarder( + uint256 upkeepID + ) external view returns (IAutomationForwarder) { return s_upkeep[upkeepID].forwarder; } /** * @notice returns if the dedupKey exists or not */ - function hasDedupKey(bytes32 dedupKey) external view returns (bool) { + function hasDedupKey( + bytes32 dedupKey + ) external view returns (bool) { return s_dedupKeys[dedupKey]; } @@ -575,14 +608,18 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { * @notice returns the amount of a particular token that is reserved as * user deposits / NOP payments */ - function getReserveAmount(IERC20 billingToken) external view returns (uint256) { + function getReserveAmount( + IERC20 billingToken + ) external view returns (uint256) { return s_reserveAmounts[billingToken]; } /** * @notice returns the amount of a particular token that is withdraw-able by finance admin */ - function getAvailableERC20ForPayment(IERC20 billingToken) external view returns (uint256) { + function getAvailableERC20ForPayment( + IERC20 billingToken + ) external view returns (uint256) { return billingToken.balanceOf(address(this)) - s_reserveAmounts[IERC20(address(billingToken))]; } @@ -596,14 +633,18 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { /** * @notice returns the BillingOverrides config for a given upkeep */ - function getBillingOverrides(uint256 upkeepID) external view returns (BillingOverrides memory) { + function getBillingOverrides( + uint256 upkeepID + ) external view returns (BillingOverrides memory) { return s_billingOverrides[upkeepID]; } /** * @notice returns the BillingConfig for a given billing token, this includes decimals and price feed etc */ - function getBillingConfig(IERC20 billingToken) external view returns (BillingConfig memory) { + function getBillingConfig( + IERC20 billingToken + ) external view returns (BillingConfig memory) { return s_billingConfigs[billingToken]; } diff --git a/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol b/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol index a4eb32e35c..07076337fc 100644 --- a/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol +++ b/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol @@ -2,9 +2,9 @@ pragma solidity 0.8.26; import {ERC20Mock} from "../../shared/mocks/ERC20Mock.sol"; -import {IERC20Metadata as IERC20} from - "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/IERC20Metadata.sol"; + import {BundleAggregatorProxy} from "../BundleAggregatorProxy.sol"; +import {IERC20Metadata as IERC20} from "@openzeppelin/contracts@5.0.2/token/ERC20/extensions/IERC20Metadata.sol"; import {DataFeedsCache} from "../DataFeedsCache.sol"; import {IDataFeedsCache} from "../interfaces/IDataFeedsCache.sol"; diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol index b7453b7bc0..b0554122c1 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {AggregatorV3Interface} from "../../../shared/interfaces/AggregatorV3Interface.sol"; -import {IFunctionsBilling, FunctionsBillingConfig} from "./interfaces/IFunctionsBilling.sol"; +import {FunctionsBillingConfig, IFunctionsBilling} from "./interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {Routable} from "./Routable.sol"; import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; @@ -93,7 +93,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @notice Sets the Chainlink Coordinator's billing configuration /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information - function updateConfig(FunctionsBillingConfig memory config) public { + function updateConfig( + FunctionsBillingConfig memory config + ) public { _onlyOwner(); s_config = config; @@ -105,7 +107,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ /// @inheritdoc IFunctionsBilling - function getDONFeeJuels(bytes memory /* requestData */) public view override returns (uint72) { + function getDONFeeJuels( + bytes memory /* requestData */ + ) public view override returns (uint72) { // s_config.donFee is in cents of USD. Convert to dollars amount then get amount of Juels. return SafeCast.toUint72(_getJuelsFromUsd(s_config.donFeeCentsUsd) / 100); } @@ -123,7 +127,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getWeiPerUnitLink() public view returns (uint256) { - (, int256 weiPerUnitLink, , uint256 timestamp, ) = s_linkToNativeFeed.latestRoundData(); + (, int256 weiPerUnitLink,, uint256 timestamp,) = s_linkToNativeFeed.latestRoundData(); // Only fallback if feedStalenessSeconds is set // solhint-disable-next-line not-rely-on-time if (s_config.feedStalenessSeconds < block.timestamp - timestamp && s_config.feedStalenessSeconds > 0) { @@ -135,7 +139,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return uint256(weiPerUnitLink); } - function _getJuelsFromWei(uint256 amountWei) private view returns (uint96) { + function _getJuelsFromWei( + uint256 amountWei + ) private view returns (uint96) { // (1e18 juels/link) * wei / (wei/link) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) return SafeCast.toUint96((1e18 * amountWei) / getWeiPerUnitLink()); @@ -143,7 +149,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getUsdPerUnitLink() public view returns (uint256, uint8) { - (, int256 usdPerUnitLink, , uint256 timestamp, ) = s_linkToUsdFeed.latestRoundData(); + (, int256 usdPerUnitLink,, uint256 timestamp,) = s_linkToUsdFeed.latestRoundData(); // Only fallback if feedStalenessSeconds is set // solhint-disable-next-line not-rely-on-time if (s_config.feedStalenessSeconds < block.timestamp - timestamp && s_config.feedStalenessSeconds > 0) { @@ -155,7 +161,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return (uint256(usdPerUnitLink), s_linkToUsdFeed.decimals()); } - function _getJuelsFromUsd(uint256 amountUsd) private view returns (uint96) { + function _getJuelsFromUsd( + uint256 amountUsd + ) private view returns (uint96) { (uint256 usdPerLink, uint8 decimals) = getUsdPerUnitLink(); // (usd) * (10**18 juels/link) * (10**decimals) / (link / usd) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) @@ -204,8 +212,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { uint256 totalFeeWei = (gasPriceWei * executionGas) + l1FeeWei; // Basis Points are 1/100th of 1%, divide by 10_000 to bring back to original units - uint256 totalFeeWeiWithOverestimate = totalFeeWei + - ((totalFeeWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); + uint256 totalFeeWeiWithOverestimate = + totalFeeWei + ((totalFeeWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); uint96 estimatedGasReimbursementJuels = _getJuelsFromWei(totalFeeWeiWithOverestimate); @@ -232,13 +240,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { uint72 donFee = getDONFeeJuels(request.data); operationFee = getOperationFeeJuels(); - uint96 estimatedTotalCostJuels = _calculateCostEstimate( - request.callbackGasLimit, - tx.gasprice, - donFee, - request.adminFee, - operationFee - ); + uint96 estimatedTotalCostJuels = + _calculateCostEstimate(request.callbackGasLimit, tx.gasprice, donFee, request.adminFee, operationFee); // Check that subscription can afford the estimated cost if ((request.availableBalance) < estimatedTotalCostJuels) { @@ -294,7 +297,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { bytes memory response, bytes memory err, bytes memory onchainMetadata, - bytes memory /* offchainMetadata TODO: use in getDonFee() for dynamic billing */, + bytes memory, /* offchainMetadata TODO: use in getDonFee() for dynamic billing */ uint8 reportBatchSize ) internal returns (FunctionsResponse.FulfillResult) { FunctionsResponse.Commitment memory commitment = abi.decode(onchainMetadata, (FunctionsResponse.Commitment)); @@ -334,8 +337,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // In these two fulfillment results the user has been charged // Otherwise, the Coordinator should hold on to the request commitment if ( - resultCode == FunctionsResponse.FulfillResult.FULFILLED || - resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + resultCode == FunctionsResponse.FulfillResult.FULFILLED + || resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { delete s_requestCommitments[requestId]; // Reimburse the transmitter for the fulfillment gas cost @@ -366,7 +369,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling /// @dev Only callable by the Router /// @dev Used by FunctionsRouter.sol during timeout of a request - function deleteCommitment(bytes32 requestId) external override onlyRouter { + function deleteCommitment( + bytes32 requestId + ) external override onlyRouter { // Delete commitment delete s_requestCommitments[requestId]; emit CommitmentDeleted(requestId); @@ -439,7 +444,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { function _onlyOwner() internal view virtual; // Used in FunctionsCoordinator.sol - function _isExistingRequest(bytes32 requestId) internal view returns (bool) { + function _isExistingRequest( + bytes32 requestId + ) internal view returns (bool) { return s_requestCommitments[requestId] != bytes32(0); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsClient.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsClient.sol index 378714dac8..1f959bea3a 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsClient.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsClient.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; import {IFunctionsClient} from "./interfaces/IFunctionsClient.sol"; +import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; import {FunctionsRequest} from "./libraries/FunctionsRequest.sol"; @@ -18,7 +18,9 @@ abstract contract FunctionsClient is IFunctionsClient { error OnlyRouterCanFulfill(); - constructor(address router) { + constructor( + address router + ) { i_functionsRouter = IFunctionsRouter(router); } @@ -35,11 +37,7 @@ abstract contract FunctionsClient is IFunctionsClient { bytes32 donId ) internal returns (bytes32) { bytes32 requestId = i_functionsRouter.sendRequest( - subscriptionId, - data, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - donId + subscriptionId, data, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, donId ); emit RequestSent(requestId); return requestId; diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsCoordinator.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsCoordinator.sol index 69d6f3a7b0..c8a283ba00 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsCoordinator.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsCoordinator} from "./interfaces/IFunctionsCoordinator.sol"; import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; +import {IFunctionsCoordinator} from "./interfaces/IFunctionsCoordinator.sol"; import {FunctionsBilling, FunctionsBillingConfig} from "./FunctionsBilling.sol"; -import {OCR2Base} from "./ocr/OCR2Base.sol"; + import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; +import {OCR2Base} from "./ocr/OCR2Base.sol"; /// @title Functions Coordinator contract /// @notice Contract that nodes of a Decentralized Oracle Network (DON) interact with @@ -55,7 +56,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external override onlyOwner { + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external override onlyOwner { if (thresholdPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -71,7 +74,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setDONPublicKey(bytes calldata donPublicKey) external override onlyOwner { + function setDONPublicKey( + bytes calldata donPublicKey + ) external override onlyOwner { if (donPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -79,7 +84,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev check if node is in current transmitter list - function _isTransmitter(address node) internal view returns (bool) { + function _isTransmitter( + address node + ) internal view returns (bool) { // Bounded by "maxNumOracles" on OCR2Abstract.sol for (uint256 i = 0; i < s_transmitters.length; ++i) { if (s_transmitters[i] == node) { @@ -128,7 +135,7 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev DON fees are pooled together. If the OCR configuration is going to change, these need to be distributed. - function _beforeSetConfig(uint8 /* _f */, bytes memory /* _onchainConfig */) internal override { + function _beforeSetConfig(uint8, /* _f */ bytes memory /* _onchainConfig */ ) internal override { if (_getTransmitters().length > 0) { _disperseFeePool(); } @@ -152,11 +159,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli uint256 numberOfFulfillments = uint8(requestIds.length); if ( - numberOfFulfillments == 0 || - numberOfFulfillments != results.length || - numberOfFulfillments != errors.length || - numberOfFulfillments != onchainMetadata.length || - numberOfFulfillments != offchainMetadata.length + numberOfFulfillments == 0 || numberOfFulfillments != results.length || numberOfFulfillments != errors.length + || numberOfFulfillments != onchainMetadata.length || numberOfFulfillments != offchainMetadata.length ) { revert ReportInvalid("Fields must be equal length"); } @@ -187,7 +191,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev Report hook called within OCR2Base.sol - function _report(DecodedReport memory decodedReport) internal override { + function _report( + DecodedReport memory decodedReport + ) internal override { uint256 numberOfFulfillments = uint8(decodedReport.requestIds.length); // Bounded by "MaxRequestBatchSize" on the Job's ReportingPluginConfig @@ -207,8 +213,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli // In these two fulfillment results the user has been charged // Otherwise, the DON will re-try if ( - result == FunctionsResponse.FulfillResult.FULFILLED || - result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + result == FunctionsResponse.FulfillResult.FULFILLED + || result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { emit OracleResponse(decodedReport.requestIds[i], msg.sender); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol index dab17bdb6d..31e98e0fde 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import {IAccessController} from "../../../shared/interfaces/IAccessController.sol"; import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; -import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; import {IFunctionsCoordinator} from "./interfaces/IFunctionsCoordinator.sol"; -import {IAccessController} from "../../../shared/interfaces/IAccessController.sol"; +import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; +import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; import {FunctionsSubscriptions} from "./FunctionsSubscriptions.sol"; import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; -import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; -import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; import {Pausable} from "@openzeppelin/contracts@4.8.3/security/Pausable.sol"; +import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, ITypeAndVersion, ConfirmedOwner { using FunctionsResponse for FunctionsResponse.RequestMeta; @@ -51,10 +51,7 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, ); event RequestNotProcessed( - bytes32 indexed requestId, - address coordinator, - address transmitter, - FunctionsResponse.FulfillResult resultCode + bytes32 indexed requestId, address coordinator, address transmitter, FunctionsResponse.FulfillResult resultCode ); error EmptyRequestData(); @@ -109,12 +106,11 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, bytes32[] ids; // ══╸ The IDs that key into the routes that will be modified if the update is applied address[] to; // ═══╸ The address of the contracts that the route will point to if the updated is applied } + ContractProposalSet private s_proposedContractSet; event ContractProposed( - bytes32 proposedContractSetId, - address proposedContractSetFromAddress, - address proposedContractSetToAddress + bytes32 proposedContractSetId, address proposedContractSetFromAddress, address proposedContractSetToAddress ); event ContractUpdated(bytes32 id, address from, address to); @@ -146,7 +142,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, } /// @notice The router configuration - function updateConfig(Config memory config) public onlyOwner { + function updateConfig( + Config memory config + ) public onlyOwner { s_config = config; emit ConfigUpdated(config); } @@ -174,7 +172,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, } /// @inheritdoc IFunctionsRouter - function setAllowListId(bytes32 allowListId) external override onlyOwner { + function setAllowListId( + bytes32 allowListId + ) external override onlyOwner { s_allowListId = allowListId; } @@ -360,17 +360,11 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, delete s_requestCommitments[commitment.requestId]; - CallbackResult memory result = _callback( - commitment.requestId, - response, - err, - commitment.callbackGasLimit, - commitment.client - ); + CallbackResult memory result = + _callback(commitment.requestId, response, err, commitment.callbackGasLimit, commitment.client); - resultCode = result.success - ? FunctionsResponse.FulfillResult.FULFILLED - : FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR; + resultCode = + result.success ? FunctionsResponse.FulfillResult.FULFILLED : FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR; Receipt memory receipt = _pay( commitment.subscriptionId, @@ -414,12 +408,8 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, return CallbackResult({success: false, gasUsed: 0, returnData: new bytes(0)}); } - bytes memory encodedCallback = abi.encodeWithSelector( - s_config.handleOracleFulfillmentSelector, - requestId, - response, - err - ); + bytes memory encodedCallback = + abi.encodeWithSelector(s_config.handleOracleFulfillmentSelector, requestId, response, err); uint16 gasForCallExactCheck = s_config.gasForCallExactCheck; @@ -441,15 +431,11 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // as we do not want to provide them with less, however that check itself costs // gas. gasForCallExactCheck ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, gasForCallExactCheck) { - revert(0, 0) - } + if lt(g, gasForCallExactCheck) { revert(0, 0) } g := sub(g, gasForCallExactCheck) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), callbackGasLimit)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), callbackGasLimit)) { revert(0, 0) } // call and report whether we succeeded // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) let gasBeforeCall := gas() @@ -458,9 +444,7 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // limit our copy to MAX_CALLBACK_RETURN_BYTES bytes let toCopy := returndatasize() - if gt(toCopy, MAX_CALLBACK_RETURN_BYTES) { - toCopy := MAX_CALLBACK_RETURN_BYTES - } + if gt(toCopy, MAX_CALLBACK_RETURN_BYTES) { toCopy := MAX_CALLBACK_RETURN_BYTES } // Store the length of the copied bytes mstore(returnData, toCopy) // copy the bytes from returnData[0:_toCopy] @@ -475,7 +459,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // ================================================================ /// @inheritdoc IFunctionsRouter - function getContractById(bytes32 id) public view override returns (address) { + function getContractById( + bytes32 id + ) public view override returns (address) { address currentImplementation = s_route[id]; if (currentImplementation == address(0)) { revert RouteNotFound(id); @@ -484,7 +470,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, } /// @inheritdoc IFunctionsRouter - function getProposedContractById(bytes32 id) public view override returns (address) { + function getProposedContractById( + bytes32 id + ) public view override returns (address) { // Iterations will not exceed MAX_PROPOSAL_SET_LENGTH for (uint8 i = 0; i < s_proposedContractSet.ids.length; ++i) { if (id == s_proposedContractSet.ids[i]) { @@ -519,8 +507,8 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, bytes32 id = proposedContractSetIds[i]; address proposedContract = proposedContractSetAddresses[i]; if ( - proposedContract == address(0) || // The Proposed address must be a valid address - s_route[id] == proposedContract // The Proposed address must point to a different address than what is currently set + proposedContract == address(0) // The Proposed address must be a valid address + || s_route[id] == proposedContract // The Proposed address must point to a different address than what is currently set ) { revert InvalidProposal(); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsSubscriptions.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsSubscriptions.sol index f34d4f979b..fb1ace9347 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsSubscriptions.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsSubscriptions.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {IERC677Receiver} from "../../../shared/interfaces/IERC677Receiver.sol"; import {IFunctionsBilling} from "./interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; @@ -66,6 +66,7 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece error MustBeSubscriptionOwner(); error TimeoutNotExceeded(); error MustBeProposedOwner(address proposedOwner); + event FundsRecovered(address to, uint256 amount); // ================================================================ @@ -84,7 +85,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // ================================================================ // | Initialization | // ================================================================ - constructor(address link) { + constructor( + address link + ) { i_linkToken = IERC20(link); } @@ -117,8 +120,8 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece uint96 totalCostJuels = costWithoutCallbackJuels + adminFee + callbackGasCostJuels; if ( - s_subscriptions[subscriptionId].balance < totalCostJuels || - s_subscriptions[subscriptionId].blockedBalance < estimatedTotalCostJuels + s_subscriptions[subscriptionId].balance < totalCostJuels + || s_subscriptions[subscriptionId].blockedBalance < estimatedTotalCostJuels ) { revert InsufficientBalance(s_subscriptions[subscriptionId].balance); } @@ -146,14 +149,18 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // ================================================================ /// @inheritdoc IFunctionsSubscriptions - function ownerCancelSubscription(uint64 subscriptionId) external override { + function ownerCancelSubscription( + uint64 subscriptionId + ) external override { _onlyRouterOwner(); _isExistingSubscription(subscriptionId); _cancelSubscriptionHelper(subscriptionId, s_subscriptions[subscriptionId].owner, false); } /// @inheritdoc IFunctionsSubscriptions - function recoverFunds(address to) external override { + function recoverFunds( + address to + ) external override { _onlyRouterOwner(); uint256 externalBalance = i_linkToken.balanceOf(address(this)); uint256 internalBalance = uint256(s_totalLinkBalance); @@ -214,7 +221,7 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece /// @dev address(ROUTER), /// @dev amount, /// @dev abi.encode(subscriptionId)); - function onTokenTransfer(address /* sender */, uint256 amount, bytes calldata data) external override { + function onTokenTransfer(address, /* sender */ uint256 amount, bytes calldata data) external override { _whenNotPaused(); if (msg.sender != address(i_linkToken)) { revert OnlyCallableFromLink(); @@ -249,7 +256,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function getSubscription(uint64 subscriptionId) public view override returns (Subscription memory) { + function getSubscription( + uint64 subscriptionId + ) public view override returns (Subscription memory) { _isExistingSubscription(subscriptionId); return s_subscriptions[subscriptionId]; } @@ -260,9 +269,8 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece uint64 subscriptionIdEnd ) external view override returns (Subscription[] memory subscriptions) { if ( - subscriptionIdStart > subscriptionIdEnd || - subscriptionIdEnd > s_currentSubscriptionId || - s_currentSubscriptionId == 0 + subscriptionIdStart > subscriptionIdEnd || subscriptionIdEnd > s_currentSubscriptionId + || s_currentSubscriptionId == 0 ) { revert InvalidCalldata(); } @@ -281,7 +289,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @dev Used within this file & FunctionsRouter.sol - function _isExistingSubscription(uint64 subscriptionId) internal view { + function _isExistingSubscription( + uint64 subscriptionId + ) internal view { if (s_subscriptions[subscriptionId].owner == address(0)) { revert InvalidSubscription(); } @@ -315,7 +325,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function createSubscriptionWithConsumer(address consumer) external override returns (uint64 subscriptionId) { + function createSubscriptionWithConsumer( + address consumer + ) external override returns (uint64 subscriptionId) { _whenNotPaused(); _onlySenderThatAcceptedToS(); @@ -353,7 +365,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function acceptSubscriptionOwnerTransfer(uint64 subscriptionId) external override { + function acceptSubscriptionOwnerTransfer( + uint64 subscriptionId + ) external override { _whenNotPaused(); _onlySenderThatAcceptedToS(); @@ -468,7 +482,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function pendingRequestExists(uint64 subscriptionId) public view override returns (bool) { + function pendingRequestExists( + uint64 subscriptionId + ) public view override returns (bool) { address[] memory consumers = s_subscriptions[subscriptionId].consumers; // NOTE: loop iterations are bounded by config.maxConsumers for (uint256 i = 0; i < consumers.length; ++i) { @@ -488,7 +504,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function getFlags(uint64 subscriptionId) public view returns (bytes32) { + function getFlags( + uint64 subscriptionId + ) public view returns (bytes32) { return s_subscriptions[subscriptionId].flags; } @@ -497,7 +515,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // ================================================================ /// @inheritdoc IFunctionsSubscriptions - function timeoutRequests(FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment) external override { + function timeoutRequests( + FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment + ) external override { _whenNotPaused(); for (uint256 i = 0; i < requestsToTimeoutByCommitment.length; ++i) { @@ -531,7 +551,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // | Modifiers | // ================================================================ - function _onlySubscriptionOwner(uint64 subscriptionId) internal view { + function _onlySubscriptionOwner( + uint64 subscriptionId + ) internal view { address owner = s_subscriptions[subscriptionId].owner; if (owner == address(0)) { revert InvalidSubscription(); diff --git a/contracts/src/v0.8/functions/dev/v1_X/Routable.sol b/contracts/src/v0.8/functions/dev/v1_X/Routable.sol index 92e23362f9..4d6c20a693 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/Routable.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/Routable.sol @@ -15,7 +15,9 @@ abstract contract Routable is ITypeAndVersion { error OnlyCallableByRouterOwner(); /// @dev Initializes the contract. - constructor(address router) { + constructor( + address router + ) { if (router == address(0)) { revert RouterMustBeSet(); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol index 2a6e7225de..ce51556d72 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {ITermsOfServiceAllowList, TermsOfServiceAllowListConfig} from "./interfaces/ITermsOfServiceAllowList.sol"; import {IAccessController} from "../../../../shared/interfaces/IAccessController.sol"; import {ITypeAndVersion} from "../../../../shared/interfaces/ITypeAndVersion.sol"; +import {ITermsOfServiceAllowList, TermsOfServiceAllowListConfig} from "./interfaces/ITermsOfServiceAllowList.sol"; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; @@ -75,7 +75,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, /// @notice Sets the contracts's configuration /// @param config - See the contents of the TermsOfServiceAllowListConfig struct in ITermsOfServiceAllowList.sol for more information - function updateConfig(TermsOfServiceAllowListConfig memory config) public onlyOwner { + function updateConfig( + TermsOfServiceAllowListConfig memory config + ) public onlyOwner { s_config = config; emit ConfigUpdated(config); } @@ -96,9 +98,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } // Validate that the signature is correct and the correct data has been signed - bytes32 prefixedMessage = keccak256( - abi.encodePacked("\x19Ethereum Signed Message:\n32", getMessage(acceptor, recipient)) - ); + bytes32 prefixedMessage = + keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", getMessage(acceptor, recipient))); if (ecrecover(prefixedMessage, v, r, s) != s_config.signerPublicKey) { revert InvalidSignature(); } @@ -145,7 +146,7 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc IAccessController - function hasAccess(address user, bytes calldata /* data */) external view override returns (bool) { + function hasAccess(address user, bytes calldata /* data */ ) external view override returns (bool) { if (!s_config.enabled) { return true; } @@ -157,7 +158,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, // ================================================================ /// @inheritdoc ITermsOfServiceAllowList - function isBlockedSender(address sender) external view override returns (bool) { + function isBlockedSender( + address sender + ) external view override returns (bool) { if (!s_config.enabled) { return false; } @@ -165,14 +168,18 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc ITermsOfServiceAllowList - function blockSender(address sender) external override onlyOwner { + function blockSender( + address sender + ) external override onlyOwner { s_allowedSenders.remove(sender); s_blockedSenders.add(sender); emit BlockedAccess(sender); } /// @inheritdoc ITermsOfServiceAllowList - function unblockSender(address sender) external override onlyOwner { + function unblockSender( + address sender + ) external override onlyOwner { s_blockedSenders.remove(sender); emit UnblockedAccess(sender); } @@ -188,9 +195,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, uint64 blockedSenderIdxEnd ) external view override returns (address[] memory blockedSenders) { if ( - blockedSenderIdxStart > blockedSenderIdxEnd || - blockedSenderIdxEnd >= s_blockedSenders.length() || - s_blockedSenders.length() == 0 + blockedSenderIdxStart > blockedSenderIdxEnd || blockedSenderIdxEnd >= s_blockedSenders.length() + || s_blockedSenders.length() == 0 ) { revert InvalidCalldata(); } @@ -204,7 +210,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc ITermsOfServiceAllowList - function migratePreviouslyAllowedSenders(address[] memory previousSendersToAdd) external override onlyOwner { + function migratePreviouslyAllowedSenders( + address[] memory previousSendersToAdd + ) external override onlyOwner { if (s_previousToSContract == address(0)) { revert NoPreviousToSContract(); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol index 32a0ecef79..261dc627af 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol @@ -12,7 +12,9 @@ interface ITermsOfServiceAllowList { /// @notice Check if the address is blocked for usage /// @param sender The transaction sender's address /// @return True or false - function isBlockedSender(address sender) external returns (bool); + function isBlockedSender( + address sender + ) external returns (bool); /// @notice Get a list of all allowed senders /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed @@ -48,11 +50,15 @@ interface ITermsOfServiceAllowList { /// @notice Removes a sender's access if already authorized, and disallows re-accepting the Terms of Service /// @param sender - Address of the sender to block - function blockSender(address sender) external; + function blockSender( + address sender + ) external; /// @notice Re-allows a previously blocked sender to accept the Terms of Service /// @param sender - Address of the sender to unblock - function unblockSender(address sender) external; + function unblockSender( + address sender + ) external; /// @notice Get details about the total number of blocked senders /// @return count - total number of blocked senders in the system @@ -72,7 +78,9 @@ interface ITermsOfServiceAllowList { /// @notice Enables migrating any previously allowed senders to the new contract /// @param previousSendersToAdd - List of addresses to migrate. These address must be allowed on the previous ToS contract and not blocked - function migratePreviouslyAllowedSenders(address[] memory previousSendersToAdd) external; + function migratePreviouslyAllowedSenders( + address[] memory previousSendersToAdd + ) external; } // ================================================================ diff --git a/contracts/src/v0.8/functions/dev/v1_X/example/FunctionsClientExample.sol b/contracts/src/v0.8/functions/dev/v1_X/example/FunctionsClientExample.sol index abb8569b1e..165100e586 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/example/FunctionsClientExample.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/example/FunctionsClientExample.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsClient} from "../FunctionsClient.sol"; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; +import {FunctionsClient} from "../FunctionsClient.sol"; import {FunctionsRequest} from "../libraries/FunctionsRequest.sol"; /// @title Chainlink Functions example Client contract implementation @@ -19,7 +19,9 @@ contract FunctionsClientExample is FunctionsClient, ConfirmedOwner { error UnexpectedRequestID(bytes32 requestId); - constructor(address router) FunctionsClient(router) ConfirmedOwner(msg.sender) {} + constructor( + address router + ) FunctionsClient(router) ConfirmedOwner(msg.sender) {} /// @notice Send a simple request /// @param source JavaScript source code @@ -56,7 +58,9 @@ contract FunctionsClientExample is FunctionsClient, ConfirmedOwner { s_lastErrorLength = uint32(err.length); } - function _bytesToBytes32(bytes memory b) private pure returns (bytes32 out) { + function _bytesToBytes32( + bytes memory b + ) private pure returns (bytes32 out) { uint256 maxLen = 32; if (b.length < 32) { maxLen = b.length; diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol index 0f31f7f234..1c6c3fd82f 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol @@ -15,7 +15,9 @@ interface IFunctionsBilling { /// @notice Determine the fee that will be split between Node Operators for servicing a request /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request /// @return fee - Cost in Juels (1e18) of LINK - function getDONFeeJuels(bytes memory requestCBOR) external view returns (uint72); + function getDONFeeJuels( + bytes memory requestCBOR + ) external view returns (uint72); /// @notice Determine the fee that will be paid to the Coordinator owner for operating the network /// @return fee - Cost in Juels (1e18) of LINK @@ -40,7 +42,9 @@ interface IFunctionsBilling { /// @notice Remove a request commitment that the Router has determined to be stale /// @param requestId - The request ID to remove - function deleteCommitment(bytes32 requestId) external; + function deleteCommitment( + bytes32 requestId + ) external; /// @notice Oracle withdraw LINK earned through fulfilling requests /// @notice If amount is 0 the full balance will be withdrawn diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsCoordinator.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsCoordinator.sol index 4e2bd703dc..bb376055d9 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsCoordinator.sol @@ -14,7 +14,9 @@ interface IFunctionsCoordinator { /// @notice Sets the DON's threshold encryption public key used to encrypt secrets /// @dev Used to rotate the key /// @param thresholdPublicKey The new public key - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external; + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external; /// @notice Returns the DON's secp256k1 public key that is used to encrypt secrets /// @dev All nodes on the DON have the corresponding private key @@ -25,7 +27,9 @@ interface IFunctionsCoordinator { /// @notice Sets DON's secp256k1 public key used to encrypt secrets /// @dev Used to rotate the key /// @param donPublicKey The new public key - function setDONPublicKey(bytes calldata donPublicKey) external; + function setDONPublicKey( + bytes calldata donPublicKey + ) external; /// @notice Receives a request to be emitted to the DON for processing /// @param request The request metadata diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsRouter.sol index 5f93aac873..104b7ca035 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsRouter.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsRouter.sol @@ -12,7 +12,9 @@ interface IFunctionsRouter { /// @notice Set the identifier of the route to retrieve the address of the access control contract /// The access control contract controls which accounts can manage subscriptions - function setAllowListId(bytes32 allowListId) external; + function setAllowListId( + bytes32 allowListId + ) external; /// @notice Get the flat fee (in Juels of LINK) that will be paid to the Router owner for operation of the network /// @return adminFee @@ -79,12 +81,16 @@ interface IFunctionsRouter { /// @notice Get the current contract given an ID /// @param id A bytes32 identifier for the route /// @return contract The current contract address - function getContractById(bytes32 id) external view returns (address); + function getContractById( + bytes32 id + ) external view returns (address); /// @notice Get the proposed next contract given an ID /// @param id A bytes32 identifier for the route /// @return contract The current or proposed contract address - function getProposedContractById(bytes32 id) external view returns (address); + function getProposedContractById( + bytes32 id + ) external view returns (address); /// @notice Return the latest proprosal set /// @return ids The identifiers of the contracts to update diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol index eafd6f4fe9..de074d6373 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol @@ -23,7 +23,9 @@ interface IFunctionsSubscriptions { /// @notice Get details about a subscription. /// @param subscriptionId - the ID of the subscription /// @return subscription - see IFunctionsSubscriptions.Subscription for more information on the structure - function getSubscription(uint64 subscriptionId) external view returns (Subscription memory); + function getSubscription( + uint64 subscriptionId + ) external view returns (Subscription memory); /// @notice Retrieve details about multiple subscriptions using an inclusive range /// @param subscriptionIdStart - the ID of the subscription to start the range at @@ -51,7 +53,9 @@ interface IFunctionsSubscriptions { /// @notice Time out all expired requests: unlocks funds and removes the ability for the request to be fulfilled /// @param requestsToTimeoutByCommitment - A list of request commitments to time out /// @dev The commitment can be found on the "OracleRequest" event created when sending the request. - function timeoutRequests(FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment) external; + function timeoutRequests( + FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment + ) external; /// @notice Oracle withdraw LINK earned through fulfilling requests /// @notice If amount is 0 the full balance will be withdrawn @@ -64,12 +68,16 @@ interface IFunctionsSubscriptions { /// @dev Only callable by the Router Owner /// @param subscriptionId subscription id /// @dev notably can be called even if there are pending requests, outstanding ones may fail onchain - function ownerCancelSubscription(uint64 subscriptionId) external; + function ownerCancelSubscription( + uint64 subscriptionId + ) external; /// @notice Recover link sent with transfer instead of transferAndCall. /// @dev Only callable by the Router Owner /// @param to address to send link to - function recoverFunds(address to) external; + function recoverFunds( + address to + ) external; /// @notice Create a new subscription. /// @return subscriptionId - A unique subscription id. @@ -89,7 +97,9 @@ interface IFunctionsSubscriptions { /// @dev address(ROUTER), /// @dev amount, /// @dev abi.encode(subscriptionId)); - function createSubscriptionWithConsumer(address consumer) external returns (uint64 subscriptionId); + function createSubscriptionWithConsumer( + address consumer + ) external returns (uint64 subscriptionId); /// @notice Propose a new owner for a subscription. /// @dev Only callable by the Subscription's owner @@ -100,7 +110,9 @@ interface IFunctionsSubscriptions { /// @notice Accept an ownership transfer. /// @param subscriptionId - ID of the subscription /// @dev will revert if original owner of subscriptionId has not requested that msg.sender become the new owner. - function acceptSubscriptionOwnerTransfer(uint64 subscriptionId) external; + function acceptSubscriptionOwnerTransfer( + uint64 subscriptionId + ) external; /// @notice Remove a consumer from a Chainlink Functions subscription. /// @dev Only callable by the Subscription's owner @@ -125,7 +137,9 @@ interface IFunctionsSubscriptions { /// @return true if there exists at least one unfulfilled request for the subscription, false otherwise. /// @dev Looping is bounded to MAX_CONSUMERS*(number of DONs). /// @dev Used to disable subscription canceling while outstanding request are present. - function pendingRequestExists(uint64 subscriptionId) external view returns (bool); + function pendingRequestExists( + uint64 subscriptionId + ) external view returns (bool); /// @notice Set subscription specific flags for a subscription. /// Each byte of the flag is used to represent a resource tier that the subscription can utilize. @@ -136,5 +150,7 @@ interface IFunctionsSubscriptions { /// @notice Get flags for a given subscription. /// @param subscriptionId - ID of the subscription /// @return flags - current flag values - function getFlags(uint64 subscriptionId) external view returns (bytes32); + function getFlags( + uint64 subscriptionId + ) external view returns (bytes32); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IOwnableFunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IOwnableFunctionsRouter.sol index f6d7880da3..7fdbe2bd2f 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IOwnableFunctionsRouter.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IOwnableFunctionsRouter.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsRouter} from "./IFunctionsRouter.sol"; import {IOwnable} from "../../../../shared/interfaces/IOwnable.sol"; +import {IFunctionsRouter} from "./IFunctionsRouter.sol"; /// @title Chainlink Functions Router interface with Ownability. interface IOwnableFunctionsRouter is IOwnable, IFunctionsRouter {} diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol index d4c4b5f442..e9bc6b97d9 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol @@ -41,11 +41,13 @@ library ChainSpecificUtil { /// @notice Returns the upper limit estimate of the L1 fees in wei that will be paid for L2 chains /// @notice based on the size of the transaction data and the current gas conditions. /// @notice This is an "upper limit" as it assumes the transaction data is uncompressed when posted on L1. - function _getL1FeeUpperLimit(uint256 calldataSizeBytes) internal view returns (uint256 l1FeeWei) { + function _getL1FeeUpperLimit( + uint256 calldataSizeBytes + ) internal view returns (uint256 l1FeeWei) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { // https://docs.arbitrum.io/build-decentralized-apps/how-to-estimate-gas#where-do-we-get-all-this-information-from - (, uint256 l1PricePerByte, , , , ) = ARBGAS.getPricesInWei(); + (, uint256 l1PricePerByte,,,,) = ARBGAS.getPricesInWei(); return l1PricePerByte * (calldataSizeBytes + ARB_DATA_PADDING_SIZE); } else if (_isOptimismChainId(chainid)) { return GAS_PRICE_ORACLE.getL1FeeUpperBound(calldataSizeBytes); @@ -54,22 +56,19 @@ library ChainSpecificUtil { } /// @notice Return true if and only if the provided chain ID is an Arbitrum chain ID. - function _isArbitrumChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == ARB_MAINNET_CHAIN_ID || - chainId == ARB_GOERLI_TESTNET_CHAIN_ID || - chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; + function _isArbitrumChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == ARB_MAINNET_CHAIN_ID || chainId == ARB_GOERLI_TESTNET_CHAIN_ID + || chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; } /// @notice Return true if and only if the provided chain ID is an Optimism (or Base) chain ID. /// @notice Note that optimism chain id's are also OP stack chain id's. - function _isOptimismChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == OP_MAINNET_CHAIN_ID || - chainId == OP_GOERLI_CHAIN_ID || - chainId == OP_SEPOLIA_CHAIN_ID || - chainId == BASE_MAINNET_CHAIN_ID || - chainId == BASE_GOERLI_CHAIN_ID || - chainId == BASE_SEPOLIA_CHAIN_ID; + function _isOptimismChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_CHAIN_ID || chainId == OP_SEPOLIA_CHAIN_ID + || chainId == BASE_MAINNET_CHAIN_ID || chainId == BASE_GOERLI_CHAIN_ID || chainId == BASE_SEPOLIA_CHAIN_ID; } } diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol index 4e3134dc12..2170ae67f3 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol @@ -14,12 +14,13 @@ library FunctionsRequest { Inline, // Provided within the Request Remote, // Hosted through remote location that can be accessed through a provided URL DONHosted // Hosted on the DON's storage + } enum CodeLanguage { JavaScript - // In future version we may add other languages } + // In future version we may add other languages struct Request { Location codeLocation; // ════════════╸ The location of the source code that will be executed on each node in the DON @@ -39,7 +40,9 @@ library FunctionsRequest { /// @notice Encodes a Request to CBOR encoded bytes /// @param self The request to encode /// @return CBOR encoded bytes - function _encodeCBOR(Request memory self) internal pure returns (bytes memory) { + function _encodeCBOR( + Request memory self + ) internal pure returns (bytes memory) { CBOR.CBORBuffer memory buffer = CBOR.create(DEFAULT_BUFFER_SIZE); buffer.writeString("codeLocation"); diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol index 65fad665d6..eb7eb60266 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol @@ -26,6 +26,7 @@ library FunctionsResponse { INSUFFICIENT_GAS_PROVIDED, // 4 SUBSCRIPTION_BALANCE_INVARIANT_VIOLATION, // 5 INVALID_COMMITMENT // 6 + } struct Commitment { diff --git a/contracts/src/v0.8/functions/dev/v1_X/mocks/FunctionsV1EventsMock.sol b/contracts/src/v0.8/functions/dev/v1_X/mocks/FunctionsV1EventsMock.sol index ac040ad47a..51bf990a86 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/mocks/FunctionsV1EventsMock.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/mocks/FunctionsV1EventsMock.sol @@ -14,9 +14,7 @@ contract FunctionsV1EventsMock { event ConfigUpdated(Config param1); event ContractProposed( - bytes32 proposedContractSetId, - address proposedContractSetFromAddress, - address proposedContractSetToAddress + bytes32 proposedContractSetId, address proposedContractSetFromAddress, address proposedContractSetToAddress ); event ContractUpdated(bytes32 id, address from, address to); event FundsRecovered(address to, uint256 amount); @@ -56,7 +54,9 @@ contract FunctionsV1EventsMock { event SubscriptionOwnerTransferred(uint64 indexed subscriptionId, address from, address to); event Unpaused(address account); - function emitConfigUpdated(Config memory param1) public { + function emitConfigUpdated( + Config memory param1 + ) public { emit ConfigUpdated(param1); } @@ -84,7 +84,9 @@ contract FunctionsV1EventsMock { emit OwnershipTransferred(from, to); } - function emitPaused(address account) public { + function emitPaused( + address account + ) public { emit Paused(account); } @@ -108,14 +110,7 @@ contract FunctionsV1EventsMock { bytes memory callbackReturnData ) public { emit RequestProcessed( - requestId, - subscriptionId, - totalCostJuels, - transmitter, - resultCode, - response, - err, - callbackReturnData + requestId, subscriptionId, totalCostJuels, transmitter, resultCode, response, err, callbackReturnData ); } @@ -145,7 +140,9 @@ contract FunctionsV1EventsMock { ); } - function emitRequestTimedOut(bytes32 requestId) public { + function emitRequestTimedOut( + bytes32 requestId + ) public { emit RequestTimedOut(requestId); } @@ -177,7 +174,9 @@ contract FunctionsV1EventsMock { emit SubscriptionOwnerTransferred(subscriptionId, from, to); } - function emitUnpaused(address account) public { + function emitUnpaused( + address account + ) public { emit Unpaused(account); } } diff --git a/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Abstract.sol b/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Abstract.sol index 77cc950217..d7d4188386 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Abstract.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Abstract.sol @@ -62,19 +62,19 @@ abstract contract OCR2Abstract is ITypeAndVersion { returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest); /** - * @notice optionally emited to indicate the latest configDigest and epoch for - which a report was successfully transmited. Alternatively, the contract may - use latestConfigDigestAndEpoch with scanLogs set to false. - */ + * @notice optionally emited to indicate the latest configDigest and epoch for + * which a report was successfully transmited. Alternatively, the contract may + * use latestConfigDigestAndEpoch with scanLogs set to false. + */ event Transmitted(bytes32 configDigest, uint32 epoch); /** - * @notice optionally returns the latest configDigest and epoch for which a - report was successfully transmitted. Alternatively, the contract may return - scanLogs set to true and use Transmitted events to provide this information - to offchain watchers. + * @notice optionally returns the latest configDigest and epoch for which a + * report was successfully transmitted. Alternatively, the contract may return + * scanLogs set to true and use Transmitted events to provide this information + * to offchain watchers. * @return scanLogs indicates whether to rely on the configDigest and epoch - returned or whether to scan logs for the Transmitted event instead. + * returned or whether to scan logs for the Transmitted event instead. * @return configDigest * @return epoch */ diff --git a/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol index 28fa670650..b859a20f88 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol @@ -29,6 +29,7 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { uint8 f; // ───╮ uint8 n; // ───╯ } + ConfigInfo internal s_configInfo; // Used for s_oracles[a].role, where a is an address, to track the purpose @@ -245,23 +246,23 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { * for the extending contract to handle additional logic, such as oracle payment * @param decodedReport decodedReport */ - function _report(DecodedReport memory decodedReport) internal virtual; + function _report( + DecodedReport memory decodedReport + ) internal virtual; // The constant-length components of the msg.data sent to transmit. // See the "If we wanted to call sam" example on for example reasoning // https://solidity.readthedocs.io/en/v0.7.2/abi-spec.html - uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = - 4 + // function selector - 32 * - 3 + // 3 words containing reportContext - 32 + // word containing start location of abiencoded report value - 32 + // word containing location start of abiencoded rs value - 32 + // word containing start location of abiencoded ss value - 32 + // rawVs value - 32 + // word containing length of report - 32 + // word containing length rs - 32 + // word containing length of ss - 0; // placeholder + uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = 4 // function selector + + 32 * 3 // 3 words containing reportContext + + 32 // word containing start location of abiencoded report value + + 32 // word containing location start of abiencoded rs value + + 32 // word containing start location of abiencoded ss value + + 32 // rawVs value + + 32 // word containing length of report + + 32 // word containing length rs + + 32 // word containing length of ss + + 0; // placeholder function _requireExpectedMsgDataLength( bytes calldata report, @@ -269,13 +270,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + - report.length + // one byte pure entry in _report - rs.length * - 32 + // 32 bytes per entry in _rs - ss.length * - 32 + // 32 bytes per entry in _ss - 0; // placeholder + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + + rs.length * 32 // 32 bytes per entry in _rs + + ss.length * 32 // 32 bytes per entry in _ss + + 0; // placeholder if (msg.data.length != expected) revert ReportInvalid("calldata length mismatch"); } @@ -327,8 +325,9 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { if (rs.length != ss.length) revert ReportInvalid("report rs and ss must be of equal length"); Oracle memory transmitter = s_oracles[msg.sender]; - if (transmitter.role != Role.Transmitter && msg.sender != s_transmitters[transmitter.index]) + if (transmitter.role != Role.Transmitter && msg.sender != s_transmitters[transmitter.index]) { revert ReportInvalid("unauthorized transmitter"); + } } address[MAX_NUM_ORACLES] memory signed; diff --git a/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol b/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol index d57d5113e8..9b31834adf 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsClient} from "../../dev/v1_X/FunctionsClient.sol"; import {FunctionsRouter} from "../../dev/v1_X/FunctionsRouter.sol"; import {FunctionsSubscriptions} from "../../dev/v1_X/FunctionsSubscriptions.sol"; import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsFulfillmentSetup} from "./Setup.t.sol"; @@ -43,8 +43,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -64,8 +64,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -85,8 +85,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -130,8 +130,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentS FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -151,8 +151,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentS FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -172,8 +172,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentS FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -214,8 +214,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -235,8 +235,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, @@ -256,8 +256,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup FunctionsFulfillmentSetup.setUp(); // Check request cost estimate - uint96 expectedEstimatedTotalCostJuels = _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + - l1FeeEstimateJuels; + uint96 expectedEstimatedTotalCostJuels = + _getExpectedCostEstimate(s_requests[1].requestData.callbackGasLimit) + l1FeeEstimateJuels; assertEq( s_requests[1].commitment.estimatedTotalCostJuels, expectedEstimatedTotalCostJuels, diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol index b66c1e42f9..00f0fb7111 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol @@ -1,14 +1,21 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsCoordinator} from "../../dev/v1_X/FunctionsCoordinator.sol"; import {FunctionsBilling} from "../../dev/v1_X/FunctionsBilling.sol"; -import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; -import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {FunctionsCoordinator} from "../../dev/v1_X/FunctionsCoordinator.sol"; + import {FunctionsSubscriptions} from "../../dev/v1_X/FunctionsSubscriptions.sol"; import {Routable} from "../../dev/v1_X/Routable.sol"; +import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; +import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; -import {FunctionsRouterSetup, FunctionsSubscriptionSetup, FunctionsClientRequestSetup, FunctionsFulfillmentSetup, FunctionsMultipleFulfillmentsSetup} from "./Setup.t.sol"; +import { + FunctionsClientRequestSetup, + FunctionsFulfillmentSetup, + FunctionsMultipleFulfillmentsSetup, + FunctionsRouterSetup, + FunctionsSubscriptionSetup +} from "./Setup.t.sol"; import {FunctionsBillingConfig} from "../../dev/v1_X/interfaces/IFunctionsBilling.sol"; @@ -123,9 +130,8 @@ contract FunctionsBilling_GetOperationFee is FunctionsRouterSetup { vm.startPrank(STRANGER_ADDRESS); uint72 operationFee = s_functionsCoordinator.getOperationFeeJuels(); - uint72 expectedOperationFee = uint72( - ((s_operationFee * 10 ** (18 + LINK_USD_DECIMALS)) / uint256(LINK_USD_RATE)) / 100 - ); + uint72 expectedOperationFee = + uint72(((s_operationFee * 10 ** (18 + LINK_USD_DECIMALS)) / uint256(LINK_USD_RATE)) / 100); assertEq(operationFee, expectedOperationFee); } } @@ -171,10 +177,7 @@ contract FunctionsBilling_EstimateCost is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -191,26 +194,17 @@ contract FunctionsBilling_EstimateCost is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); uint32 callbackGasLimit = 5_500; uint256 gasPriceWei = 1; - uint96 costEstimate = s_functionsCoordinator.estimateCost( - s_subscriptionId, - requestData, - callbackGasLimit, - gasPriceWei - ); - uint96 expectedCostEstimate = 51110500000000000 + - s_adminFee + - s_functionsCoordinator.getDONFeeJuels(requestData) + - s_functionsCoordinator.getOperationFeeJuels(); + uint96 costEstimate = + s_functionsCoordinator.estimateCost(s_subscriptionId, requestData, callbackGasLimit, gasPriceWei); + uint96 expectedCostEstimate = 51110500000000000 + s_adminFee + s_functionsCoordinator.getDONFeeJuels(requestData) + + s_functionsCoordinator.getOperationFeeJuels(); assertEq(costEstimate, expectedCostEstimate); } @@ -219,33 +213,24 @@ contract FunctionsBilling_EstimateCost is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); uint32 callbackGasLimit = 5_500; uint256 gasPriceWei = 5000000000; // 5 gwei - uint96 costEstimate = s_functionsCoordinator.estimateCost( - s_subscriptionId, - requestData, - callbackGasLimit, - gasPriceWei - ); - uint96 expectedCostEstimate = 255552500000000000 + - s_adminFee + - s_functionsCoordinator.getDONFeeJuels(requestData) + - s_functionsCoordinator.getOperationFeeJuels(); + uint96 costEstimate = + s_functionsCoordinator.estimateCost(s_subscriptionId, requestData, callbackGasLimit, gasPriceWei); + uint96 expectedCostEstimate = 255552500000000000 + s_adminFee + s_functionsCoordinator.getDONFeeJuels(requestData) + + s_functionsCoordinator.getOperationFeeJuels(); assertEq(costEstimate, expectedCostEstimate); } } /// @notice #_calculateCostEstimate contract FunctionsBilling__CalculateCostEstimate { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_startBilling @@ -333,12 +318,7 @@ contract FunctionsBilling__FulfillAndBill is FunctionsClientRequestSetup { ); FunctionsResponse.FulfillResult resultCode = s_functionsCoordinator.fulfillAndBill_HARNESS( - s_requests[1].requestId, - new bytes(0), - new bytes(0), - abi.encode(s_requests[1].commitment), - new bytes(0), - 1 + s_requests[1].requestId, new bytes(0), new bytes(0), abi.encode(s_requests[1].commitment), new bytes(0), 1 ); assertEq(uint256(resultCode), uint256(FunctionsResponse.FulfillResult.FULFILLED)); @@ -440,8 +420,8 @@ contract FunctionsBilling_OracleWithdraw is FunctionsMultipleFulfillmentsSetup { uint96 totalOperationFees = s_functionsCoordinator.getOperationFeeJuels() * s_requestsFulfilled; uint96 totalDonFees = s_functionsCoordinator.getDONFeeJuels(new bytes(0)) * s_requestsFulfilled; uint96 donFeeShare = totalDonFees / uint8(s_transmitters.length); - uint96 expectedBalancePerFulfillment = ((s_fulfillmentCoordinatorBalance - totalOperationFees - totalDonFees) / - s_requestsFulfilled); + uint96 expectedBalancePerFulfillment = + ((s_fulfillmentCoordinatorBalance - totalOperationFees - totalDonFees) / s_requestsFulfilled); uint256[4] memory transmitterBalancesAfter = _getTransmitterBalances(); // Transmitter 1 has transmitted twice @@ -494,8 +474,8 @@ contract FunctionsBilling_OracleWithdrawAll is FunctionsMultipleFulfillmentsSetu uint96 totalOperationFees = s_functionsCoordinator.getOperationFeeJuels() * s_requestsFulfilled; uint96 totalDonFees = s_functionsCoordinator.getDONFeeJuels(new bytes(0)) * s_requestsFulfilled; uint96 donFeeShare = totalDonFees / uint8(s_transmitters.length); - uint96 expectedBalancePerFulfillment = ((s_fulfillmentCoordinatorBalance - totalOperationFees - totalDonFees) / - s_requestsFulfilled); + uint96 expectedBalancePerFulfillment = + ((s_fulfillmentCoordinatorBalance - totalOperationFees - totalDonFees) / s_requestsFulfilled); uint256[4] memory transmitterBalancesAfter = _getTransmitterBalances(); // Transmitter 1 has transmitted twice diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol index 363827645c..f340441d84 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsClient} from "../../dev/v1_X/FunctionsClient.sol"; import {FunctionsRouter} from "../../dev/v1_X/FunctionsRouter.sol"; import {FunctionsSubscriptions} from "../../dev/v1_X/FunctionsSubscriptions.sol"; import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {BaseTest} from "./BaseTest.t.sol"; -import {FunctionsClientSetup, FunctionsSubscriptionSetup, FunctionsClientRequestSetup} from "./Setup.t.sol"; +import {FunctionsClientRequestSetup, FunctionsClientSetup, FunctionsSubscriptionSetup} from "./Setup.t.sol"; /// @notice #constructor contract FunctionsClient_Constructor is FunctionsClientSetup { @@ -24,10 +24,7 @@ contract FunctionsClient__SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol index 03d9f64514..64c9e11476 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol @@ -1,15 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsCoordinator} from "../../dev/v1_X/FunctionsCoordinator.sol"; import {FunctionsBilling} from "../../dev/v1_X/FunctionsBilling.sol"; -import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; -import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {FunctionsCoordinator} from "../../dev/v1_X/FunctionsCoordinator.sol"; + import {FunctionsRouter} from "../../dev/v1_X/FunctionsRouter.sol"; import {Routable} from "../../dev/v1_X/Routable.sol"; +import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; +import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; import {BaseTest} from "./BaseTest.t.sol"; -import {FunctionsRouterSetup, FunctionsDONSetup, FunctionsSubscriptionSetup} from "./Setup.t.sol"; +import {FunctionsDONSetup, FunctionsRouterSetup, FunctionsSubscriptionSetup} from "./Setup.t.sol"; /// @notice #constructor contract FunctionsCoordinator_Constructor is FunctionsRouterSetup { @@ -163,16 +164,12 @@ contract FunctionsCoordinator_StartRequest is FunctionsSubscriptionSetup { // Send as Router vm.stopPrank(); vm.startPrank(address(s_functionsRouter)); - (, , address txOrigin) = vm.readCallers(); + (,, address txOrigin) = vm.readCallers(); bytes memory _requestData = new bytes(0); uint32 _callbackGasLimit = 5_500; - uint96 costEstimate = s_functionsCoordinator.estimateCost( - s_subscriptionId, - _requestData, - _callbackGasLimit, - tx.gasprice - ); + uint96 costEstimate = + s_functionsCoordinator.estimateCost(s_subscriptionId, _requestData, _callbackGasLimit, tx.gasprice); uint32 timeoutTimestamp = uint32(block.timestamp + getCoordinatorConfig().requestTimeoutSeconds); bytes32 expectedRequestId = keccak256( abi.encode( @@ -239,20 +236,20 @@ contract FunctionsCoordinator_StartRequest is FunctionsSubscriptionSetup { /// @notice #_beforeSetConfig contract FunctionsCoordinator__BeforeSetConfig { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_getTransmitters contract FunctionsCoordinator__GetTransmitters { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_report contract FunctionsCoordinator__Report { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_onlyOwner contract FunctionsCoordinator__OnlyOwner { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol index 62db3e467d..6f23a80ab4 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol @@ -1,16 +1,23 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import {FunctionsBilling} from "../../dev/v1_X/FunctionsBilling.sol"; +import {FunctionsCoordinator} from "../../dev/v1_X/FunctionsCoordinator.sol"; import {FunctionsRouter} from "../../dev/v1_X/FunctionsRouter.sol"; import {FunctionsSubscriptions} from "../../dev/v1_X/FunctionsSubscriptions.sol"; -import {FunctionsCoordinator} from "../../dev/v1_X/FunctionsCoordinator.sol"; -import {FunctionsBilling} from "../../dev/v1_X/FunctionsBilling.sol"; + import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; -import {FunctionsCoordinatorTestHelper} from "./testhelpers/FunctionsCoordinatorTestHelper.sol"; + import {FunctionsClientTestHelper} from "./testhelpers/FunctionsClientTestHelper.sol"; +import {FunctionsCoordinatorTestHelper} from "./testhelpers/FunctionsCoordinatorTestHelper.sol"; -import {FunctionsRouterSetup, FunctionsRoutesSetup, FunctionsSubscriptionSetup, FunctionsClientRequestSetup} from "./Setup.t.sol"; +import { + FunctionsClientRequestSetup, + FunctionsRouterSetup, + FunctionsRoutesSetup, + FunctionsSubscriptionSetup +} from "./Setup.t.sol"; import "forge-std/Vm.sol"; @@ -190,7 +197,7 @@ contract FunctionsRouter_SetAllowListId is FunctionsRouterSetup { /// @notice #_getMaxConsumers contract FunctionsRouter__GetMaxConsumers is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #sendRequest @@ -207,10 +214,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -218,11 +222,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.RouteNotFound.selector, invalidDonId)); s_functionsRouter.sendRequest( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5_000, - invalidDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, invalidDonId ); } @@ -231,10 +231,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -243,11 +240,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { // Low level revert from incorrect call vm.expectRevert(); s_functionsRouter.sendRequest( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5_000, - incorrectDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, incorrectDonId ); } @@ -258,10 +251,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -274,10 +264,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -285,11 +272,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); s_functionsRouter.sendRequest( - invalidSubscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5000, - s_donId + invalidSubscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, s_donId ); } @@ -301,10 +284,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -317,10 +297,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -334,11 +311,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.GasLimitTooBig.selector, maxCallbackGasLimit)); s_functionsRouter.sendRequest( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 500_000, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 500_000, s_donId ); } @@ -348,11 +321,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsRouter.EmptyRequestData.selector); s_functionsRouter.sendRequest( - s_subscriptionId, - emptyRequestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5_000, - s_donId + s_subscriptionId, emptyRequestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, s_donId ); } @@ -365,10 +334,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -376,11 +342,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsBilling.InsufficientBalance.selector); s_functionsRouter.sendRequest( - subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - s_donId + subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, s_donId ); } @@ -389,21 +351,14 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); uint32 callbackGasLimit = 5_000; bytes memory requestData = FunctionsRequest._encodeCBOR(request); // Send a first request that will remain pending bytes32 requestId = s_functionsRouter.sendRequest( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, s_donId ); // Mock the Coordinator to always give back the first requestId @@ -429,11 +384,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.DuplicateRequestId.selector, requestId)); s_functionsRouter.sendRequest( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, s_donId ); } @@ -455,30 +406,19 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); uint32 callbackGasLimit = 5000; - uint96 costEstimate = s_functionsCoordinator.estimateCost( - s_subscriptionId, - requestData, - callbackGasLimit, - tx.gasprice - ); + uint96 costEstimate = + s_functionsCoordinator.estimateCost(s_subscriptionId, requestData, callbackGasLimit, tx.gasprice); vm.recordLogs(); bytes32 requestIdFromReturn = s_functionsRouter.sendRequest( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, s_donId ); // Get requestId from RequestStart event log topic 1 @@ -516,10 +456,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { // Deploy new Coordinator contract s_functionsCoordinator2 = new FunctionsCoordinatorTestHelper( - address(s_functionsRouter), - getCoordinatorConfig(), - address(s_linkEthFeed), - address(s_linkUsdFeed) + address(s_functionsRouter), getCoordinatorConfig(), address(s_linkEthFeed), address(s_linkUsdFeed) ); // Propose new Coordinator contract @@ -536,10 +473,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -547,11 +481,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.RouteNotFound.selector, invalidDonId)); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5_000, - invalidDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, invalidDonId ); } @@ -560,10 +490,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -572,11 +499,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { // Low level revert from incorrect call vm.expectRevert(); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5_000, - incorrectDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, incorrectDonId ); } @@ -587,20 +510,13 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); vm.expectRevert("Pausable: paused"); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5000, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, s_donId ); } @@ -609,10 +525,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -620,11 +533,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); s_functionsRouter.sendRequestToProposed( - invalidSubscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5000, - s_donId + invalidSubscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, s_donId ); } @@ -636,20 +545,13 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); vm.expectRevert(FunctionsSubscriptions.InvalidConsumer.selector); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5000, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, s_donId ); } @@ -658,10 +560,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -675,11 +574,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.GasLimitTooBig.selector, maxCallbackGasLimit)); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 500_000, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 500_000, s_donId ); } @@ -689,11 +584,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsRouter.EmptyRequestData.selector); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - emptyRequestData, - FunctionsRequest.REQUEST_DATA_VERSION, - 5_000, - s_donId + s_subscriptionId, emptyRequestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, s_donId ); } @@ -706,10 +597,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); @@ -717,11 +605,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsBilling.InsufficientBalance.selector); s_functionsRouter.sendRequestToProposed( - subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - s_donId + subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, s_donId ); } @@ -743,30 +627,19 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { string memory sourceCode = "return 'hello world';"; FunctionsRequest.Request memory request; FunctionsRequest._initializeRequest( - request, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - sourceCode + request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); uint32 callbackGasLimit = 5000; - uint96 costEstimate = s_functionsCoordinator2.estimateCost( - s_subscriptionId, - requestData, - callbackGasLimit, - tx.gasprice - ); + uint96 costEstimate = + s_functionsCoordinator2.estimateCost(s_subscriptionId, requestData, callbackGasLimit, tx.gasprice); vm.recordLogs(); bytes32 requestIdFromReturn = s_functionsRouter.sendRequestToProposed( - s_subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - s_donId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, s_donId ); // Get requestId from RequestStart event log topic 1 @@ -794,7 +667,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { /// @notice #_sendRequest contract FunctionsRouter__SendRequest is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #fulfill @@ -836,10 +709,7 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { } event RequestNotProcessed( - bytes32 indexed requestId, - address coordinator, - address transmitter, - FunctionsResponse.FulfillResult resultCode + bytes32 indexed requestId, address coordinator, address transmitter, FunctionsResponse.FulfillResult resultCode ); function test_Fulfill_RequestNotProcessedInvalidRequestId() public { @@ -870,16 +740,10 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { resultCode: FunctionsResponse.FulfillResult.INVALID_REQUEST_ID }); - (FunctionsResponse.FulfillResult resultCode, uint96 callbackGasCostJuels) = s_functionsRouter.fulfill( - response, - err, - juelsPerGas, - costWithoutCallback, - transmitter, - commitment - ); + (FunctionsResponse.FulfillResult resultCode, uint96 callbackGasCostJuels) = + s_functionsRouter.fulfill(response, err, juelsPerGas, costWithoutCallback, transmitter, commitment); - assertEq(uint(resultCode), uint(FunctionsResponse.FulfillResult.INVALID_REQUEST_ID)); + assertEq(uint256(resultCode), uint256(FunctionsResponse.FulfillResult.INVALID_REQUEST_ID)); assertEq(callbackGasCostJuels, 0); } @@ -910,16 +774,10 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { resultCode: FunctionsResponse.FulfillResult.INVALID_COMMITMENT }); - (FunctionsResponse.FulfillResult resultCode, uint96 callbackGasCostJuels) = s_functionsRouter.fulfill( - response, - err, - juelsPerGas, - costWithoutCallback, - transmitter, - commitment - ); + (FunctionsResponse.FulfillResult resultCode, uint96 callbackGasCostJuels) = + s_functionsRouter.fulfill(response, err, juelsPerGas, costWithoutCallback, transmitter, commitment); - assertEq(uint(resultCode), uint(FunctionsResponse.FulfillResult.INVALID_COMMITMENT)); + assertEq(uint256(resultCode), uint256(FunctionsResponse.FulfillResult.INVALID_COMMITMENT)); assertEq(callbackGasCostJuels, 0); } @@ -961,7 +819,7 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { // Find the storage slot that the Subscription is on vm.record(); s_functionsRouter.getSubscription(s_subscriptionId); - (bytes32[] memory reads, ) = vm.accesses(address(s_functionsRouter)); + (bytes32[] memory reads,) = vm.accesses(address(s_functionsRouter)); // The first read is from '_isExistingSubscription' which checks Subscription.owner on slot 0 // Slot 0 is shared with the Subscription.balance uint256 slot = uint256(reads[0]); @@ -1064,17 +922,13 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { vm.recordLogs(); bytes32 requestId = s_clientWithFailingCallback.sendSimpleRequestWithJavaScript( - sourceCode, - s_subscriptionId, - s_donId, - callbackGasLimit + sourceCode, s_subscriptionId, s_donId, callbackGasLimit ); // Get commitment data from OracleRequest event log Vm.Log[] memory entries = vm.getRecordedLogs(); - (, , , , , , , FunctionsResponse.Commitment memory _commitment) = abi.decode( - entries[0].data, - (address, uint64, address, bytes, uint16, bytes32, uint64, FunctionsResponse.Commitment) + (,,,,,,, FunctionsResponse.Commitment memory _commitment) = abi.decode( + entries[0].data, (address, uint64, address, bytes, uint16, bytes32, uint64, FunctionsResponse.Commitment) ); s_requests[requestKey] = Request({ @@ -1248,7 +1102,7 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { /// @notice #_callback contract FunctionsRouter__Callback is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #getContractById @@ -1283,10 +1137,7 @@ contract FunctionsRouter_GetProposedContractById is FunctionsRoutesSetup { // Deploy new Coordinator contract s_functionsCoordinator2 = new FunctionsCoordinatorTestHelper( - address(s_functionsRouter), - getCoordinatorConfig(), - address(s_linkEthFeed), - address(s_linkUsdFeed) + address(s_functionsRouter), getCoordinatorConfig(), address(s_linkEthFeed), address(s_linkUsdFeed) ); // Propose new Coordinator contract @@ -1330,10 +1181,7 @@ contract FunctionsRouter_GetProposedContractSet is FunctionsRoutesSetup { // Deploy new Coordinator contract s_functionsCoordinator2 = new FunctionsCoordinatorTestHelper( - address(s_functionsRouter), - getCoordinatorConfig(), - address(s_linkEthFeed), - address(s_linkUsdFeed) + address(s_functionsRouter), getCoordinatorConfig(), address(s_linkEthFeed), address(s_linkUsdFeed) ); // Propose new Coordinator contract @@ -1350,8 +1198,8 @@ contract FunctionsRouter_GetProposedContractSet is FunctionsRoutesSetup { vm.stopPrank(); vm.startPrank(STRANGER_ADDRESS); - (bytes32[] memory proposedContractSetIds, address[] memory proposedContractSetAddresses) = s_functionsRouter - .getProposedContractSet(); + (bytes32[] memory proposedContractSetIds, address[] memory proposedContractSetAddresses) = + s_functionsRouter.getProposedContractSet(); assertEq(proposedContractSetIds.length, 1); assertEq(proposedContractSetIds[0], s_donId); @@ -1371,10 +1219,7 @@ contract FunctionsRouter_ProposeContractsUpdate is FunctionsRoutesSetup { // Deploy new Coordinator contract s_functionsCoordinator2 = new FunctionsCoordinatorTestHelper( - address(s_functionsRouter), - getCoordinatorConfig(), - address(s_linkEthFeed), - address(s_linkUsdFeed) + address(s_functionsRouter), getCoordinatorConfig(), address(s_linkEthFeed), address(s_linkUsdFeed) ); // Propose new Coordinator contract @@ -1413,7 +1258,7 @@ contract FunctionsRouter_ProposeContractsUpdate is FunctionsRoutesSetup { } address[] memory proposedContractSetAddresses = new address[](INVALID_PROPOSAL_SET_LENGTH); for (uint256 i = 0; i < INVALID_PROPOSAL_SET_LENGTH; ++i) { - proposedContractSetAddresses[i] = address(uint160(uint(keccak256(abi.encodePacked(i + 111))))); + proposedContractSetAddresses[i] = address(uint160(uint256(keccak256(abi.encodePacked(i + 111))))); } vm.expectRevert(FunctionsRouter.InvalidProposal.selector); @@ -1441,9 +1286,7 @@ contract FunctionsRouter_ProposeContractsUpdate is FunctionsRoutesSetup { } event ContractProposed( - bytes32 proposedContractSetId, - address proposedContractSetFromAddress, - address proposedContractSetToAddress + bytes32 proposedContractSetId, address proposedContractSetFromAddress, address proposedContractSetToAddress ); function test_ProposeContractsUpdate_Success() public { @@ -1474,10 +1317,7 @@ contract FunctionsRouter_UpdateContracts is FunctionsRoutesSetup { // Deploy new Coordinator contract s_functionsCoordinator2 = new FunctionsCoordinatorTestHelper( - address(s_functionsRouter), - getCoordinatorConfig(), - address(s_linkEthFeed), - address(s_linkUsdFeed) + address(s_functionsRouter), getCoordinatorConfig(), address(s_linkEthFeed), address(s_linkUsdFeed) ); // Propose new Coordinator contract @@ -1515,8 +1355,8 @@ contract FunctionsRouter_UpdateContracts is FunctionsRoutesSetup { s_functionsRouter.updateContracts(); - (bytes32[] memory proposedContractSetIds, address[] memory proposedContractSetAddresses) = s_functionsRouter - .getProposedContractSet(); + (bytes32[] memory proposedContractSetIds, address[] memory proposedContractSetAddresses) = + s_functionsRouter.getProposedContractSet(); assertEq(proposedContractSetIds.length, 0); assertEq(proposedContractSetAddresses.length, 0); @@ -1525,17 +1365,17 @@ contract FunctionsRouter_UpdateContracts is FunctionsRoutesSetup { /// @notice #_whenNotPaused contract FunctionsRouter__WhenNotPaused is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_onlyRouterOwner contract FunctionsRouter__OnlyRouterOwner is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_onlySenderThatAcceptedToS contract FunctionsRouter__OnlySenderThatAcceptedToS is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #pause diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol index aa188f85ed..9fb38b013f 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol @@ -1,14 +1,21 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsRouter} from "../../dev/v1_X/FunctionsRouter.sol"; import {FunctionsSubscriptions} from "../../dev/v1_X/FunctionsSubscriptions.sol"; import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {BaseTest} from "./BaseTest.t.sol"; import {IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/IERC20.sol"; -import {FunctionsRouterSetup, FunctionsOwnerAcceptTermsOfServiceSetup, FunctionsClientSetup, FunctionsSubscriptionSetup, FunctionsClientRequestSetup, FunctionsFulfillmentSetup} from "./Setup.t.sol"; +import { + FunctionsClientRequestSetup, + FunctionsClientSetup, + FunctionsFulfillmentSetup, + FunctionsOwnerAcceptTermsOfServiceSetup, + FunctionsRouterSetup, + FunctionsSubscriptionSetup +} from "./Setup.t.sol"; import "forge-std/Vm.sol"; @@ -17,7 +24,9 @@ import "forge-std/Vm.sol"; // ================================================================ contract FunctionsSubscriptions_Constructor_Helper is FunctionsSubscriptions { - constructor(address link) FunctionsSubscriptions(link) {} + constructor( + address link + ) FunctionsSubscriptions(link) {} function getLinkToken() public view returns (IERC20) { return IERC20(i_linkToken); @@ -56,12 +65,12 @@ contract FunctionsSubscriptions_Constructor is BaseTest { /// @notice #_markRequestInFlight contract FunctionsSubscriptions__MarkRequestInFlight { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_pay contract FunctionsSubscriptions__Pay { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #ownerCancelSubscription @@ -387,7 +396,8 @@ contract FunctionsSubscriptions_GetSubscriptionsInRange is FunctionsSubscription FunctionsSubscriptionSetup.setUp(); // Create 2 more subscriptions - /* uint64 subscriptionId2 = */ s_functionsRouter.createSubscription(); + /* uint64 subscriptionId2 = */ + s_functionsRouter.createSubscription(); uint64 subscriptionId3 = s_functionsRouter.createSubscription(); // Give each one unique state @@ -421,10 +431,8 @@ contract FunctionsSubscriptions_GetSubscriptionsInRange is FunctionsSubscription vm.startPrank(STRANGER_ADDRESS); uint64 lastSubscriptionId = s_functionsRouter.getSubscriptionCount(); - FunctionsSubscriptions.Subscription[] memory subscriptions = s_functionsRouter.getSubscriptionsInRange( - s_subscriptionId, - lastSubscriptionId - ); + FunctionsSubscriptions.Subscription[] memory subscriptions = + s_functionsRouter.getSubscriptionsInRange(s_subscriptionId, lastSubscriptionId); assertEq(subscriptions.length, 3); @@ -479,10 +487,8 @@ contract FunctionsSubscriptions_GetConsumer is FunctionsSubscriptionSetup { vm.stopPrank(); vm.startPrank(STRANGER_ADDRESS); - FunctionsSubscriptions.Consumer memory consumer = s_functionsRouter.getConsumer( - address(s_functionsClient), - s_subscriptionId - ); + FunctionsSubscriptions.Consumer memory consumer = + s_functionsRouter.getConsumer(address(s_functionsClient), s_subscriptionId); assertEq(consumer.allowed, true); assertEq(consumer.initiatedRequests, 0); @@ -492,12 +498,12 @@ contract FunctionsSubscriptions_GetConsumer is FunctionsSubscriptionSetup { /// @notice #_isExistingSubscription contract FunctionsSubscriptions__IsExistingSubscription is FunctionsSubscriptionSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #_isAllowedConsumer contract FunctionsSubscriptions__IsAllowedConsumer { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #createSubscription @@ -625,13 +631,7 @@ contract FunctionsSubscriptions_ProposeSubscriptionOwnerTransfer is FunctionsSub bytes32 message2 = s_termsOfServiceAllowList.getMessage(NEW_OWNER_ADDRESS_WITH_TOS2, NEW_OWNER_ADDRESS_WITH_TOS2); bytes32 prefixedMessage2 = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", message2)); (uint8 v2, bytes32 r2, bytes32 s2) = vm.sign(TOS_SIGNER_PRIVATE_KEY, prefixedMessage2); - s_termsOfServiceAllowList.acceptTermsOfService( - NEW_OWNER_ADDRESS_WITH_TOS2, - NEW_OWNER_ADDRESS_WITH_TOS2, - r2, - s2, - v2 - ); + s_termsOfServiceAllowList.acceptTermsOfService(NEW_OWNER_ADDRESS_WITH_TOS2, NEW_OWNER_ADDRESS_WITH_TOS2, r2, s2, v2); vm.stopPrank(); vm.startPrank(OWNER_ADDRESS); @@ -899,7 +899,7 @@ contract FunctionsSubscriptions_RemoveConsumer is FunctionsSubscriptionSetup { /// @notice #_getMaxConsumers contract FunctionsSubscriptions__GetMaxConsumers is FunctionsRouterSetup { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #addConsumer @@ -1148,7 +1148,7 @@ contract FunctionsSubscriptions_CancelSubscription_ReceiveDeposit is FunctionsFu /// @notice #_cancelSubscriptionHelper contract FunctionsSubscriptions__CancelSubscriptionHelper { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #pendingRequestExists @@ -1256,9 +1256,8 @@ contract FunctionsSubscriptions_TimeoutRequests is FunctionsClientRequestSetup { event RequestTimedOut(bytes32 indexed requestId); function test_TimeoutRequests_Success() public { - uint64 consumerCompletedRequestsBefore = s_functionsRouter - .getConsumer(address(s_functionsClient), s_subscriptionId) - .completedRequests; + uint64 consumerCompletedRequestsBefore = + s_functionsRouter.getConsumer(address(s_functionsClient), s_subscriptionId).completedRequests; // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). bool checkTopic1 = false; @@ -1278,14 +1277,13 @@ contract FunctionsSubscriptions_TimeoutRequests is FunctionsClientRequestSetup { // Releases blocked balance and increments completed requests uint96 subscriptionBlockedBalanceAfter = s_functionsRouter.getSubscription(s_subscriptionId).blockedBalance; assertEq(0, subscriptionBlockedBalanceAfter); - uint64 consumerCompletedRequestsAfter = s_functionsRouter - .getConsumer(address(s_functionsClient), s_subscriptionId) - .completedRequests; + uint64 consumerCompletedRequestsAfter = + s_functionsRouter.getConsumer(address(s_functionsClient), s_subscriptionId).completedRequests; assertEq(consumerCompletedRequestsBefore + 1, consumerCompletedRequestsAfter); } } // @notice #_onlySubscriptionOwner contract FunctionsSubscriptions__OnlySubscriptionOwner { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol index 9bf09748b8..38981d0f3c 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol @@ -5,7 +5,7 @@ import {TermsOfServiceAllowList} from "../../dev/v1_X/accessControl/TermsOfServi import {TermsOfServiceAllowListConfig} from "../../dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol"; import {FunctionsClientTestHelper} from "./testhelpers/FunctionsClientTestHelper.sol"; -import {FunctionsRoutesSetup, FunctionsOwnerAcceptTermsOfServiceSetup} from "./Setup.t.sol"; +import {FunctionsOwnerAcceptTermsOfServiceSetup, FunctionsRoutesSetup} from "./Setup.t.sol"; import "forge-std/Vm.sol"; /// @notice #constructor @@ -45,10 +45,8 @@ contract FunctionsTermsOfServiceAllowList_UpdateConfig is FunctionsRoutesSetup { event ConfigUpdated(TermsOfServiceAllowListConfig config); function test_UpdateConfig_Success() public { - TermsOfServiceAllowListConfig memory configToSet = TermsOfServiceAllowListConfig({ - enabled: false, - signerPublicKey: TOS_SIGNER - }); + TermsOfServiceAllowListConfig memory configToSet = + TermsOfServiceAllowListConfig({enabled: false, signerPublicKey: TOS_SIGNER}); // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). bool checkTopic1 = false; @@ -323,9 +321,7 @@ contract FunctionsTermsOfServiceAllowList_HasAccess is FunctionsRoutesSetup { function test_HasAccess_TrueWhenDisabled() public { // Disable allow list, which opens all access - s_termsOfServiceAllowList.updateConfig( - TermsOfServiceAllowListConfig({enabled: false, signerPublicKey: TOS_SIGNER}) - ); + s_termsOfServiceAllowList.updateConfig(TermsOfServiceAllowListConfig({enabled: false, signerPublicKey: TOS_SIGNER})); // Send as stranger vm.stopPrank(); @@ -541,9 +537,7 @@ contract FunctionsTermsOfServiceAllowList_MigratePreviouslyAllowedSenders is Fun s_termsOfServiceAllowList.blockSender(currentlyBlockedSender); vm.mockCall( - MOCK_PREVIOUS_TOS_ADDRESS, - abi.encodeWithSelector(TermsOfServiceAllowList.hasAccess.selector), - abi.encode(true) + MOCK_PREVIOUS_TOS_ADDRESS, abi.encodeWithSelector(TermsOfServiceAllowList.hasAccess.selector), abi.encode(true) ); s_termsOfServiceAllowList.migratePreviouslyAllowedSenders(mockPreviousAllowlist); diff --git a/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol b/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol index 1ecc0fb7c0..860119b3ba 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol @@ -1,14 +1,19 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsRouter} from "../../dev/v1_X/FunctionsRouter.sol"; import {FunctionsSubscriptions} from "../../dev/v1_X/FunctionsSubscriptions.sol"; import {FunctionsRequest} from "../../dev/v1_X/libraries/FunctionsRequest.sol"; import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsClientTestHelper} from "./testhelpers/FunctionsClientTestHelper.sol"; -import {FunctionsRoutesSetup, FunctionsOwnerAcceptTermsOfServiceSetup, FunctionsSubscriptionSetup, FunctionsClientRequestSetup} from "./Setup.t.sol"; +import { + FunctionsClientRequestSetup, + FunctionsOwnerAcceptTermsOfServiceSetup, + FunctionsRoutesSetup, + FunctionsSubscriptionSetup +} from "./Setup.t.sol"; import "forge-std/Vm.sol"; @@ -89,7 +94,9 @@ contract Gas_SendRequest is FunctionsSubscriptionSetup { bytes s_minimalRequestData; bytes s_maximalRequestData; - function _makeStringOfBytesSize(uint16 bytesSize) internal pure returns (string memory) { + function _makeStringOfBytesSize( + uint16 bytesSize + ) internal pure returns (string memory) { return vm.toString(new bytes((bytesSize - 2) / 2)); } @@ -103,10 +110,7 @@ contract Gas_SendRequest is FunctionsSubscriptionSetup { FunctionsRequest.Request memory minimalRequest; string memory minimalSourceCode = "return Functions.encodeString('hello world');"; FunctionsRequest._initializeRequest( - minimalRequest, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - minimalSourceCode + minimalRequest, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, minimalSourceCode ); s_minimalRequestData = FunctionsRequest._encodeCBOR(minimalRequest); } @@ -118,10 +122,7 @@ contract Gas_SendRequest is FunctionsSubscriptionSetup { // Create maximum viable request data - 30 KB encoded data string memory maximalSourceCode = _makeStringOfBytesSize(29_898); // CBOR size without source code is 102 bytes FunctionsRequest._initializeRequest( - maxmimalRequest, - FunctionsRequest.Location.Inline, - FunctionsRequest.CodeLanguage.JavaScript, - maximalSourceCode + maxmimalRequest, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, maximalSourceCode ); s_maximalRequestData = FunctionsRequest._encodeCBOR(maxmimalRequest); assertEq(s_maximalRequestData.length, 30_000); @@ -158,7 +159,9 @@ contract Gas_FulfillRequest_Setup is FunctionsClientRequestSetup { FunctionsClientTestHelper s_functionsClientWithMaximumReturnData; - function _makeStringOfBytesSize(uint16 bytesSize) internal pure returns (string memory) { + function _makeStringOfBytesSize( + uint16 bytesSize + ) internal pure returns (string memory) { return vm.toString(new bytes((bytesSize - 2) / 2)); } @@ -213,11 +216,8 @@ contract Gas_FulfillRequest_Setup is FunctionsClientRequestSetup { signerPrivateKeys[1] = NOP_SIGNER_PRIVATE_KEY_2; signerPrivateKeys[2] = NOP_SIGNER_PRIVATE_KEY_3; - (bytes32[] memory rawRs, bytes32[] memory rawSs, bytes32 rawVs) = _signReport( - report, - reportContext, - signerPrivateKeys - ); + (bytes32[] memory rawRs, bytes32[] memory rawSs, bytes32 rawVs) = + _signReport(report, reportContext, signerPrivateKeys); // Store the report data s_reports[1] = Report({rs: rawRs, ss: rawSs, vs: rawVs, report: report, reportContext: reportContext}); @@ -256,11 +256,8 @@ contract Gas_FulfillRequest_Setup is FunctionsClientRequestSetup { signerPrivateKeys[1] = NOP_SIGNER_PRIVATE_KEY_2; signerPrivateKeys[2] = NOP_SIGNER_PRIVATE_KEY_3; - (bytes32[] memory rawRs, bytes32[] memory rawSs, bytes32 rawVs) = _signReport( - report, - reportContext, - signerPrivateKeys - ); + (bytes32[] memory rawRs, bytes32[] memory rawSs, bytes32 rawVs) = + _signReport(report, reportContext, signerPrivateKeys); // Store the report data s_reports[2] = Report({rs: rawRs, ss: rawSs, vs: rawVs, report: report, reportContext: reportContext}); diff --git a/contracts/src/v0.8/functions/tests/v1_X/OCR2.t.sol b/contracts/src/v0.8/functions/tests/v1_X/OCR2.t.sol index 3dc0db85a4..e1158a1e08 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/OCR2.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/OCR2.t.sol @@ -28,7 +28,7 @@ contract OCR2Base_Transmitters {} /// @notice #_report contract OCR2Base__Report { - // TODO: make contract internal function helper +// TODO: make contract internal function helper } /// @notice #requireExpectedMsgDataLength diff --git a/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol b/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol index ff2ca42d30..4940b4fa9a 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol @@ -1,19 +1,22 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; -import {FunctionsClientHarness} from "./testhelpers/FunctionsClientHarness.sol"; -import {ZKSyncFunctionsRouterHarness, ZKSyncFunctionsRouter} from "./testhelpers/ZKSyncFunctionsRouterHarness.sol"; -import {FunctionsRouter as FunctionsRouterStable} from "../../v1_0_0/FunctionsRouter.sol"; -import {FunctionsRouterHarness, FunctionsRouter} from "./testhelpers/FunctionsRouterHarness.sol"; -import {FunctionsCoordinatorHarness} from "./testhelpers/FunctionsCoordinatorHarness.sol"; -import {FunctionsBilling} from "../../dev/v1_X/FunctionsBilling.sol"; -import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; import {MockV3Aggregator} from "../../../shared/mocks/MockV3Aggregator.sol"; +import {FunctionsBilling} from "../../dev/v1_X/FunctionsBilling.sol"; import {TermsOfServiceAllowList} from "../../dev/v1_X/accessControl/TermsOfServiceAllowList.sol"; import {TermsOfServiceAllowListConfig} from "../../dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol"; -import {MockLinkToken} from "./testhelpers/MockLinkToken.sol"; + import {FunctionsBillingConfig} from "../../dev/v1_X/interfaces/IFunctionsBilling.sol"; +import {FunctionsResponse} from "../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {FunctionsRouter as FunctionsRouterStable} from "../../v1_0_0/FunctionsRouter.sol"; +import {BaseTest} from "./BaseTest.t.sol"; +import {FunctionsClientHarness} from "./testhelpers/FunctionsClientHarness.sol"; + +import {FunctionsCoordinatorHarness} from "./testhelpers/FunctionsCoordinatorHarness.sol"; +import {FunctionsRouter, FunctionsRouterHarness} from "./testhelpers/FunctionsRouterHarness.sol"; + +import {MockLinkToken} from "./testhelpers/MockLinkToken.sol"; +import {ZKSyncFunctionsRouter, ZKSyncFunctionsRouterHarness} from "./testhelpers/ZKSyncFunctionsRouterHarness.sol"; import "forge-std/Vm.sol"; @@ -50,18 +53,12 @@ contract FunctionsRouterSetup is BaseTest { s_linkEthFeed = new MockV3Aggregator(LINK_ETH_DECIMALS, LINK_ETH_RATE); s_linkUsdFeed = new MockV3Aggregator(LINK_USD_DECIMALS, LINK_USD_RATE); s_functionsCoordinator = new FunctionsCoordinatorHarness( - address(s_functionsRouter), - getCoordinatorConfig(), - address(s_linkEthFeed), - address(s_linkUsdFeed) + address(s_functionsRouter), getCoordinatorConfig(), address(s_linkEthFeed), address(s_linkUsdFeed) ); address[] memory initialAllowedSenders; address[] memory initialBlockedSenders; s_termsOfServiceAllowList = new TermsOfServiceAllowList( - getTermsOfServiceConfig(), - initialAllowedSenders, - initialBlockedSenders, - MOCK_PREVIOUS_TOS_ADDRESS + getTermsOfServiceConfig(), initialAllowedSenders, initialBlockedSenders, MOCK_PREVIOUS_TOS_ADDRESS ); } @@ -71,35 +68,33 @@ contract FunctionsRouterSetup is BaseTest { maxCallbackGasLimits[1] = 500_000; maxCallbackGasLimits[2] = 1_000_000; - return - FunctionsRouter.Config({ - maxConsumersPerSubscription: s_maxConsumersPerSubscription, - adminFee: s_adminFee, - handleOracleFulfillmentSelector: s_handleOracleFulfillmentSelector, - maxCallbackGasLimits: maxCallbackGasLimits, - gasForCallExactCheck: 5000, - subscriptionDepositMinimumRequests: s_subscriptionDepositMinimumRequests, - subscriptionDepositJuels: s_subscriptionDepositJuels - }); + return FunctionsRouter.Config({ + maxConsumersPerSubscription: s_maxConsumersPerSubscription, + adminFee: s_adminFee, + handleOracleFulfillmentSelector: s_handleOracleFulfillmentSelector, + maxCallbackGasLimits: maxCallbackGasLimits, + gasForCallExactCheck: 5000, + subscriptionDepositMinimumRequests: s_subscriptionDepositMinimumRequests, + subscriptionDepositJuels: s_subscriptionDepositJuels + }); } function getCoordinatorConfig() public view returns (FunctionsBillingConfig memory) { - return - FunctionsBillingConfig({ - feedStalenessSeconds: 24 * 60 * 60, // 1 day - gasOverheadAfterCallback: 93_942, - gasOverheadBeforeCallback: 105_000, - requestTimeoutSeconds: 60 * 5, // 5 minutes - donFeeCentsUsd: s_donFee, - operationFeeCentsUsd: s_operationFee, - maxSupportedRequestDataVersion: 1, - fulfillmentGasPriceOverEstimationBP: 5000, - fallbackNativePerUnitLink: 5000000000000000, - fallbackUsdPerUnitLink: 1400000000, - fallbackUsdPerUnitLinkDecimals: 8, - minimumEstimateGasPriceWei: 1000000000, // 1 gwei - transmitTxSizeBytes: 1764 - }); + return FunctionsBillingConfig({ + feedStalenessSeconds: 24 * 60 * 60, // 1 day + gasOverheadAfterCallback: 93_942, + gasOverheadBeforeCallback: 105_000, + requestTimeoutSeconds: 60 * 5, // 5 minutes + donFeeCentsUsd: s_donFee, + operationFeeCentsUsd: s_operationFee, + maxSupportedRequestDataVersion: 1, + fulfillmentGasPriceOverEstimationBP: 5000, + fallbackNativePerUnitLink: 5000000000000000, + fallbackUsdPerUnitLink: 1400000000, + fallbackUsdPerUnitLinkDecimals: 8, + minimumEstimateGasPriceWei: 1000000000, // 1 gwei + transmitTxSizeBytes: 1764 + }); } function getTermsOfServiceConfig() public view returns (TermsOfServiceAllowListConfig memory) { @@ -130,16 +125,15 @@ contract ZKSyncFunctionsRouterSetup is BaseTest { maxCallbackGasLimits[1] = 500_000; maxCallbackGasLimits[2] = 1_000_000; - return - FunctionsRouterStable.Config({ - maxConsumersPerSubscription: s_maxConsumersPerSubscription, - adminFee: s_adminFee, - handleOracleFulfillmentSelector: s_handleOracleFulfillmentSelector, - maxCallbackGasLimits: maxCallbackGasLimits, - gasForCallExactCheck: 5000, - subscriptionDepositMinimumRequests: s_subscriptionDepositMinimumRequests, - subscriptionDepositJuels: s_subscriptionDepositJuels - }); + return FunctionsRouterStable.Config({ + maxConsumersPerSubscription: s_maxConsumersPerSubscription, + adminFee: s_adminFee, + handleOracleFulfillmentSelector: s_handleOracleFulfillmentSelector, + maxCallbackGasLimits: maxCallbackGasLimits, + gasForCallExactCheck: 5000, + subscriptionDepositMinimumRequests: s_subscriptionDepositMinimumRequests, + subscriptionDepositJuels: s_subscriptionDepositJuels + }); } } @@ -170,14 +164,12 @@ contract FunctionsDONSetup is FunctionsRouterSetup { uint64 internal s_offchainConfigVersion = 1; bytes internal s_offchainConfig = new bytes(0); - bytes s_thresholdKey = - vm.parseBytes( - "0x7b2247726f7570223a2250323536222c22475f626172223a22424f2f344358424575792f64547a436a612b614e774d666c2b645a77346d325036533246536b4966472f6633527547327337392b494e79642b4639326a346f586e67433657427561556a752b4a637a32377834484251343d222c2248223a224250532f72485065377941467232416c447a79395549466258776d46384666756632596d514177666e3342373844336f474845643247474536466e616f34552b4c6a4d4d5756792b464f7075686e77554f6a75427a64773d222c22484172726179223a5b22424d75546862414473337768316e67764e56792f6e3841316d42674b5a4b4c475259385937796a39695769337242502f316a32347571695869534531437554384c6f51446a386248466d384345477667517158494e62383d222c224248687974716d6e34314373322f4658416f43737548687151486236382f597930524b2b41354c6647654f645a78466f4e386c442b45656e4b587a544943784f6d3231636d535447364864484a6e336342645663714c673d222c22424d794e7a4534616e596258474d72694f52664c52634e7239766c347878654279316432452f4464335a744630546372386267567435582b2b42355967552b4b7875726e512f4d656b6857335845782b79506e4e4f584d3d222c22424d6a753272375a657a4a45545539413938746a6b6d547966796a79493735345742555835505174724a6578346d6766366130787373426d50325a7472412b55576d504e592b6d4664526b46674f7944694c53614e59453d225d7d" - ); - bytes s_donKey = - vm.parseBytes( - "0xf2f9c47363202d89aa9fa70baf783d70006fe493471ac8cfa82f1426fd09f16a5f6b32b7c4b5d5165cd147a6e513ba4c0efd39d969d6b20a8a21126f0411b9c6" - ); + bytes s_thresholdKey = vm.parseBytes( + "0x7b2247726f7570223a2250323536222c22475f626172223a22424f2f344358424575792f64547a436a612b614e774d666c2b645a77346d325036533246536b4966472f6633527547327337392b494e79642b4639326a346f586e67433657427561556a752b4a637a32377834484251343d222c2248223a224250532f72485065377941467232416c447a79395549466258776d46384666756632596d514177666e3342373844336f474845643247474536466e616f34552b4c6a4d4d5756792b464f7075686e77554f6a75427a64773d222c22484172726179223a5b22424d75546862414473337768316e67764e56792f6e3841316d42674b5a4b4c475259385937796a39695769337242502f316a32347571695869534531437554384c6f51446a386248466d384345477667517158494e62383d222c224248687974716d6e34314373322f4658416f43737548687151486236382f597930524b2b41354c6647654f645a78466f4e386c442b45656e4b587a544943784f6d3231636d535447364864484a6e336342645663714c673d222c22424d794e7a4534616e596258474d72694f52664c52634e7239766c347878654279316432452f4464335a744630546372386267567435582b2b42355967552b4b7875726e512f4d656b6857335845782b79506e4e4f584d3d222c22424d6a753272375a657a4a45545539413938746a6b6d547966796a79493735345742555835505174724a6578346d6766366130787373426d50325a7472412b55576d504e592b6d4664526b46674f7944694c53614e59453d225d7d" + ); + bytes s_donKey = vm.parseBytes( + "0xf2f9c47363202d89aa9fa70baf783d70006fe493471ac8cfa82f1426fd09f16a5f6b32b7c4b5d5165cd147a6e513ba4c0efd39d969d6b20a8a21126f0411b9c6" + ); function setUp() public virtual override { FunctionsRouterSetup.setUp(); @@ -196,12 +188,7 @@ contract FunctionsDONSetup is FunctionsRouterSetup { // set OCR config s_functionsCoordinator.setConfig( - s_signers, - s_transmitters, - s_f, - s_onchainConfig, - s_offchainConfigVersion, - s_offchainConfig + s_signers, s_transmitters, s_f, s_onchainConfig, s_offchainConfigVersion, s_offchainConfig ); } @@ -299,6 +286,7 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { bytes[] bytesArgs; uint32 callbackGasLimit; } + struct Request { RequestData requestData; bytes32 requestId; @@ -333,39 +321,35 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { /// @notice Predicts the estimated cost (maximum cost) of a request /// @dev Meant only for Ethereum, does not add L2 chains' L1 fee - function _getExpectedCostEstimate(uint256 callbackGas) internal view returns (uint96) { + function _getExpectedCostEstimate( + uint256 callbackGas + ) internal view returns (uint96) { uint256 gasPrice = TX_GASPRICE_START < getCoordinatorConfig().minimumEstimateGasPriceWei ? getCoordinatorConfig().minimumEstimateGasPriceWei : TX_GASPRICE_START; - uint256 gasPriceWithOverestimation = gasPrice + - ((gasPrice * getCoordinatorConfig().fulfillmentGasPriceOverEstimationBP) / 10_000); + uint256 gasPriceWithOverestimation = + gasPrice + ((gasPrice * getCoordinatorConfig().fulfillmentGasPriceOverEstimationBP) / 10_000); uint96 juelsPerGas = uint96((1e18 * gasPriceWithOverestimation) / uint256(LINK_ETH_RATE)); - uint96 gasOverheadJuels = juelsPerGas * - ((getCoordinatorConfig().gasOverheadBeforeCallback + getCoordinatorConfig().gasOverheadAfterCallback)); + uint96 gasOverheadJuels = juelsPerGas + * ((getCoordinatorConfig().gasOverheadBeforeCallback + getCoordinatorConfig().gasOverheadAfterCallback)); uint96 callbackGasCostJuels = uint96(juelsPerGas * callbackGas); bytes memory emptyData = new bytes(0); - return - gasOverheadJuels + - s_functionsCoordinator.getDONFeeJuels(emptyData) + - s_adminFee + - s_functionsCoordinator.getOperationFeeJuels() + - callbackGasCostJuels; + return gasOverheadJuels + s_functionsCoordinator.getDONFeeJuels(emptyData) + s_adminFee + + s_functionsCoordinator.getOperationFeeJuels() + callbackGasCostJuels; } /// @notice Predicts the actual cost of a request /// @dev Meant only for Ethereum, does not add L2 chains' L1 fee - function _getExpectedCost(uint256 gasUsed) internal view returns (uint96) { + function _getExpectedCost( + uint256 gasUsed + ) internal view returns (uint96) { uint96 juelsPerGas = uint96((1e18 * TX_GASPRICE_START) / uint256(LINK_ETH_RATE)); - uint96 gasOverheadJuels = juelsPerGas * - (getCoordinatorConfig().gasOverheadBeforeCallback + getCoordinatorConfig().gasOverheadAfterCallback); + uint96 gasOverheadJuels = + juelsPerGas * (getCoordinatorConfig().gasOverheadBeforeCallback + getCoordinatorConfig().gasOverheadAfterCallback); uint96 callbackGasCostJuels = uint96(juelsPerGas * gasUsed); bytes memory emptyData = new bytes(0); - return - gasOverheadJuels + - s_functionsCoordinator.getDONFeeJuels(emptyData) + - s_adminFee + - s_functionsCoordinator.getOperationFeeJuels() + - callbackGasCostJuels; + return gasOverheadJuels + s_functionsCoordinator.getDONFeeJuels(emptyData) + s_adminFee + + s_functionsCoordinator.getOperationFeeJuels() + callbackGasCostJuels; } /// @notice Send a request and store information about it in s_requests @@ -392,20 +376,13 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { vm.recordLogs(); bytes32 requestId = FunctionsClientHarness(client).sendRequest( - s_donId, - sourceCode, - secrets, - args, - bytesArgs, - s_subscriptionId, - callbackGasLimit + s_donId, sourceCode, secrets, args, bytesArgs, s_subscriptionId, callbackGasLimit ); // Get commitment data from OracleRequest event log Vm.Log[] memory entries = vm.getRecordedLogs(); - (, , , , , , , FunctionsResponse.Commitment memory commitment) = abi.decode( - entries[0].data, - (address, uint64, address, bytes, uint16, bytes32, uint64, FunctionsResponse.Commitment) + (,,,,,,, FunctionsResponse.Commitment memory commitment) = abi.decode( + entries[0].data, (address, uint64, address, bytes, uint16, bytes32, uint64, FunctionsResponse.Commitment) ); s_requests[requestNumberKey] = Request({ requestData: RequestData({ @@ -451,13 +428,7 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { uint32 callbackGasLimit ) internal { _sendAndStoreRequest( - requestNumberKey, - sourceCode, - secrets, - args, - bytesArgs, - callbackGasLimit, - address(s_functionsClient) + requestNumberKey, sourceCode, secrets, args, bytesArgs, callbackGasLimit, address(s_functionsClient) ); } @@ -549,11 +520,8 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { signerPrivateKeys[0] = NOP_SIGNER_PRIVATE_KEY_1; signerPrivateKeys[1] = NOP_SIGNER_PRIVATE_KEY_2; signerPrivateKeys[2] = NOP_SIGNER_PRIVATE_KEY_3; - (bytes32[] memory rawRs, bytes32[] memory rawSs, bytes32 rawVs) = _signReport( - report, - reportContext, - signerPrivateKeys - ); + (bytes32[] memory rawRs, bytes32[] memory rawSs, bytes32 rawVs) = + _signReport(report, reportContext, signerPrivateKeys); return Report({report: report, reportContext: reportContext, rs: rawRs, ss: rawSs, vs: rawVs}); } @@ -597,7 +565,7 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { if (expectedToSucceed) { // Get actual cost from RequestProcessed event log - (uint96 totalCostJuels, , , , , ) = abi.decode( + (uint96 totalCostJuels,,,,,) = abi.decode( vm.getRecordedLogs()[requestProcessedStartIndex].data, (uint96, address, FunctionsResponse.FulfillResult, bytes, bytes, bytes) ); @@ -679,11 +647,7 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { /// @dev @param expectedToSucceed is overloaded to give the value as true - The report transmission is expected to produce a RequestProcessed event for every fulfillment /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction with the default amount of gas - function _reportAndStore( - uint256[] memory requestNumberKeys, - string[] memory results, - bytes[] memory errors - ) internal { + function _reportAndStore(uint256[] memory requestNumberKeys, string[] memory results, bytes[] memory errors) internal { _reportAndStore(requestNumberKeys, results, errors, NOP_TRANSMITTER_ADDRESS_1); } } diff --git a/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol b/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol index 8fc83bf5be..1fda5121a6 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; -import {ZKSyncFunctionsRouter} from "../../v1_3_0_zksync/ZKSyncFunctionsRouter.sol"; +import {MockSystemContext} from "../../../shared/test/mocks/MockSystemContext.sol"; import {FunctionsRouter} from "../../v1_0_0/FunctionsRouter.sol"; -import {ZKSyncFunctionsRouterHarness} from "./testhelpers/ZKSyncFunctionsRouterHarness.sol"; +import {ZKSyncFunctionsRouter} from "../../v1_3_0_zksync/ZKSyncFunctionsRouter.sol"; +import {BaseTest} from "./BaseTest.t.sol"; + import {ZKSyncFunctionsRouterSetup} from "./Setup.t.sol"; -import {MockSystemContext} from "../../../shared/test/mocks/MockSystemContext.sol"; +import {ZKSyncFunctionsRouterHarness} from "./testhelpers/ZKSyncFunctionsRouterHarness.sol"; contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { MockClientSuccess internal s_mockClientSuccess; @@ -37,14 +38,8 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { uint32 callbackGasLimit = 4_000_000; address noCodeAddress = address(12345); - ZKSyncFunctionsRouter.CallbackResult memory result = _callback( - reqId, - resp, - err, - totalGas, - callbackGasLimit, - noCodeAddress - ); + ZKSyncFunctionsRouter.CallbackResult memory result = + _callback(reqId, resp, err, totalGas, callbackGasLimit, noCodeAddress); assertFalse(result.success, "Should skip => success=false"); assertEq(result.gasUsed, 0, "gasUsed=0 for skip"); @@ -59,14 +54,7 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { uint32 callbackGasLimit = 4_000_000; address client = address(s_mockClientSuccess); - ZKSyncFunctionsRouter.CallbackResult memory result = _callback( - reqId, - resp, - err, - totalGas, - callbackGasLimit, - client - ); + ZKSyncFunctionsRouter.CallbackResult memory result = _callback(reqId, resp, err, totalGas, callbackGasLimit, client); assertTrue(result.success, "callback should succeed"); assertGt(result.gasUsed, 0, "some gas used"); @@ -81,14 +69,7 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { uint32 totalGas = 5_000_000; uint32 callbackGasLimit = 4_000_000; address client = address(s_mockClientRevert); - ZKSyncFunctionsRouter.CallbackResult memory result = _callback( - reqId, - resp, - err, - totalGas, - callbackGasLimit, - client - ); + ZKSyncFunctionsRouter.CallbackResult memory result = _callback(reqId, resp, err, totalGas, callbackGasLimit, client); assertFalse(result.success, "client revert => success=false"); assertGt(result.gasUsed, 0, "some gas is consumed"); @@ -106,14 +87,7 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { uint32 callbackGasLimit = 4_000_000; address client = address(s_mockClientSuccess); uint256 startGas = gasleft(); - ZKSyncFunctionsRouter.CallbackResult memory result = _callback( - reqId, - resp, - err, - totalGas, - callbackGasLimit, - client - ); + ZKSyncFunctionsRouter.CallbackResult memory result = _callback(reqId, resp, err, totalGas, callbackGasLimit, client); uint256 endGas = gasleft(); uint256 actualUsed = startGas - endGas; assertTrue(result.success, "callback success"); @@ -134,14 +108,7 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { uint32 callbackGasLimit = 4_000_000; address client = address(bigClient); - ZKSyncFunctionsRouter.CallbackResult memory result = _callback( - reqId, - resp, - err, - totalGas, - callbackGasLimit, - client - ); + ZKSyncFunctionsRouter.CallbackResult memory result = _callback(reqId, resp, err, totalGas, callbackGasLimit, client); assertTrue(result.success, "Should succeed"); uint256 expectedMax = s_functionsRouter.MAX_CALLBACK_RETURN_BYTES(); // The returned data should be truncated exactly to expectedMax. @@ -157,14 +124,8 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { uint32 callbackGasLimit, address client ) internal returns (FunctionsRouter.CallbackResult memory) { - bytes memory payload = abi.encodeWithSelector( - s_functionsRouter.exposed_callback.selector, - reqId, - resp, - err, - callbackGasLimit, - client - ); + bytes memory payload = + abi.encodeWithSelector(s_functionsRouter.exposed_callback.selector, reqId, resp, err, callbackGasLimit, client); (bool ok, bytes memory retData) = address(s_functionsRouter).call{gas: totalGas}(payload); assertTrue(ok, "callback should succeed"); return abi.decode(retData, (FunctionsRouter.CallbackResult)); @@ -181,7 +142,7 @@ contract MockClientLargeReturn { function handleOracleFulfillment(bytes32, bytes memory, bytes memory) external pure returns (bytes memory) { // Return ~1,000 bytes. bytes memory largeData = new bytes(1000); - for (uint i = 0; i < 1000; i++) { + for (uint256 i = 0; i < 1000; i++) { largeData[i] = bytes1(uint8(65 + (i % 26))); // Fill with A..Z. } return largeData; diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientHarness.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientHarness.sol index f0cb3965b5..ce4a4bb7d3 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientHarness.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientHarness.sol @@ -1,13 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsClientUpgradeHelper} from "./FunctionsClientUpgradeHelper.sol"; import {FunctionsResponse} from "../../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {FunctionsClientUpgradeHelper} from "./FunctionsClientUpgradeHelper.sol"; /// @title Functions Client Test Harness /// @notice Contract to expose internal functions for testing purposes contract FunctionsClientHarness is FunctionsClientUpgradeHelper { - constructor(address router) FunctionsClientUpgradeHelper(router) {} + constructor( + address router + ) FunctionsClientUpgradeHelper(router) {} function getRouter_HARNESS() external view returns (address) { return address(i_functionsRouter); diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientTestHelper.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientTestHelper.sol index c300f4d2b8..69ad71a3eb 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientTestHelper.sol @@ -4,8 +4,8 @@ pragma solidity ^0.8.19; import {ITermsOfServiceAllowList} from "../../../dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol"; import {IFunctionsSubscriptions} from "../../../dev/v1_X/interfaces/IFunctionsSubscriptions.sol"; -import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; import {FunctionsClient} from "../../../dev/v1_X/FunctionsClient.sol"; +import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; contract FunctionsClientTestHelper is FunctionsClient { using FunctionsRequest for FunctionsRequest.Request; @@ -22,7 +22,9 @@ contract FunctionsClientTestHelper is FunctionsClient { uint64 private s_subscriptionId; bytes32 private s_donId; - constructor(address router) FunctionsClient(router) {} + constructor( + address router + ) FunctionsClient(router) {} function sendRequest( bytes32 donId, @@ -65,11 +67,7 @@ contract FunctionsClientTestHelper is FunctionsClient { request._initializeRequestForInlineJavaScript(sourceCode); bytes memory requestData = FunctionsRequest._encodeCBOR(request); requestId = i_functionsRouter.sendRequestToProposed( - subscriptionId, - requestData, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - donId + subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, donId ); emit RequestSent(requestId); emit SendRequestInvoked(requestId, sourceCode, subscriptionId); @@ -81,7 +79,9 @@ contract FunctionsClientTestHelper is FunctionsClient { allowList.acceptTermsOfService(acceptor, recipient, r, s, v); } - function acceptSubscriptionOwnerTransfer(uint64 subscriptionId) external { + function acceptSubscriptionOwnerTransfer( + uint64 subscriptionId + ) external { IFunctionsSubscriptions(address(i_functionsRouter)).acceptSubscriptionOwnerTransfer(subscriptionId); } @@ -103,15 +103,21 @@ contract FunctionsClientTestHelper is FunctionsClient { emit FulfillRequestInvoked(requestId, response, err); } - function setRevertFulfillRequest(bool on) external { + function setRevertFulfillRequest( + bool on + ) external { s_revertFulfillRequest = on; } - function setRevertFulfillRequestMessage(string memory message) external { + function setRevertFulfillRequestMessage( + string memory message + ) external { s_revertFulfillRequestMessage = message; } - function setDoInvalidOperation(bool on) external { + function setDoInvalidOperation( + bool on + ) external { s_doInvalidOperation = on; } diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientUpgradeHelper.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientUpgradeHelper.sol index e0f636ee89..bcc93fbcb1 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientUpgradeHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientUpgradeHelper.sol @@ -1,14 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; -import {FunctionsClient} from "../../../dev/v1_X/FunctionsClient.sol"; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; +import {FunctionsClient} from "../../../dev/v1_X/FunctionsClient.sol"; +import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; contract FunctionsClientUpgradeHelper is FunctionsClient, ConfirmedOwner { using FunctionsRequest for FunctionsRequest.Request; - constructor(address router) FunctionsClient(router) ConfirmedOwner(msg.sender) {} + constructor( + address router + ) FunctionsClient(router) ConfirmedOwner(msg.sender) {} event ResponseReceived(bytes32 indexed requestId, bytes result, bytes err); @@ -83,11 +85,7 @@ contract FunctionsClientUpgradeHelper is FunctionsClient, ConfirmedOwner { bytes32 donId ) internal returns (bytes32) { bytes32 requestId = i_functionsRouter.sendRequestToProposed( - subscriptionId, - data, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - donId + subscriptionId, data, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, donId ); emit RequestSent(requestId); return requestId; diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientWithEmptyCallback.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientWithEmptyCallback.sol index e567471773..4a7ae76038 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientWithEmptyCallback.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsClientWithEmptyCallback.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; import {FunctionsClient} from "../../../dev/v1_X/FunctionsClient.sol"; +import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; contract FunctionsClientWithEmptyCallback is FunctionsClient { using FunctionsRequest for FunctionsRequest.Request; @@ -10,7 +10,9 @@ contract FunctionsClientWithEmptyCallback is FunctionsClient { event SendRequestInvoked(bytes32 requestId, string sourceCode, uint64 subscriptionId); event FulfillRequestInvoked(bytes32 requestId, bytes response, bytes err); - constructor(address router) FunctionsClient(router) {} + constructor( + address router + ) FunctionsClient(router) {} function sendSimpleRequestWithJavaScript( string memory sourceCode, @@ -25,7 +27,7 @@ contract FunctionsClientWithEmptyCallback is FunctionsClient { emit SendRequestInvoked(requestId, sourceCode, subscriptionId); } - function _fulfillRequest(bytes32 /*requestId*/, bytes memory /*response*/, bytes memory /*err*/) internal override { + function _fulfillRequest(bytes32, /*requestId*/ bytes memory, /*response*/ bytes memory /*err*/ ) internal override { // Do nothing } } diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorHarness.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorHarness.sol index 0de449f3a0..c84d22a037 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorHarness.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorHarness.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsCoordinator} from "../../../dev/v1_X/FunctionsCoordinator.sol"; import {FunctionsBilling} from "../../../dev/v1_X/FunctionsBilling.sol"; -import {FunctionsResponse} from "../../../dev/v1_X/libraries/FunctionsResponse.sol"; +import {FunctionsCoordinator} from "../../../dev/v1_X/FunctionsCoordinator.sol"; + import {FunctionsBillingConfig} from "../../../dev/v1_X/interfaces/IFunctionsBilling.sol"; +import {FunctionsResponse} from "../../../dev/v1_X/libraries/FunctionsResponse.sol"; /// @title Functions Coordinator Test Harness /// @notice Contract to expose internal functions for testing purposes @@ -24,7 +25,9 @@ contract FunctionsCoordinatorHarness is FunctionsCoordinator { s_router_HARNESS = router; } - function isTransmitter_HARNESS(address node) external view returns (bool) { + function isTransmitter_HARNESS( + address node + ) external view returns (bool) { return super._isTransmitter(node); } @@ -37,7 +40,9 @@ contract FunctionsCoordinatorHarness is FunctionsCoordinator { return super._getTransmitters(); } - function report_HARNESS(DecodedReport memory decodedReport) external { + function report_HARNESS( + DecodedReport memory decodedReport + ) external { return super._report(decodedReport); } @@ -111,17 +116,16 @@ contract FunctionsCoordinatorHarness is FunctionsCoordinator { uint64 _encodedConfigVersion, bytes memory _encodedConfig ) internal pure returns (bytes32) { - return - super._configDigestFromConfigData( - _chainId, - _contractAddress, - _configCount, - _signers, - _transmitters, - _f, - _onchainConfig, - _encodedConfigVersion, - _encodedConfig - ); + return super._configDigestFromConfigData( + _chainId, + _contractAddress, + _configCount, + _signers, + _transmitters, + _f, + _onchainConfig, + _encodedConfigVersion, + _encodedConfig + ); } } diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorTestHelper.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorTestHelper.sol index 8703d2b254..f36853df0a 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsCoordinatorTestHelper.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsCoordinator} from "../../../dev/v1_X/FunctionsCoordinator.sol"; import {FunctionsBilling} from "../../../dev/v1_X/FunctionsBilling.sol"; +import {FunctionsCoordinator} from "../../../dev/v1_X/FunctionsCoordinator.sol"; import {FunctionsBillingConfig} from "../../../dev/v1_X/interfaces/IFunctionsBilling.sol"; contract FunctionsCoordinatorTestHelper is FunctionsCoordinator { @@ -13,7 +13,9 @@ contract FunctionsCoordinatorTestHelper is FunctionsCoordinator { address linkToUsdFeed ) FunctionsCoordinator(router, config, linkToNativeFeed, linkToUsdFeed) {} - function callReport(bytes calldata report) external { + function callReport( + bytes calldata report + ) external { address[MAX_NUM_ORACLES] memory signers; signers[0] = msg.sender; ( diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsLoadTestClient.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsLoadTestClient.sol index 1623fc5e12..4fb414e465 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsLoadTestClient.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsLoadTestClient.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsClient} from "../../../dev/v1_X/FunctionsClient.sol"; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; +import {FunctionsClient} from "../../../dev/v1_X/FunctionsClient.sol"; import {FunctionsRequest} from "../../../dev/v1_X/libraries/FunctionsRequest.sol"; /** @@ -21,7 +21,9 @@ contract FunctionsLoadTestClient is FunctionsClient, ConfirmedOwner { uint32 public totalSucceededResponses; uint32 public totalFailedResponses; - constructor(address router) FunctionsClient(router) ConfirmedOwner(msg.sender) {} + constructor( + address router + ) FunctionsClient(router) ConfirmedOwner(msg.sender) {} /** * @notice Send a simple request @@ -44,7 +46,7 @@ contract FunctionsLoadTestClient is FunctionsClient, ConfirmedOwner { req._initializeRequestForInlineJavaScript(source); if (encryptedSecretsReferences.length > 0) req._addSecretsReference(encryptedSecretsReferences); if (args.length > 0) req._setArgs(args); - uint i = 0; + uint256 i = 0; for (i = 0; i < times; i++) { lastRequestID = _sendRequest(req._encodeCBOR(), subscriptionId, MAX_CALLBACK_GAS, donId); totalRequests += 1; @@ -74,7 +76,7 @@ contract FunctionsLoadTestClient is FunctionsClient, ConfirmedOwner { req._initializeRequestForInlineJavaScript(source); req._addDONHostedSecrets(slotId, slotVersion); if (args.length > 0) req._setArgs(args); - uint i = 0; + uint256 i = 0; for (i = 0; i < times; i++) { lastRequestID = _sendRequest(req._encodeCBOR(), subscriptionId, MAX_CALLBACK_GAS, donId); totalRequests += 1; @@ -94,7 +96,7 @@ contract FunctionsLoadTestClient is FunctionsClient, ConfirmedOwner { uint64 subscriptionId, bytes32 donId ) public onlyOwner { - uint i = 0; + uint256 i = 0; for (i = 0; i < times; i++) { lastRequestID = _sendRequest(cborEncodedRequest, subscriptionId, MAX_CALLBACK_GAS, donId); totalRequests += 1; diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsSubscriptionsHarness.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsSubscriptionsHarness.sol index 2e2427f6e1..3830e9338a 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsSubscriptionsHarness.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsSubscriptionsHarness.sol @@ -6,7 +6,9 @@ import {FunctionsSubscriptions} from "../../../dev/v1_X/FunctionsSubscriptions.s /// @title Functions Subscriptions Test Harness /// @notice Contract to expose internal functions for testing purposes contract FunctionsSubscriptionsHarness is FunctionsSubscriptions { - constructor(address link) FunctionsSubscriptions(link) {} + constructor( + address link + ) FunctionsSubscriptions(link) {} function markRequestInFlight_HARNESS(address client, uint64 subscriptionId, uint96 estimatedTotalCostJuels) external { return super._markRequestInFlight(client, subscriptionId, estimatedTotalCostJuels); @@ -21,19 +23,14 @@ contract FunctionsSubscriptionsHarness is FunctionsSubscriptions { uint96 gasUsed, uint96 costWithoutCallbackJuels ) external returns (Receipt memory) { - return - super._pay( - subscriptionId, - estimatedTotalCostJuels, - client, - adminFee, - juelsPerGas, - gasUsed, - costWithoutCallbackJuels - ); + return super._pay( + subscriptionId, estimatedTotalCostJuels, client, adminFee, juelsPerGas, gasUsed, costWithoutCallbackJuels + ); } - function isExistingSubscription_HARNESS(uint64 subscriptionId) external view { + function isExistingSubscription_HARNESS( + uint64 subscriptionId + ) external view { return super._isExistingSubscription(subscriptionId); } diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsTestHelper.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsTestHelper.sol index 50e90c4495..5a38a8e196 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/FunctionsTestHelper.sol @@ -14,13 +14,17 @@ contract FunctionsTestHelper { emit RequestData(s_req._encodeCBOR()); } - function initializeRequestForInlineJavaScript(string memory sourceCode) public { + function initializeRequestForInlineJavaScript( + string memory sourceCode + ) public { FunctionsRequest.Request memory r; r._initializeRequestForInlineJavaScript(sourceCode); storeRequest(r); } - function addSecretsReference(bytes memory secrets) public { + function addSecretsReference( + bytes memory secrets + ) public { FunctionsRequest.Request memory r = s_req; r._addSecretsReference(secrets); storeRequest(r); @@ -41,7 +45,9 @@ contract FunctionsTestHelper { storeRequest(r); } - function storeRequest(FunctionsRequest.Request memory r) private { + function storeRequest( + FunctionsRequest.Request memory r + ) private { s_req.codeLocation = r.codeLocation; s_req.language = r.language; s_req.source = r.source; diff --git a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/MockLinkToken.sol b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/MockLinkToken.sol index 37ab5f50d5..a546006104 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/testhelpers/MockLinkToken.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/testhelpers/MockLinkToken.sol @@ -27,7 +27,9 @@ contract MockLinkToken { return true; } - function balanceOf(address _address) external view returns (uint256) { + function balanceOf( + address _address + ) external view returns (uint256) { return balances[_address]; } @@ -39,7 +41,9 @@ contract MockLinkToken { return true; } - function isContract(address _addr) private view returns (bool hasCode) { + function isContract( + address _addr + ) private view returns (bool hasCode) { uint256 length; assembly { length := extcodesize(_addr) diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol index 606b11169d..53ad186095 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {IFunctionsBilling} from "./interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {Routable} from "./Routable.sol"; import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; @@ -87,7 +87,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @notice Sets the Chainlink Coordinator's billing configuration /// @param config - See the contents of the Config struct in IFunctionsBilling.Config for more information - function updateConfig(Config memory config) public { + function updateConfig( + Config memory config + ) public { _onlyOwner(); s_config = config; @@ -99,7 +101,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ /// @inheritdoc IFunctionsBilling - function getDONFee(bytes memory /* requestData */) public view override returns (uint72) { + function getDONFee( + bytes memory /* requestData */ + ) public view override returns (uint72) { return s_config.donFee; } @@ -111,7 +115,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getWeiPerUnitLink() public view returns (uint256) { Config memory config = s_config; - (, int256 weiPerUnitLink, , uint256 timestamp, ) = s_linkToNativeFeed.latestRoundData(); + (, int256 weiPerUnitLink,, uint256 timestamp,) = s_linkToNativeFeed.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (config.feedStalenessSeconds < block.timestamp - timestamp && config.feedStalenessSeconds > 0) { return config.fallbackNativePerUnitLink; @@ -122,7 +126,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return uint256(weiPerUnitLink); } - function _getJuelsPerGas(uint256 gasPriceWei) private view returns (uint96) { + function _getJuelsPerGas( + uint256 gasPriceWei + ) private view returns (uint96) { // (1e18 juels/link) * (wei/gas) / (wei/link) = juels per gas // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) return SafeCast.toUint96((1e18 * gasPriceWei) / getWeiPerUnitLink()); @@ -160,8 +166,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { ) internal view returns (uint96) { uint256 executionGas = s_config.gasOverheadBeforeCallback + s_config.gasOverheadAfterCallback + callbackGasLimit; - uint256 gasPriceWithOverestimation = gasPriceWei + - ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); + uint256 gasPriceWithOverestimation = + gasPriceWei + ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); /// @NOTE: Basis Points are 1/100th of 1%, divide by 10_000 to bring back to original units uint96 juelsPerGas = _getJuelsPerGas(gasPriceWithOverestimation); @@ -190,12 +196,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { } uint72 donFee = getDONFee(request.data); - uint96 estimatedTotalCostJuels = _calculateCostEstimate( - request.callbackGasLimit, - tx.gasprice, - donFee, - request.adminFee - ); + uint96 estimatedTotalCostJuels = + _calculateCostEstimate(request.callbackGasLimit, tx.gasprice, donFee, request.adminFee); // Check that subscription can afford the estimated cost if ((request.availableBalance) < estimatedTotalCostJuels) { @@ -203,10 +205,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { } bytes32 requestId = _computeRequestId( - address(this), - request.requestingContract, - request.subscriptionId, - request.initiatedRequests + 1 + address(this), request.requestingContract, request.subscriptionId, request.initiatedRequests + 1 ); commitment = FunctionsResponse.Commitment({ @@ -265,8 +264,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { uint96 juelsPerGas = _getJuelsPerGas(tx.gasprice); // Gas overhead without callback - uint96 gasOverheadJuels = juelsPerGas * - (commitment.gasOverheadBeforeCallback + commitment.gasOverheadAfterCallback); + uint96 gasOverheadJuels = juelsPerGas * (commitment.gasOverheadBeforeCallback + commitment.gasOverheadAfterCallback); // The Functions Router will perform the callback to the client contract (FunctionsResponse.FulfillResult resultCode, uint96 callbackCostJuels) = _getRouter().fulfill( @@ -282,8 +280,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // In these two fulfillment results the user has been charged // Otherwise, the Coordinator should hold on to the request commitment if ( - resultCode == FunctionsResponse.FulfillResult.FULFILLED || - resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + resultCode == FunctionsResponse.FulfillResult.FULFILLED + || resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { delete s_requestCommitments[requestId]; // Reimburse the transmitter for the fulfillment gas cost @@ -303,7 +301,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling /// @dev Only callable by the Router /// @dev Used by FunctionsRouter.sol during timeout of a request - function deleteCommitment(bytes32 requestId) external override onlyRouter { + function deleteCommitment( + bytes32 requestId + ) external override onlyRouter { // Delete commitment delete s_requestCommitments[requestId]; emit CommitmentDeleted(requestId); diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsClient.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsClient.sol index ecbbbd928f..b8226c8bc1 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsClient.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsClient.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; import {IFunctionsClient} from "./interfaces/IFunctionsClient.sol"; +import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; import {FunctionsRequest} from "./libraries/FunctionsRequest.sol"; @@ -18,7 +18,9 @@ abstract contract FunctionsClient is IFunctionsClient { error OnlyRouterCanFulfill(); - constructor(address router) { + constructor( + address router + ) { i_router = IFunctionsRouter(router); } @@ -33,13 +35,8 @@ abstract contract FunctionsClient is IFunctionsClient { uint32 callbackGasLimit, bytes32 donId ) internal returns (bytes32) { - bytes32 requestId = i_router.sendRequest( - subscriptionId, - data, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - donId - ); + bytes32 requestId = + i_router.sendRequest(subscriptionId, data, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, donId); emit RequestSent(requestId); return requestId; } diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsCoordinator.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsCoordinator.sol index 1488bc4588..ab51f68b75 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsCoordinator.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsCoordinator} from "./interfaces/IFunctionsCoordinator.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {IFunctionsCoordinator} from "./interfaces/IFunctionsCoordinator.sol"; import {FunctionsBilling} from "./FunctionsBilling.sol"; -import {OCR2Base} from "./ocr/OCR2Base.sol"; + import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; +import {OCR2Base} from "./ocr/OCR2Base.sol"; /// @title Functions Coordinator contract /// @notice Contract that nodes of a Decentralized Oracle Network (DON) interact with @@ -54,7 +55,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external override onlyOwner { + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external override onlyOwner { if (thresholdPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -70,7 +73,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setDONPublicKey(bytes calldata donPublicKey) external override onlyOwner { + function setDONPublicKey( + bytes calldata donPublicKey + ) external override onlyOwner { if (donPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -78,7 +83,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev check if node is in current transmitter list - function _isTransmitter(address node) internal view returns (bool) { + function _isTransmitter( + address node + ) internal view returns (bool) { address[] memory nodes = s_transmitters; // Bounded by "maxNumOracles" on OCR2Abstract.sol for (uint256 i = 0; i < nodes.length; ++i) { @@ -112,7 +119,7 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev DON fees are pooled together. If the OCR configuration is going to change, these need to be distributed. - function _beforeSetConfig(uint8 /* _f */, bytes memory /* _onchainConfig */) internal override { + function _beforeSetConfig(uint8, /* _f */ bytes memory /* _onchainConfig */ ) internal override { if (_getTransmitters().length > 0) { _disperseFeePool(); } @@ -125,10 +132,10 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli /// @dev Report hook called within OCR2Base.sol function _report( - uint256 /*initialGas*/, - address /*transmitter*/, - uint8 /*signerCount*/, - address[MAX_NUM_ORACLES] memory /*signers*/, + uint256, /*initialGas*/ + address, /*transmitter*/ + uint8, /*signerCount*/ + address[MAX_NUM_ORACLES] memory, /*signers*/ bytes calldata report ) internal override { bytes32[] memory requestIds; @@ -136,17 +143,12 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli bytes[] memory errors; bytes[] memory onchainMetadata; bytes[] memory offchainMetadata; - (requestIds, results, errors, onchainMetadata, offchainMetadata) = abi.decode( - report, - (bytes32[], bytes[], bytes[], bytes[], bytes[]) - ); + (requestIds, results, errors, onchainMetadata, offchainMetadata) = + abi.decode(report, (bytes32[], bytes[], bytes[], bytes[], bytes[])); if ( - requestIds.length == 0 || - requestIds.length != results.length || - requestIds.length != errors.length || - requestIds.length != onchainMetadata.length || - requestIds.length != offchainMetadata.length + requestIds.length == 0 || requestIds.length != results.length || requestIds.length != errors.length + || requestIds.length != onchainMetadata.length || requestIds.length != offchainMetadata.length ) { revert ReportInvalid(); } @@ -161,8 +163,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli // In these two fulfillment results the user has been charged // Otherwise, the DON will re-try if ( - result == FunctionsResponse.FulfillResult.FULFILLED || - result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + result == FunctionsResponse.FulfillResult.FULFILLED + || result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { emit OracleResponse(requestIds[i], msg.sender); } diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol index 0437de432a..3450d8198e 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol @@ -1,17 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import {IAccessController} from "../../shared/interfaces/IAccessController.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; import {IFunctionsCoordinator} from "./interfaces/IFunctionsCoordinator.sol"; -import {IAccessController} from "../../shared/interfaces/IAccessController.sol"; +import {IFunctionsRouter} from "./interfaces/IFunctionsRouter.sol"; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {FunctionsSubscriptions} from "./FunctionsSubscriptions.sol"; import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; -import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; import {Pausable} from "@openzeppelin/contracts@4.8.3/security/Pausable.sol"; +import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, ITypeAndVersion, ConfirmedOwner { using FunctionsResponse for FunctionsResponse.RequestMeta; @@ -51,10 +51,7 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, ); event RequestNotProcessed( - bytes32 indexed requestId, - address coordinator, - address transmitter, - FunctionsResponse.FulfillResult resultCode + bytes32 indexed requestId, address coordinator, address transmitter, FunctionsResponse.FulfillResult resultCode ); error EmptyRequestData(); @@ -108,12 +105,11 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, bytes32[] ids; // ══╸ The IDs that key into the routes that will be modified if the update is applied address[] to; // ═══╸ The address of the contracts that the route will point to if the updated is applied } + ContractProposalSet private s_proposedContractSet; event ContractProposed( - bytes32 proposedContractSetId, - address proposedContractSetFromAddress, - address proposedContractSetToAddress + bytes32 proposedContractSetId, address proposedContractSetFromAddress, address proposedContractSetToAddress ); event ContractUpdated(bytes32 id, address from, address to); @@ -145,7 +141,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, } /// @notice The router configuration - function updateConfig(Config memory config) public onlyOwner { + function updateConfig( + Config memory config + ) public onlyOwner { s_config = config; emit ConfigUpdated(config); } @@ -173,7 +171,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, } /// @inheritdoc IFunctionsRouter - function setAllowListId(bytes32 allowListId) external override onlyOwner { + function setAllowListId( + bytes32 allowListId + ) external override onlyOwner { s_allowListId = allowListId; } @@ -358,17 +358,11 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, delete s_requestCommitments[commitment.requestId]; - CallbackResult memory result = _callback( - commitment.requestId, - response, - err, - commitment.callbackGasLimit, - commitment.client - ); + CallbackResult memory result = + _callback(commitment.requestId, response, err, commitment.callbackGasLimit, commitment.client); - resultCode = result.success - ? FunctionsResponse.FulfillResult.FULFILLED - : FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR; + resultCode = + result.success ? FunctionsResponse.FulfillResult.FULFILLED : FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR; Receipt memory receipt = _pay( commitment.subscriptionId, @@ -412,12 +406,8 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, return CallbackResult({success: false, gasUsed: 0, returnData: new bytes(0)}); } - bytes memory encodedCallback = abi.encodeWithSelector( - s_config.handleOracleFulfillmentSelector, - requestId, - response, - err - ); + bytes memory encodedCallback = + abi.encodeWithSelector(s_config.handleOracleFulfillmentSelector, requestId, response, err); uint16 gasForCallExactCheck = s_config.gasForCallExactCheck; @@ -439,15 +429,11 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // as we do not want to provide them with less, however that check itself costs // gas. gasForCallExactCheck ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, gasForCallExactCheck) { - revert(0, 0) - } + if lt(g, gasForCallExactCheck) { revert(0, 0) } g := sub(g, gasForCallExactCheck) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), callbackGasLimit)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), callbackGasLimit)) { revert(0, 0) } // call and report whether we succeeded // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) let gasBeforeCall := gas() @@ -456,9 +442,7 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // limit our copy to MAX_CALLBACK_RETURN_BYTES bytes let toCopy := returndatasize() - if gt(toCopy, MAX_CALLBACK_RETURN_BYTES) { - toCopy := MAX_CALLBACK_RETURN_BYTES - } + if gt(toCopy, MAX_CALLBACK_RETURN_BYTES) { toCopy := MAX_CALLBACK_RETURN_BYTES } // Store the length of the copied bytes mstore(returnData, toCopy) // copy the bytes from returnData[0:_toCopy] @@ -473,7 +457,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // ================================================================ /// @inheritdoc IFunctionsRouter - function getContractById(bytes32 id) public view override returns (address) { + function getContractById( + bytes32 id + ) public view override returns (address) { address currentImplementation = s_route[id]; if (currentImplementation == address(0)) { revert RouteNotFound(id); @@ -482,7 +468,9 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, } /// @inheritdoc IFunctionsRouter - function getProposedContractById(bytes32 id) public view override returns (address) { + function getProposedContractById( + bytes32 id + ) public view override returns (address) { // Iterations will not exceed MAX_PROPOSAL_SET_LENGTH for (uint8 i = 0; i < s_proposedContractSet.ids.length; ++i) { if (id == s_proposedContractSet.ids[i]) { @@ -517,8 +505,8 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, bytes32 id = proposedContractSetIds[i]; address proposedContract = proposedContractSetAddresses[i]; if ( - proposedContract == address(0) || // The Proposed address must be a valid address - s_route[id] == proposedContract // The Proposed address must point to a different address than what is currently set + proposedContract == address(0) // The Proposed address must be a valid address + || s_route[id] == proposedContract // The Proposed address must point to a different address than what is currently set ) { revert InvalidProposal(); } diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsSubscriptions.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsSubscriptions.sol index f0d5eb862e..d2993fdd03 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsSubscriptions.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsSubscriptions.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; import {IFunctionsBilling} from "./interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "./interfaces/IFunctionsSubscriptions.sol"; import {FunctionsResponse} from "./libraries/FunctionsResponse.sol"; @@ -66,6 +66,7 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece error MustBeSubscriptionOwner(); error TimeoutNotExceeded(); error MustBeProposedOwner(address proposedOwner); + event FundsRecovered(address to, uint256 amount); // ================================================================ @@ -84,7 +85,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // ================================================================ // | Initialization | // ================================================================ - constructor(address link) { + constructor( + address link + ) { i_linkToken = IERC20(link); } @@ -117,8 +120,8 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece uint96 totalCostJuels = costWithoutCallbackJuels + adminFee + callbackGasCostJuels; if ( - s_subscriptions[subscriptionId].balance < totalCostJuels || - s_subscriptions[subscriptionId].blockedBalance < estimatedTotalCostJuels + s_subscriptions[subscriptionId].balance < totalCostJuels + || s_subscriptions[subscriptionId].blockedBalance < estimatedTotalCostJuels ) { revert InsufficientBalance(s_subscriptions[subscriptionId].balance); } @@ -146,14 +149,18 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // ================================================================ /// @inheritdoc IFunctionsSubscriptions - function ownerCancelSubscription(uint64 subscriptionId) external override { + function ownerCancelSubscription( + uint64 subscriptionId + ) external override { _onlyRouterOwner(); _isExistingSubscription(subscriptionId); _cancelSubscriptionHelper(subscriptionId, s_subscriptions[subscriptionId].owner, false); } /// @inheritdoc IFunctionsSubscriptions - function recoverFunds(address to) external override { + function recoverFunds( + address to + ) external override { _onlyRouterOwner(); uint256 externalBalance = i_linkToken.balanceOf(address(this)); uint256 internalBalance = uint256(s_totalLinkBalance); @@ -214,7 +221,7 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece /// @dev address(ROUTER), /// @dev amount, /// @dev abi.encode(subscriptionId)); - function onTokenTransfer(address /* sender */, uint256 amount, bytes calldata data) external override { + function onTokenTransfer(address, /* sender */ uint256 amount, bytes calldata data) external override { _whenNotPaused(); if (msg.sender != address(i_linkToken)) { revert OnlyCallableFromLink(); @@ -249,7 +256,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function getSubscription(uint64 subscriptionId) public view override returns (Subscription memory) { + function getSubscription( + uint64 subscriptionId + ) public view override returns (Subscription memory) { _isExistingSubscription(subscriptionId); return s_subscriptions[subscriptionId]; } @@ -260,9 +269,8 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece uint64 subscriptionIdEnd ) external view override returns (Subscription[] memory subscriptions) { if ( - subscriptionIdStart > subscriptionIdEnd || - subscriptionIdEnd > s_currentSubscriptionId || - s_currentSubscriptionId == 0 + subscriptionIdStart > subscriptionIdEnd || subscriptionIdEnd > s_currentSubscriptionId + || s_currentSubscriptionId == 0 ) { revert InvalidCalldata(); } @@ -281,7 +289,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @dev Used within this file & FunctionsRouter.sol - function _isExistingSubscription(uint64 subscriptionId) internal view { + function _isExistingSubscription( + uint64 subscriptionId + ) internal view { if (s_subscriptions[subscriptionId].owner == address(0)) { revert InvalidSubscription(); } @@ -315,7 +325,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function createSubscriptionWithConsumer(address consumer) external override returns (uint64 subscriptionId) { + function createSubscriptionWithConsumer( + address consumer + ) external override returns (uint64 subscriptionId) { _whenNotPaused(); _onlySenderThatAcceptedToS(); @@ -353,7 +365,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function acceptSubscriptionOwnerTransfer(uint64 subscriptionId) external override { + function acceptSubscriptionOwnerTransfer( + uint64 subscriptionId + ) external override { _whenNotPaused(); _onlySenderThatAcceptedToS(); @@ -468,7 +482,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function pendingRequestExists(uint64 subscriptionId) public view override returns (bool) { + function pendingRequestExists( + uint64 subscriptionId + ) public view override returns (bool) { address[] memory consumers = s_subscriptions[subscriptionId].consumers; // NOTE: loop iterations are bounded by config.maxConsumers for (uint256 i = 0; i < consumers.length; ++i) { @@ -488,7 +504,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece } /// @inheritdoc IFunctionsSubscriptions - function getFlags(uint64 subscriptionId) public view returns (bytes32) { + function getFlags( + uint64 subscriptionId + ) public view returns (bytes32) { return s_subscriptions[subscriptionId].flags; } @@ -497,7 +515,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // ================================================================ /// @inheritdoc IFunctionsSubscriptions - function timeoutRequests(FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment) external override { + function timeoutRequests( + FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment + ) external override { _whenNotPaused(); for (uint256 i = 0; i < requestsToTimeoutByCommitment.length; ++i) { @@ -531,7 +551,9 @@ abstract contract FunctionsSubscriptions is IFunctionsSubscriptions, IERC677Rece // | Modifiers | // ================================================================ - function _onlySubscriptionOwner(uint64 subscriptionId) internal view { + function _onlySubscriptionOwner( + uint64 subscriptionId + ) internal view { address owner = s_subscriptions[subscriptionId].owner; if (owner == address(0)) { revert InvalidSubscription(); diff --git a/contracts/src/v0.8/functions/v1_0_0/Routable.sol b/contracts/src/v0.8/functions/v1_0_0/Routable.sol index 6c11d4d618..b5de90ca82 100644 --- a/contracts/src/v0.8/functions/v1_0_0/Routable.sol +++ b/contracts/src/v0.8/functions/v1_0_0/Routable.sol @@ -15,7 +15,9 @@ abstract contract Routable is ITypeAndVersion { error OnlyCallableByRouterOwner(); /// @dev Initializes the contract. - constructor(address router) { + constructor( + address router + ) { if (router == address(0)) { revert RouterMustBeSet(); } diff --git a/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol index 1a32771fa5..f3ad0ee1bd 100644 --- a/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {ITermsOfServiceAllowList} from "./interfaces/ITermsOfServiceAllowList.sol"; import {IAccessController} from "../../../shared/interfaces/IAccessController.sol"; import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; +import {ITermsOfServiceAllowList} from "./interfaces/ITermsOfServiceAllowList.sol"; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; @@ -45,7 +45,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, // | Initialization | // ================================================================ - constructor(Config memory config) ConfirmedOwner(msg.sender) { + constructor( + Config memory config + ) ConfirmedOwner(msg.sender) { updateConfig(config); } @@ -61,7 +63,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, /// @notice Sets the contracts's configuration /// @param config - See the contents of the TermsOfServiceAllowList.Config struct for more information - function updateConfig(Config memory config) public onlyOwner { + function updateConfig( + Config memory config + ) public onlyOwner { s_config = config; emit ConfigUpdated(config); } @@ -82,9 +86,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } // Validate that the signature is correct and the correct data has been signed - bytes32 prefixedMessage = keccak256( - abi.encodePacked("\x19Ethereum Signed Message:\n32", getMessage(acceptor, recipient)) - ); + bytes32 prefixedMessage = + keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", getMessage(acceptor, recipient))); if (ecrecover(prefixedMessage, v, r, s) != s_config.signerPublicKey) { revert InvalidSignature(); } @@ -108,7 +111,7 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc IAccessController - function hasAccess(address user, bytes calldata /* data */) external view override returns (bool) { + function hasAccess(address user, bytes calldata /* data */ ) external view override returns (bool) { if (!s_config.enabled) { return true; } @@ -120,7 +123,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, // ================================================================ /// @inheritdoc ITermsOfServiceAllowList - function isBlockedSender(address sender) external view override returns (bool) { + function isBlockedSender( + address sender + ) external view override returns (bool) { if (!s_config.enabled) { return false; } @@ -128,14 +133,18 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc ITermsOfServiceAllowList - function blockSender(address sender) external override onlyOwner { + function blockSender( + address sender + ) external override onlyOwner { s_allowedSenders.remove(sender); s_blockedSenders[sender] = true; emit BlockedAccess(sender); } /// @inheritdoc ITermsOfServiceAllowList - function unblockSender(address sender) external override onlyOwner { + function unblockSender( + address sender + ) external override onlyOwner { s_blockedSenders[sender] = false; emit UnblockedAccess(sender); } diff --git a/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol index af4daa18bc..5b5d76b2cf 100644 --- a/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol @@ -12,7 +12,9 @@ interface ITermsOfServiceAllowList { /// @notice Check if the address is blocked for usage /// @param sender The transaction sender's address /// @return True or false - function isBlockedSender(address sender) external returns (bool); + function isBlockedSender( + address sender + ) external returns (bool); /// @notice Get a list of all allowed senders /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed @@ -32,9 +34,13 @@ interface ITermsOfServiceAllowList { /// @notice Removes a sender's access if already authorized, and disallows re-accepting the Terms of Service /// @param sender - Address of the sender to block - function blockSender(address sender) external; + function blockSender( + address sender + ) external; /// @notice Re-allows a previously blocked sender to accept the Terms of Service /// @param sender - Address of the sender to unblock - function unblockSender(address sender) external; + function unblockSender( + address sender + ) external; } diff --git a/contracts/src/v0.8/functions/v1_0_0/example/FunctionsClientExample.sol b/contracts/src/v0.8/functions/v1_0_0/example/FunctionsClientExample.sol index 8d1cf36c6c..a04f6a0dbd 100644 --- a/contracts/src/v0.8/functions/v1_0_0/example/FunctionsClientExample.sol +++ b/contracts/src/v0.8/functions/v1_0_0/example/FunctionsClientExample.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsClient} from "../FunctionsClient.sol"; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; +import {FunctionsClient} from "../FunctionsClient.sol"; import {FunctionsRequest} from "../libraries/FunctionsRequest.sol"; /// @title Chainlink Functions example Client contract implementation @@ -19,7 +19,9 @@ contract FunctionsClientExample is FunctionsClient, ConfirmedOwner { error UnexpectedRequestID(bytes32 requestId); - constructor(address router) FunctionsClient(router) ConfirmedOwner(msg.sender) {} + constructor( + address router + ) FunctionsClient(router) ConfirmedOwner(msg.sender) {} /// @notice Send a simple request /// @param source JavaScript source code @@ -56,7 +58,9 @@ contract FunctionsClientExample is FunctionsClient, ConfirmedOwner { s_lastErrorLength = uint32(err.length); } - function bytesToBytes32(bytes memory b) private pure returns (bytes32 out) { + function bytesToBytes32( + bytes memory b + ) private pure returns (bytes32 out) { uint256 maxLen = 32; if (b.length < 32) { maxLen = b.length; diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol index 6291d05e57..1b04a7d94e 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol @@ -10,7 +10,9 @@ interface IFunctionsBilling { /// @notice Determine the fee that will be split between Node Operators for servicing a request /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request /// @return fee - Cost in Juels (1e18) of LINK - function getDONFee(bytes memory requestCBOR) external view returns (uint72); + function getDONFee( + bytes memory requestCBOR + ) external view returns (uint72); /// @notice Determine the fee that will be paid to the Router owner for operating the network /// @return fee - Cost in Juels (1e18) of LINK @@ -31,7 +33,9 @@ interface IFunctionsBilling { /// @notice Remove a request commitment that the Router has determined to be stale /// @param requestId - The request ID to remove - function deleteCommitment(bytes32 requestId) external; + function deleteCommitment( + bytes32 requestId + ) external; /// @notice Oracle withdraw LINK earned through fulfilling requests /// @notice If amount is 0 the full balance will be withdrawn diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsCoordinator.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsCoordinator.sol index 4e2bd703dc..bb376055d9 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsCoordinator.sol @@ -14,7 +14,9 @@ interface IFunctionsCoordinator { /// @notice Sets the DON's threshold encryption public key used to encrypt secrets /// @dev Used to rotate the key /// @param thresholdPublicKey The new public key - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external; + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external; /// @notice Returns the DON's secp256k1 public key that is used to encrypt secrets /// @dev All nodes on the DON have the corresponding private key @@ -25,7 +27,9 @@ interface IFunctionsCoordinator { /// @notice Sets DON's secp256k1 public key used to encrypt secrets /// @dev Used to rotate the key /// @param donPublicKey The new public key - function setDONPublicKey(bytes calldata donPublicKey) external; + function setDONPublicKey( + bytes calldata donPublicKey + ) external; /// @notice Receives a request to be emitted to the DON for processing /// @param request The request metadata diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsRouter.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsRouter.sol index 5f93aac873..104b7ca035 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsRouter.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsRouter.sol @@ -12,7 +12,9 @@ interface IFunctionsRouter { /// @notice Set the identifier of the route to retrieve the address of the access control contract /// The access control contract controls which accounts can manage subscriptions - function setAllowListId(bytes32 allowListId) external; + function setAllowListId( + bytes32 allowListId + ) external; /// @notice Get the flat fee (in Juels of LINK) that will be paid to the Router owner for operation of the network /// @return adminFee @@ -79,12 +81,16 @@ interface IFunctionsRouter { /// @notice Get the current contract given an ID /// @param id A bytes32 identifier for the route /// @return contract The current contract address - function getContractById(bytes32 id) external view returns (address); + function getContractById( + bytes32 id + ) external view returns (address); /// @notice Get the proposed next contract given an ID /// @param id A bytes32 identifier for the route /// @return contract The current or proposed contract address - function getProposedContractById(bytes32 id) external view returns (address); + function getProposedContractById( + bytes32 id + ) external view returns (address); /// @notice Return the latest proprosal set /// @return ids The identifiers of the contracts to update diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol index eafd6f4fe9..de074d6373 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol @@ -23,7 +23,9 @@ interface IFunctionsSubscriptions { /// @notice Get details about a subscription. /// @param subscriptionId - the ID of the subscription /// @return subscription - see IFunctionsSubscriptions.Subscription for more information on the structure - function getSubscription(uint64 subscriptionId) external view returns (Subscription memory); + function getSubscription( + uint64 subscriptionId + ) external view returns (Subscription memory); /// @notice Retrieve details about multiple subscriptions using an inclusive range /// @param subscriptionIdStart - the ID of the subscription to start the range at @@ -51,7 +53,9 @@ interface IFunctionsSubscriptions { /// @notice Time out all expired requests: unlocks funds and removes the ability for the request to be fulfilled /// @param requestsToTimeoutByCommitment - A list of request commitments to time out /// @dev The commitment can be found on the "OracleRequest" event created when sending the request. - function timeoutRequests(FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment) external; + function timeoutRequests( + FunctionsResponse.Commitment[] calldata requestsToTimeoutByCommitment + ) external; /// @notice Oracle withdraw LINK earned through fulfilling requests /// @notice If amount is 0 the full balance will be withdrawn @@ -64,12 +68,16 @@ interface IFunctionsSubscriptions { /// @dev Only callable by the Router Owner /// @param subscriptionId subscription id /// @dev notably can be called even if there are pending requests, outstanding ones may fail onchain - function ownerCancelSubscription(uint64 subscriptionId) external; + function ownerCancelSubscription( + uint64 subscriptionId + ) external; /// @notice Recover link sent with transfer instead of transferAndCall. /// @dev Only callable by the Router Owner /// @param to address to send link to - function recoverFunds(address to) external; + function recoverFunds( + address to + ) external; /// @notice Create a new subscription. /// @return subscriptionId - A unique subscription id. @@ -89,7 +97,9 @@ interface IFunctionsSubscriptions { /// @dev address(ROUTER), /// @dev amount, /// @dev abi.encode(subscriptionId)); - function createSubscriptionWithConsumer(address consumer) external returns (uint64 subscriptionId); + function createSubscriptionWithConsumer( + address consumer + ) external returns (uint64 subscriptionId); /// @notice Propose a new owner for a subscription. /// @dev Only callable by the Subscription's owner @@ -100,7 +110,9 @@ interface IFunctionsSubscriptions { /// @notice Accept an ownership transfer. /// @param subscriptionId - ID of the subscription /// @dev will revert if original owner of subscriptionId has not requested that msg.sender become the new owner. - function acceptSubscriptionOwnerTransfer(uint64 subscriptionId) external; + function acceptSubscriptionOwnerTransfer( + uint64 subscriptionId + ) external; /// @notice Remove a consumer from a Chainlink Functions subscription. /// @dev Only callable by the Subscription's owner @@ -125,7 +137,9 @@ interface IFunctionsSubscriptions { /// @return true if there exists at least one unfulfilled request for the subscription, false otherwise. /// @dev Looping is bounded to MAX_CONSUMERS*(number of DONs). /// @dev Used to disable subscription canceling while outstanding request are present. - function pendingRequestExists(uint64 subscriptionId) external view returns (bool); + function pendingRequestExists( + uint64 subscriptionId + ) external view returns (bool); /// @notice Set subscription specific flags for a subscription. /// Each byte of the flag is used to represent a resource tier that the subscription can utilize. @@ -136,5 +150,7 @@ interface IFunctionsSubscriptions { /// @notice Get flags for a given subscription. /// @param subscriptionId - ID of the subscription /// @return flags - current flag values - function getFlags(uint64 subscriptionId) external view returns (bytes32); + function getFlags( + uint64 subscriptionId + ) external view returns (bytes32); } diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IOwnableFunctionsRouter.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IOwnableFunctionsRouter.sol index c5f3d82677..4d0eb5e6a2 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IOwnableFunctionsRouter.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IOwnableFunctionsRouter.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsRouter} from "./IFunctionsRouter.sol"; import {IOwnable} from "../../../shared/interfaces/IOwnable.sol"; +import {IFunctionsRouter} from "./IFunctionsRouter.sol"; /// @title Chainlink Functions Router interface with Ownability. interface IOwnableFunctionsRouter is IOwnable, IFunctionsRouter {} diff --git a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol index ef697b5e80..11a76c613e 100644 --- a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol +++ b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol @@ -14,12 +14,13 @@ library FunctionsRequest { Inline, // Provided within the Request Remote, // Hosted through remote location that can be accessed through a provided URL DONHosted // Hosted on the DON's storage + } enum CodeLanguage { JavaScript - // In future version we may add other languages } + // In future version we may add other languages struct Request { Location codeLocation; // ════════════╸ The location of the source code that will be executed on each node in the DON @@ -39,7 +40,9 @@ library FunctionsRequest { /// @notice Encodes a Request to CBOR encoded bytes /// @param self The request to encode /// @return CBOR encoded bytes - function encodeCBOR(Request memory self) internal pure returns (bytes memory) { + function encodeCBOR( + Request memory self + ) internal pure returns (bytes memory) { CBOR.CBORBuffer memory buffer = CBOR.create(DEFAULT_BUFFER_SIZE); buffer.writeString("codeLocation"); diff --git a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol index 65fad665d6..eb7eb60266 100644 --- a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol +++ b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol @@ -26,6 +26,7 @@ library FunctionsResponse { INSUFFICIENT_GAS_PROVIDED, // 4 SUBSCRIPTION_BALANCE_INVARIANT_VIOLATION, // 5 INVALID_COMMITMENT // 6 + } struct Commitment { diff --git a/contracts/src/v0.8/functions/v1_0_0/mocks/FunctionsV1EventsMock.sol b/contracts/src/v0.8/functions/v1_0_0/mocks/FunctionsV1EventsMock.sol index 68b51f8901..4bedff708c 100644 --- a/contracts/src/v0.8/functions/v1_0_0/mocks/FunctionsV1EventsMock.sol +++ b/contracts/src/v0.8/functions/v1_0_0/mocks/FunctionsV1EventsMock.sol @@ -10,11 +10,10 @@ contract FunctionsV1EventsMock { uint16 gasForCallExactCheck; uint32[] maxCallbackGasLimits; } + event ConfigUpdated(Config param1); event ContractProposed( - bytes32 proposedContractSetId, - address proposedContractSetFromAddress, - address proposedContractSetToAddress + bytes32 proposedContractSetId, address proposedContractSetFromAddress, address proposedContractSetToAddress ); event ContractUpdated(bytes32 id, address from, address to); event FundsRecovered(address to, uint256 amount); @@ -54,7 +53,9 @@ contract FunctionsV1EventsMock { event SubscriptionOwnerTransferred(uint64 indexed subscriptionId, address from, address to); event Unpaused(address account); - function emitConfigUpdated(Config memory param1) public { + function emitConfigUpdated( + Config memory param1 + ) public { emit ConfigUpdated(param1); } @@ -82,7 +83,9 @@ contract FunctionsV1EventsMock { emit OwnershipTransferred(from, to); } - function emitPaused(address account) public { + function emitPaused( + address account + ) public { emit Paused(account); } @@ -106,14 +109,7 @@ contract FunctionsV1EventsMock { bytes memory callbackReturnData ) public { emit RequestProcessed( - requestId, - subscriptionId, - totalCostJuels, - transmitter, - resultCode, - response, - err, - callbackReturnData + requestId, subscriptionId, totalCostJuels, transmitter, resultCode, response, err, callbackReturnData ); } @@ -143,7 +139,9 @@ contract FunctionsV1EventsMock { ); } - function emitRequestTimedOut(bytes32 requestId) public { + function emitRequestTimedOut( + bytes32 requestId + ) public { emit RequestTimedOut(requestId); } @@ -175,7 +173,9 @@ contract FunctionsV1EventsMock { emit SubscriptionOwnerTransferred(subscriptionId, from, to); } - function emitUnpaused(address account) public { + function emitUnpaused( + address account + ) public { emit Unpaused(account); } } diff --git a/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Abstract.sol b/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Abstract.sol index 09c4a825f4..1c38bfd0ee 100644 --- a/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Abstract.sol +++ b/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Abstract.sol @@ -93,19 +93,19 @@ abstract contract OCR2Abstract is ITypeAndVersion { } /** - * @notice optionally emited to indicate the latest configDigest and epoch for - which a report was successfully transmited. Alternatively, the contract may - use latestConfigDigestAndEpoch with scanLogs set to false. - */ + * @notice optionally emited to indicate the latest configDigest and epoch for + * which a report was successfully transmited. Alternatively, the contract may + * use latestConfigDigestAndEpoch with scanLogs set to false. + */ event Transmitted(bytes32 configDigest, uint32 epoch); /** - * @notice optionally returns the latest configDigest and epoch for which a - report was successfully transmitted. Alternatively, the contract may return - scanLogs set to true and use Transmitted events to provide this information - to offchain watchers. + * @notice optionally returns the latest configDigest and epoch for which a + * report was successfully transmitted. Alternatively, the contract may return + * scanLogs set to true and use Transmitted events to provide this information + * to offchain watchers. * @return scanLogs indicates whether to rely on the configDigest and epoch - returned or whether to scan logs for the Transmitted event instead. + * returned or whether to scan logs for the Transmitted event instead. * @return configDigest * @return epoch */ diff --git a/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol index b7c3f03fea..1d5b4f326e 100644 --- a/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol @@ -15,7 +15,9 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bool internal immutable i_uniqueReports; - constructor(bool uniqueReports) ConfirmedOwner(msg.sender) { + constructor( + bool uniqueReports + ) ConfirmedOwner(msg.sender) { i_uniqueReports = uniqueReports; } @@ -35,6 +37,7 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { uint8 f; // TODO: could be optimized by squeezing into one slot uint8 n; } + ConfigInfo internal s_configInfo; // Used for s_oracles[a].role, where a is an address, to track the purpose @@ -254,18 +257,16 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { // The constant-length components of the msg.data sent to transmit. // See the "If we wanted to call sam" example on for example reasoning // https://solidity.readthedocs.io/en/v0.7.2/abi-spec.html - uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = - 4 + // function selector - 32 * - 3 + // 3 words containing reportContext - 32 + // word containing start location of abiencoded report value - 32 + // word containing location start of abiencoded rs value - 32 + // word containing start location of abiencoded ss value - 32 + // rawVs value - 32 + // word containing length of report - 32 + // word containing length rs - 32 + // word containing length of ss - 0; // placeholder + uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = 4 // function selector + + 32 * 3 // 3 words containing reportContext + + 32 // word containing start location of abiencoded report value + + 32 // word containing location start of abiencoded rs value + + 32 // word containing start location of abiencoded ss value + + 32 // rawVs value + + 32 // word containing length of report + + 32 // word containing length rs + + 32 // word containing length of ss + + 0; // placeholder function requireExpectedMsgDataLength( bytes calldata report, @@ -273,13 +274,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + - report.length + // one byte pure entry in _report - rs.length * - 32 + // 32 bytes per entry in _rs - ss.length * - 32 + // 32 bytes per entry in _ss - 0; // placeholder + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + + rs.length * 32 // 32 bytes per entry in _rs + + ss.length * 32 // 32 bytes per entry in _ss + + 0; // placeholder require(msg.data.length == expected, "calldata length mismatch"); } diff --git a/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol index 003ca649a8..b6d425ecf7 100644 --- a/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {IFunctionsBilling} from "../v1_0_0/interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; import {Routable} from "../v1_0_0/Routable.sol"; import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; @@ -99,7 +99,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @notice Sets the Chainlink Coordinator's billing configuration /// @param config - See the contents of the Config struct in IFunctionsBilling.Config for more information - function updateConfig(Config memory config) public { + function updateConfig( + Config memory config + ) public { _onlyOwner(); s_config = config; @@ -111,7 +113,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ /// @inheritdoc IFunctionsBilling - function getDONFee(bytes memory /* requestData */) public view override returns (uint72) { + function getDONFee( + bytes memory /* requestData */ + ) public view override returns (uint72) { return s_config.donFee; } @@ -123,7 +127,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getWeiPerUnitLink() public view returns (uint256) { Config memory config = s_config; - (, int256 weiPerUnitLink, , uint256 timestamp, ) = s_linkToNativeFeed.latestRoundData(); + (, int256 weiPerUnitLink,, uint256 timestamp,) = s_linkToNativeFeed.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (config.feedStalenessSeconds < block.timestamp - timestamp && config.feedStalenessSeconds > 0) { return config.fallbackNativePerUnitLink; @@ -134,7 +138,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return uint256(weiPerUnitLink); } - function _getJuelsFromWei(uint256 amountWei) private view returns (uint96) { + function _getJuelsFromWei( + uint256 amountWei + ) private view returns (uint96) { // (1e18 juels/link) * wei / (wei/link) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) return SafeCast.toUint96((1e18 * amountWei) / getWeiPerUnitLink()); @@ -175,8 +181,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { gasPriceWei = s_config.minimumEstimateGasPriceWei; } - uint256 gasPriceWithOverestimation = gasPriceWei + - ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); + uint256 gasPriceWithOverestimation = + gasPriceWei + ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); /// @NOTE: Basis Points are 1/100th of 1%, divide by 10_000 to bring back to original units uint256 executionGas = s_config.gasOverheadBeforeCallback + s_config.gasOverheadAfterCallback + callbackGasLimit; @@ -207,12 +213,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { } uint72 donFee = getDONFee(request.data); - uint96 estimatedTotalCostJuels = _calculateCostEstimate( - request.callbackGasLimit, - tx.gasprice, - donFee, - request.adminFee - ); + uint96 estimatedTotalCostJuels = + _calculateCostEstimate(request.callbackGasLimit, tx.gasprice, donFee, request.adminFee); // Check that subscription can afford the estimated cost if ((request.availableBalance) < estimatedTotalCostJuels) { @@ -268,7 +270,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { bytes memory response, bytes memory err, bytes memory onchainMetadata, - bytes memory /* offchainMetadata TODO: use in getDonFee() for dynamic billing */, + bytes memory, /* offchainMetadata TODO: use in getDonFee() for dynamic billing */ uint8 reportBatchSize ) internal returns (FunctionsResponse.FulfillResult) { FunctionsResponse.Commitment memory commitment = abi.decode(onchainMetadata, (FunctionsResponse.Commitment)); @@ -293,8 +295,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // In these two fulfillment results the user has been charged // Otherwise, the Coordinator should hold on to the request commitment if ( - resultCode == FunctionsResponse.FulfillResult.FULFILLED || - resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + resultCode == FunctionsResponse.FulfillResult.FULFILLED + || resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { delete s_requestCommitments[requestId]; // Reimburse the transmitter for the fulfillment gas cost @@ -321,7 +323,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling /// @dev Only callable by the Router /// @dev Used by FunctionsRouter.sol during timeout of a request - function deleteCommitment(bytes32 requestId) external override onlyRouter { + function deleteCommitment( + bytes32 requestId + ) external override onlyRouter { // Delete commitment delete s_requestCommitments[requestId]; emit CommitmentDeleted(requestId); diff --git a/contracts/src/v0.8/functions/v1_1_0/FunctionsCoordinator.sol b/contracts/src/v0.8/functions/v1_1_0/FunctionsCoordinator.sol index 188e217b80..9b95f5b3e3 100644 --- a/contracts/src/v0.8/functions/v1_1_0/FunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/v1_1_0/FunctionsCoordinator.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsCoordinator} from "../v1_0_0/interfaces/IFunctionsCoordinator.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {IFunctionsCoordinator} from "../v1_0_0/interfaces/IFunctionsCoordinator.sol"; +import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; import {FunctionsBilling} from "./FunctionsBilling.sol"; import {OCR2Base} from "./ocr/OCR2Base.sol"; -import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; /// @title Functions Coordinator contract /// @notice Contract that nodes of a Decentralized Oracle Network (DON) interact with @@ -54,7 +54,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external override onlyOwner { + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external override onlyOwner { if (thresholdPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -70,7 +72,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setDONPublicKey(bytes calldata donPublicKey) external override onlyOwner { + function setDONPublicKey( + bytes calldata donPublicKey + ) external override onlyOwner { if (donPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -78,7 +82,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev check if node is in current transmitter list - function _isTransmitter(address node) internal view returns (bool) { + function _isTransmitter( + address node + ) internal view returns (bool) { address[] memory nodes = s_transmitters; // Bounded by "maxNumOracles" on OCR2Abstract.sol for (uint256 i = 0; i < nodes.length; ++i) { @@ -113,7 +119,7 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev DON fees are pooled together. If the OCR configuration is going to change, these need to be distributed. - function _beforeSetConfig(uint8 /* _f */, bytes memory /* _onchainConfig */) internal override { + function _beforeSetConfig(uint8, /* _f */ bytes memory /* _onchainConfig */ ) internal override { if (_getTransmitters().length > 0) { _disperseFeePool(); } @@ -126,10 +132,10 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli /// @dev Report hook called within OCR2Base.sol function _report( - uint256 /*initialGas*/, - address /*transmitter*/, - uint8 /*signerCount*/, - address[MAX_NUM_ORACLES] memory /*signers*/, + uint256, /*initialGas*/ + address, /*transmitter*/ + uint8, /*signerCount*/ + address[MAX_NUM_ORACLES] memory, /*signers*/ bytes calldata report ) internal override { ( @@ -142,11 +148,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli uint256 numberOfFulfillments = uint8(requestIds.length); if ( - numberOfFulfillments == 0 || - numberOfFulfillments != results.length || - numberOfFulfillments != errors.length || - numberOfFulfillments != onchainMetadata.length || - numberOfFulfillments != offchainMetadata.length + numberOfFulfillments == 0 || numberOfFulfillments != results.length || numberOfFulfillments != errors.length + || numberOfFulfillments != onchainMetadata.length || numberOfFulfillments != offchainMetadata.length ) { revert ReportInvalid("Fields must be equal length"); } @@ -168,8 +171,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli // In these two fulfillment results the user has been charged // Otherwise, the DON will re-try if ( - result == FunctionsResponse.FulfillResult.FULFILLED || - result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + result == FunctionsResponse.FulfillResult.FULFILLED + || result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { emit OracleResponse(requestIds[i], msg.sender); } diff --git a/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol b/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol index 68d346e676..192917dc39 100644 --- a/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol @@ -46,7 +46,9 @@ library ChainSpecificUtil { /// @notice On Arbitrum, the provided calldata is not used to calculate the fees. /// @notice On Optimism, the provided calldata is passed to the GasPriceOracle predeploy /// @notice and getL1Fee is called to get the fees. - function _getCurrentTxL1GasFees(bytes memory txCallData) internal view returns (uint256 l1FeeWei) { + function _getCurrentTxL1GasFees( + bytes memory txCallData + ) internal view returns (uint256 l1FeeWei) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { return ARBGAS.getCurrentTxL1GasFees(); @@ -57,22 +59,19 @@ library ChainSpecificUtil { } /// @notice Return true if and only if the provided chain ID is an Arbitrum chain ID. - function _isArbitrumChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == ARB_MAINNET_CHAIN_ID || - chainId == ARB_GOERLI_TESTNET_CHAIN_ID || - chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; + function _isArbitrumChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == ARB_MAINNET_CHAIN_ID || chainId == ARB_GOERLI_TESTNET_CHAIN_ID + || chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; } /// @notice Return true if and only if the provided chain ID is an Optimism (or Base) chain ID. /// @notice Note that optimism chain id's are also OP stack chain id's. - function _isOptimismChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == OP_MAINNET_CHAIN_ID || - chainId == OP_GOERLI_CHAIN_ID || - chainId == OP_SEPOLIA_CHAIN_ID || - chainId == BASE_MAINNET_CHAIN_ID || - chainId == BASE_GOERLI_CHAIN_ID || - chainId == BASE_SEPOLIA_CHAIN_ID; + function _isOptimismChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_CHAIN_ID || chainId == OP_SEPOLIA_CHAIN_ID + || chainId == BASE_MAINNET_CHAIN_ID || chainId == BASE_GOERLI_CHAIN_ID || chainId == BASE_SEPOLIA_CHAIN_ID; } } diff --git a/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Abstract.sol b/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Abstract.sol index 4182227d64..2730b4d3bb 100644 --- a/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Abstract.sol +++ b/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Abstract.sol @@ -62,19 +62,19 @@ abstract contract OCR2Abstract is ITypeAndVersion { returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest); /** - * @notice optionally emited to indicate the latest configDigest and epoch for - which a report was successfully transmited. Alternatively, the contract may - use latestConfigDigestAndEpoch with scanLogs set to false. - */ + * @notice optionally emited to indicate the latest configDigest and epoch for + * which a report was successfully transmited. Alternatively, the contract may + * use latestConfigDigestAndEpoch with scanLogs set to false. + */ event Transmitted(bytes32 configDigest, uint32 epoch); /** - * @notice optionally returns the latest configDigest and epoch for which a - report was successfully transmitted. Alternatively, the contract may return - scanLogs set to true and use Transmitted events to provide this information - to offchain watchers. + * @notice optionally returns the latest configDigest and epoch for which a + * report was successfully transmitted. Alternatively, the contract may return + * scanLogs set to true and use Transmitted events to provide this information + * to offchain watchers. * @return scanLogs indicates whether to rely on the configDigest and epoch - returned or whether to scan logs for the Transmitted event instead. + * returned or whether to scan logs for the Transmitted event instead. * @return configDigest * @return epoch */ diff --git a/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol index a4fd2bfa12..3789508ec7 100644 --- a/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol @@ -29,6 +29,7 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { uint8 f; // TODO: could be optimized by squeezing into one slot uint8 n; } + ConfigInfo internal s_configInfo; // Used for s_oracles[a].role, where a is an address, to track the purpose @@ -251,18 +252,16 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { // The constant-length components of the msg.data sent to transmit. // See the "If we wanted to call sam" example on for example reasoning // https://solidity.readthedocs.io/en/v0.7.2/abi-spec.html - uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = - 4 + // function selector - 32 * - 3 + // 3 words containing reportContext - 32 + // word containing start location of abiencoded report value - 32 + // word containing location start of abiencoded rs value - 32 + // word containing start location of abiencoded ss value - 32 + // rawVs value - 32 + // word containing length of report - 32 + // word containing length rs - 32 + // word containing length of ss - 0; // placeholder + uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = 4 // function selector + + 32 * 3 // 3 words containing reportContext + + 32 // word containing start location of abiencoded report value + + 32 // word containing location start of abiencoded rs value + + 32 // word containing start location of abiencoded ss value + + 32 // rawVs value + + 32 // word containing length of report + + 32 // word containing length rs + + 32 // word containing length of ss + + 0; // placeholder function _requireExpectedMsgDataLength( bytes calldata report, @@ -270,13 +269,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + - report.length + // one byte pure entry in _report - rs.length * - 32 + // 32 bytes per entry in _rs - ss.length * - 32 + // 32 bytes per entry in _ss - 0; // placeholder + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + + rs.length * 32 // 32 bytes per entry in _rs + + ss.length * 32 // 32 bytes per entry in _ss + + 0; // placeholder if (msg.data.length != expected) revert ReportInvalid("calldata length mismatch"); } @@ -320,8 +316,9 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { if (rs.length != ss.length) revert ReportInvalid("report rs and ss must be of equal length"); Oracle memory transmitter = s_oracles[msg.sender]; - if (transmitter.role != Role.Transmitter && msg.sender != s_transmitters[transmitter.index]) + if (transmitter.role != Role.Transmitter && msg.sender != s_transmitters[transmitter.index]) { revert ReportInvalid("unauthorized transmitter"); + } } address[MAX_NUM_ORACLES] memory signed; diff --git a/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol index dd88d2be16..f5d89c911c 100644 --- a/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; -import {IFunctionsBilling, FunctionsBillingConfig} from "./interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; +import {FunctionsBillingConfig, IFunctionsBilling} from "./interfaces/IFunctionsBilling.sol"; import {Routable} from "../v1_0_0/Routable.sol"; import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; @@ -93,7 +93,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @notice Sets the Chainlink Coordinator's billing configuration /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information - function updateConfig(FunctionsBillingConfig memory config) public { + function updateConfig( + FunctionsBillingConfig memory config + ) public { _onlyOwner(); s_config = config; @@ -105,7 +107,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ /// @inheritdoc IFunctionsBilling - function getDONFeeJuels(bytes memory /* requestData */) public view override returns (uint72) { + function getDONFeeJuels( + bytes memory /* requestData */ + ) public view override returns (uint72) { // s_config.donFee is in cents of USD. Get Juel amount then convert to dollars. return SafeCast.toUint72(_getJuelsFromUsd(s_config.donFeeCentsUsd) / 100); } @@ -123,7 +127,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getWeiPerUnitLink() public view returns (uint256) { - (, int256 weiPerUnitLink, , uint256 timestamp, ) = s_linkToNativeFeed.latestRoundData(); + (, int256 weiPerUnitLink,, uint256 timestamp,) = s_linkToNativeFeed.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (s_config.feedStalenessSeconds < block.timestamp - timestamp && s_config.feedStalenessSeconds > 0) { return s_config.fallbackNativePerUnitLink; @@ -134,7 +138,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return uint256(weiPerUnitLink); } - function _getJuelsFromWei(uint256 amountWei) private view returns (uint96) { + function _getJuelsFromWei( + uint256 amountWei + ) private view returns (uint96) { // (1e18 juels/link) * wei / (wei/link) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) return SafeCast.toUint96((1e18 * amountWei) / getWeiPerUnitLink()); @@ -142,7 +148,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getUsdPerUnitLink() public view returns (uint256, uint8) { - (, int256 usdPerUnitLink, , uint256 timestamp, ) = s_linkToUsdFeed.latestRoundData(); + (, int256 usdPerUnitLink,, uint256 timestamp,) = s_linkToUsdFeed.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (s_config.feedStalenessSeconds < block.timestamp - timestamp && s_config.feedStalenessSeconds > 0) { return (s_config.fallbackUsdPerUnitLink, s_config.fallbackUsdPerUnitLinkDecimals); @@ -153,7 +159,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return (uint256(usdPerUnitLink), s_linkToUsdFeed.decimals()); } - function _getJuelsFromUsd(uint256 amountUsd) private view returns (uint96) { + function _getJuelsFromUsd( + uint256 amountUsd + ) private view returns (uint96) { (uint256 usdPerLink, uint8 decimals) = getUsdPerUnitLink(); // (usd) * (10**18 juels/link) * (10**decimals) / (link / usd) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) @@ -197,8 +205,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { gasPriceWei = s_config.minimumEstimateGasPriceWei; } - uint256 gasPriceWithOverestimation = gasPriceWei + - ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); + uint256 gasPriceWithOverestimation = + gasPriceWei + ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); /// @NOTE: Basis Points are 1/100th of 1%, divide by 10_000 to bring back to original units uint256 executionGas = s_config.gasOverheadBeforeCallback + s_config.gasOverheadAfterCallback + callbackGasLimit; @@ -228,13 +236,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { uint72 donFee = getDONFeeJuels(request.data); operationFee = getOperationFeeJuels(); - uint96 estimatedTotalCostJuels = _calculateCostEstimate( - request.callbackGasLimit, - tx.gasprice, - donFee, - request.adminFee, - operationFee - ); + uint96 estimatedTotalCostJuels = + _calculateCostEstimate(request.callbackGasLimit, tx.gasprice, donFee, request.adminFee, operationFee); // Check that subscription can afford the estimated cost if ((request.availableBalance) < estimatedTotalCostJuels) { @@ -290,7 +293,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { bytes memory response, bytes memory err, bytes memory onchainMetadata, - bytes memory /* offchainMetadata TODO: use in getDonFee() for dynamic billing */, + bytes memory, /* offchainMetadata TODO: use in getDonFee() for dynamic billing */ uint8 reportBatchSize ) internal returns (FunctionsResponse.FulfillResult) { FunctionsResponse.Commitment memory commitment = abi.decode(onchainMetadata, (FunctionsResponse.Commitment)); @@ -330,8 +333,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // In these two fulfillment results the user has been charged // Otherwise, the Coordinator should hold on to the request commitment if ( - resultCode == FunctionsResponse.FulfillResult.FULFILLED || - resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + resultCode == FunctionsResponse.FulfillResult.FULFILLED + || resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { delete s_requestCommitments[requestId]; // Reimburse the transmitter for the fulfillment gas cost @@ -362,7 +365,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling /// @dev Only callable by the Router /// @dev Used by FunctionsRouter.sol during timeout of a request - function deleteCommitment(bytes32 requestId) external override onlyRouter { + function deleteCommitment( + bytes32 requestId + ) external override onlyRouter { // Delete commitment delete s_requestCommitments[requestId]; emit CommitmentDeleted(requestId); @@ -431,7 +436,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { function _onlyOwner() internal view virtual; // Used in FunctionsCoordinator.sol - function _isExistingRequest(bytes32 requestId) internal view returns (bool) { + function _isExistingRequest( + bytes32 requestId + ) internal view returns (bool) { return s_requestCommitments[requestId] != bytes32(0); } diff --git a/contracts/src/v0.8/functions/v1_3_0/FunctionsClient.sol b/contracts/src/v0.8/functions/v1_3_0/FunctionsClient.sol index 84b6414651..65fa77b5ca 100644 --- a/contracts/src/v0.8/functions/v1_3_0/FunctionsClient.sol +++ b/contracts/src/v0.8/functions/v1_3_0/FunctionsClient.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsRouter} from "../v1_0_0/interfaces/IFunctionsRouter.sol"; import {IFunctionsClient} from "../v1_0_0/interfaces/IFunctionsClient.sol"; +import {IFunctionsRouter} from "../v1_0_0/interfaces/IFunctionsRouter.sol"; import {FunctionsRequest} from "../v1_0_0/libraries/FunctionsRequest.sol"; @@ -18,7 +18,9 @@ abstract contract FunctionsClient is IFunctionsClient { error OnlyRouterCanFulfill(); - constructor(address router) { + constructor( + address router + ) { i_functionsRouter = IFunctionsRouter(router); } @@ -34,11 +36,7 @@ abstract contract FunctionsClient is IFunctionsClient { bytes32 donId ) internal returns (bytes32) { bytes32 requestId = i_functionsRouter.sendRequest( - subscriptionId, - data, - FunctionsRequest.REQUEST_DATA_VERSION, - callbackGasLimit, - donId + subscriptionId, data, FunctionsRequest.REQUEST_DATA_VERSION, callbackGasLimit, donId ); emit RequestSent(requestId); return requestId; diff --git a/contracts/src/v0.8/functions/v1_3_0/FunctionsCoordinator.sol b/contracts/src/v0.8/functions/v1_3_0/FunctionsCoordinator.sol index 9c7f359871..17cf86cfad 100644 --- a/contracts/src/v0.8/functions/v1_3_0/FunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/v1_3_0/FunctionsCoordinator.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsCoordinator} from "../v1_0_0/interfaces/IFunctionsCoordinator.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {IFunctionsCoordinator} from "../v1_0_0/interfaces/IFunctionsCoordinator.sol"; +import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; import {FunctionsBilling, FunctionsBillingConfig} from "./FunctionsBilling.sol"; import {OCR2Base} from "./ocr/OCR2Base.sol"; -import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; /// @title Functions Coordinator contract /// @notice Contract that nodes of a Decentralized Oracle Network (DON) interact with @@ -56,7 +56,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external override onlyOwner { + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external override onlyOwner { if (thresholdPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -72,7 +74,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setDONPublicKey(bytes calldata donPublicKey) external override onlyOwner { + function setDONPublicKey( + bytes calldata donPublicKey + ) external override onlyOwner { if (donPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -80,7 +84,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev check if node is in current transmitter list - function _isTransmitter(address node) internal view returns (bool) { + function _isTransmitter( + address node + ) internal view returns (bool) { // Bounded by "maxNumOracles" on OCR2Abstract.sol for (uint256 i = 0; i < s_transmitters.length; ++i) { if (s_transmitters[i] == node) { @@ -129,7 +135,7 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev DON fees are pooled together. If the OCR configuration is going to change, these need to be distributed. - function _beforeSetConfig(uint8 /* _f */, bytes memory /* _onchainConfig */) internal override { + function _beforeSetConfig(uint8, /* _f */ bytes memory /* _onchainConfig */ ) internal override { if (_getTransmitters().length > 0) { _disperseFeePool(); } @@ -153,11 +159,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli uint256 numberOfFulfillments = uint8(requestIds.length); if ( - numberOfFulfillments == 0 || - numberOfFulfillments != results.length || - numberOfFulfillments != errors.length || - numberOfFulfillments != onchainMetadata.length || - numberOfFulfillments != offchainMetadata.length + numberOfFulfillments == 0 || numberOfFulfillments != results.length || numberOfFulfillments != errors.length + || numberOfFulfillments != onchainMetadata.length || numberOfFulfillments != offchainMetadata.length ) { revert ReportInvalid("Fields must be equal length"); } @@ -188,7 +191,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev Report hook called within OCR2Base.sol - function _report(DecodedReport memory decodedReport) internal override { + function _report( + DecodedReport memory decodedReport + ) internal override { uint256 numberOfFulfillments = uint8(decodedReport.requestIds.length); // Bounded by "MaxRequestBatchSize" on the Job's ReportingPluginConfig @@ -208,8 +213,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli // In these two fulfillment results the user has been charged // Otherwise, the DON will re-try if ( - result == FunctionsResponse.FulfillResult.FULFILLED || - result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + result == FunctionsResponse.FulfillResult.FULFILLED + || result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { emit OracleResponse(decodedReport.requestIds[i], msg.sender); } diff --git a/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol index 03f3513f64..2aaa161d40 100644 --- a/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {ITermsOfServiceAllowList, TermsOfServiceAllowListConfig} from "./interfaces/ITermsOfServiceAllowList.sol"; import {IAccessController} from "../../../shared/interfaces/IAccessController.sol"; import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; +import {ITermsOfServiceAllowList, TermsOfServiceAllowListConfig} from "./interfaces/ITermsOfServiceAllowList.sol"; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; @@ -71,7 +71,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, /// @notice Sets the contracts's configuration /// @param config - See the contents of the TermsOfServiceAllowListConfig struct in ITermsOfServiceAllowList.sol for more information - function updateConfig(TermsOfServiceAllowListConfig memory config) public onlyOwner { + function updateConfig( + TermsOfServiceAllowListConfig memory config + ) public onlyOwner { s_config = config; emit ConfigUpdated(config); } @@ -92,9 +94,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } // Validate that the signature is correct and the correct data has been signed - bytes32 prefixedMessage = keccak256( - abi.encodePacked("\x19Ethereum Signed Message:\n32", getMessage(acceptor, recipient)) - ); + bytes32 prefixedMessage = + keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", getMessage(acceptor, recipient))); if (ecrecover(prefixedMessage, v, r, s) != s_config.signerPublicKey) { revert InvalidSignature(); } @@ -129,9 +130,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, uint64 allowedSenderIdxEnd ) external view override returns (address[] memory allowedSenders) { if ( - allowedSenderIdxStart > allowedSenderIdxEnd || - allowedSenderIdxEnd >= s_allowedSenders.length() || - s_allowedSenders.length() == 0 + allowedSenderIdxStart > allowedSenderIdxEnd || allowedSenderIdxEnd >= s_allowedSenders.length() + || s_allowedSenders.length() == 0 ) { revert InvalidCalldata(); } @@ -145,7 +145,7 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc IAccessController - function hasAccess(address user, bytes calldata /* data */) external view override returns (bool) { + function hasAccess(address user, bytes calldata /* data */ ) external view override returns (bool) { if (!s_config.enabled) { return true; } @@ -157,7 +157,9 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, // ================================================================ /// @inheritdoc ITermsOfServiceAllowList - function isBlockedSender(address sender) external view override returns (bool) { + function isBlockedSender( + address sender + ) external view override returns (bool) { if (!s_config.enabled) { return false; } @@ -165,14 +167,18 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @inheritdoc ITermsOfServiceAllowList - function blockSender(address sender) external override onlyOwner { + function blockSender( + address sender + ) external override onlyOwner { s_allowedSenders.remove(sender); s_blockedSenders.add(sender); emit BlockedAccess(sender); } /// @inheritdoc ITermsOfServiceAllowList - function unblockSender(address sender) external override onlyOwner { + function unblockSender( + address sender + ) external override onlyOwner { s_blockedSenders.remove(sender); emit UnblockedAccess(sender); } @@ -188,9 +194,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, uint64 blockedSenderIdxEnd ) external view override returns (address[] memory blockedSenders) { if ( - blockedSenderIdxStart > blockedSenderIdxEnd || - blockedSenderIdxEnd >= s_blockedSenders.length() || - s_blockedSenders.length() == 0 + blockedSenderIdxStart > blockedSenderIdxEnd || blockedSenderIdxEnd >= s_blockedSenders.length() + || s_blockedSenders.length() == 0 ) { revert InvalidCalldata(); } diff --git a/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol index 65db9c42b6..2a1a0d60c5 100644 --- a/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol @@ -12,7 +12,9 @@ interface ITermsOfServiceAllowList { /// @notice Check if the address is blocked for usage /// @param sender The transaction sender's address /// @return True or false - function isBlockedSender(address sender) external returns (bool); + function isBlockedSender( + address sender + ) external returns (bool); /// @notice Get a list of all allowed senders /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed @@ -48,11 +50,15 @@ interface ITermsOfServiceAllowList { /// @notice Removes a sender's access if already authorized, and disallows re-accepting the Terms of Service /// @param sender - Address of the sender to block - function blockSender(address sender) external; + function blockSender( + address sender + ) external; /// @notice Re-allows a previously blocked sender to accept the Terms of Service /// @param sender - Address of the sender to unblock - function unblockSender(address sender) external; + function unblockSender( + address sender + ) external; /// @notice Get details about the total number of blocked senders /// @return count - total number of blocked senders in the system diff --git a/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol index 79806f1eb1..369518489e 100644 --- a/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol @@ -15,7 +15,9 @@ interface IFunctionsBilling { /// @notice Determine the fee that will be split between Node Operators for servicing a request /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request /// @return fee - Cost in Juels (1e18) of LINK - function getDONFeeJuels(bytes memory requestCBOR) external view returns (uint72); + function getDONFeeJuels( + bytes memory requestCBOR + ) external view returns (uint72); /// @notice Determine the fee that will be paid to the Coordinator owner for operating the network /// @return fee - Cost in Juels (1e18) of LINK @@ -40,7 +42,9 @@ interface IFunctionsBilling { /// @notice Remove a request commitment that the Router has determined to be stale /// @param requestId - The request ID to remove - function deleteCommitment(bytes32 requestId) external; + function deleteCommitment( + bytes32 requestId + ) external; /// @notice Oracle withdraw LINK earned through fulfilling requests /// @notice If amount is 0 the full balance will be withdrawn diff --git a/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Abstract.sol b/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Abstract.sol index 4182227d64..2730b4d3bb 100644 --- a/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Abstract.sol +++ b/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Abstract.sol @@ -62,19 +62,19 @@ abstract contract OCR2Abstract is ITypeAndVersion { returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest); /** - * @notice optionally emited to indicate the latest configDigest and epoch for - which a report was successfully transmited. Alternatively, the contract may - use latestConfigDigestAndEpoch with scanLogs set to false. - */ + * @notice optionally emited to indicate the latest configDigest and epoch for + * which a report was successfully transmited. Alternatively, the contract may + * use latestConfigDigestAndEpoch with scanLogs set to false. + */ event Transmitted(bytes32 configDigest, uint32 epoch); /** - * @notice optionally returns the latest configDigest and epoch for which a - report was successfully transmitted. Alternatively, the contract may return - scanLogs set to true and use Transmitted events to provide this information - to offchain watchers. + * @notice optionally returns the latest configDigest and epoch for which a + * report was successfully transmitted. Alternatively, the contract may return + * scanLogs set to true and use Transmitted events to provide this information + * to offchain watchers. * @return scanLogs indicates whether to rely on the configDigest and epoch - returned or whether to scan logs for the Transmitted event instead. + * returned or whether to scan logs for the Transmitted event instead. * @return configDigest * @return epoch */ diff --git a/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol index 565e7d800d..5103b93504 100644 --- a/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol @@ -29,6 +29,7 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { uint8 f; // TODO: could be optimized by squeezing into one slot uint8 n; } + ConfigInfo internal s_configInfo; // Used for s_oracles[a].role, where a is an address, to track the purpose @@ -245,23 +246,23 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { * for the extending contract to handle additional logic, such as oracle payment * @param decodedReport decodedReport */ - function _report(DecodedReport memory decodedReport) internal virtual; + function _report( + DecodedReport memory decodedReport + ) internal virtual; // The constant-length components of the msg.data sent to transmit. // See the "If we wanted to call sam" example on for example reasoning // https://solidity.readthedocs.io/en/v0.7.2/abi-spec.html - uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = - 4 + // function selector - 32 * - 3 + // 3 words containing reportContext - 32 + // word containing start location of abiencoded report value - 32 + // word containing location start of abiencoded rs value - 32 + // word containing start location of abiencoded ss value - 32 + // rawVs value - 32 + // word containing length of report - 32 + // word containing length rs - 32 + // word containing length of ss - 0; // placeholder + uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = 4 // function selector + + 32 * 3 // 3 words containing reportContext + + 32 // word containing start location of abiencoded report value + + 32 // word containing location start of abiencoded rs value + + 32 // word containing start location of abiencoded ss value + + 32 // rawVs value + + 32 // word containing length of report + + 32 // word containing length rs + + 32 // word containing length of ss + + 0; // placeholder function _requireExpectedMsgDataLength( bytes calldata report, @@ -269,13 +270,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + - report.length + // one byte pure entry in _report - rs.length * - 32 + // 32 bytes per entry in _rs - ss.length * - 32 + // 32 bytes per entry in _ss - 0; // placeholder + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + + rs.length * 32 // 32 bytes per entry in _rs + + ss.length * 32 // 32 bytes per entry in _ss + + 0; // placeholder if (msg.data.length != expected) revert ReportInvalid("calldata length mismatch"); } @@ -327,8 +325,9 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { if (rs.length != ss.length) revert ReportInvalid("report rs and ss must be of equal length"); Oracle memory transmitter = s_oracles[msg.sender]; - if (transmitter.role != Role.Transmitter && msg.sender != s_transmitters[transmitter.index]) + if (transmitter.role != Role.Transmitter && msg.sender != s_transmitters[transmitter.index]) { revert ReportInvalid("unauthorized transmitter"); + } } address[MAX_NUM_ORACLES] memory signed; diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol index bb5bca3034..e41fae80e9 100644 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; -import {IFunctionsBilling, FunctionsBillingConfig} from "../v1_3_0/interfaces/IFunctionsBilling.sol"; +import {IFunctionsSubscriptions} from "../v1_0_0/interfaces/IFunctionsSubscriptions.sol"; +import {FunctionsBillingConfig, IFunctionsBilling} from "../v1_3_0/interfaces/IFunctionsBilling.sol"; import {Routable} from "../v1_0_0/Routable.sol"; import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; @@ -91,7 +91,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @notice Sets the Chainlink Coordinator's billing configuration /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information - function updateConfig(FunctionsBillingConfig memory config) public { + function updateConfig( + FunctionsBillingConfig memory config + ) public { _onlyOwner(); s_config = config; @@ -103,7 +105,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ /// @inheritdoc IFunctionsBilling - function getDONFeeJuels(bytes memory /* requestData */) public view override returns (uint72) { + function getDONFeeJuels( + bytes memory /* requestData */ + ) public view override returns (uint72) { // s_config.donFee is in cents of USD. Get Juel amount then convert to dollars. return SafeCast.toUint72(_getJuelsFromUsd(s_config.donFeeCentsUsd) / 100); } @@ -121,7 +125,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getWeiPerUnitLink() public view returns (uint256) { - (, int256 weiPerUnitLink, , uint256 timestamp, ) = s_linkToNativeFeed.latestRoundData(); + (, int256 weiPerUnitLink,, uint256 timestamp,) = s_linkToNativeFeed.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (s_config.feedStalenessSeconds < block.timestamp - timestamp && s_config.feedStalenessSeconds > 0) { return s_config.fallbackNativePerUnitLink; @@ -132,7 +136,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return uint256(weiPerUnitLink); } - function _getJuelsFromWei(uint256 amountWei) private view returns (uint96) { + function _getJuelsFromWei( + uint256 amountWei + ) private view returns (uint96) { // (1e18 juels/link) * wei / (wei/link) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) return SafeCast.toUint96((1e18 * amountWei) / getWeiPerUnitLink()); @@ -140,7 +146,7 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling function getUsdPerUnitLink() public view returns (uint256, uint8) { - (, int256 usdPerUnitLink, , uint256 timestamp, ) = s_linkToUsdFeed.latestRoundData(); + (, int256 usdPerUnitLink,, uint256 timestamp,) = s_linkToUsdFeed.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (s_config.feedStalenessSeconds < block.timestamp - timestamp && s_config.feedStalenessSeconds > 0) { return (s_config.fallbackUsdPerUnitLink, s_config.fallbackUsdPerUnitLinkDecimals); @@ -151,7 +157,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return (uint256(usdPerUnitLink), s_linkToUsdFeed.decimals()); } - function _getJuelsFromUsd(uint256 amountUsd) private view returns (uint96) { + function _getJuelsFromUsd( + uint256 amountUsd + ) private view returns (uint96) { (uint256 usdPerLink, uint8 decimals) = getUsdPerUnitLink(); // (usd) * (10**18 juels/link) * (10**decimals) / (link / usd) = juels // There are only 1e9*1e18 = 1e27 juels in existence, should not exceed uint96 (2^96 ~ 7e28) @@ -195,8 +203,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { gasPriceWei = s_config.minimumEstimateGasPriceWei; } - uint256 gasPriceWithOverestimation = gasPriceWei + - ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); + uint256 gasPriceWithOverestimation = + gasPriceWei + ((gasPriceWei * s_config.fulfillmentGasPriceOverEstimationBP) / 10_000); /// @NOTE: Basis Points are 1/100th of 1%, divide by 10_000 to bring back to original units uint256 executionGas = s_config.gasOverheadBeforeCallback + s_config.gasOverheadAfterCallback + callbackGasLimit; @@ -225,13 +233,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { uint72 donFee = getDONFeeJuels(request.data); operationFee = getOperationFeeJuels(); - uint96 estimatedTotalCostJuels = _calculateCostEstimate( - request.callbackGasLimit, - tx.gasprice, - donFee, - request.adminFee, - operationFee - ); + uint96 estimatedTotalCostJuels = + _calculateCostEstimate(request.callbackGasLimit, tx.gasprice, donFee, request.adminFee, operationFee); // Check that subscription can afford the estimated cost if ((request.availableBalance) < estimatedTotalCostJuels) { @@ -325,8 +328,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // In these two fulfillment results the user has been charged // Otherwise, the Coordinator should hold on to the request commitment if ( - resultCode == FunctionsResponse.FulfillResult.FULFILLED || - resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + resultCode == FunctionsResponse.FulfillResult.FULFILLED + || resultCode == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { delete s_requestCommitments[requestId]; // Reimburse the transmitter for the fulfillment gas cost @@ -357,7 +360,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { /// @inheritdoc IFunctionsBilling /// @dev Only callable by the Router /// @dev Used by FunctionsRouter.sol during timeout of a request - function deleteCommitment(bytes32 requestId) external override onlyRouter { + function deleteCommitment( + bytes32 requestId + ) external override onlyRouter { // Delete commitment delete s_requestCommitments[requestId]; emit CommitmentDeleted(requestId); @@ -426,7 +431,9 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { function _onlyOwner() internal view virtual; // Used in FunctionsCoordinator.sol - function _isExistingRequest(bytes32 requestId) internal view returns (bool) { + function _isExistingRequest( + bytes32 requestId + ) internal view returns (bool) { return s_requestCommitments[requestId] != bytes32(0); } diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsCoordinator.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsCoordinator.sol index 66802cc492..0f1de40042 100644 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsCoordinator.sol +++ b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsCoordinator.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {IFunctionsCoordinator} from "../v1_0_0/interfaces/IFunctionsCoordinator.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {IFunctionsCoordinator} from "../v1_0_0/interfaces/IFunctionsCoordinator.sol"; -import {FunctionsBilling, FunctionsBillingConfig} from "./FunctionsBilling.sol"; -import {OCR2Base} from "../v1_3_0/ocr/OCR2Base.sol"; import {FunctionsResponse} from "../v1_0_0/libraries/FunctionsResponse.sol"; +import {OCR2Base} from "../v1_3_0/ocr/OCR2Base.sol"; +import {FunctionsBilling, FunctionsBillingConfig} from "./FunctionsBilling.sol"; /// @title Functions Coordinator contract /// @notice Contract that nodes of a Decentralized Oracle Network (DON) interact with @@ -56,7 +56,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setThresholdPublicKey(bytes calldata thresholdPublicKey) external override onlyOwner { + function setThresholdPublicKey( + bytes calldata thresholdPublicKey + ) external override onlyOwner { if (thresholdPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -72,7 +74,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @inheritdoc IFunctionsCoordinator - function setDONPublicKey(bytes calldata donPublicKey) external override onlyOwner { + function setDONPublicKey( + bytes calldata donPublicKey + ) external override onlyOwner { if (donPublicKey.length == 0) { revert EmptyPublicKey(); } @@ -80,7 +84,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev check if node is in current transmitter list - function _isTransmitter(address node) internal view returns (bool) { + function _isTransmitter( + address node + ) internal view returns (bool) { // Bounded by "maxNumOracles" on OCR2Abstract.sol for (uint256 i = 0; i < s_transmitters.length; ++i) { if (s_transmitters[i] == node) { @@ -129,7 +135,7 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev DON fees are pooled together. If the OCR configuration is going to change, these need to be distributed. - function _beforeSetConfig(uint8 /* _f */, bytes memory /* _onchainConfig */) internal override { + function _beforeSetConfig(uint8, /* _f */ bytes memory /* _onchainConfig */ ) internal override { if (_getTransmitters().length > 0) { _disperseFeePool(); } @@ -153,11 +159,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli uint256 numberOfFulfillments = uint8(requestIds.length); if ( - numberOfFulfillments == 0 || - numberOfFulfillments != results.length || - numberOfFulfillments != errors.length || - numberOfFulfillments != onchainMetadata.length || - numberOfFulfillments != offchainMetadata.length + numberOfFulfillments == 0 || numberOfFulfillments != results.length || numberOfFulfillments != errors.length + || numberOfFulfillments != onchainMetadata.length || numberOfFulfillments != offchainMetadata.length ) { revert ReportInvalid("Fields must be equal length"); } @@ -188,7 +191,9 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli } /// @dev Report hook called within OCR2Base.sol - function _report(DecodedReport memory decodedReport) internal override { + function _report( + DecodedReport memory decodedReport + ) internal override { uint256 numberOfFulfillments = uint8(decodedReport.requestIds.length); // Bounded by "MaxRequestBatchSize" on the Job's ReportingPluginConfig @@ -207,8 +212,8 @@ contract FunctionsCoordinator is OCR2Base, IFunctionsCoordinator, FunctionsBilli // In these two fulfillment results the user has been charged // Otherwise, the DON will re-try if ( - result == FunctionsResponse.FulfillResult.FULFILLED || - result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR + result == FunctionsResponse.FulfillResult.FULFILLED + || result == FunctionsResponse.FulfillResult.USER_CALLBACK_ERROR ) { emit OracleResponse(decodedReport.requestIds[i], msg.sender); } diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/ZKSyncFunctionsRouter.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/ZKSyncFunctionsRouter.sol index 869e674c5f..372a9fb434 100644 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/ZKSyncFunctionsRouter.sol +++ b/contracts/src/v0.8/functions/v1_3_0_zksync/ZKSyncFunctionsRouter.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsRouter} from "../v1_0_0/FunctionsRouter.sol"; import {CallWithExactGasZKSync} from "../../shared/call/CallWithExactGasZKSync.sol"; +import {FunctionsRouter} from "../v1_0_0/FunctionsRouter.sol"; /// /// @title FunctionsRouterZkSync @@ -29,11 +29,11 @@ contract ZKSyncFunctionsRouter is FunctionsRouter { (bool success, bytes memory returnData, uint256 pubdataGasSpent) = CallWithExactGasZKSync ._callWithExactGasSafeReturnData( - client, - callbackGasLimit, - abi.encodeWithSelector(this.getConfig().handleOracleFulfillmentSelector, requestId, response, err), - MAX_CALLBACK_RETURN_BYTES - ); + client, + callbackGasLimit, + abi.encodeWithSelector(this.getConfig().handleOracleFulfillmentSelector, requestId, response, err), + MAX_CALLBACK_RETURN_BYTES + ); return CallbackResult({success: success, gasUsed: g1 - gasleft() + pubdataGasSpent, returnData: returnData}); } } diff --git a/contracts/src/v0.8/keystone/BalanceReader.sol b/contracts/src/v0.8/keystone/BalanceReader.sol index 8d72e9ddad..b2211f7c1b 100644 --- a/contracts/src/v0.8/keystone/BalanceReader.sol +++ b/contracts/src/v0.8/keystone/BalanceReader.sol @@ -8,7 +8,9 @@ import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; contract BalanceReader is ITypeAndVersion { string public constant override typeAndVersion = "BalanceReader 1.0.0"; - function getNativeBalances(address[] memory addresses) public view returns (uint256[] memory) { + function getNativeBalances( + address[] memory addresses + ) public view returns (uint256[] memory) { uint256[] memory balances = new uint256[](addresses.length); for (uint256 i = 0; i < addresses.length; ++i) { balances[i] = addresses[i].balance; diff --git a/contracts/src/v0.8/keystone/CapabilitiesRegistry.sol b/contracts/src/v0.8/keystone/CapabilitiesRegistry.sol index 831e35e73b..9c694b6fc9 100644 --- a/contracts/src/v0.8/keystone/CapabilitiesRegistry.sol +++ b/contracts/src/v0.8/keystone/CapabilitiesRegistry.sol @@ -6,10 +6,10 @@ import {ICapabilityConfiguration} from "./interfaces/ICapabilityConfiguration.so import {OwnerIsCreator} from "../shared/access/OwnerIsCreator.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableSet.sol"; -import {ERC165Checker} from "@openzeppelin/contracts@4.8.3/utils/introspection/ERC165Checker.sol"; import {ICapabilityConfiguration} from "./interfaces/ICapabilityConfiguration.sol"; import {INodeInfoProvider} from "./interfaces/INodeInfoProvider.sol"; +import {ERC165Checker} from "@openzeppelin/contracts@4.8.3/utils/introspection/ERC165Checker.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableSet.sol"; /// @notice CapabilitiesRegistry is used to manage Nodes (including their links to Node Operators), Capabilities, /// and DONs (Decentralized Oracle Networks) which are sets of nodes that support those Capabilities. @@ -428,7 +428,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Adds a list of node operators /// @param nodeOperators List of node operators to add - function addNodeOperators(NodeOperator[] calldata nodeOperators) external onlyOwner { + function addNodeOperators( + NodeOperator[] calldata nodeOperators + ) external onlyOwner { for (uint256 i; i < nodeOperators.length; ++i) { NodeOperator memory nodeOperator = nodeOperators[i]; if (nodeOperator.admin == address(0)) revert InvalidNodeOperatorAdmin(); @@ -441,7 +443,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Removes a node operator /// @param nodeOperatorIds The IDs of the node operators to remove - function removeNodeOperators(uint32[] calldata nodeOperatorIds) external onlyOwner { + function removeNodeOperators( + uint32[] calldata nodeOperatorIds + ) external onlyOwner { for (uint32 i; i < nodeOperatorIds.length; ++i) { uint32 nodeOperatorId = nodeOperatorIds[i]; delete s_nodeOperators[nodeOperatorId]; @@ -453,8 +457,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @param nodeOperatorIds The ID of the node operator being updated /// @param nodeOperators The updated node operator params function updateNodeOperators(uint32[] calldata nodeOperatorIds, NodeOperator[] calldata nodeOperators) external { - if (nodeOperatorIds.length != nodeOperators.length) + if (nodeOperatorIds.length != nodeOperators.length) { revert LengthMismatch(nodeOperatorIds.length, nodeOperators.length); + } address owner = owner(); for (uint256 i; i < nodeOperatorIds.length; ++i) { @@ -468,8 +473,8 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers if (msg.sender != currentNodeOperator.admin && msg.sender != owner) revert AccessForbidden(msg.sender); if ( - currentNodeOperator.admin != nodeOperator.admin || - keccak256(abi.encode(currentNodeOperator.name)) != keccak256(abi.encode(nodeOperator.name)) + currentNodeOperator.admin != nodeOperator.admin + || keccak256(abi.encode(currentNodeOperator.name)) != keccak256(abi.encode(nodeOperator.name)) ) { currentNodeOperator.admin = nodeOperator.admin; currentNodeOperator.name = nodeOperator.name; @@ -481,7 +486,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Gets a node operator's data /// @param nodeOperatorId The ID of the node operator to query for /// @return NodeOperator The node operator data - function getNodeOperator(uint32 nodeOperatorId) external view returns (NodeOperator memory) { + function getNodeOperator( + uint32 nodeOperatorId + ) external view returns (NodeOperator memory) { return s_nodeOperators[nodeOperatorId]; } @@ -515,7 +522,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Adds nodes. Nodes can be added with deprecated capabilities to /// avoid breaking changes when deprecating capabilities. /// @param nodes The nodes to add - function addNodes(NodeParams[] calldata nodes) external { + function addNodes( + NodeParams[] calldata nodes + ) external { bool isOwner = msg.sender == owner(); for (uint256 i; i < nodes.length; ++i) { NodeParams memory node = nodes[i]; @@ -556,7 +565,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Removes nodes. The node operator admin or contract owner /// can remove nodes /// @param removedNodeP2PIds The P2P Ids of the nodes to remove - function removeNodes(bytes32[] calldata removedNodeP2PIds) external { + function removeNodes( + bytes32[] calldata removedNodeP2PIds + ) external { bool isOwner = msg.sender == owner(); for (uint256 i; i < removedNodeP2PIds.length; ++i) { bytes32 p2pId = removedNodeP2PIds[i]; @@ -564,8 +575,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers Node storage node = s_nodes[p2pId]; if (node.signer == bytes32("")) revert NodeDoesNotExist(p2pId); - if (node.capabilitiesDONIds.length() > 0) + if (node.capabilitiesDONIds.length() > 0) { revert NodePartOfCapabilitiesDON(uint32(node.capabilitiesDONIds.at(i)), p2pId); + } if (node.workflowDONId != 0) revert NodePartOfWorkflowDON(node.workflowDONId, p2pId); if (!isOwner && msg.sender != s_nodeOperators[node.nodeOperatorId].admin) revert AccessForbidden(msg.sender); @@ -579,7 +591,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Updates nodes. The node admin can update the node's signer address /// and reconfigure its supported capabilities /// @param nodes The nodes to update - function updateNodes(NodeParams[] calldata nodes) external { + function updateNodes( + NodeParams[] calldata nodes + ) external { bool isOwner = msg.sender == owner(); for (uint256 i; i < nodes.length; ++i) { NodeParams memory node = nodes[i]; @@ -606,21 +620,22 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers uint32 capabilityConfigCount = ++storedNode.configCount; for (uint256 j; j < supportedHashedCapabilityIds.length; ++j) { - if (!s_hashedCapabilityIds.contains(supportedHashedCapabilityIds[j])) + if (!s_hashedCapabilityIds.contains(supportedHashedCapabilityIds[j])) { revert InvalidNodeCapabilities(supportedHashedCapabilityIds); + } storedNode.supportedHashedCapabilityIds[capabilityConfigCount].add(supportedHashedCapabilityIds[j]); } // Validate that capabilities required by a Workflow DON are still supported uint32 nodeWorkflowDONId = storedNode.workflowDONId; if (nodeWorkflowDONId != 0) { - bytes32[] memory workflowDonCapabilityIds = s_dons[nodeWorkflowDONId] - .config[s_dons[nodeWorkflowDONId].configCount] - .capabilityIds; + bytes32[] memory workflowDonCapabilityIds = + s_dons[nodeWorkflowDONId].config[s_dons[nodeWorkflowDONId].configCount].capabilityIds; for (uint256 j; j < workflowDonCapabilityIds.length; ++j) { - if (!storedNode.supportedHashedCapabilityIds[capabilityConfigCount].contains(workflowDonCapabilityIds[j])) + if (!storedNode.supportedHashedCapabilityIds[capabilityConfigCount].contains(workflowDonCapabilityIds[j])) { revert CapabilityRequiredByDON(workflowDonCapabilityIds[j], nodeWorkflowDONId); + } } } @@ -631,8 +646,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers bytes32[] memory donCapabilityIds = s_dons[donId].config[s_dons[donId].configCount].capabilityIds; for (uint256 k; k < donCapabilityIds.length; ++k) { - if (!storedNode.supportedHashedCapabilityIds[capabilityConfigCount].contains(donCapabilityIds[k])) + if (!storedNode.supportedHashedCapabilityIds[capabilityConfigCount].contains(donCapabilityIds[k])) { revert CapabilityRequiredByDON(donCapabilityIds[k], donId); + } } } @@ -647,7 +663,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Gets a node's data /// @param p2pId The P2P ID of the node to query for /// @return nodeInfo NodeInfo The node data - function getNode(bytes32 p2pId) public view returns (NodeInfo memory nodeInfo) { + function getNode( + bytes32 p2pId + ) public view returns (NodeInfo memory nodeInfo) { return ( NodeInfo({ nodeOperatorId: s_nodes[p2pId].nodeOperatorId, @@ -677,7 +695,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Gets nodes by their P2P IDs /// @param p2pIds The P2P IDs of the nodes to query for /// @return NodeInfo[] The nodes data - function getNodesByP2PIds(bytes32[] calldata p2pIds) external view returns (NodeInfo[] memory) { + function getNodesByP2PIds( + bytes32[] calldata p2pIds + ) external view returns (NodeInfo[] memory) { NodeInfo[] memory nodesInfo = new NodeInfo[](p2pIds.length); for (uint256 i; i < p2pIds.length; ++i) { @@ -692,7 +712,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @dev There is no function to update capabilities as this would require /// nodes to trust that the capabilities they support are not updated by the /// admin - function addCapabilities(Capability[] calldata capabilities) external onlyOwner { + function addCapabilities( + Capability[] calldata capabilities + ) external onlyOwner { for (uint256 i; i < capabilities.length; ++i) { Capability memory capability = capabilities[i]; bytes32 hashedCapabilityId = getHashedCapabilityId(capability.labelledName, capability.version); @@ -703,7 +725,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Deprecates a capability /// @param hashedCapabilityIds[] The IDs of the capabilities to deprecate - function deprecateCapabilities(bytes32[] calldata hashedCapabilityIds) external onlyOwner { + function deprecateCapabilities( + bytes32[] calldata hashedCapabilityIds + ) external onlyOwner { for (uint256 i; i < hashedCapabilityIds.length; ++i) { bytes32 hashedCapabilityId = hashedCapabilityIds[i]; if (!s_hashedCapabilityIds.contains(hashedCapabilityId)) revert CapabilityDoesNotExist(hashedCapabilityId); @@ -715,7 +739,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Returns a Capability by its hashed ID. /// @dev Use `getHashedCapabilityId` to get the hashed ID. - function getCapability(bytes32 hashedId) public view returns (CapabilityInfo memory) { + function getCapability( + bytes32 hashedId + ) public view returns (CapabilityInfo memory) { return ( CapabilityInfo({ hashedId: hashedId, @@ -755,7 +781,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Returns whether a capability is deprecated /// @param hashedCapabilityId The hashed ID of the capability to check /// @return bool True if the capability is deprecated, false otherwise - function isCapabilityDeprecated(bytes32 hashedCapabilityId) external view returns (bool) { + function isCapabilityDeprecated( + bytes32 hashedCapabilityId + ) external view returns (bool) { return s_deprecatedHashedCapabilityIds.contains(hashedCapabilityId); } @@ -819,7 +847,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Removes DONs from the Capability Registry /// @param donIds The IDs of the DON to be removed - function removeDONs(uint32[] calldata donIds) external onlyOwner { + function removeDONs( + uint32[] calldata donIds + ) external onlyOwner { for (uint256 i; i < donIds.length; ++i) { uint32 donId = donIds[i]; DON storage don = s_dons[donId]; @@ -846,7 +876,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Gets DON's data /// @param donId The DON ID /// @return DONInfo The DON's parameters - function getDON(uint32 donId) external view returns (DONInfo memory) { + function getDON( + uint32 donId + ) external view returns (DONInfo memory) { return _getDON(donId); } @@ -884,8 +916,8 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers bytes memory globalCapabilityConfig; if (s_capabilities[capabilityId].configurationContract != address(0)) { - globalCapabilityConfig = ICapabilityConfiguration(s_capabilities[capabilityId].configurationContract) - .getCapabilityConfiguration(donId); + globalCapabilityConfig = + ICapabilityConfiguration(s_capabilities[capabilityId].configurationContract).getCapabilityConfiguration(donId); } return (donCapabilityConfig, globalCapabilityConfig); @@ -927,8 +959,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers if (!donCapabilityConfig.nodes.add(nodes[i])) revert DuplicateDONNode(donParams.id, nodes[i]); if (donParams.acceptsWorkflows) { - if (s_nodes[nodes[i]].workflowDONId != donParams.id && s_nodes[nodes[i]].workflowDONId != 0) + if (s_nodes[nodes[i]].workflowDONId != donParams.id && s_nodes[nodes[i]].workflowDONId != 0) { revert NodePartOfWorkflowDON(donParams.id, nodes[i]); + } s_nodes[nodes[i]].workflowDONId = donParams.id; } else { /// Fine to add a duplicate DON ID to the set of supported DON IDs again as the set @@ -940,13 +973,16 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers for (uint256 i; i < capabilityConfigurations.length; ++i) { CapabilityConfiguration calldata configuration = capabilityConfigurations[i]; - if (!s_hashedCapabilityIds.contains(configuration.capabilityId)) + if (!s_hashedCapabilityIds.contains(configuration.capabilityId)) { revert CapabilityDoesNotExist(configuration.capabilityId); - if (s_deprecatedHashedCapabilityIds.contains(configuration.capabilityId)) + } + if (s_deprecatedHashedCapabilityIds.contains(configuration.capabilityId)) { revert CapabilityIsDeprecated(configuration.capabilityId); + } - if (donCapabilityConfig.capabilityConfigs[configuration.capabilityId].length > 0) + if (donCapabilityConfig.capabilityConfigs[configuration.capabilityId].length > 0) { revert DuplicateDONCapability(donParams.id, configuration.capabilityId); + } for (uint256 j; j < nodes.length; ++j) { if ( @@ -965,11 +1001,7 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers s_dons[donParams.id].configCount = donParams.configCount; _setDONCapabilityConfig( - donParams.id, - donParams.configCount, - configuration.capabilityId, - nodes, - configuration.config + donParams.id, donParams.configCount, configuration.capabilityId, nodes, configuration.config ); } emit ConfigSet(donParams.id, donParams.configCount); @@ -991,10 +1023,7 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers ) internal { if (s_capabilities[capabilityId].configurationContract != address(0)) { ICapabilityConfiguration(s_capabilities[capabilityId].configurationContract).beforeCapabilityConfigSet( - nodes, - config, - configCount, - donId + nodes, config, configCount, donId ); } } @@ -1019,7 +1048,9 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers /// @notice Gets DON's data /// @param donId The DON ID /// @return DONInfo The DON's parameters - function _getDON(uint32 donId) internal view returns (DONInfo memory) { + function _getDON( + uint32 donId + ) internal view returns (DONInfo memory) { uint32 configCount = s_dons[donId].configCount; DONCapabilityConfig storage donCapabilityConfig = s_dons[donId].config[configCount]; @@ -1034,15 +1065,14 @@ contract CapabilitiesRegistry is INodeInfoProvider, OwnerIsCreator, ITypeAndVers }); } - return - DONInfo({ - id: s_dons[donId].id, - configCount: configCount, - f: s_dons[donId].f, - isPublic: s_dons[donId].isPublic, - acceptsWorkflows: s_dons[donId].acceptsWorkflows, - nodeP2PIds: donCapabilityConfig.nodes.values(), - capabilityConfigurations: capabilityConfigurations - }); + return DONInfo({ + id: s_dons[donId].id, + configCount: configCount, + f: s_dons[donId].f, + isPublic: s_dons[donId].isPublic, + acceptsWorkflows: s_dons[donId].acceptsWorkflows, + nodeP2PIds: donCapabilityConfig.nodes.values(), + capabilityConfigurations: capabilityConfigurations + }); } } diff --git a/contracts/src/v0.8/keystone/KeystoneFeedsConsumer.sol b/contracts/src/v0.8/keystone/KeystoneFeedsConsumer.sol index 8786b4e272..08eb46d82c 100644 --- a/contracts/src/v0.8/keystone/KeystoneFeedsConsumer.sol +++ b/contracts/src/v0.8/keystone/KeystoneFeedsConsumer.sol @@ -82,7 +82,9 @@ contract KeystoneFeedsConsumer is IReceiver, OwnerIsCreator { } // solhint-disable-next-line chainlink-solidity/explicit-returns - function _getInfo(bytes memory metadata) internal pure returns (bytes10 workflowName, address workflowOwner) { + function _getInfo( + bytes memory metadata + ) internal pure returns (bytes10 workflowName, address workflowOwner) { // (first 32 bytes contain length of the byte array) // workflow_cid // offset 32, size 32 // workflow_name // offset 64, size 10 @@ -96,12 +98,16 @@ contract KeystoneFeedsConsumer is IReceiver, OwnerIsCreator { } } - function getPrice(bytes32 feedId) external view returns (uint224, uint32) { + function getPrice( + bytes32 feedId + ) external view returns (uint224, uint32) { StoredFeedReport memory report = s_feedReports[feedId]; return (report.Price, report.Timestamp); } - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == type(IReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } } diff --git a/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol b/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol index 36b520bb3d..cdd1228839 100644 --- a/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol +++ b/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol @@ -29,7 +29,9 @@ abstract contract KeystoneFeedsPermissionHandler is Ownable2StepMsgSender { /// @notice Sets permissions for multiple reports /// @param permissions An array of Permission structs for which to set permissions /// @dev Emits a ReportPermissionSet event for each permission set - function setReportPermissions(Permission[] memory permissions) external onlyOwner { + function setReportPermissions( + Permission[] memory permissions + ) external onlyOwner { for (uint256 i; i < permissions.length; ++i) { _setReportPermission(permissions[i]); } @@ -38,13 +40,11 @@ abstract contract KeystoneFeedsPermissionHandler is Ownable2StepMsgSender { /// @dev Internal function to set a single report permission /// @param permission The Permission struct containing details about the permission to set /// @dev Emits a ReportPermissionSet event - function _setReportPermission(Permission memory permission) internal { - bytes32 reportId = _createReportId( - permission.forwarder, - permission.workflowOwner, - permission.workflowName, - permission.reportName - ); + function _setReportPermission( + Permission memory permission + ) internal { + bytes32 reportId = + _createReportId(permission.forwarder, permission.workflowOwner, permission.workflowName, permission.reportName); s_allowedReports[reportId] = permission.isAllowed; emit ReportPermissionSet(reportId, permission); } diff --git a/contracts/src/v0.8/keystone/KeystoneForwarder.sol b/contracts/src/v0.8/keystone/KeystoneForwarder.sol index 7ffee85c51..820fd62daa 100644 --- a/contracts/src/v0.8/keystone/KeystoneForwarder.sol +++ b/contracts/src/v0.8/keystone/KeystoneForwarder.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; +import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; import {IReceiver} from "./interfaces/IReceiver.sol"; import {IRouter} from "./interfaces/IRouter.sol"; -import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; import {OwnerIsCreator} from "../shared/access/OwnerIsCreator.sol"; @@ -75,10 +75,7 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { /// @notice Emitted when a report is processed /// @param result The result of the attempted delivery. True if successful. event ReportProcessed( - address indexed receiver, - bytes32 indexed workflowExecutionId, - bytes2 indexed reportId, - bool result + address indexed receiver, bytes32 indexed workflowExecutionId, bytes2 indexed reportId, bool result ); /// @notice Contains the configuration for each DON ID @@ -115,12 +112,16 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { mapping(address forwarder => bool isForwarder) internal s_forwarders; mapping(bytes32 transmissionId => Transmission transmission) internal s_transmissions; - function addForwarder(address forwarder) external onlyOwner { + function addForwarder( + address forwarder + ) external onlyOwner { s_forwarders[forwarder] = true; emit ForwarderAdded(forwarder); } - function removeForwarder(address forwarder) external onlyOwner { + function removeForwarder( + address forwarder + ) external onlyOwner { s_forwarders[forwarder] = false; emit ForwarderRemoved(forwarder); } @@ -193,15 +194,14 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { state = transmission.success ? IRouter.TransmissionState.SUCCEEDED : IRouter.TransmissionState.FAILED; } - return - TransmissionInfo({ - gasLimit: transmission.gasLimit, - invalidReceiver: transmission.invalidReceiver, - state: state, - success: transmission.success, - transmissionId: transmissionId, - transmitter: transmission.transmitter - }); + return TransmissionInfo({ + gasLimit: transmission.gasLimit, + invalidReceiver: transmission.invalidReceiver, + state: state, + success: transmission.success, + transmissionId: transmissionId, + transmitter: transmission.transmitter + }); } /// @notice Get transmitter of a given report or 0x0 if it wasn't transmitted yet @@ -213,7 +213,9 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { return s_transmissions[getTransmissionId(receiver, workflowExecutionId, reportId)].transmitter; } - function isForwarder(address forwarder) external view returns (bool) { + function isForwarder( + address forwarder + ) external view returns (bool) { return s_forwarders[forwarder]; } @@ -285,12 +287,8 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { for (uint256 i = 0; i < signatures.length; ++i) { bytes calldata signature = signatures[i]; if (signature.length != SIGNATURE_LENGTH) revert InvalidSignature(signature); - address signer = ecrecover( - completeHash, - uint8(signature[64]) + 27, - bytes32(signature[0:32]), - bytes32(signature[32:64]) - ); + address signer = + ecrecover(completeHash, uint8(signature[64]) + 27, bytes32(signature[0:32]), bytes32(signature[32:64])); // validate signer is trusted and signature is unique uint256 index = config._positions[signer]; diff --git a/contracts/src/v0.8/keystone/OCR3Capability.sol b/contracts/src/v0.8/keystone/OCR3Capability.sol index 4a1b227e6e..51a765a154 100644 --- a/contracts/src/v0.8/keystone/OCR3Capability.sol +++ b/contracts/src/v0.8/keystone/OCR3Capability.sol @@ -25,6 +25,7 @@ contract OCR3Capability is OwnerIsCreator, OCR2Abstract { uint8 f; // TODO: could be optimized by squeezing into one slot uint8 n; } + ConfigInfo internal s_configInfo; // Reverts transaction if config args are invalid @@ -146,10 +147,10 @@ contract OCR3Capability is OwnerIsCreator, OCR2Abstract { function transmit( // NOTE: If these parameters are changed, expectedMsgDataLength and/or // TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT need to be changed accordingly - bytes32[3] calldata /* reportContext */, - bytes calldata /* report */, - bytes32[] calldata /* rs */, - bytes32[] calldata /* ss */, + bytes32[3] calldata, /* reportContext */ + bytes calldata, /* report */ + bytes32[] calldata, /* rs */ + bytes32[] calldata, /* ss */ bytes32 /* rawVs */ // signatures ) external pure override { revert ReportingUnsupported(); diff --git a/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol b/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol index 6c14447468..6b2741c744 100644 --- a/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol +++ b/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol @@ -18,7 +18,9 @@ interface ICapabilityConfiguration { /// situation where configuration size grows too large. /// @param donId The DON instance ID. These are stored in the CapabilitiesRegistry. /// @return configuration DON's configuration for the capability. - function getCapabilityConfiguration(uint32 donId) external view returns (bytes memory configuration); + function getCapabilityConfiguration( + uint32 donId + ) external view returns (bytes memory configuration); /// @notice Called by the registry prior to the config being set for a particular DON. /// @param nodes The nodes that the configuration is being set for. diff --git a/contracts/src/v0.8/keystone/interfaces/INodeInfoProvider.sol b/contracts/src/v0.8/keystone/interfaces/INodeInfoProvider.sol index 47b4b2065f..695e45b309 100644 --- a/contracts/src/v0.8/keystone/interfaces/INodeInfoProvider.sol +++ b/contracts/src/v0.8/keystone/interfaces/INodeInfoProvider.sol @@ -36,7 +36,9 @@ interface INodeInfoProvider { /// @notice Retrieves node information by its P2P ID. /// @param p2pId The P2P ID of the node to query for. /// @return nodeInfo The node data. - function getNode(bytes32 p2pId) external view returns (NodeInfo memory nodeInfo); + function getNode( + bytes32 p2pId + ) external view returns (NodeInfo memory nodeInfo); /// @notice Retrieves all node information. /// @return NodeInfo[] Array of all nodes in the registry. @@ -45,5 +47,7 @@ interface INodeInfoProvider { /// @notice Retrieves nodes by their P2P IDs. /// @param p2pIds Array of P2P IDs to query for. /// @return NodeInfo[] Array of node data corresponding to the provided P2P IDs. - function getNodesByP2PIds(bytes32[] calldata p2pIds) external view returns (NodeInfo[] memory); + function getNodesByP2PIds( + bytes32[] calldata p2pIds + ) external view returns (NodeInfo[] memory); } diff --git a/contracts/src/v0.8/keystone/interfaces/IRouter.sol b/contracts/src/v0.8/keystone/interfaces/IRouter.sol index 3d2e24f550..f683d9c5f1 100644 --- a/contracts/src/v0.8/keystone/interfaces/IRouter.sol +++ b/contracts/src/v0.8/keystone/interfaces/IRouter.sol @@ -37,8 +37,12 @@ interface IRouter { uint80 gasLimit; } - function addForwarder(address forwarder) external; - function removeForwarder(address forwarder) external; + function addForwarder( + address forwarder + ) external; + function removeForwarder( + address forwarder + ) external; function route( bytes32 transmissionId, diff --git a/contracts/src/v0.8/keystone/ocr/OCR2Abstract.sol b/contracts/src/v0.8/keystone/ocr/OCR2Abstract.sol index af822a6985..351d87962d 100644 --- a/contracts/src/v0.8/keystone/ocr/OCR2Abstract.sol +++ b/contracts/src/v0.8/keystone/ocr/OCR2Abstract.sol @@ -62,19 +62,19 @@ abstract contract OCR2Abstract is ITypeAndVersion { returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest); /** - * @notice optionally emitted to indicate the latest configDigest and epoch for - which a report was successfully transmitted. Alternatively, the contract may - use latestConfigDigestAndEpoch with scanLogs set to false. - */ + * @notice optionally emitted to indicate the latest configDigest and epoch for + * which a report was successfully transmitted. Alternatively, the contract may + * use latestConfigDigestAndEpoch with scanLogs set to false. + */ event Transmitted(bytes32 configDigest, uint32 epoch); /** - * @notice optionally returns the latest configDigest and epoch for which a - report was successfully transmitted. Alternatively, the contract may return - scanLogs set to true and use Transmitted events to provide this information - to offchain watchers. + * @notice optionally returns the latest configDigest and epoch for which a + * report was successfully transmitted. Alternatively, the contract may return + * scanLogs set to true and use Transmitted events to provide this information + * to offchain watchers. * @return scanLogs indicates whether to rely on the configDigest and epoch - returned or whether to scan logs for the Transmitted event instead. + * returned or whether to scan logs for the Transmitted event instead. * @return configDigest * @return epoch */ diff --git a/contracts/src/v0.8/keystone/test/BaseTest.t.sol b/contracts/src/v0.8/keystone/test/BaseTest.t.sol index 64dc018c3a..b638544b14 100644 --- a/contracts/src/v0.8/keystone/test/BaseTest.t.sol +++ b/contracts/src/v0.8/keystone/test/BaseTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {Test} from "forge-std/Test.sol"; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; import {Constants} from "./Constants.t.sol"; import {CapabilityConfigurationContract} from "./mocks/CapabilityConfigurationContract.sol"; -import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {Test} from "forge-std/Test.sol"; contract BaseTest is Test, Constants { CapabilitiesRegistry internal s_CapabilitiesRegistry; @@ -35,27 +35,18 @@ contract BaseTest is Test, Constants { capabilityType: CapabilitiesRegistry.CapabilityType.ACTION }); - s_basicHashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); + s_basicHashedCapabilityId = + s_CapabilitiesRegistry.getHashedCapabilityId(s_basicCapability.labelledName, s_basicCapability.version); s_capabilityWithConfigurationContractId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_capabilityWithConfigurationContract.labelledName, - s_capabilityWithConfigurationContract.version + s_capabilityWithConfigurationContract.labelledName, s_capabilityWithConfigurationContract.version ); s_nonExistentHashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId("non-existent-capability", "1.0.0"); } function _getNodeOperators() internal pure returns (CapabilitiesRegistry.NodeOperator[] memory) { CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](3); - nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ - admin: NODE_OPERATOR_ONE_ADMIN, - name: NODE_OPERATOR_ONE_NAME - }); - nodeOperators[1] = CapabilitiesRegistry.NodeOperator({ - admin: NODE_OPERATOR_TWO_ADMIN, - name: NODE_OPERATOR_TWO_NAME - }); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NODE_OPERATOR_ONE_ADMIN, name: NODE_OPERATOR_ONE_NAME}); + nodeOperators[1] = CapabilitiesRegistry.NodeOperator({admin: NODE_OPERATOR_TWO_ADMIN, name: NODE_OPERATOR_TWO_NAME}); nodeOperators[2] = CapabilitiesRegistry.NodeOperator({admin: NODE_OPERATOR_THREE, name: NODE_OPERATOR_THREE_NAME}); return nodeOperators; } diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol index 17a8682295..94dfeb9a63 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddCapabilitiesTest.t.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; +import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; import {BaseTest} from "./BaseTest.t.sol"; import {CapabilityConfigurationContract} from "./mocks/CapabilityConfigurationContract.sol"; -import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; -import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; + import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { @@ -41,8 +42,7 @@ contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { vm.expectRevert( abi.encodeWithSelector( - CapabilitiesRegistry.InvalidCapabilityConfigurationContractInterface.selector, - nonExistentContract + CapabilitiesRegistry.InvalidCapabilityConfigurationContractInterface.selector, nonExistentContract ) ); s_CapabilitiesRegistry.addCapabilities(capabilities); @@ -54,8 +54,8 @@ contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { contractWithoutERC165, abi.encodeWithSelector( IERC165.supportsInterface.selector, - ICapabilityConfiguration.getCapabilityConfiguration.selector ^ - ICapabilityConfiguration.beforeCapabilityConfigSet.selector + ICapabilityConfiguration.getCapabilityConfiguration.selector + ^ ICapabilityConfiguration.beforeCapabilityConfigSet.selector ), abi.encode(false) ); @@ -65,8 +65,7 @@ contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { vm.expectRevert( abi.encodeWithSelector( - CapabilitiesRegistry.InvalidCapabilityConfigurationContractInterface.selector, - contractWithoutERC165 + CapabilitiesRegistry.InvalidCapabilityConfigurationContractInterface.selector, contractWithoutERC165 ) ); s_CapabilitiesRegistry.addCapabilities(capabilities); @@ -80,9 +79,8 @@ contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilitiesRegistry.CapabilityConfigured(hashedCapabilityId); s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilitiesRegistry.CapabilityInfo memory storedCapability = s_CapabilitiesRegistry.getCapability( - hashedCapabilityId - ); + CapabilitiesRegistry.CapabilityInfo memory storedCapability = + s_CapabilitiesRegistry.getCapability(hashedCapabilityId); assertEq(storedCapability.labelledName, s_basicCapability.labelledName); assertEq(storedCapability.version, s_basicCapability.version); @@ -95,16 +93,14 @@ contract CapabilitiesRegistry_AddCapabilitiesTest is BaseTest { capabilities[0] = s_capabilityWithConfigurationContract; bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_capabilityWithConfigurationContract.labelledName, - s_capabilityWithConfigurationContract.version + s_capabilityWithConfigurationContract.labelledName, s_capabilityWithConfigurationContract.version ); vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilitiesRegistry.CapabilityConfigured(hashedCapabilityId); s_CapabilitiesRegistry.addCapabilities(capabilities); - CapabilitiesRegistry.CapabilityInfo memory storedCapability = s_CapabilitiesRegistry.getCapability( - hashedCapabilityId - ); + CapabilitiesRegistry.CapabilityInfo memory storedCapability = + s_CapabilitiesRegistry.getCapability(hashedCapabilityId); assertEq(storedCapability.labelledName, s_capabilityWithConfigurationContract.labelledName); assertEq(storedCapability.version, s_capabilityWithConfigurationContract.version); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol index 4e8725a2ee..7540bbb80d 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddDONTest.t.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; -import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; +import {BaseTest} from "./BaseTest.t.sol"; + import {MaliciousConfigurationContract} from "./mocks/MaliciousConfigurationContract.sol"; contract CapabilitiesRegistry_AddDONTest is BaseTest { @@ -57,8 +58,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { changePrank(STRANGER); vm.expectRevert("Only callable by owner"); bytes32[] memory nodes = new bytes32[](1); - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, @@ -71,17 +72,15 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_capabilityWithConfigurationContractId, config: CONFIG_CAPABILITY_CONFIG }); vm.expectRevert( abi.encodeWithSelector( - CapabilitiesRegistry.NodeDoesNotSupportCapability.selector, - P2P_ID_TWO, - s_capabilityWithConfigurationContractId + CapabilitiesRegistry.NodeDoesNotSupportCapability.selector, P2P_ID_TWO, s_capabilityWithConfigurationContractId ) ); s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); @@ -91,8 +90,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_nonExistentHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -107,8 +106,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](1); nodes[0] = P2P_ID; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -123,8 +122,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](2); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -150,12 +149,10 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ - capabilityId: capabilityId, - config: BASIC_CAPABILITY_CONFIG - }); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = + CapabilitiesRegistry.CapabilityConfiguration({capabilityId: capabilityId, config: BASIC_CAPABILITY_CONFIG}); vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.CapabilityIsDeprecated.selector, capabilityId)); s_CapabilitiesRegistry.addDON(nodes, capabilityConfigs, true, true, F_VALUE); @@ -166,8 +163,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -181,8 +178,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -199,8 +196,8 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_THREE; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](2); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -215,11 +212,7 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { vm.expectCall( address(s_capabilityConfigurationContract), abi.encodeWithSelector( - ICapabilityConfiguration.beforeCapabilityConfigSet.selector, - nodes, - CONFIG_CAPABILITY_CONFIG, - 1, - DON_ID + ICapabilityConfiguration.beforeCapabilityConfigSet.selector, nodes, CONFIG_CAPABILITY_CONFIG, 1, DON_ID ), 1 ); @@ -232,15 +225,13 @@ contract CapabilitiesRegistry_AddDONTest is BaseTest { assertEq(donInfo.capabilityConfigurations.length, capabilityConfigs.length); assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId); - (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_CapabilitiesRegistry - .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); + (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = + s_CapabilitiesRegistry.getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); assertEq(CapabilitiesRegistryDONConfig, BASIC_CAPABILITY_CONFIG); assertEq(capabilityConfigContractConfig, bytes("")); - ( - bytes memory CapabilitiesRegistryDONConfigTwo, - bytes memory capabilityConfigContractConfigTwo - ) = s_CapabilitiesRegistry.getCapabilityConfigs(DON_ID, s_capabilityWithConfigurationContractId); + (bytes memory CapabilitiesRegistryDONConfigTwo, bytes memory capabilityConfigContractConfigTwo) = + s_CapabilitiesRegistry.getCapabilityConfigs(DON_ID, s_capabilityWithConfigurationContractId); assertEq(CapabilitiesRegistryDONConfigTwo, CONFIG_CAPABILITY_CONFIG); assertEq(capabilityConfigContractConfigTwo, CONFIG_CAPABILITY_CONFIG); @@ -255,9 +246,8 @@ contract CapabilitiesRegistry_AddDONTest_WhenMaliciousCapabilityConfigurationCon BaseTest.setUp(); CapabilitiesRegistry.Capability[] memory capabilities = new CapabilitiesRegistry.Capability[](2); - address maliciousConfigContractAddr = address( - new MaliciousConfigurationContract(s_capabilityWithConfigurationContractId) - ); + address maliciousConfigContractAddr = + address(new MaliciousConfigurationContract(s_capabilityWithConfigurationContractId)); s_basicCapability.configurationContract = maliciousConfigContractAddr; capabilities[0] = s_basicCapability; capabilities[1] = s_capabilityWithConfigurationContract; @@ -311,8 +301,8 @@ contract CapabilitiesRegistry_AddDONTest_WhenMaliciousCapabilityConfigurationCon nodes[0] = P2P_ID; nodes[1] = P2P_ID_THREE; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol index b4f7be9bb2..2c12716697 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodeOperatorsTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_AddNodeOperatorsTest is BaseTest { function test_RevertWhen_CalledByNonAdmin() public { @@ -24,27 +24,21 @@ contract CapabilitiesRegistry_AddNodeOperatorsTest is BaseTest { vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilitiesRegistry.NodeOperatorAdded( - TEST_NODE_OPERATOR_ONE_ID, - NODE_OPERATOR_ONE_ADMIN, - NODE_OPERATOR_ONE_NAME + TEST_NODE_OPERATOR_ONE_ID, NODE_OPERATOR_ONE_ADMIN, NODE_OPERATOR_ONE_NAME ); vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilitiesRegistry.NodeOperatorAdded( - TEST_NODE_OPERATOR_TWO_ID, - NODE_OPERATOR_TWO_ADMIN, - NODE_OPERATOR_TWO_NAME + TEST_NODE_OPERATOR_TWO_ID, NODE_OPERATOR_TWO_ADMIN, NODE_OPERATOR_TWO_NAME ); s_CapabilitiesRegistry.addNodeOperators(_getNodeOperators()); - CapabilitiesRegistry.NodeOperator memory nodeOperatorOne = s_CapabilitiesRegistry.getNodeOperator( - TEST_NODE_OPERATOR_ONE_ID - ); + CapabilitiesRegistry.NodeOperator memory nodeOperatorOne = + s_CapabilitiesRegistry.getNodeOperator(TEST_NODE_OPERATOR_ONE_ID); assertEq(nodeOperatorOne.admin, NODE_OPERATOR_ONE_ADMIN); assertEq(nodeOperatorOne.name, NODE_OPERATOR_ONE_NAME); - CapabilitiesRegistry.NodeOperator memory nodeOperatorTwo = s_CapabilitiesRegistry.getNodeOperator( - TEST_NODE_OPERATOR_TWO_ID - ); + CapabilitiesRegistry.NodeOperator memory nodeOperatorTwo = + s_CapabilitiesRegistry.getNodeOperator(TEST_NODE_OPERATOR_TWO_ID); assertEq(nodeOperatorTwo.admin, NODE_OPERATOR_TWO_ADMIN); assertEq(nodeOperatorTwo.name, NODE_OPERATOR_TWO_NAME); } diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol index aa6cca4aa2..9bed5144a3 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_AddNodesTest is BaseTest { function setUp() public override { diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol index e06fa4a703..0c6634876d 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_DeprecateCapabilitiesTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_DeprecateCapabilitiesTest is BaseTest { function setUp() public override { @@ -16,10 +16,8 @@ contract CapabilitiesRegistry_DeprecateCapabilitiesTest is BaseTest { function test_RevertWhen_CalledByNonAdmin() public { changePrank(STRANGER); - bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); + bytes32 hashedCapabilityId = + s_CapabilitiesRegistry.getHashedCapabilityId(s_basicCapability.labelledName, s_basicCapability.version); bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; @@ -39,10 +37,8 @@ contract CapabilitiesRegistry_DeprecateCapabilitiesTest is BaseTest { } function test_RevertWhen_CapabilityIsDeprecated() public { - bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); + bytes32 hashedCapabilityId = + s_CapabilitiesRegistry.getHashedCapabilityId(s_basicCapability.labelledName, s_basicCapability.version); bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; @@ -53,10 +49,8 @@ contract CapabilitiesRegistry_DeprecateCapabilitiesTest is BaseTest { } function test_DeprecatesCapability() public { - bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); + bytes32 hashedCapabilityId = + s_CapabilitiesRegistry.getHashedCapabilityId(s_basicCapability.labelledName, s_basicCapability.version); bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; @@ -65,10 +59,8 @@ contract CapabilitiesRegistry_DeprecateCapabilitiesTest is BaseTest { } function test_EmitsEvent() public { - bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); + bytes32 hashedCapabilityId = + s_CapabilitiesRegistry.getHashedCapabilityId(s_basicCapability.labelledName, s_basicCapability.version); bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol index 8f39183ee7..4ea41c1366 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetCapabilitiesTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_GetCapabilitiesTest is BaseTest { function setUp() public override { @@ -14,10 +14,8 @@ contract CapabilitiesRegistry_GetCapabilitiesTest is BaseTest { } function test_ReturnsCapabilities() public { - bytes32 hashedCapabilityId = s_CapabilitiesRegistry.getHashedCapabilityId( - s_basicCapability.labelledName, - s_basicCapability.version - ); + bytes32 hashedCapabilityId = + s_CapabilitiesRegistry.getHashedCapabilityId(s_basicCapability.labelledName, s_basicCapability.version); bytes32[] memory deprecatedCapabilities = new bytes32[](1); deprecatedCapabilities[0] = hashedCapabilityId; s_CapabilitiesRegistry.deprecateCapabilities(deprecatedCapabilities); @@ -37,8 +35,7 @@ contract CapabilitiesRegistry_GetCapabilitiesTest is BaseTest { assertEq(capabilities[1].labelledName, "read-ethereum-mainnet-gas-price"); assertEq(capabilities[1].version, "1.0.2"); assertEq( - uint256(capabilities[1].responseType), - uint256(CapabilitiesRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL) + uint256(capabilities[1].responseType), uint256(CapabilitiesRegistry.CapabilityResponseType.OBSERVATION_IDENTICAL) ); assertEq(uint256(capabilities[1].capabilityType), uint256(CapabilitiesRegistry.CapabilityType.ACTION)); assertEq(capabilities[1].configurationContract, address(s_capabilityConfigurationContract)); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNextDONIdTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNextDONIdTest.t.sol index 0c6c74c204..5f111195f7 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNextDONIdTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNextDONIdTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_GetNextDONIdTest is BaseTest { function setUp() public override { @@ -60,8 +60,8 @@ contract CapabilitiesRegistry_GetNextDONIdTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_THREE; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](2); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -76,11 +76,7 @@ contract CapabilitiesRegistry_GetNextDONIdTest is BaseTest { vm.expectCall( address(s_capabilityConfigurationContract), abi.encodeWithSelector( - ICapabilityConfiguration.beforeCapabilityConfigSet.selector, - nodes, - CONFIG_CAPABILITY_CONFIG, - 1, - DON_ID + ICapabilityConfiguration.beforeCapabilityConfigSet.selector, nodes, CONFIG_CAPABILITY_CONFIG, 1, DON_ID ), 1 ); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol index 471f4a86ad..e37d211bd4 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodeOperatorsTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_GetNodeOperatorsTest is BaseTest { function setUp() public override { diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol index e01747877e..115a403680 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_GetNodesTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; import {INodeInfoProvider} from "../interfaces/INodeInfoProvider.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_GetNodesTest is BaseTest { function setUp() public override { diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol index c3a8dc1625..3000cc1899 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveDONsTest.t.sol @@ -43,8 +43,8 @@ contract CapabilitiesRegistry_RemoveDONsTest is BaseTest { changePrank(NODE_OPERATOR_ONE_ADMIN); s_CapabilitiesRegistry.addNodes(nodes); - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -87,8 +87,8 @@ contract CapabilitiesRegistry_RemoveDONsTest is BaseTest { assertEq(donInfo.isPublic, false); assertEq(donInfo.capabilityConfigurations.length, 0); - (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_CapabilitiesRegistry - .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); + (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = + s_CapabilitiesRegistry.getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); assertEq(CapabilitiesRegistryDONConfig, bytes("")); assertEq(capabilityConfigContractConfig, bytes("")); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol index 1f70bc8326..c89ab456dc 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodeOperatorsTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_RemoveNodeOperatorsTest is BaseTest { function setUp() public override { @@ -31,15 +31,13 @@ contract CapabilitiesRegistry_RemoveNodeOperatorsTest is BaseTest { nodeOperatorsToRemove[1] = TEST_NODE_OPERATOR_TWO_ID; s_CapabilitiesRegistry.removeNodeOperators(nodeOperatorsToRemove); - CapabilitiesRegistry.NodeOperator memory nodeOperatorOne = s_CapabilitiesRegistry.getNodeOperator( - TEST_NODE_OPERATOR_ONE_ID - ); + CapabilitiesRegistry.NodeOperator memory nodeOperatorOne = + s_CapabilitiesRegistry.getNodeOperator(TEST_NODE_OPERATOR_ONE_ID); assertEq(nodeOperatorOne.admin, address(0)); assertEq(nodeOperatorOne.name, ""); - CapabilitiesRegistry.NodeOperator memory nodeOperatorTwo = s_CapabilitiesRegistry.getNodeOperator( - TEST_NODE_OPERATOR_TWO_ID - ); + CapabilitiesRegistry.NodeOperator memory nodeOperatorTwo = + s_CapabilitiesRegistry.getNodeOperator(TEST_NODE_OPERATOR_TWO_ID); assertEq(nodeOperatorTwo.admin, address(0)); assertEq(nodeOperatorTwo.name, ""); } diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol index c9f5e61b4f..832e330b8f 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_RemoveNodesTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; import {INodeInfoProvider} from "../interfaces/INodeInfoProvider.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_RemoveNodesTest is BaseTest { function setUp() public override { @@ -83,8 +83,8 @@ contract CapabilitiesRegistry_RemoveNodesTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -103,8 +103,8 @@ contract CapabilitiesRegistry_RemoveNodesTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -142,8 +142,8 @@ contract CapabilitiesRegistry_RemoveNodesTest is BaseTest { nodes[1] = P2P_ID_TWO; nodes[2] = P2P_ID_THREE; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol index 52b496de2d..c8a9973578 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateDONTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; -import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {ICapabilityConfiguration} from "../interfaces/ICapabilityConfiguration.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_UpdateDONTest is BaseTest { function setUp() public override { @@ -54,8 +54,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { donNodes[0] = P2P_ID; donNodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -67,8 +67,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { changePrank(STRANGER); vm.expectRevert("Only callable by owner"); bytes32[] memory nodes = new bytes32[](1); - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, @@ -81,17 +81,15 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_capabilityWithConfigurationContractId, config: CONFIG_CAPABILITY_CONFIG }); vm.expectRevert( abi.encodeWithSelector( - CapabilitiesRegistry.NodeDoesNotSupportCapability.selector, - P2P_ID_TWO, - s_capabilityWithConfigurationContractId + CapabilitiesRegistry.NodeDoesNotSupportCapability.selector, P2P_ID_TWO, s_capabilityWithConfigurationContractId ) ); s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE); @@ -102,8 +100,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -116,8 +114,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { bytes32[] memory nodes = new bytes32[](2); nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_nonExistentHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -133,8 +131,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](2); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -160,12 +158,10 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_TWO; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); - capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ - capabilityId: capabilityId, - config: BASIC_CAPABILITY_CONFIG - }); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); + capabilityConfigs[0] = + CapabilitiesRegistry.CapabilityConfiguration({capabilityId: capabilityId, config: BASIC_CAPABILITY_CONFIG}); vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.CapabilityIsDeprecated.selector, capabilityId)); s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE); @@ -176,8 +172,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -191,8 +187,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { nodes[0] = P2P_ID; nodes[1] = P2P_ID_THREE; - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](2); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](2); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -229,8 +225,8 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest { assertEq(donInfo.capabilityConfigurations.length, capabilityConfigs.length); assertEq(donInfo.capabilityConfigurations[0].capabilityId, s_basicHashedCapabilityId); - (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = s_CapabilitiesRegistry - .getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); + (bytes memory CapabilitiesRegistryDONConfig, bytes memory capabilityConfigContractConfig) = + s_CapabilitiesRegistry.getCapabilityConfigs(DON_ID, s_basicHashedCapabilityId); assertEq(CapabilitiesRegistryDONConfig, BASIC_CAPABILITY_CONFIG); assertEq(capabilityConfigContractConfig, bytes("")); diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol index 8f6be580f4..d40d4c0240 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { uint32 private constant TEST_NODE_OPERATOR_ID = 1; @@ -43,10 +43,7 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { function test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() public { changePrank(ADMIN); CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ - admin: NEW_NODE_OPERATOR_ADMIN, - name: NEW_NODE_OPERATOR_NAME - }); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); uint32 invalidNodeOperatorId = 10000; uint32[] memory nodeOperatorIds = new uint32[](2); @@ -60,10 +57,7 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { function test_RevertWhen_NodeOperatorDoesNotExist() public { changePrank(ADMIN); CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ - admin: NEW_NODE_OPERATOR_ADMIN, - name: NEW_NODE_OPERATOR_NAME - }); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); uint32 invalidNodeOperatorId = 10000; uint32[] memory nodeOperatorIds = new uint32[](1); @@ -78,25 +72,19 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { changePrank(ADMIN); CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); - nodeOperators[0] = CapabilitiesRegistry.NodeOperator({ - admin: NEW_NODE_OPERATOR_ADMIN, - name: NEW_NODE_OPERATOR_NAME - }); + nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); uint32[] memory nodeOperatorIds = new uint32[](1); nodeOperatorIds[0] = TEST_NODE_OPERATOR_ID; vm.expectEmit(true, true, true, true, address(s_CapabilitiesRegistry)); emit CapabilitiesRegistry.NodeOperatorUpdated( - TEST_NODE_OPERATOR_ID, - NEW_NODE_OPERATOR_ADMIN, - NEW_NODE_OPERATOR_NAME + TEST_NODE_OPERATOR_ID, NEW_NODE_OPERATOR_ADMIN, NEW_NODE_OPERATOR_NAME ); s_CapabilitiesRegistry.updateNodeOperators(nodeOperatorIds, nodeOperators); - CapabilitiesRegistry.NodeOperator memory nodeOperator = s_CapabilitiesRegistry.getNodeOperator( - TEST_NODE_OPERATOR_ID - ); + CapabilitiesRegistry.NodeOperator memory nodeOperator = + s_CapabilitiesRegistry.getNodeOperator(TEST_NODE_OPERATOR_ID); assertEq(nodeOperator.admin, NEW_NODE_OPERATOR_ADMIN); assertEq(nodeOperator.name, NEW_NODE_OPERATOR_NAME); } diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol index d872bdf68c..a89958b383 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodesTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./BaseTest.t.sol"; import {CapabilitiesRegistry} from "../CapabilitiesRegistry.sol"; import {INodeInfoProvider} from "../interfaces/INodeInfoProvider.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract CapabilitiesRegistry_UpdateNodesTest is BaseTest { function setUp() public override { @@ -216,8 +216,8 @@ contract CapabilitiesRegistry_UpdateNodesTest is BaseTest { function test_RevertWhen_RemovingCapabilityRequiredByWorkflowDON() public { // SETUP: addDON - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -247,9 +247,7 @@ contract CapabilitiesRegistry_UpdateNodesTest is BaseTest { vm.expectRevert( abi.encodeWithSelector( - CapabilitiesRegistry.CapabilityRequiredByDON.selector, - s_basicHashedCapabilityId, - workflowDonId + CapabilitiesRegistry.CapabilityRequiredByDON.selector, s_basicHashedCapabilityId, workflowDonId ) ); s_CapabilitiesRegistry.updateNodes(nodes); @@ -257,8 +255,8 @@ contract CapabilitiesRegistry_UpdateNodesTest is BaseTest { function test_RevertWhen_RemovingCapabilityRequiredByCapabilityDON() public { // SETUP: addDON - CapabilitiesRegistry.CapabilityConfiguration[] - memory capabilityConfigs = new CapabilitiesRegistry.CapabilityConfiguration[](1); + CapabilitiesRegistry.CapabilityConfiguration[] memory capabilityConfigs = + new CapabilitiesRegistry.CapabilityConfiguration[](1); capabilityConfigs[0] = CapabilitiesRegistry.CapabilityConfiguration({ capabilityId: s_basicHashedCapabilityId, config: BASIC_CAPABILITY_CONFIG @@ -288,9 +286,7 @@ contract CapabilitiesRegistry_UpdateNodesTest is BaseTest { vm.expectRevert( abi.encodeWithSelector( - CapabilitiesRegistry.CapabilityRequiredByDON.selector, - s_basicHashedCapabilityId, - capabilitiesDonId + CapabilitiesRegistry.CapabilityRequiredByDON.selector, s_basicHashedCapabilityId, capabilitiesDonId ) ); s_CapabilitiesRegistry.updateNodes(nodes); diff --git a/contracts/src/v0.8/keystone/test/KeystoneForwarderBaseTest.t.sol b/contracts/src/v0.8/keystone/test/KeystoneForwarderBaseTest.t.sol index 0dd480a428..50c5ce6e98 100644 --- a/contracts/src/v0.8/keystone/test/KeystoneForwarderBaseTest.t.sol +++ b/contracts/src/v0.8/keystone/test/KeystoneForwarderBaseTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {Test} from "forge-std/Test.sol"; -import {Receiver} from "./mocks/Receiver.sol"; import {KeystoneForwarder} from "../KeystoneForwarder.sol"; +import {Receiver} from "./mocks/Receiver.sol"; +import {Test} from "forge-std/Test.sol"; contract BaseTest is Test { address internal ADMIN = address(1); @@ -47,7 +47,9 @@ contract BaseTest is Test { return signerAddrs; } - function _getSignerAddresses(uint256 limit) internal view returns (address[] memory) { + function _getSignerAddresses( + uint256 limit + ) internal view returns (address[] memory) { address[] memory signerAddrs = new address[](limit); for (uint256 i = 0; i < limit; ++i) { signerAddrs[i] = s_signers[i].signerAddress; @@ -62,10 +64,8 @@ contract BaseTest is Test { ) internal view returns (bytes[] memory signatures) { signatures = new bytes[](requiredSignatures); for (uint256 i = 0; i < requiredSignatures; ++i) { - (uint8 v, bytes32 r, bytes32 s) = vm.sign( - s_signers[i].mockPrivateKey, - keccak256(abi.encodePacked(keccak256(report), reportContext)) - ); + (uint8 v, bytes32 r, bytes32 s) = + vm.sign(s_signers[i].mockPrivateKey, keccak256(abi.encodePacked(keccak256(report), reportContext))); signatures[i] = bytes.concat(r, s, bytes1(v - 27)); } return signatures; diff --git a/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol b/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol index c6dc7fca53..35e41bbbd8 100644 --- a/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol +++ b/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol @@ -1,19 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./KeystoneForwarderBaseTest.t.sol"; +import {KeystoneForwarder} from "../KeystoneForwarder.sol"; import {IRouter} from "../interfaces/IRouter.sol"; +import {BaseTest} from "./KeystoneForwarderBaseTest.t.sol"; import {MaliciousReportReceiver} from "./mocks/MaliciousReportReceiver.sol"; import {MaliciousRevertingReceiver} from "./mocks/MaliciousRevertingReceiver.sol"; -import {KeystoneForwarder} from "../KeystoneForwarder.sol"; contract KeystoneForwarder_ReportTest is BaseTest { event MessageReceived(bytes metadata, bytes[] mercuryReports); event ReportProcessed( - address indexed receiver, - bytes32 indexed workflowExecutionId, - bytes2 indexed reportId, - bool result + address indexed receiver, bytes32 indexed workflowExecutionId, bytes2 indexed reportId, bool result ); uint8 internal version = 1; @@ -126,10 +123,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { uint256 mockPK = 999; Signer memory maliciousSigner = Signer({mockPrivateKey: mockPK, signerAddress: vm.addr(mockPK)}); - (uint8 v, bytes32 r, bytes32 s) = vm.sign( - maliciousSigner.mockPrivateKey, - keccak256(abi.encodePacked(keccak256(report), reportContext)) - ); + (uint8 v, bytes32 r, bytes32 s) = + vm.sign(maliciousSigner.mockPrivateKey, keccak256(abi.encodePacked(keccak256(report), reportContext))); signatures[1] = bytes.concat(r, s, bytes1(v - 27)); vm.expectRevert(abi.encodeWithSelector(KeystoneForwarder.InvalidSigner.selector, maliciousSigner.signerAddress)); @@ -170,11 +165,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { } function test_Report_SuccessfulDelivery() public { - IRouter.TransmissionInfo memory transmissionInfo = s_forwarder.getTransmissionInfo( - address(s_receiver), - executionId, - reportId - ); + IRouter.TransmissionInfo memory transmissionInfo = + s_forwarder.getTransmissionInfo(address(s_receiver), executionId, reportId); assertEq(uint8(transmissionInfo.state), uint8(IRouter.TransmissionState.NOT_ATTEMPTED), "state mismatch"); vm.expectEmit(address(s_receiver)); @@ -195,11 +187,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { function test_Report_SuccessfulRetryWithMoreGas() public { s_forwarder.report{gas: 200_000}(address(s_receiver), report, reportContext, signatures); - IRouter.TransmissionInfo memory transmissionInfo = s_forwarder.getTransmissionInfo( - address(s_receiver), - executionId, - reportId - ); + IRouter.TransmissionInfo memory transmissionInfo = + s_forwarder.getTransmissionInfo(address(s_receiver), executionId, reportId); // Expect to fail with the receiver running out of gas assertEq(uint8(transmissionInfo.state), uint8(IRouter.TransmissionState.FAILED), "state mismatch"); assertGt(transmissionInfo.gasLimit, 100_000, "gas limit mismatch"); @@ -245,11 +234,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { // This POC requires pretty specific initial gas, so that 1/64 of gas passed to `onReport()` is insufficient to store the success s_forwarder.report{gas: 200_000}(address(maliciousReceiver), report, reportContext, signatures); - IRouter.TransmissionInfo memory transmissionInfo = s_forwarder.getTransmissionInfo( - address(maliciousReceiver), - executionId, - reportId - ); + IRouter.TransmissionInfo memory transmissionInfo = + s_forwarder.getTransmissionInfo(address(maliciousReceiver), executionId, reportId); assertEq(transmissionInfo.transmitter, TRANSMITTER, "transmitter mismatch"); assertEq(uint8(transmissionInfo.state), uint8(IRouter.TransmissionState.SUCCEEDED), "state mismatch"); @@ -259,11 +245,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { MaliciousReportReceiver s_maliciousReceiver = new MaliciousReportReceiver(); s_forwarder.report{gas: 500_000}(address(s_maliciousReceiver), report, reportContext, signatures); - IRouter.TransmissionInfo memory transmissionInfo = s_forwarder.getTransmissionInfo( - address(s_maliciousReceiver), - executionId, - reportId - ); + IRouter.TransmissionInfo memory transmissionInfo = + s_forwarder.getTransmissionInfo(address(s_maliciousReceiver), executionId, reportId); assertEq(transmissionInfo.transmitter, TRANSMITTER, "transmitter mismatch"); assertEq(uint8(transmissionInfo.state), uint8(IRouter.TransmissionState.FAILED), "state mismatch"); @@ -298,14 +281,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { // but new config does bytes32 newExecutionId = hex"6d795f657865637574696f6e5f69640000000000000000000000000000000001"; bytes memory newMetadata = abi.encodePacked(workflowId, workflowName, workflowOwner, reportId); - bytes memory newHeader = abi.encodePacked( - version, - newExecutionId, - timestamp, - DON_ID, - CONFIG_VERSION + 1, - newMetadata - ); + bytes memory newHeader = + abi.encodePacked(version, newExecutionId, timestamp, DON_ID, CONFIG_VERSION + 1, newMetadata); bytes memory newReport = abi.encodePacked(newHeader, rawReports); // resign the new report bytes[] memory newSignatures = _signReport(newReport, reportContext, requiredSignaturesNum); diff --git a/contracts/src/v0.8/keystone/test/KeystoneForwarder_SetConfigTest.t.sol b/contracts/src/v0.8/keystone/test/KeystoneForwarder_SetConfigTest.t.sol index 5dcf79b38e..c2d76d8066 100644 --- a/contracts/src/v0.8/keystone/test/KeystoneForwarder_SetConfigTest.t.sol +++ b/contracts/src/v0.8/keystone/test/KeystoneForwarder_SetConfigTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {BaseTest} from "./KeystoneForwarderBaseTest.t.sol"; import {KeystoneForwarder} from "../KeystoneForwarder.sol"; +import {BaseTest} from "./KeystoneForwarderBaseTest.t.sol"; contract KeystoneForwarder_SetConfigTest is BaseTest { address internal constant STRANGER = address(2); diff --git a/contracts/src/v0.8/keystone/test/KeystoneRouter_AccessTest.t.sol b/contracts/src/v0.8/keystone/test/KeystoneRouter_AccessTest.t.sol index 0e43b72bdc..3736d8fefd 100644 --- a/contracts/src/v0.8/keystone/test/KeystoneRouter_AccessTest.t.sol +++ b/contracts/src/v0.8/keystone/test/KeystoneRouter_AccessTest.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {Test} from "forge-std/Test.sol"; +import {KeystoneForwarder} from "../KeystoneForwarder.sol"; import {IReceiver} from "../interfaces/IReceiver.sol"; import {IRouter} from "../interfaces/IRouter.sol"; -import {KeystoneForwarder} from "../KeystoneForwarder.sol"; import {Receiver} from "./mocks/Receiver.sol"; +import {Test} from "forge-std/Test.sol"; contract KeystoneRouter_SetConfigTest is Test { address internal ADMIN = address(1); diff --git a/contracts/src/v0.8/keystone/test/mocks/CapabilityConfigurationContract.sol b/contracts/src/v0.8/keystone/test/mocks/CapabilityConfigurationContract.sol index 52df72bb4b..fd97d4560f 100644 --- a/contracts/src/v0.8/keystone/test/mocks/CapabilityConfigurationContract.sol +++ b/contracts/src/v0.8/keystone/test/mocks/CapabilityConfigurationContract.sol @@ -7,7 +7,9 @@ import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; contract CapabilityConfigurationContract is ICapabilityConfiguration, IERC165 { mapping(uint256 => bytes) private s_donConfiguration; - function getCapabilityConfiguration(uint32 donId) external view returns (bytes memory configuration) { + function getCapabilityConfiguration( + uint32 donId + ) external view returns (bytes memory configuration) { return s_donConfiguration[donId]; } @@ -17,7 +19,9 @@ contract CapabilityConfigurationContract is ICapabilityConfiguration, IERC165 { s_donConfiguration[donId] = config; } - function supportsInterface(bytes4 interfaceId) public pure returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure returns (bool) { return interfaceId == type(ICapabilityConfiguration).interfaceId || interfaceId == type(IERC165).interfaceId; } } diff --git a/contracts/src/v0.8/keystone/test/mocks/MaliciousConfigurationContract.sol b/contracts/src/v0.8/keystone/test/mocks/MaliciousConfigurationContract.sol index 7744a8a62f..68a44002f9 100644 --- a/contracts/src/v0.8/keystone/test/mocks/MaliciousConfigurationContract.sol +++ b/contracts/src/v0.8/keystone/test/mocks/MaliciousConfigurationContract.sol @@ -1,19 +1,24 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {ICapabilityConfiguration} from "../../interfaces/ICapabilityConfiguration.sol"; import {CapabilitiesRegistry} from "../../CapabilitiesRegistry.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; +import {ICapabilityConfiguration} from "../../interfaces/ICapabilityConfiguration.sol"; + import {Constants} from "../Constants.t.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; contract MaliciousConfigurationContract is ICapabilityConfiguration, IERC165, Constants { bytes32 internal s_capabilityWithConfigurationContractId; - constructor(bytes32 capabilityWithConfigContractId) { + constructor( + bytes32 capabilityWithConfigContractId + ) { s_capabilityWithConfigurationContractId = capabilityWithConfigContractId; } - function getCapabilityConfiguration(uint32) external pure returns (bytes memory configuration) { + function getCapabilityConfiguration( + uint32 + ) external pure returns (bytes memory configuration) { return bytes(""); } @@ -43,7 +48,9 @@ contract MaliciousConfigurationContract is ICapabilityConfiguration, IERC165, Co CapabilitiesRegistry(msg.sender).updateNodes(nodes); } - function supportsInterface(bytes4 interfaceId) public pure returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure returns (bool) { return interfaceId == type(ICapabilityConfiguration).interfaceId || interfaceId == type(IERC165).interfaceId; } } diff --git a/contracts/src/v0.8/keystone/test/mocks/MaliciousReportReceiver.sol b/contracts/src/v0.8/keystone/test/mocks/MaliciousReportReceiver.sol index 0e21edc368..3dcab6862e 100644 --- a/contracts/src/v0.8/keystone/test/mocks/MaliciousReportReceiver.sol +++ b/contracts/src/v0.8/keystone/test/mocks/MaliciousReportReceiver.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {IReceiver} from "../../interfaces/IReceiver.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; contract MaliciousReportReceiver is IReceiver { event MessageReceived(bytes metadata, bytes[] mercuryReports); + bytes public latestReport; function onReport(bytes calldata metadata, bytes calldata rawReport) external { @@ -17,7 +18,9 @@ contract MaliciousReportReceiver is IReceiver { } } - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == type(IReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } } diff --git a/contracts/src/v0.8/keystone/test/mocks/MaliciousRevertingReceiver.sol b/contracts/src/v0.8/keystone/test/mocks/MaliciousRevertingReceiver.sol index d994bc43b3..f4e641a1df 100644 --- a/contracts/src/v0.8/keystone/test/mocks/MaliciousRevertingReceiver.sol +++ b/contracts/src/v0.8/keystone/test/mocks/MaliciousRevertingReceiver.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {IReceiver} from "../../interfaces/IReceiver.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; /// A malicious receiver that uses max allowed for ERC165 checks and consumes all gas in `onReport()` /// Causes parent Forwarder contract to revert if it doesn't handle gas tracking accurately @@ -13,7 +13,9 @@ contract MaliciousRevertingReceiver is IReceiver { for (uint256 i = 0; gasleft() > targetGasRemaining; ++i) {} } - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { // Consume up to the maximum amount of gas that can be consumed in this check for (uint256 i = 0; i < 500; ++i) {} diff --git a/contracts/src/v0.8/keystone/test/mocks/Receiver.sol b/contracts/src/v0.8/keystone/test/mocks/Receiver.sol index f8522d72e6..354bf45509 100644 --- a/contracts/src/v0.8/keystone/test/mocks/Receiver.sol +++ b/contracts/src/v0.8/keystone/test/mocks/Receiver.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {IReceiver} from "../../interfaces/IReceiver.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; contract Receiver is IReceiver { event MessageReceived(bytes metadata, bytes[] mercuryReports); + bytes public latestReport; constructor() {} @@ -18,7 +19,9 @@ contract Receiver is IReceiver { emit MessageReceived(metadata, mercuryReports); } - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == type(IReceiver).interfaceId || interfaceId == type(IERC165).interfaceId; } } diff --git a/contracts/src/v0.8/l2ep/CrossDomainOwnable.sol b/contracts/src/v0.8/l2ep/CrossDomainOwnable.sol index 7e1c0d1adb..51e592cc38 100644 --- a/contracts/src/v0.8/l2ep/CrossDomainOwnable.sol +++ b/contracts/src/v0.8/l2ep/CrossDomainOwnable.sol @@ -12,7 +12,9 @@ contract CrossDomainOwnable is ICrossDomainOwnable, ConfirmedOwner { address internal s_l1Owner; address internal s_l1PendingOwner; - constructor(address newl1Owner) ConfirmedOwner(msg.sender) { + constructor( + address newl1Owner + ) ConfirmedOwner(msg.sender) { _setL1Owner(newl1Owner); } @@ -20,7 +22,9 @@ contract CrossDomainOwnable is ICrossDomainOwnable, ConfirmedOwner { * @notice transfer ownership of this account to a new L1 owner * @param to new L1 owner that will be allowed to call the forward fn */ - function transferL1Ownership(address to) public virtual override onlyL1Owner { + function transferL1Ownership( + address to + ) public virtual override onlyL1Owner { _transferL1Ownership(to); } @@ -41,7 +45,9 @@ contract CrossDomainOwnable is ICrossDomainOwnable, ConfirmedOwner { /** * @notice validate, transfer ownership, and emit relevant events */ - function _transferL1Ownership(address to) internal { + function _transferL1Ownership( + address to + ) internal { // solhint-disable-next-line gas-custom-errors require(to != msg.sender, "Cannot transfer to self"); @@ -53,7 +59,9 @@ contract CrossDomainOwnable is ICrossDomainOwnable, ConfirmedOwner { /** * @notice set ownership, emit relevant events. Used in acceptOwnership() */ - function _setL1Owner(address to) internal { + function _setL1Owner( + address to + ) internal { address oldOwner = s_l1Owner; s_l1Owner = to; s_l1PendingOwner = address(0); diff --git a/contracts/src/v0.8/l2ep/Flags.sol b/contracts/src/v0.8/l2ep/Flags.sol index 2ac35be4ce..361758bede 100644 --- a/contracts/src/v0.8/l2ep/Flags.sol +++ b/contracts/src/v0.8/l2ep/Flags.sol @@ -56,7 +56,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * @return A true value indicates that a flag was raised and a * false value indicates that no flag was raised. */ - function getFlag(address subject) external view override checkAccess returns (bool) { + function getFlag( + address subject + ) external view override checkAccess returns (bool) { return s_flags[subject]; } @@ -66,7 +68,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * @return An array of bools where a true value for any flag indicates that * a flag was raised and a false value indicates that no flag was raised. */ - function getFlags(address[] calldata subjects) external view override checkAccess returns (bool[] memory) { + function getFlags( + address[] calldata subjects + ) external view override checkAccess returns (bool[] memory) { bool[] memory responses = new bool[](subjects.length); for (uint256 i = 0; i < subjects.length; i++) { responses[i] = s_flags[subjects[i]]; @@ -80,7 +84,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * who always has access. * @param subject The contract address whose flag is being raised */ - function raiseFlag(address subject) external override { + function raiseFlag( + address subject + ) external override { require(_allowedToRaiseFlags(), "Not allowed to raise flags"); _tryToRaiseFlag(subject); @@ -92,7 +98,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * who always has access. * @param subjects List of the contract addresses whose flag is being raised */ - function raiseFlags(address[] calldata subjects) external override { + function raiseFlags( + address[] calldata subjects + ) external override { require(_allowedToRaiseFlags(), "Not allowed to raise flags"); for (uint256 i = 0; i < subjects.length; i++) { @@ -106,7 +114,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * who always has access. * @param subject The contract address whose flag is being lowered */ - function lowerFlag(address subject) external override { + function lowerFlag( + address subject + ) external override { require(_allowedToLowerFlags(), "Not allowed to lower flags"); _tryToLowerFlag(subject); @@ -118,7 +128,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * who always has access. * @param subjects List of the contract addresses whose flag is being lowered */ - function lowerFlags(address[] calldata subjects) external override { + function lowerFlags( + address[] calldata subjects + ) external override { require(_allowedToLowerFlags(), "Not allowed to lower flags"); for (uint256 i = 0; i < subjects.length; i++) { @@ -132,7 +144,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { * @notice allows owner to change the access controller for raising flags. * @param racAddress new address for the raising access controller. */ - function setRaisingAccessController(address racAddress) public override onlyOwner { + function setRaisingAccessController( + address racAddress + ) public override onlyOwner { address previous = address(raisingAccessController); if (previous != racAddress) { @@ -142,7 +156,9 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { } } - function setLoweringAccessController(address lacAddress) public override onlyOwner { + function setLoweringAccessController( + address lacAddress + ) public override onlyOwner { address previous = address(loweringAccessController); if (previous != lacAddress) { @@ -161,14 +177,18 @@ contract Flags is ITypeAndVersion, IFlags, SimpleReadAccessController { return msg.sender == owner() || loweringAccessController.hasAccess(msg.sender, msg.data); } - function _tryToRaiseFlag(address subject) private { + function _tryToRaiseFlag( + address subject + ) private { if (!s_flags[subject]) { s_flags[subject] = true; emit FlagRaised(subject); } } - function _tryToLowerFlag(address subject) private { + function _tryToLowerFlag( + address subject + ) private { if (s_flags[subject]) { s_flags[subject] = false; emit FlagLowered(subject); diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol index a3b2eacd66..c4544ff53d 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol @@ -23,7 +23,9 @@ contract ArbitrumCrossDomainForwarder is ITypeAndVersion, CrossDomainForwarder { * @param l1OwnerAddr the L1 owner address that will be allowed to call the forward fn * @dev Empty constructor required due to inheriting from abstract contract CrossDomainForwarder */ - constructor(address l1OwnerAddr) CrossDomainOwnable(l1OwnerAddr) {} + constructor( + address l1OwnerAddr + ) CrossDomainOwnable(l1OwnerAddr) {} /** * @notice versions: diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol index 043f57337f..31e184ed6d 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol @@ -4,8 +4,9 @@ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; // solhint-disable-next-line no-unused-import -import {IForwarder} from "../interfaces/IForwarder.sol"; + import {IDelegateForwarder} from "../interfaces/IDelegateForwarder.sol"; +import {IForwarder} from "../interfaces/IForwarder.sol"; import {ArbitrumCrossDomainForwarder} from "./ArbitrumCrossDomainForwarder.sol"; @@ -23,7 +24,9 @@ contract ArbitrumCrossDomainGovernor is IDelegateForwarder, ArbitrumCrossDomainF * @param l1OwnerAddr the L1 owner address that will be allowed to call the forward fn * @dev Empty constructor required due to inheriting from abstract contract CrossDomainForwarder */ - constructor(address l1OwnerAddr) ArbitrumCrossDomainForwarder(l1OwnerAddr) {} + constructor( + address l1OwnerAddr + ) ArbitrumCrossDomainForwarder(l1OwnerAddr) {} /** * @notice versions: diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumSequencerUptimeFeed.sol index 1ba6b9b54b..8b762dcb79 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumSequencerUptimeFeed.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {AddressAliasHelper} from "../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; +import {SimpleReadAccessController} from "../../shared/access/SimpleReadAccessController.sol"; import {AggregatorInterface} from "../../shared/interfaces/AggregatorInterface.sol"; -import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {AggregatorV2V3Interface} from "../../shared/interfaces/AggregatorV2V3Interface.sol"; +import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {AddressAliasHelper} from "../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; import {IFlags} from "../interfaces/IFlags.sol"; import {ISequencerUptimeFeed} from "../interfaces/ISequencerUptimeFeed.sol"; -import {SimpleReadAccessController} from "../../shared/access/SimpleReadAccessController.sol"; /** * @title ArbitrumSequencerUptimeFeed - L2 sequencer uptime status aggregator @@ -84,12 +84,16 @@ contract ArbitrumSequencerUptimeFeed is * @dev Mainly used for AggregatorV2V3Interface functions * @param roundId Round ID to check */ - function _isValidRound(uint256 roundId) private view returns (bool) { + function _isValidRound( + uint256 roundId + ) private view returns (bool) { return roundId > 0 && roundId <= type(uint80).max && s_feedState.latestRoundId >= roundId; } /// @notice Check that this contract is initialised, otherwise throw - function _requireInitialized(uint80 latestRoundId) private pure { + function _requireInitialized( + uint80 latestRoundId + ) private pure { if (latestRoundId == 0) { revert Uninitialized(); } @@ -136,12 +140,16 @@ contract ArbitrumSequencerUptimeFeed is * @dev Can be disabled by setting the L1 sender as `address(0)`. Accessible only by owner. * @param to new L1 sender that will be allowed to call `updateStatus` on this contract */ - function transferL1Sender(address to) external virtual onlyOwner { + function transferL1Sender( + address to + ) external virtual onlyOwner { _setL1Sender(to); } /// @notice internal method that stores the L1 sender - function _setL1Sender(address to) private { + function _setL1Sender( + address to + ) private { address from = s_l1Sender; if (from != to) { s_l1Sender = to; @@ -163,14 +171,18 @@ contract ArbitrumSequencerUptimeFeed is * * @param status The status flag to convert to an aggregator-compatible answer */ - function _getStatusAnswer(bool status) private pure returns (int256) { + function _getStatusAnswer( + bool status + ) private pure returns (int256) { return status ? int256(1) : int256(0); } /** * @notice Raise or lower the flag on the stored Flags contract. */ - function _forwardStatusToFlags(bool status) private { + function _forwardStatusToFlags( + bool status + ) private { if (status) { FLAGS.raiseFlag(FLAG_L2_SEQ_OFFLINE); } else { @@ -245,7 +257,9 @@ contract ArbitrumSequencerUptimeFeed is } /// @inheritdoc AggregatorInterface - function getAnswer(uint256 roundId) external view override checkAccess returns (int256) { + function getAnswer( + uint256 roundId + ) external view override checkAccess returns (int256) { _requireInitialized(s_feedState.latestRoundId); if (_isValidRound(roundId)) { return _getStatusAnswer(s_rounds[uint80(roundId)].status); @@ -255,7 +269,9 @@ contract ArbitrumSequencerUptimeFeed is } /// @inheritdoc AggregatorInterface - function getTimestamp(uint256 roundId) external view override checkAccess returns (uint256) { + function getTimestamp( + uint256 roundId + ) external view override checkAccess returns (uint256) { _requireInitialized(s_feedState.latestRoundId); if (_isValidRound(roundId)) { return s_rounds[uint80(roundId)].timestamp; diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol index 62a6aa0fcd..a408f88970 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol @@ -1,17 +1,19 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; +import {SimpleWriteAccessController} from "../../shared/access/SimpleWriteAccessController.sol"; +import {AccessControllerInterface} from "../../shared/interfaces/AccessControllerInterface.sol"; import {AggregatorValidatorInterface} from "../../shared/interfaces/AggregatorValidatorInterface.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {AccessControllerInterface} from "../../shared/interfaces/AccessControllerInterface.sol"; import {BaseValidator} from "../base/BaseValidator.sol"; -import {SimpleWriteAccessController} from "../../shared/access/SimpleWriteAccessController.sol"; /* ./dev dependencies - to be moved from ./dev after audit */ -import {ISequencerUptimeFeed} from "../interfaces/ISequencerUptimeFeed.sol"; -import {IArbitrumDelayedInbox} from "../interfaces/IArbitrumDelayedInbox.sol"; -import {AddressAliasHelper} from "../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; + import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {AddressAliasHelper} from "../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; +import {IArbitrumDelayedInbox} from "../interfaces/IArbitrumDelayedInbox.sol"; +import {ISequencerUptimeFeed} from "../interfaces/ISequencerUptimeFeed.sol"; + import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** @@ -27,6 +29,7 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim L2 } // Config for L1 -> L2 Arbitrum retryable ticket message + struct GasConfig { uint256 maxGas; uint256 gasPriceBid; @@ -169,7 +172,9 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * @dev only owner can call this * @param recipient address where to send the funds */ - function withdrawFundsTo(address payable recipient) external onlyOwner { + function withdrawFundsTo( + address payable recipient + ) external onlyOwner { uint256 amount = address(this).balance; Address.sendValue(recipient, amount); } @@ -190,9 +195,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim uint256 maxSubmissionCost = _approximateMaxSubmissionCost(message.length); uint256 maxGas = 120_000; // static `maxGas` for L2 -> L1 transfer uint256 gasPriceBid = s_gasConfig.gasPriceBid; - uint256 l1PaymentValue = s_paymentStrategy == PaymentStrategy.L1 - ? _maxRetryableTicketCost(maxSubmissionCost, maxGas, gasPriceBid) - : 0; + uint256 l1PaymentValue = + s_paymentStrategy == PaymentStrategy.L1 ? _maxRetryableTicketCost(maxSubmissionCost, maxGas, gasPriceBid) : 0; // NOTICE: In the case of PaymentStrategy.L2 the L2 xDomain alias address needs to be funded, as it will be paying the fee. id = IArbitrumDelayedInbox(CROSS_DOMAIN_MESSENGER).createRetryableTicketNoRefundAliasRewrite{value: l1PaymentValue}( ARBSYS_ADDR, // target @@ -214,7 +218,9 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * @dev only owner can call this * @param accessController new AccessControllerInterface contract address */ - function setConfigAC(address accessController) external onlyOwner { + function setConfigAC( + address accessController + ) external onlyOwner { _setConfigAC(accessController); } @@ -239,7 +245,9 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * @dev access control provided by `configAC` * @param _paymentStrategy strategy describing how the contract pays for xDomain calls */ - function setPaymentStrategy(PaymentStrategy _paymentStrategy) external onlyOwnerOrConfigAccess { + function setPaymentStrategy( + PaymentStrategy _paymentStrategy + ) external onlyOwnerOrConfigAccess { _setPaymentStrategy(_paymentStrategy); } @@ -275,9 +283,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim uint256 maxSubmissionCost = _approximateMaxSubmissionCost(message.length); uint256 maxGas = s_gasConfig.maxGas; uint256 gasPriceBid = s_gasConfig.gasPriceBid; - uint256 l1PaymentValue = s_paymentStrategy == PaymentStrategy.L1 - ? _maxRetryableTicketCost(maxSubmissionCost, maxGas, gasPriceBid) - : 0; + uint256 l1PaymentValue = + s_paymentStrategy == PaymentStrategy.L1 ? _maxRetryableTicketCost(maxSubmissionCost, maxGas, gasPriceBid) : 0; // NOTICE: In the case of PaymentStrategy.L2 the L2 xDomain alias address needs to be funded, as it will be paying the fee. // We also ignore the returned msg number, that can be queried via the `InboxMessageDelivered` event. IArbitrumDelayedInbox(CROSS_DOMAIN_MESSENGER).createRetryableTicketNoRefundAliasRewrite{value: l1PaymentValue}( @@ -296,7 +303,9 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim } /// @notice internal method that stores the payment strategy - function _setPaymentStrategy(PaymentStrategy _paymentStrategy) internal { + function _setPaymentStrategy( + PaymentStrategy _paymentStrategy + ) internal { s_paymentStrategy = _paymentStrategy; emit PaymentStrategySet(_paymentStrategy); } @@ -314,7 +323,9 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim } /// @notice Internal method that stores the configuration access controller - function _setConfigAC(address accessController) internal { + function _setConfigAC( + address accessController + ) internal { address previousAccessController = address(s_configAC); if (accessController != previousAccessController) { s_configAC = AccessControllerInterface(accessController); @@ -328,12 +339,12 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * implemented in Arbitrum DelayedInbox's calculateRetryableSubmissionFee function * @param calldataSizeInBytes xDomain message size in bytes */ - function _approximateMaxSubmissionCost(uint256 calldataSizeInBytes) internal view returns (uint256) { - return - IArbitrumDelayedInbox(CROSS_DOMAIN_MESSENGER).calculateRetryableSubmissionFee( - calldataSizeInBytes, - s_gasConfig.baseFee - ); + function _approximateMaxSubmissionCost( + uint256 calldataSizeInBytes + ) internal view returns (uint256) { + return IArbitrumDelayedInbox(CROSS_DOMAIN_MESSENGER).calculateRetryableSubmissionFee( + calldataSizeInBytes, s_gasConfig.baseFee + ); } /// @notice Internal helper method that calculates the total cost of the xDomain retryable ticket call diff --git a/contracts/src/v0.8/l2ep/base/BaseSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/base/BaseSequencerUptimeFeed.sol index 81fcb11ca9..a5c740d37a 100644 --- a/contracts/src/v0.8/l2ep/base/BaseSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/base/BaseSequencerUptimeFeed.sol @@ -1,10 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {AggregatorInterface} from "../../shared/interfaces/AggregatorInterface.sol"; -import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; + import {AggregatorV2V3Interface} from "../../shared/interfaces/AggregatorV2V3Interface.sol"; +import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + import {ISequencerUptimeFeed} from "./../interfaces/ISequencerUptimeFeed.sol"; import {SimpleReadAccessController} from "../../shared/access/SimpleReadAccessController.sol"; @@ -70,7 +72,9 @@ abstract contract BaseSequencerUptimeFeed is /// @notice Check if a roundId is valid in this current contract state /// @dev Mainly used for AggregatorV2V3Interface functions /// @param roundId Round ID to check - function _isValidRound(uint256 roundId) private view returns (bool) { + function _isValidRound( + uint256 roundId + ) private view returns (bool) { return roundId > 0 && roundId <= type(uint80).max && s_feedState.latestRoundId >= roundId; } @@ -82,12 +86,16 @@ abstract contract BaseSequencerUptimeFeed is /// @notice Set the allowed L1 sender for this contract to a new L1 sender /// @dev Can be disabled by setting the L1 sender as `address(0)`. Accessible only by owner. /// @param newSender new L1 sender that will be allowed to call `updateStatus` on this contract - function transferL1Sender(address newSender) external virtual onlyOwner { + function transferL1Sender( + address newSender + ) external virtual onlyOwner { _setL1Sender(newSender); } /// @notice internal method that stores the L1 sender - function _setL1Sender(address newSender) internal { + function _setL1Sender( + address newSender + ) internal { address oldSender = s_l1Sender; if (oldSender != newSender) { s_l1Sender = newSender; @@ -97,7 +105,9 @@ abstract contract BaseSequencerUptimeFeed is /// @dev Returns an AggregatorV2V3Interface compatible answer from status flag /// @param status The status flag to convert to an aggregator-compatible answer - function _getStatusAnswer(bool status) internal pure returns (int256) { + function _getStatusAnswer( + bool status + ) internal pure returns (int256) { return status ? int256(1) : int256(0); } @@ -147,7 +157,9 @@ abstract contract BaseSequencerUptimeFeed is } /// @inheritdoc AggregatorInterface - function getAnswer(uint256 roundId) external view override checkAccess returns (int256) { + function getAnswer( + uint256 roundId + ) external view override checkAccess returns (int256) { if (!_isValidRound(roundId)) { revert NoDataPresent(); } @@ -156,7 +168,9 @@ abstract contract BaseSequencerUptimeFeed is } /// @inheritdoc AggregatorInterface - function getTimestamp(uint256 roundId) external view override checkAccess returns (uint256) { + function getTimestamp( + uint256 roundId + ) external view override checkAccess returns (uint256) { if (!_isValidRound(roundId)) { revert NoDataPresent(); } @@ -186,7 +200,9 @@ abstract contract BaseSequencerUptimeFeed is } } - function _validateSender(address l1Sender) internal virtual; + function _validateSender( + address l1Sender + ) internal virtual; /// @inheritdoc AggregatorV3Interface function getRoundData( diff --git a/contracts/src/v0.8/l2ep/base/BaseValidator.sol b/contracts/src/v0.8/l2ep/base/BaseValidator.sol index 4dfd9209cb..246c9ac3d6 100644 --- a/contracts/src/v0.8/l2ep/base/BaseValidator.sol +++ b/contracts/src/v0.8/l2ep/base/BaseValidator.sol @@ -60,7 +60,9 @@ abstract contract BaseValidator is SimpleWriteAccessController, AggregatorValida /// @notice sets the new gas cost to spend when sending cross chain message /// @param gasLimit the updated gas cost - function setGasLimit(uint32 gasLimit) external onlyOwner { + function setGasLimit( + uint32 gasLimit + ) external onlyOwner { s_gasLimit = gasLimit; emit GasLimitUpdated(gasLimit); } diff --git a/contracts/src/v0.8/l2ep/interfaces/ICrossDomainOwnable.sol b/contracts/src/v0.8/l2ep/interfaces/ICrossDomainOwnable.sol index d5a01386e3..c469e46d9a 100644 --- a/contracts/src/v0.8/l2ep/interfaces/ICrossDomainOwnable.sol +++ b/contracts/src/v0.8/l2ep/interfaces/ICrossDomainOwnable.sol @@ -9,7 +9,9 @@ interface ICrossDomainOwnable { function l1Owner() external returns (address); - function transferL1Ownership(address recipient) external; + function transferL1Ownership( + address recipient + ) external; function acceptL1Ownership() external; } diff --git a/contracts/src/v0.8/l2ep/interfaces/IFlags.sol b/contracts/src/v0.8/l2ep/interfaces/IFlags.sol index 6ae5a3a3f3..d126585e38 100644 --- a/contracts/src/v0.8/l2ep/interfaces/IFlags.sol +++ b/contracts/src/v0.8/l2ep/interfaces/IFlags.sol @@ -2,19 +2,35 @@ pragma solidity ^0.8.0; interface IFlags { - function getFlag(address) external view returns (bool); + function getFlag( + address + ) external view returns (bool); - function getFlags(address[] calldata) external view returns (bool[] memory); + function getFlags( + address[] calldata + ) external view returns (bool[] memory); - function raiseFlag(address) external; + function raiseFlag( + address + ) external; - function raiseFlags(address[] calldata) external; + function raiseFlags( + address[] calldata + ) external; - function lowerFlag(address) external; + function lowerFlag( + address + ) external; - function lowerFlags(address[] calldata) external; + function lowerFlags( + address[] calldata + ) external; - function setRaisingAccessController(address) external; + function setRaisingAccessController( + address + ) external; - function setLoweringAccessController(address) external; + function setLoweringAccessController( + address + ) external; } diff --git a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol index 8da3805c9b..d911d7bd03 100644 --- a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol @@ -9,7 +9,8 @@ import {IForwarder} from "../interfaces/IForwarder.sol"; import {CrossDomainForwarder} from "../CrossDomainForwarder.sol"; import {CrossDomainOwnable} from "../CrossDomainOwnable.sol"; -import {iOVM_CrossDomainMessenger} from "../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; +import {iOVM_CrossDomainMessenger} from + "../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** @@ -84,8 +85,7 @@ contract OptimismCrossDomainForwarder is ITypeAndVersion, CrossDomainForwarder { require(msg.sender == messenger, "Sender is not the L2 messenger"); // solhint-disable-next-line gas-custom-errors require( - iOVM_CrossDomainMessenger(messenger).xDomainMessageSender() == s_l1PendingOwner, - "Must be proposed L1 owner" + iOVM_CrossDomainMessenger(messenger).xDomainMessageSender() == s_l1PendingOwner, "Must be proposed L1 owner" ); _; } diff --git a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol index d59e6d1357..70ccc39c02 100644 --- a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol @@ -7,7 +7,8 @@ import {IForwarder} from "../interfaces/IForwarder.sol"; import {OptimismCrossDomainForwarder} from "./OptimismCrossDomainForwarder.sol"; -import {iOVM_CrossDomainMessenger} from "../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; +import {iOVM_CrossDomainMessenger} from + "../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** @@ -65,8 +66,7 @@ contract OptimismCrossDomainGovernor is IDelegateForwarder, OptimismCrossDomainF if (msg.sender == messenger) { // solhint-disable-next-line gas-custom-errors require( - iOVM_CrossDomainMessenger(messenger).xDomainMessageSender() == l1Owner(), - "xDomain sender is not the L1 owner" + iOVM_CrossDomainMessenger(messenger).xDomainMessageSender() == l1Owner(), "xDomain sender is not the L1 owner" ); } _; diff --git a/contracts/src/v0.8/l2ep/optimism/OptimismSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/optimism/OptimismSequencerUptimeFeed.sol index b160fe4615..46f5ebc349 100644 --- a/contracts/src/v0.8/l2ep/optimism/OptimismSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/optimism/OptimismSequencerUptimeFeed.sol @@ -29,10 +29,11 @@ contract OptimismSequencerUptimeFeed is BaseSequencerUptimeFeed { s_l2CrossDomainMessenger = IL2CrossDomainMessenger(l2CrossDomainMessengerAddr); } - function _validateSender(address l1Sender) internal view override { - if ( - msg.sender != address(s_l2CrossDomainMessenger) || s_l2CrossDomainMessenger.xDomainMessageSender() != l1Sender - ) { + function _validateSender( + address l1Sender + ) internal view override { + if (msg.sender != address(s_l2CrossDomainMessenger) || s_l2CrossDomainMessenger.xDomainMessageSender() != l1Sender) + { revert InvalidSender(); } } diff --git a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol index 7f6da4ee7a..d814701cd4 100644 --- a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol @@ -7,8 +7,8 @@ import {IForwarder} from "../interfaces/IForwarder.sol"; import {CrossDomainForwarder} from "../CrossDomainForwarder.sol"; import {CrossDomainOwnable} from "../CrossDomainOwnable.sol"; -import {IScrollMessenger} from "@scroll-tech/contracts/libraries/IScrollMessenger.sol"; import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; +import {IScrollMessenger} from "@scroll-tech/contracts/libraries/IScrollMessenger.sol"; /// @title ScrollCrossDomainForwarder - L1 xDomain account representation /// @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. diff --git a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol index 0e31ef9251..e657889909 100644 --- a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol @@ -9,8 +9,8 @@ import {IForwarder} from "../interfaces/IForwarder.sol"; import {CrossDomainForwarder} from "../CrossDomainForwarder.sol"; import {CrossDomainOwnable} from "../CrossDomainOwnable.sol"; -import {IScrollMessenger} from "@scroll-tech/contracts/libraries/IScrollMessenger.sol"; import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; +import {IScrollMessenger} from "@scroll-tech/contracts/libraries/IScrollMessenger.sol"; /// @title ScrollCrossDomainGovernor - L1 xDomain account representation (with delegatecall support) for Scroll /// @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. @@ -63,8 +63,7 @@ contract ScrollCrossDomainGovernor is IDelegateForwarder, ITypeAndVersion, Cross // 1. The delegatecall MUST come from either the L1 owner (via cross-chain message) or the L2 owner // solhint-disable-next-line gas-custom-errors require( - msg.sender == i_scrollCrossDomainMessenger || msg.sender == owner(), - "Sender is not the L2 messenger or owner" + msg.sender == i_scrollCrossDomainMessenger || msg.sender == owner(), "Sender is not the L2 messenger or owner" ); // 2. The L2 Messenger's caller MUST be the L1 Owner if (msg.sender == i_scrollCrossDomainMessenger) { diff --git a/contracts/src/v0.8/l2ep/scroll/ScrollSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/scroll/ScrollSequencerUptimeFeed.sol index 9c0c22290f..79d3119db7 100644 --- a/contracts/src/v0.8/l2ep/scroll/ScrollSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/scroll/ScrollSequencerUptimeFeed.sol @@ -30,10 +30,11 @@ contract ScrollSequencerUptimeFeed is BaseSequencerUptimeFeed { s_l2CrossDomainMessenger = IL2ScrollMessenger(l2CrossDomainMessengerAddr); } - function _validateSender(address l1Sender) internal view override { - if ( - msg.sender != address(s_l2CrossDomainMessenger) || s_l2CrossDomainMessenger.xDomainMessageSender() != l1Sender - ) { + function _validateSender( + address l1Sender + ) internal view override { + if (msg.sender != address(s_l2CrossDomainMessenger) || s_l2CrossDomainMessenger.xDomainMessageSender() != l1Sender) + { revert InvalidSender(); } } diff --git a/contracts/src/v0.8/l2ep/scroll/ScrollValidator.sol b/contracts/src/v0.8/l2ep/scroll/ScrollValidator.sol index 0e0b19b229..c2c9d58d01 100644 --- a/contracts/src/v0.8/l2ep/scroll/ScrollValidator.sol +++ b/contracts/src/v0.8/l2ep/scroll/ScrollValidator.sol @@ -5,8 +5,8 @@ import {ISequencerUptimeFeed} from "../interfaces/ISequencerUptimeFeed.sol"; import {BaseValidator} from "../base/BaseValidator.sol"; -import {IL1MessageQueueV2} from "@scroll-tech/contracts/L1/rollup/IL1MessageQueueV2.sol"; import {IL1ScrollMessenger} from "@scroll-tech/contracts/L1/IL1ScrollMessenger.sol"; +import {IL1MessageQueueV2} from "@scroll-tech/contracts/L1/rollup/IL1MessageQueueV2.sol"; /// @title ScrollValidator - makes cross chain call to update the Sequencer Uptime Feed on L2 contract ScrollValidator is BaseValidator { @@ -42,9 +42,7 @@ contract ScrollValidator is BaseValidator { L2_UPTIME_FEED_ADDR, 0, abi.encodeWithSelector( - ISequencerUptimeFeed.updateStatus.selector, - currentAnswer == ANSWER_SEQ_OFFLINE, - uint64(block.timestamp) + ISequencerUptimeFeed.updateStatus.selector, currentAnswer == ANSWER_SEQ_OFFLINE, uint64(block.timestamp) ), s_gasLimit ); diff --git a/contracts/src/v0.8/l2ep/test/FeedConsumer.sol b/contracts/src/v0.8/l2ep/test/FeedConsumer.sol index f83781b5ac..6c3831627e 100644 --- a/contracts/src/v0.8/l2ep/test/FeedConsumer.sol +++ b/contracts/src/v0.8/l2ep/test/FeedConsumer.sol @@ -7,7 +7,9 @@ contract FeedConsumer { // solhint-disable-next-line AggregatorV2V3Interface public immutable AGGREGATOR; - constructor(address feedAddress) { + constructor( + address feedAddress + ) { AGGREGATOR = AggregatorV2V3Interface(feedAddress); } @@ -23,11 +25,15 @@ contract FeedConsumer { return AGGREGATOR.latestRound(); } - function getAnswer(uint256 roundId) external view returns (int256) { + function getAnswer( + uint256 roundId + ) external view returns (int256) { return AGGREGATOR.getAnswer(roundId); } - function getTimestamp(uint256 roundId) external view returns (uint256) { + function getTimestamp( + uint256 roundId + ) external view returns (uint256) { return AGGREGATOR.getTimestamp(roundId); } @@ -45,11 +51,7 @@ contract FeedConsumer { function getRoundData( uint80 _roundId - ) - external - view - returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) - { + ) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) { return AGGREGATOR.getRoundData(_roundId); } diff --git a/contracts/src/v0.8/l2ep/test/Greeter.sol b/contracts/src/v0.8/l2ep/test/Greeter.sol index 313c7c5e3b..988c62bc37 100644 --- a/contracts/src/v0.8/l2ep/test/Greeter.sol +++ b/contracts/src/v0.8/l2ep/test/Greeter.sol @@ -6,9 +6,13 @@ import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; contract Greeter is ConfirmedOwner { string public greeting; - constructor(address owner) ConfirmedOwner(owner) {} + constructor( + address owner + ) ConfirmedOwner(owner) {} - function setGreeting(string calldata _greeting) external onlyOwner { + function setGreeting( + string calldata _greeting + ) external onlyOwner { require(bytes(_greeting).length > 0, "Invalid greeting length"); greeting = _greeting; } diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol b/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol index 52019324f5..3c69e62e9b 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol @@ -16,11 +16,15 @@ contract MockAggregatorV2V3 is AggregatorV2V3Interface { return 0; } - function getAnswer(uint256) external pure returns (int256) { + function getAnswer( + uint256 + ) external pure returns (int256) { return 0; } - function getTimestamp(uint256 roundId) external pure returns (uint256) { + function getTimestamp( + uint256 roundId + ) external pure returns (uint256) { return roundId; } @@ -38,11 +42,7 @@ contract MockAggregatorV2V3 is AggregatorV2V3Interface { function getRoundData( uint80 - ) - external - pure - returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) - { + ) external pure returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) { return (0, 0, 0, 0, 0); } diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockArbitrumInbox.sol b/contracts/src/v0.8/l2ep/test/mocks/MockArbitrumInbox.sol index 3ec76338b8..f01a3d1fa6 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockArbitrumInbox.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockArbitrumInbox.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; -import {IInbox} from "../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/bridge/interfaces/IInbox.sol"; import {IBridge} from "../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/bridge/interfaces/IBridge.sol"; +import {IInbox} from "../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/bridge/interfaces/IInbox.sol"; contract MockArbitrumInbox is IInbox { event RetryableTicketNoRefundAliasRewriteCreated( @@ -16,45 +16,47 @@ contract MockArbitrumInbox is IInbox { bytes data ); - function sendL2Message(bytes calldata /* messageData */) external pure override returns (uint256) { + function sendL2Message( + bytes calldata /* messageData */ + ) external pure override returns (uint256) { return 0; } function sendUnsignedTransaction( - uint256 /* maxGas */, - uint256 /* gasPriceBid */, - uint256 /* nonce */, - address /* destAddr */, - uint256 /* amount */, + uint256, /* maxGas */ + uint256, /* gasPriceBid */ + uint256, /* nonce */ + address, /* destAddr */ + uint256, /* amount */ bytes calldata /* data */ ) external pure override returns (uint256) { return 0; } function sendContractTransaction( - uint256 /* maxGas */, - uint256 /* gasPriceBid */, - address /* destAddr */, - uint256 /* amount */, + uint256, /* maxGas */ + uint256, /* gasPriceBid */ + address, /* destAddr */ + uint256, /* amount */ bytes calldata /* data */ ) external pure override returns (uint256) { return 0; } function sendL1FundedUnsignedTransaction( - uint256 /* maxGas */, - uint256 /* gasPriceBid */, - uint256 /* nonce */, - address /* destAddr */, + uint256, /* maxGas */ + uint256, /* gasPriceBid */ + uint256, /* nonce */ + address, /* destAddr */ bytes calldata /* data */ ) external payable override returns (uint256) { return 0; } function sendL1FundedContractTransaction( - uint256 /* maxGas */, - uint256 /* gasPriceBid */, - address /* destAddr */, + uint256, /* maxGas */ + uint256, /* gasPriceBid */ + address, /* destAddr */ bytes calldata /* data */ ) external payable override returns (uint256) { return 0; @@ -84,26 +86,28 @@ contract MockArbitrumInbox is IInbox { } function createRetryableTicket( - address /* destAddr */, - uint256 /* arbTxCallValue */, - uint256 /* maxSubmissionCost */, - address /* submissionRefundAddress */, - address /* valueRefundAddress */, - uint256 /* maxGas */, - uint256 /* gasPriceBid */, + address, /* destAddr */ + uint256, /* arbTxCallValue */ + uint256, /* maxSubmissionCost */ + address, /* submissionRefundAddress */ + address, /* valueRefundAddress */ + uint256, /* maxGas */ + uint256, /* gasPriceBid */ bytes calldata /* data */ ) external payable override returns (uint256) { return 0; } - function depositEth(address /* destAddr */) external payable override returns (uint256) { + function depositEth( + address /* destAddr */ + ) external payable override returns (uint256) { return 0; } function depositEthRetryable( - address /* destAddr */, - uint256 /* maxSubmissionCost */, - uint256 /* maxGas */, + address, /* destAddr */ + uint256, /* maxSubmissionCost */ + uint256, /* maxGas */ uint256 /* maxGasPrice */ ) external payable override returns (uint256) { return 0; diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol index 50d852faa4..138fe3b93a 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockBaseSequencerUptimeFeed.sol @@ -17,7 +17,9 @@ contract MockBaseSequencerUptimeFeed is BaseSequencerUptimeFeed { s_validateSenderShouldPass = validateSenderShouldPass; } - function _validateSender(address /* l1Sender */) internal view override { + function _validateSender( + address /* l1Sender */ + ) internal view override { if (!s_validateSenderShouldPass) { revert InvalidSender(); } diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol b/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol index d23efb4865..673d52ffe5 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockBaseValidator.sol @@ -13,9 +13,9 @@ contract MockBaseValidator is BaseValidator { ) BaseValidator(l1CrossDomainMessengerAddress, l2UptimeFeedAddr, gasLimit) {} function validate( - uint256 /* previousRoundId */, - int256 /* previousAnswer */, - uint256 /* currentRoundId */, + uint256, /* previousRoundId */ + int256, /* previousAnswer */ + uint256, /* currentRoundId */ int256 /* currentAnswer */ ) external view override checkAccess returns (bool) { return true; diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockOptimismL2CrossDomainMessenger.sol b/contracts/src/v0.8/l2ep/test/mocks/MockOptimismL2CrossDomainMessenger.sol index 38ec3378c1..42dfe10070 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockOptimismL2CrossDomainMessenger.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockOptimismL2CrossDomainMessenger.sol @@ -13,7 +13,9 @@ contract MockOptimismL2CrossDomainMessenger is IL2CrossDomainMessenger { return s_sender; } - function setSender(address newSender) external { + function setSender( + address newSender + ) external { s_sender = newSender; } diff --git a/contracts/src/v0.8/l2ep/test/mocks/optimism/MockOVMCrossDomainMessenger.sol b/contracts/src/v0.8/l2ep/test/mocks/optimism/MockOVMCrossDomainMessenger.sol index beb7df99bf..2eea19a64b 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/optimism/MockOVMCrossDomainMessenger.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/optimism/MockOVMCrossDomainMessenger.sol @@ -1,14 +1,17 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {iOVM_CrossDomainMessenger} from "../../../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; +import {iOVM_CrossDomainMessenger} from + "../../../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; import {Address} from "@openzeppelin/contracts@4.8.3/utils/Address.sol"; contract MockOVMCrossDomainMessenger is iOVM_CrossDomainMessenger { address internal s_mockMessageSender; - constructor(address sender) { + constructor( + address sender + ) { s_mockMessageSender = sender; } @@ -16,7 +19,9 @@ contract MockOVMCrossDomainMessenger is iOVM_CrossDomainMessenger { return s_mockMessageSender; } - function _setMockMessageSender(address sender) external { + function _setMockMessageSender( + address sender + ) external { s_mockMessageSender = sender; } diff --git a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollCrossDomainMessenger.sol b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollCrossDomainMessenger.sol index 5f310f6c17..e8c3297342 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollCrossDomainMessenger.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollCrossDomainMessenger.sol @@ -8,7 +8,9 @@ import {Address} from "@openzeppelin/contracts@4.8.3/utils/Address.sol"; contract MockScrollCrossDomainMessenger is IScrollMessenger { address internal s_mockMessageSender; - constructor(address sender) { + constructor( + address sender + ) { s_mockMessageSender = sender; } @@ -16,7 +18,9 @@ contract MockScrollCrossDomainMessenger is IScrollMessenger { return s_mockMessageSender; } - function _setMockMessageSender(address sender) external { + function _setMockMessageSender( + address sender + ) external { s_mockMessageSender = sender; } diff --git a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueueV2.sol b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueueV2.sol index e362073faf..10409c65b8 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueueV2.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL1MessageQueueV2.sol @@ -15,12 +15,16 @@ contract MockScrollL1MessageQueueV2 is IL1MessageQueueV2 { } /// @notice Return the message of in `queueIndex`. - function getCrossDomainMessage(uint256 /* queueIndex */) external pure returns (bytes32) { + function getCrossDomainMessage( + uint256 /* queueIndex */ + ) external pure returns (bytes32) { return ""; } /// @notice Return the amount of ETH should pay for cross domain message. - function estimateCrossDomainMessageFee(uint256 /* gasLimit */) external pure returns (uint256) { + function estimateCrossDomainMessageFee( + uint256 /* gasLimit */ + ) external pure returns (uint256) { return 0; } @@ -35,12 +39,16 @@ contract MockScrollL1MessageQueueV2 is IL1MessageQueueV2 { } /// @notice Return the message rolling hash of `queueIndex`. - function getMessageRollingHash(uint256 /* queueIndex */) external pure returns (bytes32) { + function getMessageRollingHash( + uint256 /* queueIndex */ + ) external pure returns (bytes32) { return ""; } /// @notice Return the message enqueue timestamp of `queueIndex`. - function getMessageEnqueueTimestamp(uint256 /*queueIndex*/) external pure returns (uint256) { + function getMessageEnqueueTimestamp( + uint256 /*queueIndex*/ + ) external pure returns (uint256) { return 0; } @@ -55,17 +63,19 @@ contract MockScrollL1MessageQueueV2 is IL1MessageQueueV2 { } /// @notice Return the amount of intrinsic gas fee should pay for cross domain message. - function calculateIntrinsicGasFee(bytes memory /* _calldata */) external pure returns (uint256) { + function calculateIntrinsicGasFee( + bytes memory /* _calldata */ + ) external pure returns (uint256) { return 0; } /// @notice Return the hash of a L1 message. function computeTransactionHash( - address /* sender */, - uint256 /* queueIndex */, - uint256 /* value */, - address /* target */, - uint256 /* gasLimit */, + address, /* sender */ + uint256, /* queueIndex */ + uint256, /* value */ + address, /* target */ + uint256, /* gasLimit */ bytes calldata /* data */ ) external pure returns (bytes32) { return 0; @@ -103,9 +113,13 @@ contract MockScrollL1MessageQueueV2 is IL1MessageQueueV2 { function popCrossDomainMessage(uint256 startIndex, uint256 count, uint256 skippedBitmap) external {} /// @notice Drop a skipped message from the queue. - function dropCrossDomainMessage(uint256 index) external {} + function dropCrossDomainMessage( + uint256 index + ) external {} /// @notice Mark cross-domain messages as finalized. /// @dev This function can only be called by `ScrollChain`. - function finalizePoppedCrossDomainMessage(uint256 /* nextUnfinalizedQueueIndex */) external {} + function finalizePoppedCrossDomainMessage( + uint256 /* nextUnfinalizedQueueIndex */ + ) external {} } diff --git a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL2CrossDomainMessenger.sol b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL2CrossDomainMessenger.sol index af0e0b5ca5..b639d23f93 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL2CrossDomainMessenger.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/scroll/MockScrollL2CrossDomainMessenger.sol @@ -41,7 +41,9 @@ contract MockScrollL2CrossDomainMessenger is IL2ScrollMessenger { ) external override {} /// Needed for backwards compatibility in Hardhat tests - function setSender(address newSender) external { + function setSender( + address newSender + ) external { s_sender = newSender; } diff --git a/contracts/src/v0.8/l2ep/test/mocks/zksync/MockZKSyncL1Bridge.sol b/contracts/src/v0.8/l2ep/test/mocks/zksync/MockZKSyncL1Bridge.sol index b46b9d9fdf..3a1a7c6bf2 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/zksync/MockZKSyncL1Bridge.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/zksync/MockZKSyncL1Bridge.sol @@ -1,17 +1,21 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {IBridgehub, L2TransactionRequestDirect, L2TransactionRequestTwoBridgesOuter} from "@zksync/contracts/l1-contracts/contracts/bridgehub/IBridgehub.sol"; import {IL1SharedBridge} from "@zksync/contracts/l1-contracts/contracts/bridge/interfaces/IL1SharedBridge.sol"; -import {L2Message, L2Log, TxStatus} from "@zksync/contracts/l1-contracts/contracts/common/Messaging.sol"; +import { + IBridgehub, + L2TransactionRequestDirect, + L2TransactionRequestTwoBridgesOuter +} from "@zksync/contracts/l1-contracts/contracts/bridgehub/IBridgehub.sol"; +import {L2Log, L2Message, TxStatus} from "@zksync/contracts/l1-contracts/contracts/common/Messaging.sol"; contract MockBridgehub is IBridgehub { address public pendingAdmin; address public admin; address public sharedBridgeAddr; - mapping(address stateTransitionManager => bool stateTransitionManagerIsRegistered) - public registeredStateTransitionManagers; + mapping(address stateTransitionManager => bool stateTransitionManagerIsRegistered) public + registeredStateTransitionManagers; mapping(uint256 chainId => address stateTransitionManagerAddress) public stateTransitionManagers; mapping(address baseToken => bool tokenIsRegistered) public registeredTokens; mapping(uint256 chainId => address baseToken) public baseTokens; @@ -24,7 +28,9 @@ contract MockBridgehub is IBridgehub { event SentMessage(address indexed sender, bytes message); /// Admin functions - function setPendingAdmin(address _newPendingAdmin) external override { + function setPendingAdmin( + address _newPendingAdmin + ) external override { emit NewPendingAdmin(pendingAdmin, _newPendingAdmin); pendingAdmin = _newPendingAdmin; } @@ -40,19 +46,27 @@ contract MockBridgehub is IBridgehub { } /// Getters - function stateTransitionManagerIsRegistered(address _stateTransitionManager) external view override returns (bool) { + function stateTransitionManagerIsRegistered( + address _stateTransitionManager + ) external view override returns (bool) { return registeredStateTransitionManagers[_stateTransitionManager]; } - function stateTransitionManager(uint256 _chainId) external view override returns (address) { + function stateTransitionManager( + uint256 _chainId + ) external view override returns (address) { return stateTransitionManagers[_chainId]; } - function tokenIsRegistered(address _baseToken) external view override returns (bool) { + function tokenIsRegistered( + address _baseToken + ) external view override returns (bool) { return registeredTokens[_baseToken]; } - function baseToken(uint256 _chainId) external view override returns (address) { + function baseToken( + uint256 _chainId + ) external view override returns (address) { return baseTokens[_chainId]; } @@ -60,7 +74,9 @@ contract MockBridgehub is IBridgehub { return IL1SharedBridge(sharedBridgeAddr); } - function getHyperchain(uint256 _chainId) external view override returns (address) { + function getHyperchain( + uint256 _chainId + ) external view override returns (address) { return hyperchains[_chainId]; } @@ -129,19 +145,27 @@ contract MockBridgehub is IBridgehub { return _chainId; } - function addStateTransitionManager(address _stateTransitionManager) external override { + function addStateTransitionManager( + address _stateTransitionManager + ) external override { registeredStateTransitionManagers[_stateTransitionManager] = true; } - function removeStateTransitionManager(address _stateTransitionManager) external override { + function removeStateTransitionManager( + address _stateTransitionManager + ) external override { registeredStateTransitionManagers[_stateTransitionManager] = false; } - function addToken(address _token) external override { + function addToken( + address _token + ) external override { registeredTokens[_token] = true; } - function setSharedBridge(address _sharedBridgeAddr) external override { + function setSharedBridge( + address _sharedBridgeAddr + ) external override { sharedBridgeAddr = _sharedBridgeAddr; } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol index 0bd377a7cb..131448c184 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/L2EPTest.t.sol @@ -49,19 +49,20 @@ contract L2EPTest is Test { /// @return an encoded transaction structured as specified in the MultiSend#multiSend comments function encodeMultiSendTx(address greeterAddr, bytes memory data) public pure returns (bytes memory) { bytes memory txData = abi.encodeWithSelector(Greeter.setGreeting.selector, data); - return - abi.encodePacked( - uint8(0), // operation - greeterAddr, // to - uint256(0), // value - uint256(txData.length), // data length - txData // data as bytes - ); + return abi.encodePacked( + uint8(0), // operation + greeterAddr, // to + uint256(0), // value + uint256(txData.length), // data length + txData // data as bytes + ); } /// @param l1Address - Address on L1 /// @return an Arbitrum L2 address - function toArbitrumL2AliasAddress(address l1Address) public pure returns (address) { + function toArbitrumL2AliasAddress( + address l1Address + ) public pure returns (address) { return address(uint160(l1Address) + uint160(0x1111000000000000000000000000000000001111)); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol index 62f7cd5651..a7c09d894a 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainForwarder.t.sol @@ -63,8 +63,7 @@ contract ArbitrumCrossDomainForwarder_Forward is ArbitrumCrossDomainForwarderTes // Sends the message s_arbitrumCrossDomainForwarder.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) ); // Checks that the greeter got the message @@ -79,8 +78,7 @@ contract ArbitrumCrossDomainForwarder_Forward is ArbitrumCrossDomainForwarderTes // Sends an invalid message vm.expectRevert("Invalid greeting length"); s_arbitrumCrossDomainForwarder.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, "") + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, "") ); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol index 45f67d52cc..7881b418a9 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumCrossDomainGovernor.t.sol @@ -67,8 +67,7 @@ contract ArbitrumCrossDomainGovernor_Forward is ArbitrumCrossDomainGovernorTest // Sends the message s_arbitrumCrossDomainGovernor.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) ); // Checks that the greeter got the message @@ -85,8 +84,7 @@ contract ArbitrumCrossDomainGovernor_Forward is ArbitrumCrossDomainGovernorTest // Sends the message s_arbitrumCrossDomainGovernor.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) ); // Checks that the greeter message was updated @@ -101,8 +99,7 @@ contract ArbitrumCrossDomainGovernor_Forward is ArbitrumCrossDomainGovernorTest // Sends an invalid message vm.expectRevert("Invalid greeting length"); s_arbitrumCrossDomainGovernor.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, "") + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, "") ); } } @@ -178,8 +175,7 @@ contract ArbitrumCrossDomainGovernor_ForwardDelegate is ArbitrumCrossDomainGover // Sends an invalid message (empty transaction data is not allowed) vm.expectRevert("Greeter: revert triggered"); s_arbitrumCrossDomainGovernor.forwardDelegate( - address(s_greeter), - abi.encodeWithSelector(Greeter.triggerRevert.selector) + address(s_greeter), abi.encodeWithSelector(Greeter.triggerRevert.selector) ); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol index 1474b680ec..05fbe52894 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol @@ -2,10 +2,12 @@ pragma solidity 0.8.24; import {SimpleWriteAccessController} from "../../../../shared/access/SimpleWriteAccessController.sol"; + +import {Flags} from "../../../Flags.sol"; import {ArbitrumSequencerUptimeFeed} from "../../../arbitrum/ArbitrumSequencerUptimeFeed.sol"; -import {MockAggregatorV2V3} from "../../mocks/MockAggregatorV2V3.sol"; import {FeedConsumer} from "../../FeedConsumer.sol"; -import {Flags} from "../../../Flags.sol"; +import {MockAggregatorV2V3} from "../../mocks/MockAggregatorV2V3.sol"; + import {L2EPTest} from "../L2EPTest.t.sol"; contract ArbitrumSequencerUptimeFeedTest is L2EPTest { @@ -192,13 +194,8 @@ contract ArbitrumSequencerUptimeFeed_AggregatorV3Interface is ArbitrumSequencerU vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); // Gets data from a round that has not happened yet - ( - uint80 roundId, - int256 answer, - uint256 startedAt, - uint256 updatedAt, - uint80 answeredInRound - ) = s_arbitrumSequencerUptimeFeed.getRoundData(2); + (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) = + s_arbitrumSequencerUptimeFeed.getRoundData(2); // Validates round data assertEq(roundId, 2); @@ -240,7 +237,7 @@ contract ArbitrumSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFuncti assertEq(s_arbitrumSequencerUptimeFeed.hasAccess(address(feedConsumer), abi.encode("")), true); // Asserts reads are possible from consuming contract - (uint80 roundId, int256 answer, , , ) = feedConsumer.latestRoundData(); + (uint80 roundId, int256 answer,,,) = feedConsumer.latestRoundData(); assertEq(feedConsumer.latestAnswer(), 0); assertEq(roundId, 1); assertEq(answer, 0); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol index 916764d788..6a5cea3418 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol @@ -7,8 +7,9 @@ import {SimpleWriteAccessController} from "../../../../shared/access/SimpleWrite import {ArbitrumSequencerUptimeFeed} from "../../../arbitrum/ArbitrumSequencerUptimeFeed.sol"; import {ArbitrumValidator} from "../../../arbitrum/ArbitrumValidator.sol"; import {BaseValidator} from "../../../base/BaseValidator.sol"; -import {MockArbitrumInbox} from "../../mocks/MockArbitrumInbox.sol"; + import {MockAggregatorV2V3} from "../../mocks/MockAggregatorV2V3.sol"; +import {MockArbitrumInbox} from "../../mocks/MockArbitrumInbox.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; contract ArbitrumValidatorTest is L2EPTest { diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol index 5562b413e3..a196784d05 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainForwarder.t.sol @@ -2,8 +2,9 @@ pragma solidity 0.8.24; import {OptimismCrossDomainForwarder} from "../../../optimism/OptimismCrossDomainForwarder.sol"; -import {MockOVMCrossDomainMessenger} from "../../mocks/optimism/MockOVMCrossDomainMessenger.sol"; + import {Greeter} from "../../Greeter.sol"; +import {MockOVMCrossDomainMessenger} from "../../mocks/optimism/MockOVMCrossDomainMessenger.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; contract OptimismCrossDomainForwarderTest is L2EPTest { @@ -21,10 +22,7 @@ contract OptimismCrossDomainForwarderTest is L2EPTest { // Deploys contracts vm.startPrank(s_l1OwnerAddr); s_mockOptimismCrossDomainMessenger = new MockOVMCrossDomainMessenger(s_l1OwnerAddr); - s_optimismCrossDomainForwarder = new OptimismCrossDomainForwarder( - s_mockOptimismCrossDomainMessenger, - s_l1OwnerAddr - ); + s_optimismCrossDomainForwarder = new OptimismCrossDomainForwarder(s_mockOptimismCrossDomainMessenger, s_l1OwnerAddr); s_greeter = new Greeter(address(s_optimismCrossDomainForwarder)); vm.stopPrank(); } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol index 3328a89b89..dc4396f69a 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismCrossDomainGovernor.t.sol @@ -2,8 +2,9 @@ pragma solidity 0.8.24; import {OptimismCrossDomainGovernor} from "../../../optimism/OptimismCrossDomainGovernor.sol"; -import {MockOVMCrossDomainMessenger} from "../../mocks/optimism/MockOVMCrossDomainMessenger.sol"; + import {Greeter} from "../../Greeter.sol"; +import {MockOVMCrossDomainMessenger} from "../../mocks/optimism/MockOVMCrossDomainMessenger.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; import {MultiSend} from "../../../../vendor/MultiSend.sol"; @@ -99,8 +100,7 @@ contract OptimismCrossDomainGovernor_Forward is OptimismCrossDomainGovernorTest // Sends the message s_optimismCrossDomainGovernor.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) ); // Checks that the greeter message was updated diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol index 393da70d79..dfa6aa7979 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismSequencerUptimeFeed.t.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; +import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; +import {OptimismSequencerUptimeFeed} from "../../../optimism/OptimismSequencerUptimeFeed.sol"; import {MockOptimismL1CrossDomainMessenger} from "../../mocks/MockOptimismL1CrossDomainMessenger.sol"; import {MockOptimismL2CrossDomainMessenger} from "../../mocks/MockOptimismL2CrossDomainMessenger.sol"; -import {OptimismSequencerUptimeFeed} from "../../../optimism/OptimismSequencerUptimeFeed.sol"; -import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; + import {L2EPTest} from "../L2EPTest.t.sol"; contract OptimismSequencerUptimeFeed_TestWrapper is OptimismSequencerUptimeFeed { @@ -15,7 +16,9 @@ contract OptimismSequencerUptimeFeed_TestWrapper is OptimismSequencerUptimeFeed ) OptimismSequencerUptimeFeed(l1SenderAddress, l2CrossDomainMessengerAddr, initialStatus) {} /// @notice Exposes the internal `_validateSender` function for testing - function validateSenderTestWrapper(address l1Sender) external view { + function validateSenderTestWrapper( + address l1Sender + ) external view { super._validateSender(l1Sender); } } @@ -33,11 +36,8 @@ contract OptimismSequencerUptimeFeed_Setup is L2EPTest { // Deploy contracts s_mockOptimismL1CrossDomainMessenger = new MockOptimismL1CrossDomainMessenger(); s_mockOptimismL2CrossDomainMessenger = new MockOptimismL2CrossDomainMessenger(); - s_optimismSequencerUptimeFeed = new OptimismSequencerUptimeFeed_TestWrapper( - s_l1OwnerAddr, - address(s_mockOptimismL2CrossDomainMessenger), - false - ); + s_optimismSequencerUptimeFeed = + new OptimismSequencerUptimeFeed_TestWrapper(s_l1OwnerAddr, address(s_mockOptimismL2CrossDomainMessenger), false); // Sets mock sender in mock L2 messenger contract s_mockOptimismL2CrossDomainMessenger.setSender(s_l1OwnerAddr); @@ -57,7 +57,7 @@ contract OptimismSequencerUptimeFeed_Constructor is OptimismSequencerUptimeFeed_ assertEq(actualL1Addr, s_l1OwnerAddr); // Checks latest round data - (uint80 roundId, int256 answer, , , ) = s_optimismSequencerUptimeFeed.latestRoundData(); + (uint80 roundId, int256 answer,,,) = s_optimismSequencerUptimeFeed.latestRoundData(); assertEq(roundId, 1); assertEq(answer, 0); } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol index a05def8c0a..4bff7c1b2b 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol @@ -3,11 +3,11 @@ pragma solidity 0.8.24; import {ISequencerUptimeFeed} from "../../../interfaces/ISequencerUptimeFeed.sol"; -import {MockOptimismL1CrossDomainMessenger} from "../../mocks/MockOptimismL1CrossDomainMessenger.sol"; -import {MockOptimismL2CrossDomainMessenger} from "../../mocks/MockOptimismL2CrossDomainMessenger.sol"; -import {OptimismSequencerUptimeFeed} from "../../../optimism/OptimismSequencerUptimeFeed.sol"; import {BaseValidator} from "../../../base/BaseValidator.sol"; +import {OptimismSequencerUptimeFeed} from "../../../optimism/OptimismSequencerUptimeFeed.sol"; import {OptimismValidator} from "../../../optimism/OptimismValidator.sol"; +import {MockOptimismL1CrossDomainMessenger} from "../../mocks/MockOptimismL1CrossDomainMessenger.sol"; +import {MockOptimismL2CrossDomainMessenger} from "../../mocks/MockOptimismL2CrossDomainMessenger.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; contract OptimismValidator_Setup is L2EPTest { @@ -30,15 +30,11 @@ contract OptimismValidator_Setup is L2EPTest { s_mockOptimismL2CrossDomainMessenger = new MockOptimismL2CrossDomainMessenger(); s_optimismSequencerUptimeFeed = new OptimismSequencerUptimeFeed( - address(s_mockOptimismL1CrossDomainMessenger), - address(s_mockOptimismL2CrossDomainMessenger), - true + address(s_mockOptimismL1CrossDomainMessenger), address(s_mockOptimismL2CrossDomainMessenger), true ); s_optimismValidator = new OptimismValidator( - address(s_mockOptimismL1CrossDomainMessenger), - address(s_optimismSequencerUptimeFeed), - INIT_GAS_LIMIT + address(s_mockOptimismL1CrossDomainMessenger), address(s_optimismSequencerUptimeFeed), INIT_GAS_LIMIT ); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol index d28df02e97..1f170d1616 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainForwarder.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {MockScrollCrossDomainMessenger} from "../../mocks/scroll/MockScrollCrossDomainMessenger.sol"; import {ScrollCrossDomainForwarder} from "../../../scroll/ScrollCrossDomainForwarder.sol"; import {Greeter} from "../../Greeter.sol"; +import {MockScrollCrossDomainMessenger} from "../../mocks/scroll/MockScrollCrossDomainMessenger.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; contract ScrollCrossDomainForwarderTest is L2EPTest { diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol index 544923f49f..eb70f948eb 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollCrossDomainGovernor.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; -import {MockScrollCrossDomainMessenger} from "../../mocks/scroll/MockScrollCrossDomainMessenger.sol"; import {ScrollCrossDomainGovernor} from "../../../scroll/ScrollCrossDomainGovernor.sol"; import {Greeter} from "../../Greeter.sol"; +import {MockScrollCrossDomainMessenger} from "../../mocks/scroll/MockScrollCrossDomainMessenger.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; import {MultiSend} from "../../../../vendor/MultiSend.sol"; @@ -98,8 +98,7 @@ contract ScrollCrossDomainGovernor_Forward is ScrollCrossDomainGovernorTest { // Sends the message s_scrollCrossDomainGovernor.forward( - address(s_greeter), - abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) + address(s_greeter), abi.encodeWithSelector(s_greeter.setGreeting.selector, greeting) ); // Checks that the greeter message was updated diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol index 1ad4bfd811..8b8fa10ce2 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollSequencerUptimeFeed.t.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.24; +import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; +import {ScrollSequencerUptimeFeed} from "../../../scroll/ScrollSequencerUptimeFeed.sol"; import {MockScrollL1CrossDomainMessenger} from "../../mocks/scroll/MockScrollL1CrossDomainMessenger.sol"; import {MockScrollL2CrossDomainMessenger} from "../../mocks/scroll/MockScrollL2CrossDomainMessenger.sol"; -import {ScrollSequencerUptimeFeed} from "../../../scroll/ScrollSequencerUptimeFeed.sol"; -import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; + import {L2EPTest} from "../L2EPTest.t.sol"; contract ScrollSequencerUptimeFeedTestWrapper is ScrollSequencerUptimeFeed { @@ -15,7 +16,9 @@ contract ScrollSequencerUptimeFeedTestWrapper is ScrollSequencerUptimeFeed { ) ScrollSequencerUptimeFeed(l1SenderAddress, l2CrossDomainMessengerAddr, initialStatus) {} /// @notice It exposes the internal _validateSender function for testing - function validateSenderTestWrapper(address l1Sender) external view { + function validateSenderTestWrapper( + address l1Sender + ) external view { super._validateSender(l1Sender); } } @@ -39,11 +42,8 @@ contract ScrollSequencerUptimeFeed_Setup is L2EPTest { // Deploys contracts s_mockScrollL1CrossDomainMessenger = new MockScrollL1CrossDomainMessenger(); s_mockScrollL2CrossDomainMessenger = new MockScrollL2CrossDomainMessenger(); - s_scrollSequencerUptimeFeed = new ScrollSequencerUptimeFeedTestWrapper( - s_l1OwnerAddr, - address(s_mockScrollL2CrossDomainMessenger), - false - ); + s_scrollSequencerUptimeFeed = + new ScrollSequencerUptimeFeedTestWrapper(s_l1OwnerAddr, address(s_mockScrollL2CrossDomainMessenger), false); // Sets mock sender in mock L2 messenger contract s_mockScrollL2CrossDomainMessenger.setSender(s_l1OwnerAddr); @@ -64,7 +64,7 @@ contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeed_Setu assertEq(actualL1Addr, s_l1OwnerAddr); // Checks latest round data - (uint80 roundId, int256 answer, , , ) = s_scrollSequencerUptimeFeed.latestRoundData(); + (uint80 roundId, int256 answer,,,) = s_scrollSequencerUptimeFeed.latestRoundData(); assertEq(roundId, 1); assertEq(answer, 0); } @@ -72,18 +72,15 @@ contract ScrollSequencerUptimeFeed_Constructor is ScrollSequencerUptimeFeed_Setu /// @notice Tests initial state with valid L2 Cross Domain Messenger function test_Constructor_InitialState_WhenValidL2XDomainMessenger() public { vm.startPrank(s_l1OwnerAddr, s_l1OwnerAddr); - ScrollSequencerUptimeFeed scrollSequencerUptimeFeed = new ScrollSequencerUptimeFeed( - s_l1OwnerAddr, - address(s_mockScrollL2CrossDomainMessenger), - false - ); + ScrollSequencerUptimeFeed scrollSequencerUptimeFeed = + new ScrollSequencerUptimeFeed(s_l1OwnerAddr, address(s_mockScrollL2CrossDomainMessenger), false); // Checks L1 sender address actualL1Addr = scrollSequencerUptimeFeed.l1Sender(); assertEq(actualL1Addr, s_l1OwnerAddr); // Checks latest round data - (uint80 roundId, int256 answer, , , ) = scrollSequencerUptimeFeed.latestRoundData(); + (uint80 roundId, int256 answer,,,) = scrollSequencerUptimeFeed.latestRoundData(); assertEq(roundId, 1); assertEq(answer, 0); } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol index 49b8a078dd..76c9a4c962 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol @@ -3,12 +3,13 @@ pragma solidity 0.8.24; import {ISequencerUptimeFeed} from "../../../interfaces/ISequencerUptimeFeed.sol"; -import {MockScrollL1CrossDomainMessenger} from "../../mocks/scroll/MockScrollL1CrossDomainMessenger.sol"; -import {MockScrollL2CrossDomainMessenger} from "../../mocks/scroll/MockScrollL2CrossDomainMessenger.sol"; -import {MockScrollL1MessageQueueV2} from "../../mocks/scroll/MockScrollL1MessageQueueV2.sol"; +import {BaseValidator} from "../../../base/BaseValidator.sol"; import {ScrollSequencerUptimeFeed} from "../../../scroll/ScrollSequencerUptimeFeed.sol"; import {ScrollValidator} from "../../../scroll/ScrollValidator.sol"; -import {BaseValidator} from "../../../base/BaseValidator.sol"; +import {MockScrollL1CrossDomainMessenger} from "../../mocks/scroll/MockScrollL1CrossDomainMessenger.sol"; +import {MockScrollL1MessageQueueV2} from "../../mocks/scroll/MockScrollL1MessageQueueV2.sol"; +import {MockScrollL2CrossDomainMessenger} from "../../mocks/scroll/MockScrollL2CrossDomainMessenger.sol"; + import {L2EPTest} from "../L2EPTest.t.sol"; contract ScrollValidator_Setup is L2EPTest { @@ -25,12 +26,7 @@ contract ScrollValidator_Setup is L2EPTest { /// https://github.com/scroll-tech/scroll/blob/03089eaeee1193ff44c532c7038611ae123e7ef3/contracts/src/libraries/IScrollMessenger.sol#L22 event SentMessage( - address indexed sender, - address indexed target, - uint256 value, - uint256 messageNonce, - uint256 gasLimit, - bytes message + address indexed sender, address indexed target, uint256 value, uint256 messageNonce, uint256 gasLimit, bytes message ); /// Setup @@ -40,9 +36,7 @@ contract ScrollValidator_Setup is L2EPTest { s_mockScrollL1MessageQueue = new MockScrollL1MessageQueueV2(); s_scrollSequencerUptimeFeed = new ScrollSequencerUptimeFeed( - address(s_mockScrollL1CrossDomainMessenger), - address(s_mockScrollL2CrossDomainMessenger), - true + address(s_mockScrollL1CrossDomainMessenger), address(s_mockScrollL2CrossDomainMessenger), true ); s_scrollValidator = new ScrollValidator( @@ -61,10 +55,7 @@ contract ScrollValidator_Constructor is ScrollValidator_Setup { vm.expectRevert("Invalid L1 message queue address"); new ScrollValidator( - address(s_mockScrollL1CrossDomainMessenger), - address(s_scrollSequencerUptimeFeed), - address(0), - INIT_GAS_LIMIT + address(s_mockScrollL1CrossDomainMessenger), address(s_scrollSequencerUptimeFeed), address(0), INIT_GAS_LIMIT ); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol index 367aa00a62..df49b682a4 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {Vm} from "forge-std/Test.sol"; -import {AddressAliasHelper} from "../../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; +import {AddressAliasHelper} from + "../../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; import {MockBaseSequencerUptimeFeed} from "../../../test/mocks/MockBaseSequencerUptimeFeed.sol"; import {FeedConsumer} from "../../FeedConsumer.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; +import {Vm} from "forge-std/Test.sol"; contract BaseSequencerUptimeFeed_Setup is L2EPTest { /// Helper Variables @@ -39,7 +40,7 @@ contract BaseSequencerUptimeFeed_Constructor is BaseSequencerUptimeFeed_Setup { assertEq(actualL1Addr, s_l1OwnerAddr); // Checks latest round data - (uint80 roundId, int256 answer, , , ) = s_sequencerUptimeFeed.latestRoundData(); + (uint80 roundId, int256 answer,,,) = s_sequencerUptimeFeed.latestRoundData(); assertEq(roundId, 1); assertEq(answer, 0); } @@ -88,11 +89,8 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeed_Setup { // Sets msg.sender and tx.origin to an unauthorized address vm.startPrank(s_strangerAddr, s_strangerAddr); - BaseSequencerUptimeFeed s_sequencerUptimeFeedFailSenderCheck = new MockBaseSequencerUptimeFeed( - s_l1OwnerAddr, - false, - false - ); + BaseSequencerUptimeFeed s_sequencerUptimeFeedFailSenderCheck = + new MockBaseSequencerUptimeFeed(s_l1OwnerAddr, false, false); // Tries to update the status from an unauthorized account vm.expectRevert(BaseSequencerUptimeFeed.InvalidSender.selector); @@ -298,7 +296,7 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); uint256 startedAt; - (, , startedAt, , ) = s_sequencerUptimeFeed.latestRoundData(); + (,, startedAt,,) = s_sequencerUptimeFeed.latestRoundData(); s_sequencerUptimeFeed.updateStatus(true, uint64(startedAt + 1000)); @@ -321,7 +319,7 @@ contract BaseSequencerUptimeFeed_AggregatorV3Interface is BaseSequencerUptimeFee vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); uint256 startedAt; - (, , startedAt, , ) = s_sequencerUptimeFeed.latestRoundData(); + (,, startedAt,,) = s_sequencerUptimeFeed.latestRoundData(); s_sequencerUptimeFeed.updateStatus(true, uint64(startedAt + 1000)); @@ -369,7 +367,7 @@ contract BaseSequencerUptimeFeed_ProtectReadsOnAggregatorV2V3InterfaceFunctions assertEq(s_sequencerUptimeFeed.hasAccess(address(feedConsumer), abi.encode("")), true); // Asserts reads are possible from consuming contract - (uint80 roundId, int256 answer, , , ) = feedConsumer.latestRoundData(); + (uint80 roundId, int256 answer,,,) = feedConsumer.latestRoundData(); assertEq(feedConsumer.latestAnswer(), 0); assertEq(roundId, 1); assertEq(answer, 0); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol index a00d9490ba..a0c1737b61 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol @@ -17,11 +17,7 @@ contract BaseValidator_Setup is L2EPTest { /// Setup function setUp() public { - s_baseValidator = new MockBaseValidator( - DUMMY_L1_XDOMAIN_MSNGR_ADDR, - L2_SEQ_STATUS_RECORDER_ADDRESS, - INIT_GAS_LIMIT - ); + s_baseValidator = new MockBaseValidator(DUMMY_L1_XDOMAIN_MSNGR_ADDR, L2_SEQ_STATUS_RECORDER_ADDRESS, INIT_GAS_LIMIT); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol index 8e9c387c87..6ebd3e336a 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncSequencerUptimeFeed.t.sol @@ -1,16 +1,20 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {AddressAliasHelper} from "../../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; -import {ZKSyncSequencerUptimeFeed} from "../../../zksync/ZKSyncSequencerUptimeFeed.sol"; +import {AddressAliasHelper} from + "../../../../vendor/arb-bridge-eth/v0.8.0-custom/contracts/libraries/AddressAliasHelper.sol"; + import {BaseSequencerUptimeFeed} from "../../../base/BaseSequencerUptimeFeed.sol"; +import {ZKSyncSequencerUptimeFeed} from "../../../zksync/ZKSyncSequencerUptimeFeed.sol"; import {L2EPTest} from "../L2EPTest.t.sol"; contract ZKSyncSequencerUptimeFeed_TestWrapper is ZKSyncSequencerUptimeFeed { constructor(address l1SenderAddress, bool initialStatus) ZKSyncSequencerUptimeFeed(l1SenderAddress, initialStatus) {} /// @notice Exposes the internal _validateSender function for testing - function validateSenderTestWrapper(address l1Sender) external view { + function validateSenderTestWrapper( + address l1Sender + ) external view { super._validateSender(l1Sender); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol index 7d967acd56..63e1ed1db4 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {MockBridgehub} from "../../mocks/zksync/MockZKSyncL1Bridge.sol"; +import {BaseValidator} from "../../../base/BaseValidator.sol"; import {ISequencerUptimeFeed} from "../../../interfaces/ISequencerUptimeFeed.sol"; import {ZKSyncValidator} from "../../../zksync/ZKSyncValidator.sol"; -import {BaseValidator} from "../../../base/BaseValidator.sol"; +import {MockBridgehub} from "../../mocks/zksync/MockZKSyncL1Bridge.sol"; + import {L2EPTest} from "../L2EPTest.t.sol"; contract ZKSyncValidator_Setup is L2EPTest { @@ -55,11 +56,7 @@ contract ZKSyncValidator_Constructor is ZKSyncValidator_Setup { function test_Constructor_RevertWhen_L1BridgeAddressIsZero() public { vm.expectRevert(BaseValidator.L1CrossDomainMessengerAddressZero.selector); new ZKSyncValidator( - address(0), - DUMMY_L2_UPTIME_FEED_ADDR, - INIT_GAS_LIMIT, - MAIN_NET_CHAIN_ID, - INIT_GAS_PER_PUBDATA_BYTE_LIMIT + address(0), DUMMY_L2_UPTIME_FEED_ADDR, INIT_GAS_LIMIT, MAIN_NET_CHAIN_ID, INIT_GAS_PER_PUBDATA_BYTE_LIMIT ); } @@ -67,11 +64,7 @@ contract ZKSyncValidator_Constructor is ZKSyncValidator_Setup { function test_Constructor_RevertWhen_L2UpdateFeedAddressIsZero() public { vm.expectRevert(BaseValidator.L2UptimeFeedAddrZero.selector); new ZKSyncValidator( - DUMMY_L1_XDOMAIN_MSNGR_ADDR, - address(0), - INIT_GAS_LIMIT, - MAIN_NET_CHAIN_ID, - INIT_GAS_PER_PUBDATA_BYTE_LIMIT + DUMMY_L1_XDOMAIN_MSNGR_ADDR, address(0), INIT_GAS_LIMIT, MAIN_NET_CHAIN_ID, INIT_GAS_PER_PUBDATA_BYTE_LIMIT ); } } @@ -117,11 +110,8 @@ contract ZKSyncValidator_Validate is ZKSyncValidator_Setup { vm.warp(futureTimestampInSeconds); // Sets up the expected event data - bytes memory message = abi.encodeWithSelector( - ISequencerUptimeFeed.updateStatus.selector, - false, - futureTimestampInSeconds - ); + bytes memory message = + abi.encodeWithSelector(ISequencerUptimeFeed.updateStatus.selector, false, futureTimestampInSeconds); vm.expectEmit(false, false, false, true); emit SentMessage(address(s_zksyncValidator), message); diff --git a/contracts/src/v0.8/l2ep/zksync/ZKSyncSequencerUptimeFeed.sol b/contracts/src/v0.8/l2ep/zksync/ZKSyncSequencerUptimeFeed.sol index e464cc7407..5b34115efb 100644 --- a/contracts/src/v0.8/l2ep/zksync/ZKSyncSequencerUptimeFeed.sol +++ b/contracts/src/v0.8/l2ep/zksync/ZKSyncSequencerUptimeFeed.sol @@ -15,7 +15,9 @@ contract ZKSyncSequencerUptimeFeed is BaseSequencerUptimeFeed { /// @param initialStatus The initial status of the feed constructor(address l1SenderAddress, bool initialStatus) BaseSequencerUptimeFeed(l1SenderAddress, initialStatus) {} - function _validateSender(address l1Sender) internal view override { + function _validateSender( + address l1Sender + ) internal view override { address aliasedL1Sender = AddressAliasHelper.applyL1ToL2Alias(l1Sender); if (msg.sender != aliasedL1Sender) { diff --git a/contracts/src/v0.8/l2ep/zksync/ZKSyncValidator.sol b/contracts/src/v0.8/l2ep/zksync/ZKSyncValidator.sol index ace5b9d7ea..e8bf08df52 100644 --- a/contracts/src/v0.8/l2ep/zksync/ZKSyncValidator.sol +++ b/contracts/src/v0.8/l2ep/zksync/ZKSyncValidator.sol @@ -5,7 +5,9 @@ import {ISequencerUptimeFeed} from "./../interfaces/ISequencerUptimeFeed.sol"; import {BaseValidator} from "../base/BaseValidator.sol"; -import {IBridgehub, L2TransactionRequestDirect} from "@zksync/contracts/l1-contracts/contracts/bridgehub/IBridgehub.sol"; +import { + IBridgehub, L2TransactionRequestDirect +} from "@zksync/contracts/l1-contracts/contracts/bridgehub/IBridgehub.sol"; /// @title ZKSyncValidator - makes cross chain call to update the Sequencer Uptime Feed on L2 contract ZKSyncValidator is BaseValidator { @@ -45,7 +47,9 @@ contract ZKSyncValidator is BaseValidator { /// @notice sets the l2GasPerPubdataByteLimit for the L2 transaction request /// @param l2GasPerPubdataByteLimit the updated l2GasPerPubdataByteLimit - function setL2GasPerPubdataByteLimit(uint32 l2GasPerPubdataByteLimit) external onlyOwner { + function setL2GasPerPubdataByteLimit( + uint32 l2GasPerPubdataByteLimit + ) external onlyOwner { if (s_l2GasPerPubdataByteLimit != l2GasPerPubdataByteLimit) { s_l2GasPerPubdataByteLimit = l2GasPerPubdataByteLimit; emit GasPerPubdataByteLimitUpdated(l2GasPerPubdataByteLimit); @@ -73,12 +77,8 @@ contract ZKSyncValidator is BaseValidator { ) external override checkAccess returns (bool) { IBridgehub bridgeHub = IBridgehub(L1_CROSS_DOMAIN_MESSENGER_ADDRESS); - uint256 transactionBaseCostEstimate = bridgeHub.l2TransactionBaseCost( - CHAIN_ID, - tx.gasprice, - s_gasLimit, - s_l2GasPerPubdataByteLimit - ); + uint256 transactionBaseCostEstimate = + bridgeHub.l2TransactionBaseCost(CHAIN_ID, tx.gasprice, s_gasLimit, s_l2GasPerPubdataByteLimit); L2TransactionRequestDirect memory l2TransactionRequestDirect = L2TransactionRequestDirect({ chainId: CHAIN_ID, @@ -86,9 +86,7 @@ contract ZKSyncValidator is BaseValidator { l2Contract: L2_UPTIME_FEED_ADDR, l2Value: 0, l2Calldata: abi.encodeWithSelector( - ISequencerUptimeFeed.updateStatus.selector, - currentAnswer == ANSWER_SEQ_OFFLINE, - uint64(block.timestamp) + ISequencerUptimeFeed.updateStatus.selector, currentAnswer == ANSWER_SEQ_OFFLINE, uint64(block.timestamp) ), l2GasLimit: s_gasLimit, l2GasPerPubdataByteLimit: s_l2GasPerPubdataByteLimit, diff --git a/contracts/src/v0.8/llo-feeds/libraries/Common.sol b/contracts/src/v0.8/llo-feeds/libraries/Common.sol index 491aec4457..700d45816c 100644 --- a/contracts/src/v0.8/llo-feeds/libraries/Common.sol +++ b/contracts/src/v0.8/llo-feeds/libraries/Common.sol @@ -24,9 +24,11 @@ library Common { * @param recipients The array of AddressAndWeight to check * @return bool True if there are duplicates, false otherwise */ - function _hasDuplicateAddresses(address[] memory recipients) internal pure returns (bool) { - for (uint256 i = 0; i < recipients.length; ) { - for (uint256 j = i + 1; j < recipients.length; ) { + function _hasDuplicateAddresses( + address[] memory recipients + ) internal pure returns (bool) { + for (uint256 i = 0; i < recipients.length;) { + for (uint256 j = i + 1; j < recipients.length;) { if (recipients[i] == recipients[j]) { return true; } @@ -46,9 +48,11 @@ library Common { * @param recipients The array of AddressAndWeight to check * @return bool True if there are duplicates, false otherwise */ - function _hasDuplicateAddresses(Common.AddressAndWeight[] memory recipients) internal pure returns (bool) { - for (uint256 i = 0; i < recipients.length; ) { - for (uint256 j = i + 1; j < recipients.length; ) { + function _hasDuplicateAddresses( + Common.AddressAndWeight[] memory recipients + ) internal pure returns (bool) { + for (uint256 i = 0; i < recipients.length;) { + for (uint256 j = i + 1; j < recipients.length;) { if (recipients[i].addr == recipients[j].addr) { return true; } diff --git a/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol b/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol index d0ad925632..5c02377991 100644 --- a/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; import {ByteUtil} from "../ByteUtil.sol"; +import {Test} from "forge-std/Test.sol"; contract ByteUtilTest is Test { using ByteUtil for bytes; diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol index 806983d0ac..adac316d56 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol @@ -2,16 +2,19 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IFeeManager} from "./interfaces/IFeeManager.sol"; + import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + +import {IWERC20} from "../../shared/interfaces/IWERC20.sol"; import {Common} from "../libraries/Common.sol"; +import {IFeeManager} from "./interfaces/IFeeManager.sol"; import {IRewardManager} from "./interfaces/IRewardManager.sol"; -import {IWERC20} from "../../shared/interfaces/IWERC20.sol"; + +import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; -import {Math} from "@openzeppelin/contracts@4.8.3/utils/math/Math.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; -import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {Math} from "@openzeppelin/contracts@4.8.3/utils/math/Math.sol"; /** * @title FeeManager @@ -134,10 +137,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { address _rewardManagerAddress ) ConfirmedOwner(msg.sender) { if ( - _linkAddress == address(0) || - _nativeAddress == address(0) || - _proxyAddress == address(0) || - _rewardManagerAddress == address(0) + _linkAddress == address(0) || _nativeAddress == address(0) || _proxyAddress == address(0) + || _rewardManagerAddress == address(0) ) revert InvalidAddress(); i_linkAddress = _linkAddress; @@ -164,7 +165,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == this.processFee.selector || interfaceId == this.processFeeBulk.selector; } @@ -174,11 +177,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { bytes calldata parameterPayload, address subscriber ) external payable override onlyProxy { - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _processFee( - payload, - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _processFee(payload, parameterPayload, subscriber); if (fee.amount == 0) { _tryReturnChange(subscriber, msg.value); @@ -209,19 +209,12 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 feesAndRewardsIndex; for (uint256 i; i < payloads.length; ++i) { - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _processFee( - payloads[i], - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _processFee(payloads[i], parameterPayload, subscriber); if (fee.amount != 0) { - feesAndRewards[feesAndRewardsIndex++] = IFeeManager.FeeAndReward( - bytes32(payloads[i]), - fee, - reward, - appliedDiscount - ); + feesAndRewards[feesAndRewardsIndex++] = + IFeeManager.FeeAndReward(bytes32(payloads[i]), fee, reward, appliedDiscount); unchecked { //keep track of some tallys to make downstream calculations more efficient @@ -272,10 +265,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 linkQuantity; uint256 nativeQuantity; uint256 expiresAt; - (, , , nativeQuantity, linkQuantity, expiresAt) = abi.decode( - report, - (bytes32, uint32, uint32, uint192, uint192, uint32) - ); + (,,, nativeQuantity, linkQuantity, expiresAt) = + abi.decode(report, (bytes32, uint32, uint32, uint192, uint192, uint32)); //read the timestamp bytes from the report data and verify it has not expired if (expiresAt < block.timestamp) { @@ -313,7 +304,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IFeeManager - function setNativeSurcharge(uint64 surcharge) external onlyOwner { + function setNativeSurcharge( + uint64 surcharge + ) external onlyOwner { if (surcharge > PERCENTAGE_SCALAR) revert InvalidSurcharge(); s_nativeSurcharge = surcharge; @@ -342,7 +335,7 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { function withdraw(address assetAddress, address recipient, uint192 quantity) external onlyOwner { //address 0 is used to withdraw native in the context of withdrawing if (assetAddress == address(0)) { - (bool success, ) = payable(recipient).call{value: quantity}(""); + (bool success,) = payable(recipient).call{value: quantity}(""); if (!success) revert InvalidReceivingAddress(); return; @@ -365,7 +358,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { * @notice Gets the current version of the report that is encoded as the last two bytes of the feed * @param feedId feed id to get the report version for */ - function _getReportVersion(bytes32 feedId) internal pure returns (bytes32) { + function _getReportVersion( + bytes32 feedId + ) internal pure returns (bytes32) { return REPORT_VERSION_MASK & feedId; } @@ -411,15 +406,11 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 totalNumberOfFees = numberOfLinkFees + numberOfNativeFees; for (uint256 i; i < totalNumberOfFees; ++i) { if (feesAndRewards[i].fee.assetAddress == i_linkAddress) { - linkRewards[linkRewardsIndex++] = IRewardManager.FeePayment( - feesAndRewards[i].configDigest, - uint192(feesAndRewards[i].reward.amount) - ); + linkRewards[linkRewardsIndex++] = + IRewardManager.FeePayment(feesAndRewards[i].configDigest, uint192(feesAndRewards[i].reward.amount)); } else { - nativeFeeLinkRewards[nativeFeeLinkRewardsIndex++] = IRewardManager.FeePayment( - feesAndRewards[i].configDigest, - uint192(feesAndRewards[i].reward.amount) - ); + nativeFeeLinkRewards[nativeFeeLinkRewardsIndex++] = + IRewardManager.FeePayment(feesAndRewards[i].configDigest, uint192(feesAndRewards[i].reward.amount)); totalNativeFee += feesAndRewards[i].fee.amount; totalNativeFeeLinkValue += feesAndRewards[i].reward.amount; } @@ -489,7 +480,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IFeeManager - function payLinkDeficit(bytes32 configDigest) external onlyOwner { + function payLinkDeficit( + bytes32 configDigest + ) external onlyOwner { uint256 deficit = s_linkDeficit[configDigest]; if (deficit == 0) revert ZeroDeficit(); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol index 7facd3e494..c599b15071 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol @@ -2,10 +2,11 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IRewardManager} from "./interfaces/IRewardManager.sol"; -import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; + import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {Common} from "../libraries/Common.sol"; +import {IRewardManager} from "./interfaces/IRewardManager.sol"; +import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; /** @@ -66,7 +67,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { * @notice Constructor * @param linkAddress address of the wrapped LINK token */ - constructor(address linkAddress) ConfirmedOwner(msg.sender) { + constructor( + address linkAddress + ) ConfirmedOwner(msg.sender) { //ensure that the address ia not zero if (linkAddress == address(0)) revert InvalidAddress(); @@ -79,7 +82,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == this.onFeePaid.selector; } @@ -88,7 +93,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { _; } - modifier onlyOwnerOrRecipientInPool(bytes32 poolId) { + modifier onlyOwnerOrRecipientInPool( + bytes32 poolId + ) { if (msg.sender != owner() && s_rewardRecipientWeights[poolId][msg.sender] == 0) revert Unauthorized(); _; } @@ -120,7 +127,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IRewardManager - function claimRewards(bytes32[] memory poolIds) external override { + function claimRewards( + bytes32[] memory poolIds + ) external override { _claimRewards(msg.sender, poolIds); } @@ -271,7 +280,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IRewardManager - function setFeeManager(address newFeeManagerAddress) external onlyOwner { + function setFeeManager( + address newFeeManagerAddress + ) external onlyOwner { if (newFeeManagerAddress == address(0)) revert InvalidAddress(); s_feeManagerAddress = newFeeManagerAddress; diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol index 4f69823b69..ac3daf6f4c 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol @@ -2,11 +2,13 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; + +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + +import {Common} from "../libraries/Common.sol"; import {IVerifier} from "./interfaces/IVerifier.sol"; import {IVerifierProxy} from "./interfaces/IVerifierProxy.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {Common} from "../libraries/Common.sol"; // OCR2 standard uint256 constant MAX_NUM_ORACLES = 31; @@ -176,7 +178,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { mapping(bytes32 => VerifierState) internal s_feedVerifierStates; /// @param verifierProxyAddr The address of the VerifierProxy contract - constructor(address verifierProxyAddr) ConfirmedOwner(msg.sender) { + constructor( + address verifierProxyAddr + ) ConfirmedOwner(msg.sender) { if (verifierProxyAddr == address(0)) revert ZeroAddress(); i_verifierProxyAddr = verifierProxyAddr; } @@ -189,7 +193,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool isVerifier) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool isVerifier) { return interfaceId == this.verify.selector; } @@ -204,13 +210,8 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { address sender ) external override returns (bytes memory verifierResponse) { if (msg.sender != i_verifierProxyAddr) revert AccessForbidden(); - ( - bytes32[3] memory reportContext, - bytes memory reportData, - bytes32[] memory rs, - bytes32[] memory ss, - bytes32 rawVs - ) = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); + (bytes32[3] memory reportContext, bytes memory reportData, bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) + = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); // The feed ID is the first 32 bytes of the report data. bytes32 feedId = bytes32(reportData); @@ -417,19 +418,15 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { // Here the contract checks to see if a signer's address has already // been set to ensure that the group of signer addresses that will // sign reports with the config digest are unique. - bool isSignerAlreadySet = feedVerifierState.s_verificationDataConfigs[configDigest].oracles[signerAddr].role != - Role.Unset; + bool isSignerAlreadySet = + feedVerifierState.s_verificationDataConfigs[configDigest].oracles[signerAddr].role != Role.Unset; if (isSignerAlreadySet) revert NonUniqueSignatures(); - feedVerifierState.s_verificationDataConfigs[configDigest].oracles[signerAddr] = Signer({ - role: Role.Signer, - index: i - }); + feedVerifierState.s_verificationDataConfigs[configDigest].oracles[signerAddr] = + Signer({role: Role.Signer, index: i}); } IVerifierProxy(i_verifierProxyAddr).setVerifier( - feedVerifierState.latestConfigDigest, - configDigest, - recipientAddressesAndWeights + feedVerifierState.latestConfigDigest, configDigest, recipientAddressesAndWeights ); emit ConfigSet( @@ -520,7 +517,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifier - function activateFeed(bytes32 feedId) external onlyOwner { + function activateFeed( + bytes32 feedId + ) external onlyOwner { VerifierState storage feedVerifierState = s_feedVerifierStates[feedId]; if (feedVerifierState.configCount == 0) revert InvalidFeed(feedId); @@ -529,7 +528,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifier - function deactivateFeed(bytes32 feedId) external onlyOwner { + function deactivateFeed( + bytes32 feedId + ) external onlyOwner { VerifierState storage feedVerifierState = s_feedVerifierStates[feedId]; if (feedVerifierState.configCount == 0) revert InvalidFeed(feedId); @@ -550,10 +551,7 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { bytes32 feedId ) external view override returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest) { VerifierState storage feedVerifierState = s_feedVerifierStates[feedId]; - return ( - feedVerifierState.configCount, - feedVerifierState.latestConfigBlockNumber, - feedVerifierState.latestConfigDigest - ); + return + (feedVerifierState.configCount, feedVerifierState.latestConfigBlockNumber, feedVerifierState.latestConfigDigest); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/VerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/VerifierProxy.sol index ca2740943b..8dca31caf5 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/VerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/VerifierProxy.sol @@ -2,13 +2,15 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IVerifierProxy} from "./interfaces/IVerifierProxy.sol"; -import {IVerifier} from "./interfaces/IVerifier.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + import {AccessControllerInterface} from "../../shared/interfaces/AccessControllerInterface.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + import {Common} from "../libraries/Common.sol"; +import {IVerifier} from "./interfaces/IVerifier.sol"; +import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {IVerifierProxy} from "./interfaces/IVerifierProxy.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; /** * The verifier proxy contract is the gateway for all report verification requests @@ -88,7 +90,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { /// @notice The contract to control fees for report verification IVerifierFeeManager public s_feeManager; - constructor(AccessControllerInterface accessController) ConfirmedOwner(msg.sender) { + constructor( + AccessControllerInterface accessController + ) ConfirmedOwner(msg.sender) { s_accessController = accessController; } @@ -103,13 +107,17 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { _; } - modifier onlyValidVerifier(address verifierAddress) { + modifier onlyValidVerifier( + address verifierAddress + ) { if (verifierAddress == address(0)) revert ZeroAddress(); if (!IERC165(verifierAddress).supportsInterface(IVerifier.verify.selector)) revert VerifierInvalid(); _; } - modifier onlyUnsetConfigDigest(bytes32 configDigest) { + modifier onlyUnsetConfigDigest( + bytes32 configDigest + ) { address configDigestVerifier = s_verifiersByConfig[configDigest]; if (configDigestVerifier != address(0)) revert ConfigDigestAlreadySet(configDigest, configDigestVerifier); _; @@ -156,7 +164,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { return verifiedReports; } - function _verify(bytes calldata payload) internal returns (bytes memory verifiedReport) { + function _verify( + bytes calldata payload + ) internal returns (bytes memory verifiedReport) { // First 32 bytes of the signed report is the config digest bytes32 configDigest = bytes32(payload); address verifierAddress = s_verifiersByConfig[configDigest]; @@ -166,7 +176,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifierProxy - function initializeVerifier(address verifierAddress) external override onlyOwner onlyValidVerifier(verifierAddress) { + function initializeVerifier( + address verifierAddress + ) external override onlyOwner onlyValidVerifier(verifierAddress) { if (s_initializedVerifiers[verifierAddress]) revert VerifierAlreadyInitialized(verifierAddress); s_initializedVerifiers[verifierAddress] = true; @@ -194,7 +206,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifierProxy - function unsetVerifier(bytes32 configDigest) external override onlyOwner { + function unsetVerifier( + bytes32 configDigest + ) external override onlyOwner { address verifierAddress = s_verifiersByConfig[configDigest]; if (verifierAddress == address(0)) revert VerifierNotFound(configDigest); delete s_verifiersByConfig[configDigest]; @@ -202,24 +216,30 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifierProxy - function getVerifier(bytes32 configDigest) external view override returns (address) { + function getVerifier( + bytes32 configDigest + ) external view override returns (address) { return s_verifiersByConfig[configDigest]; } /// @inheritdoc IVerifierProxy - function setAccessController(AccessControllerInterface accessController) external onlyOwner { + function setAccessController( + AccessControllerInterface accessController + ) external onlyOwner { address oldAccessController = address(s_accessController); s_accessController = accessController; emit AccessControllerSet(oldAccessController, address(accessController)); } /// @inheritdoc IVerifierProxy - function setFeeManager(IVerifierFeeManager feeManager) external onlyOwner { + function setFeeManager( + IVerifierFeeManager feeManager + ) external onlyOwner { if (address(feeManager) == address(0)) revert ZeroAddress(); if ( - !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFee.selector) || - !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFeeBulk.selector) + !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFee.selector) + || !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFeeBulk.selector) ) revert FeeManagerInvalid(); address oldFeeManager = address(s_feeManager); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol index 9669e7aa3b..5029221206 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; import {IVerifierFeeManager} from "./IVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IFeeManager is IERC165, IVerifierFeeManager { /** @@ -23,7 +23,9 @@ interface IFeeManager is IERC165, IVerifierFeeManager { * @notice Sets the native surcharge * @param surcharge surcharge to be paid if paying in native */ - function setNativeSurcharge(uint64 surcharge) external; + function setNativeSurcharge( + uint64 surcharge + ) external; /** * @notice Adds a subscriber to the fee manager @@ -52,14 +54,16 @@ interface IFeeManager is IERC165, IVerifierFeeManager { * @notice Admin function to pay the LINK deficit for a given config digest * @param configDigest the config digest to pay the deficit for */ - function payLinkDeficit(bytes32 configDigest) external; + function payLinkDeficit( + bytes32 configDigest + ) external; /** * @notice The structure to hold a fee and reward to verify a report * @param digest the digest linked to the fee and reward * @param fee the fee paid to verify the report * @param reward the reward paid upon verification - & @param appliedDiscount the discount applied to the reward + * & @param appliedDiscount the discount applied to the reward */ struct FeeAndReward { bytes32 configDigest; diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol index 55075384ed..644cde5b5e 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IRewardManager is IERC165 { /** @@ -16,7 +16,9 @@ interface IRewardManager is IERC165 { * @notice Claims the rewards in a specific pool * @param poolIds array of poolIds to claim rewards for */ - function claimRewards(bytes32[] calldata poolIds) external; + function claimRewards( + bytes32[] calldata poolIds + ) external; /** * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else updateRewardRecipients should be used. @@ -43,7 +45,9 @@ interface IRewardManager is IERC165 { * @notice Sets the fee manager. This needs to be done post construction to prevent a circular dependency. * @param newFeeManager address of the new verifier proxy */ - function setFeeManager(address newFeeManager) external; + function setFeeManager( + address newFeeManager + ) external; /** * @notice Gets a list of pool ids which have reward for a specific recipient. diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifier.sol index 5e7db4800b..726a4c56b6 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifier.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IVerifier is IERC165 { /** @@ -89,14 +89,18 @@ interface IVerifier is IERC165 { * @param feedId Feed ID to activated * @dev This function can be called by the contract admin to activate a feed */ - function activateFeed(bytes32 feedId) external; + function activateFeed( + bytes32 feedId + ) external; /** * @notice Deactivates the given feed * @param feedId Feed ID to deactivated * @dev This function can be called by the contract admin to deactivate a feed */ - function deactivateFeed(bytes32 feedId) external; + function deactivateFeed( + bytes32 feedId + ) external; /** * @notice returns the latest config digest and epoch for a feed diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierFeeManager.sol index c63bc22e17..5f2b0c68fd 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierFeeManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IVerifierFeeManager is IERC165 { /** diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierProxy.sol index 684d637407..0843e5d990 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IVerifierProxy.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {Common} from "../../libraries/Common.sol"; import {AccessControllerInterface} from "../../../shared/interfaces/AccessControllerInterface.sol"; +import {Common} from "../../libraries/Common.sol"; import {IVerifierFeeManager} from "./IVerifierFeeManager.sol"; interface IVerifierProxy { @@ -36,7 +36,9 @@ interface IVerifierProxy { * @notice Sets the verifier address initially, allowing `setVerifier` to be set by this Verifier in the future * @param verifierAddress The address of the verifier contract to initialize */ - function initializeVerifier(address verifierAddress) external; + function initializeVerifier( + address verifierAddress + ) external; /** * @notice Sets a new verifier for a config digest @@ -55,7 +57,9 @@ interface IVerifierProxy { * @notice Removes a verifier for a given config digest * @param configDigest The config digest of the verifier to remove */ - function unsetVerifier(bytes32 configDigest) external; + function unsetVerifier( + bytes32 configDigest + ) external; /** * @notice Retrieves the verifier address that verifies reports @@ -64,17 +68,23 @@ interface IVerifierProxy { * @return verifierAddress The address of the verifier contract that verifies * reports for a given config digest. */ - function getVerifier(bytes32 configDigest) external view returns (address verifierAddress); + function getVerifier( + bytes32 configDigest + ) external view returns (address verifierAddress); /** * @notice Called by the admin to set an access controller contract * @param accessController The new access controller to set */ - function setAccessController(AccessControllerInterface accessController) external; + function setAccessController( + AccessControllerInterface accessController + ) external; /** * @notice Updates the fee manager * @param feeManager The new fee manager */ - function setFeeManager(IVerifierFeeManager feeManager) external; + function setFeeManager( + IVerifierFeeManager feeManager + ) external; } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol index 65313cbd9f..3a8bce89c7 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {FeeManager} from "../../FeeManager.sol"; -import {RewardManager} from "../../RewardManager.sol"; -import {Common} from "../../../libraries/Common.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; import {WERC20Mock} from "../../../../shared/mocks/WERC20Mock.sol"; +import {Common} from "../../../libraries/Common.sol"; +import {FeeManager} from "../../FeeManager.sol"; +import {RewardManager} from "../../RewardManager.sol"; + import {IRewardManager} from "../../interfaces/IRewardManager.sol"; import {FeeManagerProxy} from "../mocks/FeeManagerProxy.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title BaseFeeManagerTest @@ -155,55 +156,59 @@ contract BaseFeeManagerTest is Test { // solium-disable-next-line no-unused-vars function getFee(bytes memory report, address quote, address subscriber) public view returns (Common.Asset memory) { //get the fee - (Common.Asset memory fee, , ) = feeManager.getFeeAndReward(subscriber, report, quote); + (Common.Asset memory fee,,) = feeManager.getFeeAndReward(subscriber, report, quote); return fee; } function getReward(bytes memory report, address quote, address subscriber) public view returns (Common.Asset memory) { //get the reward - (, Common.Asset memory reward, ) = feeManager.getFeeAndReward(subscriber, report, quote); + (, Common.Asset memory reward,) = feeManager.getFeeAndReward(subscriber, report, quote); return reward; } function getAppliedDiscount(bytes memory report, address quote, address subscriber) public view returns (uint256) { //get the reward - (, , uint256 appliedDiscount) = feeManager.getFeeAndReward(subscriber, report, quote); + (,, uint256 appliedDiscount) = feeManager.getFeeAndReward(subscriber, report, quote); return appliedDiscount; } - function getV1Report(bytes32 feedId) public pure returns (bytes memory) { + function getV1Report( + bytes32 feedId + ) public pure returns (bytes memory) { return abi.encode(feedId, uint32(0), int192(0), int192(0), int192(0), uint64(0), bytes32(0), uint64(0), uint64(0)); } - function getV2Report(bytes32 feedId) public view returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(DEFAULT_REPORT_NATIVE_FEE), - uint192(DEFAULT_REPORT_LINK_FEE), - uint32(block.timestamp), - int192(0) - ); + function getV2Report( + bytes32 feedId + ) public view returns (bytes memory) { + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(DEFAULT_REPORT_NATIVE_FEE), + uint192(DEFAULT_REPORT_LINK_FEE), + uint32(block.timestamp), + int192(0) + ); } - function getV3Report(bytes32 feedId) public view returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(DEFAULT_REPORT_NATIVE_FEE), - uint192(DEFAULT_REPORT_LINK_FEE), - uint32(block.timestamp), - int192(0), - int192(0), - int192(0) - ); + function getV3Report( + bytes32 feedId + ) public view returns (bytes memory) { + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(DEFAULT_REPORT_NATIVE_FEE), + uint192(DEFAULT_REPORT_LINK_FEE), + uint32(block.timestamp), + int192(0), + int192(0), + int192(0) + ); } function getV3ReportWithCustomExpiryAndFee( @@ -212,18 +217,17 @@ contract BaseFeeManagerTest is Test { uint256 linkFee, uint256 nativeFee ) public pure returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(nativeFee), - uint192(linkFee), - uint32(expiry), - int192(0), - int192(0), - int192(0) - ); + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(nativeFee), + uint192(linkFee), + uint32(expiry), + int192(0), + int192(0), + int192(0) + ); } function getLinkQuote() public view returns (address) { @@ -246,15 +250,21 @@ contract BaseFeeManagerTest is Test { changePrank(originalAddr); } - function getLinkBalance(address balanceAddress) public view returns (uint256) { + function getLinkBalance( + address balanceAddress + ) public view returns (uint256) { return link.balanceOf(balanceAddress); } - function getNativeBalance(address balanceAddress) public view returns (uint256) { + function getNativeBalance( + address balanceAddress + ) public view returns (uint256) { return native.balanceOf(balanceAddress); } - function getNativeUnwrappedBalance(address balanceAddress) public view returns (uint256) { + function getNativeUnwrappedBalance( + address balanceAddress + ) public view returns (uint256) { return balanceAddress.balance; } @@ -333,7 +343,9 @@ contract BaseFeeManagerTest is Test { changePrank(originalAddr); } - function getPayload(bytes memory reportPayload) public pure returns (bytes memory) { + function getPayload( + bytes memory reportPayload + ) public pure returns (bytes memory) { return abi.encode([DEFAULT_CONFIG_DIGEST, 0, 0], reportPayload, new bytes32[](1), new bytes32[](1), bytes32("")); } @@ -373,7 +385,9 @@ contract BaseFeeManagerTest is Test { changePrank(originalAddr); } - function getLinkDeficit(bytes32 configDigest) public view returns (uint256) { + function getLinkDeficit( + bytes32 configDigest + ) public view returns (uint256) { return feeManager.s_linkDeficit(configDigest); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol index 1b0f95d51b..f9f876cb2f 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol @@ -421,9 +421,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { //get the fee required by the feeManager Common.Asset memory fee = getFee( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), - getNativeQuote(), - USER + getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), getNativeQuote(), USER ); //fee should be zero @@ -439,9 +437,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { //get the fee required by the feeManager Common.Asset memory fee = getFee( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), - getNativeQuote(), - USER + getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), getNativeQuote(), USER ); //fee should be zero @@ -558,10 +554,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { //get the fee required by the feeManager getFee( getV3ReportWithCustomExpiryAndFee( - DEFAULT_FEED_1_V3, - block.timestamp - 1, - DEFAULT_REPORT_LINK_FEE, - DEFAULT_REPORT_NATIVE_FEE + DEFAULT_FEED_1_V3, block.timestamp - 1, DEFAULT_REPORT_LINK_FEE, DEFAULT_REPORT_NATIVE_FEE ), getNativeQuote(), USER diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol index 0e0ed8977b..3f1b797fff 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol @@ -2,8 +2,9 @@ pragma solidity 0.8.19; import {Common} from "../../../libraries/Common.sol"; -import "./BaseFeeManager.t.sol"; + import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import "./BaseFeeManager.t.sol"; /** * @title BaseFeeManagerTest @@ -79,11 +80,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_processFeeWithWithCorruptQuotePayload() public { //get the default payload bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV3Report(DEFAULT_FEED_1_V3), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV3Report(DEFAULT_FEED_1_V3), new bytes32[](1), new bytes32[](1), bytes32("") ); //expect an evm revert as the quote is corrupt @@ -291,11 +288,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_V1PayloadVerifies() public { //replicate a default payload bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV2Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV2Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); //processing the fee will transfer the link from the user to the rewardManager @@ -356,9 +349,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkWithNativeQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0)); //call processFee should not revert as the fee is 0 processFee(payload, PROXY, address(native), 0); @@ -366,9 +358,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkWithLinkQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0)); //approve the link to be transferred from the from the subscriber to the rewardManager approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, USER); @@ -388,9 +379,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { mintLink(address(feeManager), DEFAULT_REPORT_LINK_FEE); //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //approve the native to be transferred from the user approveNative(address(feeManager), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -413,9 +403,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_processFeeWithZeroLinkNonZeroNativeWithLinkQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //call processFee should not revert as the fee is 0 processFee(payload, USER, address(link), 0); @@ -423,9 +412,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkReturnsChange() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //call processFee should not revert as the fee is 0 processFee(payload, USER, address(link), DEFAULT_REPORT_NATIVE_FEE); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol index fa77b98d3c..1c6a4f9b0d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import "./BaseFeeManager.t.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import "./BaseFeeManager.t.sol"; /** * @title BaseFeeManagerTest @@ -81,11 +81,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { mintLink(address(feeManager), 1); bytes memory payloadV1 = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes memory linkPayloadV2 = getPayload(getV2Report(DEFAULT_FEED_1_V2)); @@ -114,11 +110,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { mintLink(address(feeManager), DEFAULT_REPORT_LINK_FEE * 4 + 1); bytes memory payloadV1 = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes memory nativePayloadV2 = getPayload(getV2Report(DEFAULT_FEED_1_V2)); @@ -143,11 +135,7 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { function test_processMultipleV1Reports() public { bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes[] memory payloads = new bytes[](NUMBER_OF_REPORTS); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol index ee8ba4c3e3..72de313d24 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "../verifier/BaseVerifierTest.t.sol"; import {SimpleWriteAccessController} from "../../../../shared/access/SimpleWriteAccessController.sol"; import {Common} from "../../../libraries/Common.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "../verifier/BaseVerifierTest.t.sol"; contract Verifier_setConfig is BaseTest { address[] internal s_signerAddrs; @@ -44,7 +44,7 @@ contract Verifier_verifyWithFee is BaseTestWithConfiguredVerifierAndFeeManager { //warm the rewardManager link.mint(address(this), DEFAULT_NATIVE_MINT_QUANTITY); _approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, address(this)); - (, , bytes32 latestConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 latestConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); //mint some tokens to the user link.mint(USER, DEFAULT_LINK_MINT_QUANTITY); @@ -69,9 +69,7 @@ contract Verifier_verifyWithFee is BaseTestWithConfiguredVerifierAndFeeManager { function testVerifyProxyWithLinkFeeSuccess_gas() public { bytes memory signedLinkPayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); s_verifierProxy.verify(signedLinkPayload, abi.encode(link)); @@ -79,9 +77,7 @@ contract Verifier_verifyWithFee is BaseTestWithConfiguredVerifierAndFeeManager { function testVerifyProxyWithNativeFeeSuccess_gas() public { bytes memory signedNativePayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); s_verifierProxy.verify(signedNativePayload, abi.encode(native)); @@ -103,7 +99,7 @@ contract Verifier_bulkVerifyWithFee is BaseTestWithConfiguredVerifierAndFeeManag //warm the rewardManager link.mint(address(this), DEFAULT_NATIVE_MINT_QUANTITY); _approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, address(this)); - (, , bytes32 latestConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 latestConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); //mint some tokens to the user link.mint(USER, DEFAULT_LINK_MINT_QUANTITY); @@ -128,9 +124,7 @@ contract Verifier_bulkVerifyWithFee is BaseTestWithConfiguredVerifierAndFeeManag function testBulkVerifyProxyWithLinkFeeSuccess_gas() public { bytes memory signedLinkPayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedLinkPayloads = new bytes[](NUMBER_OF_REPORTS_TO_VERIFY); @@ -143,9 +137,7 @@ contract Verifier_bulkVerifyWithFee is BaseTestWithConfiguredVerifierAndFeeManag function testBulkVerifyProxyWithNativeFeeSuccess_gas() public { bytes memory signedNativePayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedNativePayloads = new bytes[](NUMBER_OF_REPORTS_TO_VERIFY); @@ -174,7 +166,7 @@ contract Verifier_verify is BaseTestWithConfiguredVerifierAndFeeManager { BLOCKNUMBER_LOWER_BOUND, uint32(block.timestamp) ); - (, , s_configDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_configDigest) = s_verifier.latestConfigDetails(FEED_ID); bytes32[3] memory reportContext; reportContext[0] = s_configDigest; reportContext[1] = bytes32(abi.encode(uint32(5), uint8(1))); @@ -213,7 +205,7 @@ contract Verifier_accessControlledVerify is BaseTestWithConfiguredVerifierAndFee BLOCKNUMBER_LOWER_BOUND, uint32(block.timestamp) ); - (, , s_configDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_configDigest) = s_verifier.latestConfigDetails(FEED_ID); bytes32[3] memory reportContext; reportContext[0] = s_configDigest; reportContext[1] = bytes32(abi.encode(uint32(5), uint8(1))); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ErroredVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ErroredVerifier.sol index e9dcd589e2..a239ff6110 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ErroredVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ErroredVerifier.sol @@ -1,11 +1,13 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {IVerifier} from "../../interfaces/IVerifier.sol"; import {Common} from "../../../libraries/Common.sol"; +import {IVerifier} from "../../interfaces/IVerifier.sol"; contract ErroredVerifier is IVerifier { - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == this.verify.selector; } @@ -77,19 +79,27 @@ contract ErroredVerifier is IVerifier { revert FailedToDeactivateConfig(); } - function activateFeed(bytes32) external pure { + function activateFeed( + bytes32 + ) external pure { revert FailedToActivateFeed(); } - function deactivateFeed(bytes32) external pure { + function deactivateFeed( + bytes32 + ) external pure { revert FailedToDeactivateFeed(); } - function latestConfigDigestAndEpoch(bytes32) external pure override returns (bool, bytes32, uint32) { + function latestConfigDigestAndEpoch( + bytes32 + ) external pure override returns (bool, bytes32, uint32) { revert FailedToGetLatestConfigDigestAndEpoch(); } - function latestConfigDetails(bytes32) external pure override returns (uint32, uint32, bytes32) { + function latestConfigDetails( + bytes32 + ) external pure override returns (uint32, uint32, bytes32) { revert FailedToGetLatestConfigDetails(); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ExposedVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ExposedVerifier.sol index 1c004bf384..6eb6bb3d94 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ExposedVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/ExposedVerifier.sol @@ -52,18 +52,17 @@ contract ExposedVerifier { uint64 _encodedConfigVersion, bytes memory _encodedConfig ) public pure returns (bytes32) { - return - _configDigestFromConfigData( - _feedId, - _chainId, - _contractAddress, - _configCount, - _signers, - _offchainTransmitters, - _f, - _onchainConfig, - _encodedConfigVersion, - _encodedConfig - ); + return _configDigestFromConfigData( + _feedId, + _chainId, + _contractAddress, + _configCount, + _signers, + _offchainTransmitters, + _f, + _onchainConfig, + _encodedConfigVersion, + _encodedConfig + ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/FeeManagerProxy.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/FeeManagerProxy.sol index 9abb4c50c2..a00631fdab 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/FeeManagerProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/mocks/FeeManagerProxy.sol @@ -14,7 +14,9 @@ contract FeeManagerProxy { s_feeManager.processFeeBulk{value: msg.value}(payloads, parameterPayload, msg.sender); } - function setFeeManager(IFeeManager feeManager) public { + function setFeeManager( + IFeeManager feeManager + ) public { s_feeManager = feeManager; } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol index 5ae22bc091..a750c2c802 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; -import {RewardManager} from "../../../v0.3.0/RewardManager.sol"; + import {Common} from "../../../libraries/Common.sol"; +import {RewardManager} from "../../../v0.3.0/RewardManager.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title BaseRewardManagerTest @@ -192,11 +193,15 @@ contract BaseRewardManagerTest is Test { changePrank(originalAddr); } - function getAsset(uint256 quantity) public view returns (Common.Asset memory) { + function getAsset( + uint256 quantity + ) public view returns (Common.Asset memory) { return Common.Asset(address(asset), quantity); } - function getAssetBalance(address addr) public view returns (uint256) { + function getAssetBalance( + address addr + ) public view returns (uint256) { return asset.balanceOf(addr); } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol index efbe9fd6b3..1774be972b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest @@ -550,11 +550,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { function test_getRewardsAvailableToRecipientInBothPools() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[0].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[0].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); @@ -563,11 +560,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { function test_getRewardsAvailableToRecipientInSinglePool() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[1].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[1].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); @@ -585,11 +579,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { function test_getRewardsAvailableToRecipientInBothPoolsWhereAlreadyClaimed() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[0].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[0].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.general.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.general.t.sol index daa9bbcae4..29462bb6f8 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.general.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.general.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; -import {RewardManager} from "../../../v0.3.0/RewardManager.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; +import {RewardManager} from "../../../v0.3.0/RewardManager.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.payRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.payRecipients.t.sol index 89fac663ba..644dd8a9a2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.payRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.payRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest @@ -141,10 +141,7 @@ contract RewardManagerPayRecipientsTest is BaseRewardManagerTest { } //check the pool has the remaining balance - assertEq( - getAssetBalance(address(rewardManager)), - POOL_DEPOSIT_AMOUNT - expectedRecipientAmount * recipients.length - ); + assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT - expectedRecipientAmount * recipients.length); } function test_payAllRecipientsFromNonAdminUser() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.setRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.setRecipients.t.sol index d3e6990bd9..5b675db04b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.setRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.setRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol index 0d3a2b69b3..4e47d96d34 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest @@ -294,12 +294,10 @@ contract RewardManagerUpdateRewardRecipientsTest is BaseRewardManagerTest { //manually check the balance of each recipient assertEq( - getAssetBalance(DEFAULT_RECIPIENT_1), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_1), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(DEFAULT_RECIPIENT_2), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_2), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( getAssetBalance(DEFAULT_RECIPIENT_3), @@ -343,8 +341,7 @@ contract RewardManagerUpdateRewardRecipientsTest is BaseRewardManagerTest { //manually check the balance of each recipient assertEq( - getAssetBalance(DEFAULT_RECIPIENT_1), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_1), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( getAssetBalance(DEFAULT_RECIPIENT_2), @@ -439,12 +436,10 @@ contract RewardManagerUpdateRewardRecipientsMultiplePoolsTest is BaseRewardManag (POOL_DEPOSIT_AMOUNT * TEN_PERCENT * 4) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(recipients[2].addr), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(recipients[2].addr), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(recipients[3].addr), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(recipients[3].addr), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol index 986205e99d..db40e64f0b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol @@ -1,19 +1,22 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {VerifierProxy} from "../../VerifierProxy.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {IVerifier} from "../../interfaces/IVerifier.sol"; -import {ErroredVerifier} from "../mocks/ErroredVerifier.sol"; -import {Verifier} from "../../Verifier.sol"; -import {Strings} from "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; -import {FeeManager} from "../../FeeManager.sol"; -import {Common} from "../../../libraries/Common.sol"; + import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; import {WERC20Mock} from "../../../../shared/mocks/WERC20Mock.sol"; +import {Common} from "../../../libraries/Common.sol"; +import {FeeManager} from "../../FeeManager.sol"; + import {RewardManager} from "../../RewardManager.sol"; +import {Verifier} from "../../Verifier.sol"; +import {VerifierProxy} from "../../VerifierProxy.sol"; +import {IVerifier} from "../../interfaces/IVerifier.sol"; +import {ErroredVerifier} from "../mocks/ErroredVerifier.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + +import {Strings} from "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; +import {Test} from "forge-std/Test.sol"; contract BaseTest is Test { uint256 internal constant MAX_ORACLES = 31; @@ -111,7 +114,9 @@ contract BaseTest is Test { } } - function _getSigners(uint256 numSigners) internal view returns (Signer[] memory) { + function _getSigners( + uint256 numSigners + ) internal view returns (Signer[] memory) { Signer[] memory signers = new Signer[](numSigners); for (uint256 i; i < numSigners; i++) { signers[i] = s_signers[i]; @@ -119,7 +124,9 @@ contract BaseTest is Test { return signers; } - function _getSignerAddresses(Signer[] memory signers) internal view returns (address[] memory) { + function _getSignerAddresses( + Signer[] memory signers + ) internal view returns (address[] memory) { address[] memory signerAddrs = new address[](signers.length); for (uint256 i = 0; i < signerAddrs.length; i++) { signerAddrs[i] = s_signers[i].signerAddress; @@ -147,19 +154,20 @@ contract BaseTest is Test { return (rs, ss, bytes32(vs)); } - function _encodeReport(V1Report memory report) internal pure returns (bytes memory) { - return - abi.encode( - report.feedId, - report.observationsTimestamp, - report.median, - report.bid, - report.ask, - report.blocknumberUpperBound, - report.upperBlockhash, - report.blocknumberLowerBound, - report.currentBlockTimestamp - ); + function _encodeReport( + V1Report memory report + ) internal pure returns (bytes memory) { + return abi.encode( + report.feedId, + report.observationsTimestamp, + report.median, + report.bid, + report.ask, + report.blocknumberUpperBound, + report.upperBlockhash, + report.blocknumberLowerBound, + report.currentBlockTimestamp + ); } function _generateV1EncodedBlob( @@ -168,11 +176,8 @@ contract BaseTest is Test { Signer[] memory signers ) internal pure returns (bytes memory) { bytes memory reportBytes = _encodeReport(report); - (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = _generateSignerSignatures( - reportBytes, - reportContext, - signers - ); + (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = + _generateSignerSignatures(reportBytes, reportContext, signers); return abi.encode(reportContext, reportBytes, rs, ss, rawVs); } @@ -220,31 +225,29 @@ contract BaseTest is Test { uint64 blocknumberLowerBound, uint32 currentBlockTimestamp ) internal pure returns (V1Report memory) { - return - V1Report({ - feedId: feedId, - observationsTimestamp: observationsTimestamp, - median: median, - bid: bid, - ask: ask, - blocknumberUpperBound: blocknumberUpperBound, - upperBlockhash: upperBlockhash, - blocknumberLowerBound: blocknumberLowerBound, - currentBlockTimestamp: currentBlockTimestamp - }); + return V1Report({ + feedId: feedId, + observationsTimestamp: observationsTimestamp, + median: median, + bid: bid, + ask: ask, + blocknumberUpperBound: blocknumberUpperBound, + upperBlockhash: upperBlockhash, + blocknumberLowerBound: blocknumberLowerBound, + currentBlockTimestamp: currentBlockTimestamp + }); } function _ccipReadURL(bytes32 feedId, uint256 commitmentBlock) internal pure returns (string memory url) { - return - string( - abi.encodePacked( - SERVER_URL, - "?feedIDHex=", - Strings.toHexString(uint256(feedId)), - "&L2Blocknumber=", - Strings.toString(commitmentBlock) - ) - ); + return string( + abi.encodePacked( + SERVER_URL, + "?feedIDHex=", + Strings.toHexString(uint256(feedId)), + "&L2Blocknumber=", + Strings.toString(commitmentBlock) + ) + ); } } @@ -296,7 +299,7 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { bytes(""), new Common.AddressAndWeight[](0) ); - (, , v1ConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, v1ConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); s_verifier.setConfig( FEED_ID_V3, @@ -308,7 +311,7 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { bytes(""), new Common.AddressAndWeight[](0) ); - (, , v3ConfigDigest) = s_verifier.latestConfigDetails(FEED_ID_V3); + (,, v3ConfigDigest) = s_verifier.latestConfigDetails(FEED_ID_V3); link = new ERC20Mock(18); native = new WERC20Mock(); @@ -320,19 +323,20 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { rewardManager.setFeeManager(address(feeManager)); } - function _encodeReport(V3Report memory report) internal pure returns (bytes memory) { - return - abi.encode( - report.feedId, - report.observationsTimestamp, - report.validFromTimestamp, - report.nativeFee, - report.linkFee, - report.expiresAt, - report.benchmarkPrice, - report.bid, - report.ask - ); + function _encodeReport( + V3Report memory report + ) internal pure returns (bytes memory) { + return abi.encode( + report.feedId, + report.observationsTimestamp, + report.validFromTimestamp, + report.nativeFee, + report.linkFee, + report.expiresAt, + report.benchmarkPrice, + report.bid, + report.ask + ); } function _generateV3EncodedBlob( @@ -341,45 +345,42 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { Signer[] memory signers ) internal pure returns (bytes memory) { bytes memory reportBytes = _encodeReport(report); - (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = _generateSignerSignatures( - reportBytes, - reportContext, - signers - ); + (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = + _generateSignerSignatures(reportBytes, reportContext, signers); return abi.encode(reportContext, reportBytes, rs, ss, rawVs); } function _generateV1Report() internal view returns (V1Report memory) { - return - _createV1Report( - FEED_ID, - OBSERVATIONS_TIMESTAMP, - MEDIAN, - BID, - ASK, - BLOCKNUMBER_UPPER_BOUND, - bytes32(blockhash(BLOCKNUMBER_UPPER_BOUND)), - BLOCKNUMBER_LOWER_BOUND, - uint32(block.timestamp) - ); + return _createV1Report( + FEED_ID, + OBSERVATIONS_TIMESTAMP, + MEDIAN, + BID, + ASK, + BLOCKNUMBER_UPPER_BOUND, + bytes32(blockhash(BLOCKNUMBER_UPPER_BOUND)), + BLOCKNUMBER_LOWER_BOUND, + uint32(block.timestamp) + ); } function _generateV3Report() internal view returns (V3Report memory) { - return - V3Report({ - feedId: FEED_ID_V3, - observationsTimestamp: OBSERVATIONS_TIMESTAMP, - validFromTimestamp: uint32(block.timestamp), - nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), - linkFee: uint192(DEFAULT_REPORT_LINK_FEE), - expiresAt: uint32(block.timestamp), - benchmarkPrice: MEDIAN, - bid: BID, - ask: ASK - }); + return V3Report({ + feedId: FEED_ID_V3, + observationsTimestamp: OBSERVATIONS_TIMESTAMP, + validFromTimestamp: uint32(block.timestamp), + nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), + linkFee: uint192(DEFAULT_REPORT_LINK_FEE), + expiresAt: uint32(block.timestamp), + benchmarkPrice: MEDIAN, + bid: BID, + ask: ASK + }); } - function _generateReportContext(bytes32 configDigest) internal pure returns (bytes32[3] memory) { + function _generateReportContext( + bytes32 configDigest + ) internal pure returns (bytes32[3] memory) { bytes32[3] memory reportContext; reportContext[0] = configDigest; reportContext[1] = bytes32(abi.encode(uint32(5), uint8(1))); @@ -411,12 +412,7 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { changePrank(originalAddr); } - function _verifyBulk( - bytes[] memory payload, - address feeAddress, - uint256 wrappedNativeValue, - address sender - ) internal { + function _verifyBulk(bytes[] memory payload, address feeAddress, uint256 wrappedNativeValue, address sender) internal { address originalAddr = msg.sender; changePrank(sender); @@ -442,7 +438,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier BaseTestWithConfiguredVerifierAndFeeManager.setUp(); Signer[] memory signers = _getSigners(MAX_ORACLES); - (, , s_configDigestOne) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_configDigestOne) = s_verifier.latestConfigDetails(FEED_ID); // Verifier 1, Feed 1, Config 2 Signer[] memory secondSetOfSigners = _getSigners(8); @@ -456,7 +452,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes(""), new Common.AddressAndWeight[](0) ); - (, , s_configDigestTwo) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_configDigestTwo) = s_verifier.latestConfigDetails(FEED_ID); // Verifier 1, Feed 1, Config 3 Signer[] memory thirdSetOfSigners = _getSigners(5); @@ -470,7 +466,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes(""), new Common.AddressAndWeight[](0) ); - (s_numConfigsSet, , s_configDigestThree) = s_verifier.latestConfigDetails(FEED_ID); + (s_numConfigsSet,, s_configDigestThree) = s_verifier.latestConfigDetails(FEED_ID); // Verifier 1, Feed 2, Config 1 s_verifier.setConfig( @@ -483,7 +479,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes(""), new Common.AddressAndWeight[](0) ); - (, , s_configDigestFour) = s_verifier.latestConfigDetails(FEED_ID_2); + (,, s_configDigestFour) = s_verifier.latestConfigDetails(FEED_ID_2); // Verifier 2, Feed 3, Config 1 s_verifierProxy.initializeVerifier(address(s_verifier_2)); @@ -497,6 +493,6 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes(""), new Common.AddressAndWeight[](0) ); - (, , s_configDigestFive) = s_verifier_2.latestConfigDetails(FEED_ID_3); + (,, s_configDigestFive) = s_verifier_2.latestConfigDetails(FEED_ID_3); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierActivateConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierActivateConfigTest.t.sol index 99daabe206..cdee03456e 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierActivateConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierActivateConfigTest.t.sol @@ -1,8 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../../v0.3.0/Verifier.sol"; +import { + BaseTestWithConfiguredVerifierAndFeeManager, BaseTestWithMultipleConfiguredDigests +} from "./BaseVerifierTest.t.sol"; contract VerifierActivateConfigTest is BaseTestWithConfiguredVerifierAndFeeManager { function test_revertsIfNotOwner() public { @@ -53,11 +55,8 @@ contract VerifierActivateConfigWithDeactivatedConfigTest is BaseTestWithMultiple s_verifier.activateConfig(FEED_ID, s_configDigestTwo); changePrank(address(s_verifierProxy)); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); s_verifier.verify(signedReport, msg.sender); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierDeactivateFeedTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierDeactivateFeedTest.t.sol index fb52c1c93e..9036dcc9d4 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierDeactivateFeedTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierDeactivateFeedTest.t.sol @@ -1,8 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../../v0.3.0/Verifier.sol"; +import { + BaseTestWithConfiguredVerifierAndFeeManager, BaseTestWithMultipleConfiguredDigests +} from "./BaseVerifierTest.t.sol"; contract VerifierActivateFeedTest is BaseTestWithConfiguredVerifierAndFeeManager { function test_revertsIfNotOwnerActivateFeed() public { @@ -58,11 +60,8 @@ contract VerifierDeactivateFeedWithVerifyTest is BaseTestWithMultipleConfiguredD s_verifier.activateFeed(FEED_ID); changePrank(address(s_verifierProxy)); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); s_verifier.verify(signedReport, msg.sender); } @@ -71,22 +70,16 @@ contract VerifierDeactivateFeedWithVerifyTest is BaseTestWithMultipleConfiguredD changePrank(address(s_verifierProxy)); s_reportContext[0] = s_configDigestTwo; - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); s_verifier.verify(signedReport, msg.sender); } function test_currentReportFailsVerification() public { changePrank(address(s_verifierProxy)); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(Verifier.InactiveFeed.selector, FEED_ID)); s_verifier.verify(signedReport, msg.sender); @@ -96,11 +89,8 @@ contract VerifierDeactivateFeedWithVerifyTest is BaseTestWithMultipleConfiguredD changePrank(address(s_verifierProxy)); s_reportContext[0] = s_configDigestTwo; - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); vm.expectRevert(abi.encodeWithSelector(Verifier.InactiveFeed.selector, FEED_ID)); s_verifier.verify(signedReport, msg.sender); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyConstructorTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyConstructorTest.t.sol index 82efd8907b..c168274f65 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyConstructorTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyConstructorTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; -import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; +import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierProxyConstructorTest is BaseTest { function test_correctlySetsTheOwner() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol index 5537d273be..18479b6872 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierProxyInitializeVerifierTest is BaseTest { bytes32 latestDigest; diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol index 03bd6d97ee..f06d54c991 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierProxySetAccessControllerTest is BaseTest { event AccessControllerSet(address oldAccessController, address newAccessController); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetVerifierTest.t.sol index 2412944f40..2cb5d78cdf 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxySetVerifierTest.t.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; -import {IVerifier} from "../../interfaces/IVerifier.sol"; +import {Common} from "../../../libraries/Common.sol"; import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; +import {IVerifier} from "../../interfaces/IVerifier.sol"; +import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; + import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {Common} from "../../../libraries/Common.sol"; contract VerifierProxyInitializeVerifierTest is BaseTestWithConfiguredVerifierAndFeeManager { function test_revertsIfNotCorrectVerifier() public { @@ -14,7 +15,7 @@ contract VerifierProxyInitializeVerifierTest is BaseTestWithConfiguredVerifierAn } function test_revertsIfDigestAlreadySet() public { - (, , bytes32 takenDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 takenDigest) = s_verifier.latestConfigDetails(FEED_ID); address maliciousVerifier = address(666); bytes32 maliciousDigest = bytes32("malicious-digest"); @@ -32,7 +33,7 @@ contract VerifierProxyInitializeVerifierTest is BaseTestWithConfiguredVerifierAn } function test_updatesVerifierIfVerifier() public { - (, , bytes32 prevDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 prevDigest) = s_verifier.latestConfigDetails(FEED_ID); changePrank(address(s_verifier)); s_verifierProxy.setVerifier(prevDigest, bytes32("new-config"), new Common.AddressAndWeight[](0)); assertEq(s_verifierProxy.getVerifier(bytes32("new-config")), address(s_verifier)); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyTest.t.sol index 441626e575..21b0a5c0d2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; -import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; import {FeeManager} from "../../../v0.3.0/FeeManager.sol"; +import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; +import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; contract VerifierProxyInitializeVerifierTest is BaseTestWithConfiguredVerifierAndFeeManager { function test_setFeeManagerZeroAddress() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol index a51c67e336..e4aef6beef 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; +import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; contract VerifierProxyUnsetVerifierTest is BaseTest { function test_revertsIfNotAdmin() public { @@ -25,7 +25,7 @@ contract VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest is BaseTestWith function setUp() public override { BaseTestWithConfiguredVerifierAndFeeManager.setUp(); - (, , s_configDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_configDigest) = s_verifier.latestConfigDetails(FEED_ID); } function test_correctlyUnsetsVerifier() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol index 9ee9b5272a..f850407727 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseTest, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; contract VerifierSetConfigFromSourceTest is BaseTest { function setUp() public virtual override { @@ -48,7 +48,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC new Common.AddressAndWeight[](0) ); - (, , bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID); address verifierAddr = s_verifierProxy.getVerifier(configDigest); assertEq(verifierAddr, address(s_verifier)); } @@ -70,7 +70,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC new Common.AddressAndWeight[](0) ); - (, , bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID_2); + (,, bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID_2); address verifierAddr = s_verifierProxy.getVerifier(configDigest); assertEq(verifierAddr, address(s_verifier)); @@ -88,7 +88,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC new Common.AddressAndWeight[](0) ); - (, , bytes32 configDigest2) = s_verifier_2.latestConfigDetails(FEED_ID_3); + (,, bytes32 configDigest2) = s_verifier_2.latestConfigDetails(FEED_ID_3); address verifierAddr2 = s_verifierProxy.getVerifier(configDigest2); assertEq(verifierAddr2, address(s_verifier_2)); } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigTest.t.sol index 972ead8123..3d4c7917b2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; -import {Verifier} from "../../../v0.3.0/Verifier.sol"; import {Common} from "../../../libraries/Common.sol"; +import {Verifier} from "../../../v0.3.0/Verifier.sol"; +import {BaseTest, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; contract VerifierSetConfigTest is BaseTest { function setUp() public virtual override { @@ -166,7 +166,7 @@ contract VerifierSetConfigWhenThereAreMultipleDigestsTest is BaseTestWithMultipl new Common.AddressAndWeight[](0) ); - (, , bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID); address verifierAddr = s_verifierProxy.getVerifier(configDigest); assertEq(verifierAddr, address(s_verifier)); } @@ -185,7 +185,7 @@ contract VerifierSetConfigWhenThereAreMultipleDigestsTest is BaseTestWithMultipl new Common.AddressAndWeight[](0) ); - (, , bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID_2); + (,, bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID_2); address verifierAddr = s_verifierProxy.getVerifier(configDigest); assertEq(verifierAddr, address(s_verifier)); @@ -200,7 +200,7 @@ contract VerifierSetConfigWhenThereAreMultipleDigestsTest is BaseTestWithMultipl new Common.AddressAndWeight[](0) ); - (, , bytes32 configDigest2) = s_verifier_2.latestConfigDetails(FEED_ID_3); + (,, bytes32 configDigest2) = s_verifier_2.latestConfigDetails(FEED_ID_3); address verifierAddr2 = s_verifierProxy.getVerifier(configDigest2); assertEq(verifierAddr2, address(s_verifier_2)); } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTest.t.sol index 81f65f0c6e..088a38e5a0 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../../v0.3.0/Verifier.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierConstructorTest is BaseTest { function test_revertsIfInitializedWithEmptyVerifierProxy() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTestBillingReport.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTestBillingReport.t.sol index ad67a239ba..a112cdc3d0 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTestBillingReport.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierTestBillingReport.t.sol @@ -23,9 +23,7 @@ contract VerifierTestWithConfiguredVerifierAndFeeManager is BaseTestWithConfigur contract VerifierTestBillingReport is VerifierTestWithConfiguredVerifierAndFeeManager { function test_verifyWithLink() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, USER); @@ -37,9 +35,7 @@ contract VerifierTestBillingReport is VerifierTestWithConfiguredVerifierAndFeeMa function test_verifyWithNative() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _approveNative(address(feeManager), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -52,9 +48,7 @@ contract VerifierTestBillingReport is VerifierTestWithConfiguredVerifierAndFeeMa function test_verifyWithNativeUnwrapped() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _verify(signedReport, address(native), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -65,9 +59,7 @@ contract VerifierTestBillingReport is VerifierTestWithConfiguredVerifierAndFeeMa function test_verifyWithNativeUnwrappedReturnsChange() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _verify(signedReport, address(native), DEFAULT_REPORT_NATIVE_FEE * 2, USER); @@ -82,9 +74,7 @@ contract VerifierBulkVerifyBillingReport is VerifierTestWithConfiguredVerifierAn function test_verifyWithBulkLink() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -102,9 +92,7 @@ contract VerifierBulkVerifyBillingReport is VerifierTestWithConfiguredVerifierAn function test_verifyWithBulkNative() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -121,9 +109,7 @@ contract VerifierBulkVerifyBillingReport is VerifierTestWithConfiguredVerifierAn function test_verifyWithBulkNativeUnwrapped() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -139,9 +125,7 @@ contract VerifierBulkVerifyBillingReport is VerifierTestWithConfiguredVerifierAn function test_verifyWithBulkNativeUnwrappedReturnsChange() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -157,15 +141,11 @@ contract VerifierBulkVerifyBillingReport is VerifierTestWithConfiguredVerifierAn function test_verifyMultiVersions() public { bytes memory signedReportV1 = _generateV1EncodedBlob( - _generateV1Report(), - _generateReportContext(v1ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV1Report(), _generateReportContext(v1ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes memory signedReportV3 = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](3); @@ -185,15 +165,11 @@ contract VerifierBulkVerifyBillingReport is VerifierTestWithConfiguredVerifierAn function test_verifyMultiVersionsReturnsVerifiedReports() public { bytes memory signedReportV1 = _generateV1EncodedBlob( - _generateV1Report(), - _generateReportContext(v1ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV1Report(), _generateReportContext(v1ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes memory signedReportV3 = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](3); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierUnsetConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierUnsetConfigTest.t.sol index e192a2e9e0..d6056ac180 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierUnsetConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierUnsetConfigTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../../v0.3.0/Verifier.sol"; +import {BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; contract VerificationdeactivateConfigWhenThereAreMultipleDigestsTest is BaseTestWithMultipleConfiguredDigests { function test_revertsIfCalledByNonOwner() public { @@ -24,25 +24,25 @@ contract VerificationdeactivateConfigWhenThereAreMultipleDigestsTest is BaseTest function test_correctlyRemovesAMiddleDigest() public { s_verifier.deactivateConfig(FEED_ID, s_configDigestTwo); - (, , bytes32 lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); assertEq(lastConfigDigest, s_configDigestThree); } function test_correctlyRemovesTheFirstDigest() public { s_verifier.deactivateConfig(FEED_ID, s_configDigestOne); - (, , bytes32 lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); assertEq(lastConfigDigest, s_configDigestThree); } function test_correctlyUnsetsDigestsInSequence() public { // Delete config digest 2 s_verifier.deactivateConfig(FEED_ID, s_configDigestTwo); - (, , bytes32 lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); assertEq(lastConfigDigest, s_configDigestThree); // Delete config digest 1 s_verifier.deactivateConfig(FEED_ID, s_configDigestOne); - (, , lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); assertEq(lastConfigDigest, s_configDigestThree); // Delete config digest 3 @@ -50,7 +50,7 @@ contract VerificationdeactivateConfigWhenThereAreMultipleDigestsTest is BaseTest abi.encodeWithSelector(Verifier.CannotDeactivateLatestConfig.selector, FEED_ID, s_configDigestThree) ); s_verifier.deactivateConfig(FEED_ID, s_configDigestThree); - (, , lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, lastConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); assertEq(lastConfigDigest, s_configDigestThree); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierVerifyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierVerifyTest.t.sol index ab1094b3ad..07b7005283 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierVerifyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierVerifyTest.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; -import {Verifier} from "../../../v0.3.0/Verifier.sol"; -import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {Verifier} from "../../../v0.3.0/Verifier.sol"; +import {VerifierProxy} from "../../../v0.3.0/VerifierProxy.sol"; +import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; contract VerifierVerifyTest is BaseTestWithConfiguredVerifierAndFeeManager { bytes32[3] internal s_reportContext; @@ -16,7 +16,7 @@ contract VerifierVerifyTest is BaseTestWithConfiguredVerifierAndFeeManager { function setUp() public virtual override { BaseTestWithConfiguredVerifierAndFeeManager.setUp(); - (, , bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, bytes32 configDigest) = s_verifier.latestConfigDetails(FEED_ID); s_reportContext[0] = configDigest; s_reportContext[1] = bytes32(abi.encode(uint32(5), uint8(1))); s_testReportOne = _createV1Report( @@ -57,21 +57,15 @@ contract VerifierVerifyTest is BaseTestWithConfiguredVerifierAndFeeManager { contract VerifierProxyVerifyTest is VerifierVerifyTest { function test_revertsIfNoVerifierConfigured() public { s_reportContext[0] = bytes32("corrupt-digest"); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(VerifierProxy.VerifierNotFound.selector, bytes32("corrupt-digest"))); s_verifierProxy.verify(signedReport, bytes("")); } function test_proxiesToTheCorrectVerifier() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes memory response = s_verifierProxy.verify(signedReport, abi.encode(native)); assertReportsEqual(response, s_testReportOne); @@ -92,11 +86,8 @@ contract VerifierProxyAccessControlledVerificationTest is VerifierVerifyTest { abi.encodeWithSelector(AccessControllerInterface.hasAccess.selector, USER), abi.encode(false) ); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(VerifierProxy.AccessForbidden.selector)); changePrank(USER); @@ -110,11 +101,8 @@ contract VerifierProxyAccessControlledVerificationTest is VerifierVerifyTest { abi.encode(true) ); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(USER); bytes memory response = s_verifierProxy.verify(signedReport, bytes("")); @@ -124,11 +112,8 @@ contract VerifierProxyAccessControlledVerificationTest is VerifierVerifyTest { contract VerifierVerifySingleConfigDigestTest is VerifierVerifyTest { function test_revertsIfVerifiedByNonProxy() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(Verifier.AccessForbidden.selector)); s_verifier.verify(signedReport, msg.sender); } @@ -155,11 +140,7 @@ contract VerifierVerifySingleConfigDigestTest is VerifierVerifyTest { function test_revertsIfConfigDigestNotSet() public { bytes32[3] memory reportContext = s_reportContext; reportContext[0] = bytes32("wrong-context-digest"); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = _generateV1EncodedBlob(s_testReportOne, reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(Verifier.DigestInactive.selector, FEED_ID, reportContext[0])); changePrank(address(s_verifierProxy)); s_verifier.verify(signedReport, msg.sender); @@ -201,11 +182,8 @@ contract VerifierVerifySingleConfigDigestTest is VerifierVerifyTest { } function test_returnsThePriceAndBlockNumIfReportVerified() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); bytes memory response = s_verifier.verify(signedReport, msg.sender); @@ -214,24 +192,18 @@ contract VerifierVerifySingleConfigDigestTest is VerifierVerifyTest { function test_setsTheCorrectEpoch() public { s_reportContext[1] = bytes32(uint256(5 << 8)); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); s_verifier.verify(signedReport, msg.sender); - (, , uint32 latestEpoch) = s_verifier.latestConfigDigestAndEpoch(FEED_ID); + (,, uint32 latestEpoch) = s_verifier.latestConfigDigestAndEpoch(FEED_ID); assertEq(latestEpoch, 5); } function test_emitsAnEventIfReportVerified() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectEmit(true, true, true, true, address(s_verifier)); emit ReportVerified(s_testReportOne.feedId, msg.sender); changePrank(address(s_verifierProxy)); @@ -247,7 +219,7 @@ contract VerifierVerifyMultipleConfigDigestTest is VerifierVerifyTest { function setUp() public override { VerifierVerifyTest.setUp(); - (, , s_oldConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_oldConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); s_verifier.setConfig( FEED_ID, _getSignerAddresses(_getSigners(20)), @@ -258,28 +230,22 @@ contract VerifierVerifyMultipleConfigDigestTest is VerifierVerifyTest { bytes(""), new Common.AddressAndWeight[](0) ); - (, , s_newConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); + (,, s_newConfigDigest) = s_verifier.latestConfigDetails(FEED_ID); } function test_revertsIfVerifyingWithAnUnsetDigest() public { s_verifier.deactivateConfig(FEED_ID, (s_oldConfigDigest)); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); vm.expectRevert(abi.encodeWithSelector(Verifier.DigestInactive.selector, FEED_ID, s_reportContext[0])); s_verifier.verify(signedReport, msg.sender); } function test_canVerifyOlderReportsWithOlderConfigs() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); bytes memory response = s_verifier.verify(signedReport, msg.sender); assertReportsEqual(response, s_testReportOne); @@ -287,11 +253,8 @@ contract VerifierVerifyMultipleConfigDigestTest is VerifierVerifyTest { function test_canVerifyNewerReportsWithNewerConfigs() public { s_reportContext[0] = s_newConfigDigest; - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); changePrank(address(s_verifierProxy)); bytes memory response = s_verifier.verify(signedReport, msg.sender); assertReportsEqual(response, s_testReportOne); @@ -300,11 +263,8 @@ contract VerifierVerifyMultipleConfigDigestTest is VerifierVerifyTest { function test_revertsIfAReportIsVerifiedWithAnExistingButIncorrectDigest() public { // Try sending the older digest signed with the new set of signers s_reportContext[0] = s_oldConfigDigest; - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); vm.expectRevert( abi.encodeWithSelector(Verifier.IncorrectSignatureCount.selector, FAULT_TOLERANCE_TWO + 1, FAULT_TOLERANCE + 1) ); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol index b4c0ecd201..cebb0bffc8 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol @@ -3,15 +3,17 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {Common} from "../libraries/Common.sol"; + import {IWERC20} from "../../shared/interfaces/IWERC20.sol"; -import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; -import {Math} from "@openzeppelin/contracts@4.8.3/utils/math/Math.sol"; -import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; -import {IDestinationRewardManager} from "./interfaces/IDestinationRewardManager.sol"; +import {Common} from "../libraries/Common.sol"; + import {IDestinationFeeManager} from "./interfaces/IDestinationFeeManager.sol"; +import {IDestinationRewardManager} from "./interfaces/IDestinationRewardManager.sol"; import {IDestinationVerifierFeeManager} from "./interfaces/IDestinationVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; +import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; +import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; +import {Math} from "@openzeppelin/contracts@4.8.3/utils/math/Math.sol"; /** * @title FeeManager @@ -145,10 +147,8 @@ contract DestinationFeeManager is address _rewardManagerAddress ) ConfirmedOwner(msg.sender) { if ( - _linkAddress == address(0) || - _nativeAddress == address(0) || - _verifierAddress == address(0) || - _rewardManagerAddress == address(0) + _linkAddress == address(0) || _nativeAddress == address(0) || _verifierAddress == address(0) + || _rewardManagerAddress == address(0) ) revert InvalidAddress(); i_linkAddress = _linkAddress; @@ -170,10 +170,11 @@ contract DestinationFeeManager is } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { - return - interfaceId == type(IDestinationFeeManager).interfaceId || - interfaceId == type(IDestinationVerifierFeeManager).interfaceId; + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { + return interfaceId == type(IDestinationFeeManager).interfaceId + || interfaceId == type(IDestinationVerifierFeeManager).interfaceId; } /// @inheritdoc IDestinationVerifierFeeManager @@ -183,11 +184,8 @@ contract DestinationFeeManager is bytes calldata parameterPayload, address subscriber ) external payable override onlyVerifier { - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _calculateFee( - payload, - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _calculateFee(payload, parameterPayload, subscriber); if (fee.amount == 0) { _tryReturnChange(subscriber, msg.value); @@ -214,9 +212,8 @@ contract DestinationFeeManager is //poolIDs are mapped to payloads, so they should be the same length if (poolIds.length != payloads.length) revert PoolIdMismatch(); - IDestinationFeeManager.FeeAndReward[] memory feesAndRewards = new IDestinationFeeManager.FeeAndReward[]( - payloads.length - ); + IDestinationFeeManager.FeeAndReward[] memory feesAndRewards = + new IDestinationFeeManager.FeeAndReward[](payloads.length); //keep track of the number of fees to prevent over initialising the FeePayment array within _convertToLinkAndNativeFees uint256 numberOfLinkFees; @@ -226,19 +223,12 @@ contract DestinationFeeManager is for (uint256 i; i < payloads.length; ++i) { if (poolIds[i] == bytes32(0)) revert InvalidAddress(); - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _calculateFee( - payloads[i], - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _calculateFee(payloads[i], parameterPayload, subscriber); if (fee.amount != 0) { - feesAndRewards[feesAndRewardsIndex++] = IDestinationFeeManager.FeeAndReward( - poolIds[i], - fee, - reward, - appliedDiscount - ); + feesAndRewards[feesAndRewardsIndex++] = + IDestinationFeeManager.FeeAndReward(poolIds[i], fee, reward, appliedDiscount); unchecked { //keep track of some tallys to make downstream calculations more efficient @@ -289,10 +279,8 @@ contract DestinationFeeManager is uint256 linkQuantity; uint256 nativeQuantity; uint256 expiresAt; - (, , , nativeQuantity, linkQuantity, expiresAt) = abi.decode( - report, - (bytes32, uint32, uint32, uint192, uint192, uint32) - ); + (,,, nativeQuantity, linkQuantity, expiresAt) = + abi.decode(report, (bytes32, uint32, uint32, uint192, uint192, uint32)); //read the timestamp bytes from the report data and verify it has not expired if (expiresAt < block.timestamp) { @@ -335,7 +323,9 @@ contract DestinationFeeManager is } /// @inheritdoc IDestinationFeeManager - function setNativeSurcharge(uint64 surcharge) external onlyOwner { + function setNativeSurcharge( + uint64 surcharge + ) external onlyOwner { if (surcharge > PERCENTAGE_SCALAR) revert InvalidSurcharge(); s_nativeSurcharge = surcharge; @@ -375,7 +365,7 @@ contract DestinationFeeManager is function withdraw(address assetAddress, address recipient, uint192 quantity) external onlyOwner { //address 0 is used to withdraw native in the context of withdrawing if (assetAddress == address(0)) { - (bool success, ) = payable(recipient).call{value: quantity}(""); + (bool success,) = payable(recipient).call{value: quantity}(""); if (!success) revert InvalidReceivingAddress(); return; @@ -398,7 +388,9 @@ contract DestinationFeeManager is * @notice Gets the current version of the report that is encoded as the last two bytes of the feed * @param feedId feed id to get the report version for */ - function _getReportVersion(bytes32 feedId) internal pure returns (bytes32) { + function _getReportVersion( + bytes32 feedId + ) internal pure returns (bytes32) { return REPORT_VERSION_MASK & feedId; } @@ -432,12 +424,10 @@ contract DestinationFeeManager is uint256 numberOfLinkFees, uint256 numberOfNativeFees ) internal { - IDestinationRewardManager.FeePayment[] memory linkRewards = new IDestinationRewardManager.FeePayment[]( - numberOfLinkFees - ); - IDestinationRewardManager.FeePayment[] memory nativeFeeLinkRewards = new IDestinationRewardManager.FeePayment[]( - numberOfNativeFees - ); + IDestinationRewardManager.FeePayment[] memory linkRewards = + new IDestinationRewardManager.FeePayment[](numberOfLinkFees); + IDestinationRewardManager.FeePayment[] memory nativeFeeLinkRewards = + new IDestinationRewardManager.FeePayment[](numberOfNativeFees); uint256 totalNativeFee; uint256 totalNativeFeeLinkValue; @@ -448,15 +438,11 @@ contract DestinationFeeManager is uint256 totalNumberOfFees = numberOfLinkFees + numberOfNativeFees; for (uint256 i; i < totalNumberOfFees; ++i) { if (feesAndRewards[i].fee.assetAddress == i_linkAddress) { - linkRewards[linkRewardsIndex++] = IDestinationRewardManager.FeePayment( - feesAndRewards[i].configDigest, - uint192(feesAndRewards[i].reward.amount) - ); + linkRewards[linkRewardsIndex++] = + IDestinationRewardManager.FeePayment(feesAndRewards[i].configDigest, uint192(feesAndRewards[i].reward.amount)); } else { - nativeFeeLinkRewards[nativeFeeLinkRewardsIndex++] = IDestinationRewardManager.FeePayment( - feesAndRewards[i].configDigest, - uint192(feesAndRewards[i].reward.amount) - ); + nativeFeeLinkRewards[nativeFeeLinkRewardsIndex++] = + IDestinationRewardManager.FeePayment(feesAndRewards[i].configDigest, uint192(feesAndRewards[i].reward.amount)); totalNativeFee += feesAndRewards[i].fee.amount; totalNativeFeeLinkValue += feesAndRewards[i].reward.amount; } @@ -526,7 +512,9 @@ contract DestinationFeeManager is } /// @inheritdoc IDestinationFeeManager - function payLinkDeficit(bytes32 configDigest) external onlyOwner { + function payLinkDeficit( + bytes32 configDigest + ) external onlyOwner { uint256 deficit = s_linkDeficit[configDigest]; if (deficit == 0) revert ZeroDeficit(); @@ -543,7 +531,9 @@ contract DestinationFeeManager is } /// @inheritdoc IDestinationFeeManager - function addVerifier(address verifierAddress) external onlyOwner { + function addVerifier( + address verifierAddress + ) external onlyOwner { if (verifierAddress == address(0)) revert InvalidAddress(); //check doesn't already exist if (s_verifierAddressList[verifierAddress] != address(0)) revert InvalidAddress(); @@ -551,7 +541,9 @@ contract DestinationFeeManager is } /// @inheritdoc IDestinationFeeManager - function removeVerifier(address verifierAddress) external onlyOwner { + function removeVerifier( + address verifierAddress + ) external onlyOwner { if (verifierAddress == address(0)) revert InvalidAddress(); //check doesn't already exist if (s_verifierAddressList[verifierAddress] == address(0)) revert InvalidAddress(); @@ -559,7 +551,9 @@ contract DestinationFeeManager is } /// @inheritdoc IDestinationFeeManager - function setRewardManager(address rewardManagerAddress) external onlyOwner { + function setRewardManager( + address rewardManagerAddress + ) external onlyOwner { if (rewardManagerAddress == address(0)) revert InvalidAddress(); if (!IERC165(rewardManagerAddress).supportsInterface(type(IDestinationRewardManager).interfaceId)) { diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol index 9dd9e0cf02..ad25a2aad4 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol @@ -2,10 +2,11 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IDestinationRewardManager} from "./interfaces/IDestinationRewardManager.sol"; -import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; + import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {Common} from "../libraries/Common.sol"; +import {IDestinationRewardManager} from "./interfaces/IDestinationRewardManager.sol"; +import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; /** @@ -66,7 +67,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, * @notice Constructor * @param linkAddress address of the wrapped LINK token */ - constructor(address linkAddress) ConfirmedOwner(msg.sender) { + constructor( + address linkAddress + ) ConfirmedOwner(msg.sender) { //ensure that the address ia not zero if (linkAddress == address(0)) revert InvalidAddress(); @@ -79,7 +82,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == type(IDestinationRewardManager).interfaceId; } @@ -88,7 +93,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, _; } - modifier onlyOwnerOrRecipientInPool(bytes32 poolId) { + modifier onlyOwnerOrRecipientInPool( + bytes32 poolId + ) { if (s_rewardRecipientWeights[poolId][msg.sender] == 0 && msg.sender != owner()) revert Unauthorized(); _; } @@ -120,7 +127,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, } /// @inheritdoc IDestinationRewardManager - function claimRewards(bytes32[] memory poolIds) external override { + function claimRewards( + bytes32[] memory poolIds + ) external override { _claimRewards(msg.sender, poolIds); } @@ -271,7 +280,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, } /// @inheritdoc IDestinationRewardManager - function addFeeManager(address newFeeManagerAddress) external onlyOwner { + function addFeeManager( + address newFeeManagerAddress + ) external onlyOwner { if (newFeeManagerAddress == address(0)) revert InvalidAddress(); if (s_feeManagerAddressList[newFeeManagerAddress] != address(0)) revert InvalidAddress(); @@ -281,7 +292,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, } /// @inheritdoc IDestinationRewardManager - function removeFeeManager(address feeManagerAddress) external onlyOwner { + function removeFeeManager( + address feeManagerAddress + ) external onlyOwner { if (s_feeManagerAddressList[feeManagerAddress] == address(0)) revert InvalidAddress(); delete s_feeManagerAddressList[feeManagerAddress]; } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol index 599c1e7040..d1eff030cf 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol @@ -2,14 +2,16 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IDestinationVerifier} from "./interfaces/IDestinationVerifier.sol"; + +import {IAccessController} from "../../shared/interfaces/IAccessController.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../libraries/Common.sol"; -import {IAccessController} from "../../shared/interfaces/IAccessController.sol"; +import {IDestinationVerifier} from "./interfaces/IDestinationVerifier.sol"; + +import {IDestinationVerifierFeeManager} from "./interfaces/IDestinationVerifierFeeManager.sol"; import {IDestinationVerifierProxy} from "./interfaces/IDestinationVerifierProxy.sol"; import {IDestinationVerifierProxyVerifier} from "./interfaces/IDestinationVerifierProxyVerifier.sol"; -import {IDestinationVerifierFeeManager} from "./interfaces/IDestinationVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; // OCR2 standard uint256 constant MAX_NUM_ORACLES = 31; @@ -133,7 +135,9 @@ contract DestinationVerifier is uint32 activationTime; } - constructor(address verifierProxy) ConfirmedOwner(msg.sender) { + constructor( + address verifierProxy + ) ConfirmedOwner(msg.sender) { if (verifierProxy == address(0)) { revert ZeroAddress(); } @@ -152,14 +156,9 @@ contract DestinationVerifier is address fm = s_feeManager; if (fm != address(0)) { //process the fee and catch the error - try - IDestinationVerifierFeeManager(fm).processFee{value: msg.value}( - donConfigId, - signedReport, - parameterPayload, - sender - ) - { + try IDestinationVerifierFeeManager(fm).processFee{value: msg.value}( + donConfigId, signedReport, parameterPayload, sender + ) { //do nothing } catch { // we purposefully obfuscate the error here to prevent information leaking leading to free verifications @@ -188,14 +187,9 @@ contract DestinationVerifier is address fm = s_feeManager; if (fm != address(0)) { //process the fee and catch the error - try - IDestinationVerifierFeeManager(fm).processFeeBulk{value: msg.value}( - donConfigs, - signedReports, - parameterPayload, - sender - ) - { + try IDestinationVerifierFeeManager(fm).processFeeBulk{value: msg.value}( + donConfigs, signedReports, parameterPayload, sender + ) { //do nothing } catch { // we purposefully obfuscate the error here to prevent information leaking leading to free verifications @@ -207,13 +201,8 @@ contract DestinationVerifier is } function _verify(bytes calldata signedReport, address sender) internal returns (bytes memory, bytes32) { - ( - bytes32[3] memory reportContext, - bytes memory reportData, - bytes32[] memory rs, - bytes32[] memory ss, - bytes32 rawVs - ) = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); + (bytes32[3] memory reportContext, bytes memory reportData, bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) + = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); // Signature lengths must match if (rs.length != ss.length) revert MismatchedSignatures(rs.length, ss.length); @@ -312,9 +301,11 @@ contract DestinationVerifier is // Register the signers for this DON for (uint256 i; i < signers.length; ++i) { if (signers[i] == address(0)) revert ZeroAddress(); - /** This index is registered so we can efficiently lookup whether a NOP is part of a config without having to - loop through the entire config each verification. It's effectively a DonConfig <-> Signer - composite key which keys track of all historic configs for a signer */ + /** + * This index is registered so we can efficiently lookup whether a NOP is part of a config without having to + * loop through the entire config each verification. It's effectively a DonConfig <-> Signer + * composite key which keys track of all historic configs for a signer + */ s_signerByAddressAndDonConfigId[keccak256(abi.encodePacked(signers[i], donConfigId))] = true; } @@ -344,9 +335,12 @@ contract DestinationVerifier is } /// @inheritdoc IDestinationVerifier - function setFeeManager(address feeManager) external override onlyOwner { - if (!IERC165(feeManager).supportsInterface(type(IDestinationVerifierFeeManager).interfaceId)) + function setFeeManager( + address feeManager + ) external override onlyOwner { + if (!IERC165(feeManager).supportsInterface(type(IDestinationVerifierFeeManager).interfaceId)) { revert FeeManagerInvalid(); + } address oldFeeManager = s_feeManager; s_feeManager = feeManager; @@ -355,7 +349,9 @@ contract DestinationVerifier is } /// @inheritdoc IDestinationVerifier - function setAccessController(address accessController) external override onlyOwner { + function setAccessController( + address accessController + ) external override onlyOwner { address oldAccessController = s_accessController; s_accessController = accessController; emit AccessControllerSet(oldAccessController, accessController); @@ -388,13 +384,17 @@ contract DestinationVerifier is emit ConfigRemoved(config.donConfigId); } - function _decodeReportTimestamp(bytes memory reportPayload) internal pure returns (uint256) { - (, , uint256 timestamp) = abi.decode(reportPayload, (bytes32, uint32, uint32)); + function _decodeReportTimestamp( + bytes memory reportPayload + ) internal pure returns (uint256) { + (,, uint256 timestamp) = abi.decode(reportPayload, (bytes32, uint32, uint32)); return timestamp; } - function _findActiveConfig(uint256 timestamp) internal view returns (DonConfig memory) { + function _findActiveConfig( + uint256 timestamp + ) internal view returns (DonConfig memory) { DonConfig memory activeDonConfig; // 99% of the time the signer config will be the last index, however for historic reports generated by a previous configuration we'll need to cycle back @@ -423,17 +423,20 @@ contract DestinationVerifier is _; } - modifier checkAccess(address sender) { + modifier checkAccess( + address sender + ) { address ac = s_accessController; if (address(ac) != address(0) && !IAccessController(ac).hasAccess(sender, msg.data)) revert AccessForbidden(); _; } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { - return - interfaceId == type(IDestinationVerifier).interfaceId || - interfaceId == type(IDestinationVerifierProxyVerifier).interfaceId; + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { + return interfaceId == type(IDestinationVerifier).interfaceId + || interfaceId == type(IDestinationVerifierProxyVerifier).interfaceId; } /// @inheritdoc ITypeAndVersion diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol index a8eb58b8a0..251cef1739 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol @@ -3,9 +3,10 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + import {IDestinationVerifierProxy} from "./interfaces/IDestinationVerifierProxy.sol"; import {IDestinationVerifierProxyVerifier} from "./interfaces/IDestinationVerifierProxyVerifier.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; /** * @title DestinationVerifierProxy @@ -43,10 +44,13 @@ contract DestinationVerifierProxy is IDestinationVerifierProxy, ConfirmedOwner, } /// @inheritdoc IDestinationVerifierProxy - function setVerifier(address verifierAddress) external onlyOwner { + function setVerifier( + address verifierAddress + ) external onlyOwner { //check it supports the functions we need - if (!IERC165(verifierAddress).supportsInterface(type(IDestinationVerifierProxyVerifier).interfaceId)) + if (!IERC165(verifierAddress).supportsInterface(type(IDestinationVerifierProxyVerifier).interfaceId)) { revert VerifierInvalid(verifierAddress); + } s_verifier = IDestinationVerifierProxyVerifier(verifierAddress); } @@ -64,7 +68,9 @@ contract DestinationVerifierProxy is IDestinationVerifierProxy, ConfirmedOwner, } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == type(IDestinationVerifierProxy).interfaceId; } } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol index afa68f491d..bcc9075387 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IDestinationFeeManager is IERC165 { /** @@ -22,7 +22,9 @@ interface IDestinationFeeManager is IERC165 { * @notice Sets the native surcharge * @param surcharge surcharge to be paid if paying in native */ - function setNativeSurcharge(uint64 surcharge) external; + function setNativeSurcharge( + uint64 surcharge + ) external; /** * @notice Adds a subscriber to the fee manager @@ -59,32 +61,40 @@ interface IDestinationFeeManager is IERC165 { * @notice Admin function to pay the LINK deficit for a given config digest * @param configDigest the config digest to pay the deficit for */ - function payLinkDeficit(bytes32 configDigest) external; + function payLinkDeficit( + bytes32 configDigest + ) external; /** * @notice Adds the verifier to the list of verifiers able to use the feeManager * @param verifier address of the verifier */ - function addVerifier(address verifier) external; + function addVerifier( + address verifier + ) external; /** * @notice Removes the verifier from the list of verifiers able to use the feeManager * @param verifier address of the verifier */ - function removeVerifier(address verifier) external; + function removeVerifier( + address verifier + ) external; /** * @notice Sets the reward manager to the address * @param rewardManager address of the reward manager */ - function setRewardManager(address rewardManager) external; + function setRewardManager( + address rewardManager + ) external; /** * @notice The structure to hold a fee and reward to verify a report * @param digest the digest linked to the fee and reward * @param fee the fee paid to verify the report * @param reward the reward paid upon verification - & @param appliedDiscount the discount applied to the reward + * & @param appliedDiscount the discount applied to the reward */ struct FeeAndReward { bytes32 configDigest; diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol index ccb5e32cc0..d94d88b057 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IDestinationRewardManager is IERC165 { /** @@ -16,7 +16,9 @@ interface IDestinationRewardManager is IERC165 { * @notice Claims the rewards in a specific pool * @param poolIds array of poolIds to claim rewards for */ - function claimRewards(bytes32[] calldata poolIds) external; + function claimRewards( + bytes32[] calldata poolIds + ) external; /** * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else updateRewardRecipients should be used. @@ -43,13 +45,17 @@ interface IDestinationRewardManager is IERC165 { * @notice Add the fee manager to the list of feeManagers able to call the reward manager * @param newFeeManager address of the new verifier proxy */ - function addFeeManager(address newFeeManager) external; + function addFeeManager( + address newFeeManager + ) external; /** * @notice Removes the fee manager. This needs to be done post construction to prevent a circular dependency. * @param feeManager address of the verifier proxy to remove */ - function removeFeeManager(address feeManager) external; + function removeFeeManager( + address feeManager + ) external; /** * @notice Gets a list of pool ids which have reward for a specific recipient. diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifier.sol index 84d6ddd3c6..d54b3324d2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifier.sol @@ -35,13 +35,17 @@ interface IDestinationVerifier is IERC165 { * @notice Sets the fee manager address * @param feeManager The address of the fee manager */ - function setFeeManager(address feeManager) external; + function setFeeManager( + address feeManager + ) external; /** * @notice Sets the access controller address * @param accessController The address of the access controller */ - function setAccessController(address accessController) external; + function setAccessController( + address accessController + ) external; /** * @notice Updates the config active status diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierFeeManager.sol index 30e7da7583..b0500fbd41 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierFeeManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IDestinationVerifierFeeManager is IERC165 { /** diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxy.sol index 00a0190e76..6793a8e452 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxy.sol @@ -34,7 +34,9 @@ interface IDestinationVerifierProxy is IERC165 { * @notice Sets the active verifier for this proxy * @param verifierAddress The address of the verifier contract */ - function setVerifier(address verifierAddress) external; + function setVerifier( + address verifierAddress + ) external; /** * @notice Used to honor the source verifierProxy feeManager interface diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol index fde28b084f..de728a713d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {DestinationFeeManager} from "../../DestinationFeeManager.sol"; -import {DestinationRewardManager} from "../../DestinationRewardManager.sol"; -import {Common} from "../../../libraries/Common.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; import {WERC20Mock} from "../../../../shared/mocks/WERC20Mock.sol"; +import {Common} from "../../../libraries/Common.sol"; +import {DestinationFeeManager} from "../../DestinationFeeManager.sol"; +import {DestinationRewardManager} from "../../DestinationRewardManager.sol"; + import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; import {DestinationFeeManagerProxy} from "../mocks/DestinationFeeManagerProxy.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title BaseDestinationFeeManagerTest @@ -100,12 +101,8 @@ contract BaseDestinationFeeManagerTest is Test { feeManagerProxy = new DestinationFeeManagerProxy(); rewardManager = new DestinationRewardManager(address(link)); - feeManager = new DestinationFeeManager( - address(link), - address(native), - address(feeManagerProxy), - address(rewardManager) - ); + feeManager = + new DestinationFeeManager(address(link), address(native), address(feeManagerProxy), address(rewardManager)); //link the feeManager to the proxy feeManagerProxy.setDestinationFeeManager(address(feeManager)); @@ -174,55 +171,59 @@ contract BaseDestinationFeeManagerTest is Test { // solium-disable-next-line no-unused-vars function getFee(bytes memory report, address quote, address subscriber) public view returns (Common.Asset memory) { //get the fee - (Common.Asset memory fee, , ) = feeManager.getFeeAndReward(subscriber, report, quote); + (Common.Asset memory fee,,) = feeManager.getFeeAndReward(subscriber, report, quote); return fee; } function getReward(bytes memory report, address quote, address subscriber) public view returns (Common.Asset memory) { //get the reward - (, Common.Asset memory reward, ) = feeManager.getFeeAndReward(subscriber, report, quote); + (, Common.Asset memory reward,) = feeManager.getFeeAndReward(subscriber, report, quote); return reward; } function getAppliedDiscount(bytes memory report, address quote, address subscriber) public view returns (uint256) { //get the reward - (, , uint256 appliedDiscount) = feeManager.getFeeAndReward(subscriber, report, quote); + (,, uint256 appliedDiscount) = feeManager.getFeeAndReward(subscriber, report, quote); return appliedDiscount; } - function getV1Report(bytes32 feedId) public pure returns (bytes memory) { + function getV1Report( + bytes32 feedId + ) public pure returns (bytes memory) { return abi.encode(feedId, uint32(0), int192(0), int192(0), int192(0), uint64(0), bytes32(0), uint64(0), uint64(0)); } - function getV2Report(bytes32 feedId) public view returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(DEFAULT_REPORT_NATIVE_FEE), - uint192(DEFAULT_REPORT_LINK_FEE), - uint32(block.timestamp), - int192(0) - ); + function getV2Report( + bytes32 feedId + ) public view returns (bytes memory) { + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(DEFAULT_REPORT_NATIVE_FEE), + uint192(DEFAULT_REPORT_LINK_FEE), + uint32(block.timestamp), + int192(0) + ); } - function getV3Report(bytes32 feedId) public view returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(DEFAULT_REPORT_NATIVE_FEE), - uint192(DEFAULT_REPORT_LINK_FEE), - uint32(block.timestamp), - int192(0), - int192(0), - int192(0) - ); + function getV3Report( + bytes32 feedId + ) public view returns (bytes memory) { + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(DEFAULT_REPORT_NATIVE_FEE), + uint192(DEFAULT_REPORT_LINK_FEE), + uint32(block.timestamp), + int192(0), + int192(0), + int192(0) + ); } function getV3ReportWithCustomExpiryAndFee( @@ -231,18 +232,17 @@ contract BaseDestinationFeeManagerTest is Test { uint256 linkFee, uint256 nativeFee ) public pure returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(nativeFee), - uint192(linkFee), - uint32(expiry), - int192(0), - int192(0), - int192(0) - ); + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(nativeFee), + uint192(linkFee), + uint32(expiry), + int192(0), + int192(0), + int192(0) + ); } function getLinkQuote() public view returns (address) { @@ -265,15 +265,21 @@ contract BaseDestinationFeeManagerTest is Test { changePrank(originalAddr); } - function getLinkBalance(address balanceAddress) public view returns (uint256) { + function getLinkBalance( + address balanceAddress + ) public view returns (uint256) { return link.balanceOf(balanceAddress); } - function getNativeBalance(address balanceAddress) public view returns (uint256) { + function getNativeBalance( + address balanceAddress + ) public view returns (uint256) { return native.balanceOf(balanceAddress); } - function getNativeUnwrappedBalance(address balanceAddress) public view returns (uint256) { + function getNativeUnwrappedBalance( + address balanceAddress + ) public view returns (uint256) { return balanceAddress.balance; } @@ -360,7 +366,9 @@ contract BaseDestinationFeeManagerTest is Test { changePrank(originalAddr); } - function getPayload(bytes memory reportPayload) public pure returns (bytes memory) { + function getPayload( + bytes memory reportPayload + ) public pure returns (bytes memory) { return abi.encode([DEFAULT_CONFIG_DIGEST, 0, 0], reportPayload, new bytes32[](1), new bytes32[](1), bytes32("")); } @@ -400,7 +408,9 @@ contract BaseDestinationFeeManagerTest is Test { changePrank(originalAddr); } - function getLinkDeficit(bytes32 configDigest) public view returns (uint256) { + function getLinkDeficit( + bytes32 configDigest + ) public view returns (uint256) { return feeManager.s_linkDeficit(configDigest); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.getFeeAndReward.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.getFeeAndReward.t.sol index ddd3ac5a8e..ebdb39086d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.getFeeAndReward.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.getFeeAndReward.t.sol @@ -421,9 +421,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { //get the fee required by the feeManager Common.Asset memory fee = getFee( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), - getNativeQuote(), - USER + getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), getNativeQuote(), USER ); //fee should be zero @@ -439,9 +437,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { //get the fee required by the feeManager Common.Asset memory fee = getFee( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), - getNativeQuote(), - USER + getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), getNativeQuote(), USER ); //fee should be zero @@ -558,10 +554,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { //get the fee required by the feeManager getFee( getV3ReportWithCustomExpiryAndFee( - DEFAULT_FEED_1_V3, - block.timestamp - 1, - DEFAULT_REPORT_LINK_FEE, - DEFAULT_REPORT_NATIVE_FEE + DEFAULT_FEED_1_V3, block.timestamp - 1, DEFAULT_REPORT_LINK_FEE, DEFAULT_REPORT_NATIVE_FEE ), getNativeQuote(), USER diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol index 0880352dca..0bebbced3b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol @@ -2,8 +2,9 @@ pragma solidity 0.8.19; import {Common} from "../../../libraries/Common.sol"; -import "./BaseDestinationFeeManager.t.sol"; + import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; +import "./BaseDestinationFeeManager.t.sol"; /** * @title BaseFeeManagerTest @@ -79,11 +80,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_processFeeWithWithCorruptQuotePayload() public { //get the default payload bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV3Report(DEFAULT_FEED_1_V3), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV3Report(DEFAULT_FEED_1_V3), new bytes32[](1), new bytes32[](1), bytes32("") ); //expect an evm revert as the quote is corrupt @@ -291,11 +288,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_V1PayloadVerifies() public { //replicate a default payload bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV2Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV2Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); //processing the fee will transfer the link from the user to the rewardManager @@ -356,9 +349,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkWithNativeQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0)); //call processFee should not revert as the fee is 0 processFee(DEFAULT_CONFIG_DIGEST, payload, PROXY, address(native), 0); @@ -366,9 +358,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkWithLinkQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0)); //approve the link to be transferred from the from the subscriber to the rewardManager approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, USER); @@ -388,9 +379,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { mintLink(address(feeManager), DEFAULT_REPORT_LINK_FEE); //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //approve the native to be transferred from the user approveNative(address(feeManager), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -413,9 +403,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_processFeeWithZeroLinkNonZeroNativeWithLinkQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //call processFee should not revert as the fee is 0 processFee(DEFAULT_CONFIG_DIGEST, payload, USER, address(link), 0); @@ -423,9 +412,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkReturnsChange() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //call processFee should not revert as the fee is 0 processFee(DEFAULT_CONFIG_DIGEST, payload, USER, address(link), DEFAULT_REPORT_NATIVE_FEE); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol index a50441bed6..258d5672e6 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import "./BaseDestinationFeeManager.t.sol"; import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; +import "./BaseDestinationFeeManager.t.sol"; /** * @title BaseFeeManagerTest @@ -96,11 +96,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { mintLink(address(feeManager), 1); bytes memory payloadV1 = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes memory linkPayloadV2 = getPayload(getV2Report(DEFAULT_FEED_1_V2)); @@ -134,11 +130,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { mintLink(address(feeManager), DEFAULT_REPORT_LINK_FEE * 4 + 1); bytes memory payloadV1 = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes memory nativePayloadV2 = getPayload(getV2Report(DEFAULT_FEED_1_V2)); @@ -168,11 +160,7 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { function test_processMultipleV1Reports() public { bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes[] memory payloads = new bytes[](NUMBER_OF_REPORTS); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/mocks/DestinationFeeManagerProxy.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/mocks/DestinationFeeManagerProxy.sol index 7dde878321..0eee37769d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/mocks/DestinationFeeManagerProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/mocks/DestinationFeeManagerProxy.sol @@ -18,7 +18,9 @@ contract DestinationFeeManagerProxy { s_feeManager.processFeeBulk{value: msg.value}(poolIds, payloads, parameterPayload, msg.sender); } - function setDestinationFeeManager(address feeManager) public { + function setDestinationFeeManager( + address feeManager + ) public { s_feeManager = IDestinationVerifierFeeManager(feeManager); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol index 706bee69f5..1335db9513 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; -import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; + import {Common} from "../../../libraries/Common.sol"; +import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title DestinationRewardManagerTest @@ -194,11 +195,15 @@ contract BaseDestinationRewardManagerTest is Test { changePrank(originalAddr); } - function getAsset(uint256 quantity) public view returns (Common.Asset memory) { + function getAsset( + uint256 quantity + ) public view returns (Common.Asset memory) { return Common.Asset(address(asset), quantity); } - function getAssetBalance(address addr) public view returns (uint256) { + function getAssetBalance( + address addr + ) public view returns (uint256) { return asset.balanceOf(addr); } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol index c0a67d0875..1315fd920c 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; /** * @title DestinationRewardManagerClaimTest @@ -550,11 +550,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat function test_getRewardsAvailableToRecipientInBothPools() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[0].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[0].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); @@ -563,11 +560,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat function test_getRewardsAvailableToRecipientInSinglePool() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[1].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[1].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); @@ -585,11 +579,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat function test_getRewardsAvailableToRecipientInBothPoolsWhereAlreadyClaimed() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[0].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[0].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.general.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.general.t.sol index 92ed9dcc49..ac69254b9d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.general.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.general.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; -import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; +import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; +import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; /** * @title DestinationRewardManagerSetupTest diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.payRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.payRecipients.t.sol index 4aa3c868b3..65c8b31963 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.payRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.payRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; +import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; /** * @title DestinationRewardManagerPayRecipientsTest @@ -141,10 +141,7 @@ contract DestinationRewardManagerPayRecipientsTest is BaseDestinationRewardManag } //check the pool has the remaining balance - assertEq( - getAssetBalance(address(rewardManager)), - POOL_DEPOSIT_AMOUNT - expectedRecipientAmount * recipients.length - ); + assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT - expectedRecipientAmount * recipients.length); } function test_payAllRecipientsFromNonAdminUser() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.setRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.setRecipients.t.sol index facbaa1ab7..6a2dd968b8 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.setRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.setRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; /** * @title DestinationRewardManagerSetRecipientsTest diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.updateRewardRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.updateRewardRecipients.t.sol index 226be8ed32..7f1ad5f483 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.updateRewardRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.updateRewardRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseDestinationRewardManagerTest} from "./BaseDestinationRewardManager.t.sol"; /** * @title DestinationRewardManagerUpdateRewardRecipientsTest @@ -294,12 +294,10 @@ contract DestinationRewardManagerUpdateRewardRecipientsTest is BaseDestinationRe //manually check the balance of each recipient assertEq( - getAssetBalance(DEFAULT_RECIPIENT_1), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_1), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(DEFAULT_RECIPIENT_2), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_2), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( getAssetBalance(DEFAULT_RECIPIENT_3), @@ -343,8 +341,7 @@ contract DestinationRewardManagerUpdateRewardRecipientsTest is BaseDestinationRe //manually check the balance of each recipient assertEq( - getAssetBalance(DEFAULT_RECIPIENT_1), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_1), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( getAssetBalance(DEFAULT_RECIPIENT_2), @@ -439,12 +436,10 @@ contract DestinationRewardManagerUpdateRewardRecipientsMultiplePoolsTest is Base (POOL_DEPOSIT_AMOUNT * TEN_PERCENT * 4) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(recipients[2].addr), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(recipients[2].addr), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(recipients[3].addr), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(recipients[3].addr), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol index 19a8fe603c..eb645f5e4a 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol @@ -1,20 +1,24 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {DestinationVerifierProxy} from "../../DestinationVerifierProxy.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {IDestinationVerifier} from "../../interfaces/IDestinationVerifier.sol"; -import {IDestinationVerifierProxy} from "../../interfaces/IDestinationVerifierProxy.sol"; -import {DestinationVerifier} from "../../DestinationVerifier.sol"; -import {Strings} from "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; -import {DestinationFeeManager} from "../../DestinationFeeManager.sol"; -import {Common} from "../../../libraries/Common.sol"; + +import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; import {WERC20Mock} from "../../../../shared/mocks/WERC20Mock.sol"; +import {Common} from "../../../libraries/Common.sol"; +import {DestinationFeeManager} from "../../DestinationFeeManager.sol"; + import {DestinationRewardManager} from "../../DestinationRewardManager.sol"; +import {DestinationVerifier} from "../../DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../DestinationVerifierProxy.sol"; + import {IDestinationRewardManager} from "../../interfaces/IDestinationRewardManager.sol"; -import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; +import {IDestinationVerifier} from "../../interfaces/IDestinationVerifier.sol"; +import {IDestinationVerifierProxy} from "../../interfaces/IDestinationVerifierProxy.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + +import {Strings} from "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; +import {Test} from "forge-std/Test.sol"; contract BaseTest is Test { uint64 internal constant POOL_SCALAR = 1e18; @@ -91,19 +95,20 @@ contract BaseTest is Test { //version 3 feeds bytes32 internal constant FEED_ID_V3 = (keccak256("ETH-USD") & V_MASK) | V3_BITMASK; - function _encodeReport(V3Report memory report) internal pure returns (bytes memory) { - return - abi.encode( - report.feedId, - report.observationsTimestamp, - report.validFromTimestamp, - report.nativeFee, - report.linkFee, - report.expiresAt, - report.benchmarkPrice, - report.bid, - report.ask - ); + function _encodeReport( + V3Report memory report + ) internal pure returns (bytes memory) { + return abi.encode( + report.feedId, + report.observationsTimestamp, + report.validFromTimestamp, + report.nativeFee, + report.linkFee, + report.expiresAt, + report.benchmarkPrice, + report.bid, + report.ask + ); } function _generateSignerSignatures( @@ -132,11 +137,8 @@ contract BaseTest is Test { Signer[] memory signers ) internal pure returns (bytes memory) { bytes memory reportBytes = _encodeReport(report); - (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = _generateSignerSignatures( - reportBytes, - reportContext, - signers - ); + (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = + _generateSignerSignatures(reportBytes, reportContext, signers); return abi.encode(reportContext, reportBytes, rs, ss, rawVs); } @@ -150,26 +152,20 @@ contract BaseTest is Test { } function _generateV3Report() internal view returns (V3Report memory) { - return - V3Report({ - feedId: FEED_ID_V3, - observationsTimestamp: OBSERVATIONS_TIMESTAMP, - validFromTimestamp: uint32(block.timestamp), - nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), - linkFee: uint192(DEFAULT_REPORT_LINK_FEE), - expiresAt: uint32(block.timestamp), - benchmarkPrice: MEDIAN, - bid: BID, - ask: ASK - }); + return V3Report({ + feedId: FEED_ID_V3, + observationsTimestamp: OBSERVATIONS_TIMESTAMP, + validFromTimestamp: uint32(block.timestamp), + nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), + linkFee: uint192(DEFAULT_REPORT_LINK_FEE), + expiresAt: uint32(block.timestamp), + benchmarkPrice: MEDIAN, + bid: BID, + ask: ASK + }); } - function _verifyBulk( - bytes[] memory payload, - address feeAddress, - uint256 wrappedNativeValue, - address sender - ) internal { + function _verifyBulk(bytes[] memory payload, address feeAddress, uint256 wrappedNativeValue, address sender) internal { address originalAddr = msg.sender; changePrank(sender); @@ -209,7 +205,9 @@ contract BaseTest is Test { } } - function _getSigners(uint256 numSigners) internal view returns (Signer[] memory) { + function _getSigners( + uint256 numSigners + ) internal view returns (Signer[] memory) { Signer[] memory signers = new Signer[](numSigners); for (uint256 i; i < numSigners; i++) { signers[i] = s_signers[i]; @@ -217,7 +215,9 @@ contract BaseTest is Test { return signers; } - function _getSignerAddresses(Signer[] memory signers) internal pure returns (address[] memory) { + function _getSignerAddresses( + Signer[] memory signers + ) internal pure returns (address[] memory) { address[] memory signerAddrs = new address[](signers.length); for (uint256 i = 0; i < signerAddrs.length; i++) { signerAddrs[i] = signers[i].signerAddress; @@ -317,12 +317,7 @@ contract MultipleVerifierWithMultipleFeeManagers is BaseTest { s_verifierProxy2.setVerifier(address(s_verifier2)); s_verifierProxy3.setVerifier(address(s_verifier3)); - feeManager2 = new DestinationFeeManager( - address(link), - address(native), - address(s_verifier), - address(rewardManager) - ); + feeManager2 = new DestinationFeeManager(address(link), address(native), address(s_verifier), address(rewardManager)); s_verifier.setFeeManager(address(feeManager)); s_verifier2.setFeeManager(address(feeManager)); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol index fa181793c8..1b0e2c4628 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol @@ -1,17 +1,19 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {VerifierWithFeeManager} from "./BaseDestinationVerifierTest.t.sol"; +import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; + +import {Common} from "../../../libraries/Common.sol"; import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; -import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {IDestinationFeeManager} from "../../../v0.4.0/interfaces/IDestinationFeeManager.sol"; import {IDestinationRewardManager} from "../../../v0.4.0/interfaces/IDestinationRewardManager.sol"; import {IDestinationVerifierProxy} from "../../../v0.4.0/interfaces/IDestinationVerifierProxy.sol"; -import {Common} from "../../../libraries/Common.sol"; +import {VerifierWithFeeManager} from "./BaseDestinationVerifierTest.t.sol"; + import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; +import {Test} from "forge-std/Test.sol"; /* This test checks the interfaces of destination verifier matches the expectations. @@ -116,7 +118,7 @@ contract VerifierInterfacesTest is VerifierWithFeeManager { IDestinationRewardManager rewardManager = IDestinationRewardManager(address(feeManager.i_rewardManager())); address feeTokenAddress = feeManager.i_linkAddress(); - (Common.Asset memory fee, , ) = feeManager.getFeeAndReward(address(this), reportData, feeTokenAddress); + (Common.Asset memory fee,,) = feeManager.getFeeAndReward(address(this), reportData, feeTokenAddress); // Approve rewardManager to spend this contract's balance in fees _approveLink(address(rewardManager), fee.amount, USER); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierProxyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierProxyTest.t.sol index a3b2172072..63a72096b5 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierProxyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierProxyTest.t.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; import {DestinationFeeManager} from "../../../v0.4.0/DestinationFeeManager.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; + import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; contract DestinationVerifierProxyInitializeVerifierTest is BaseTest { diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierRemoveLatestConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierRemoveLatestConfigTest.t.sol index 6309efc995..24e52b3e15 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierRemoveLatestConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierRemoveLatestConfigTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; contract DestinationVerifierSetConfigTest is BaseTest { bytes32[3] internal s_reportContext; diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol index 4f96e4969a..d63d8cc257 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationRewardManager} from "../../../v0.4.0/DestinationRewardManager.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; contract DestinationVerifierSetConfigTest is BaseTest { function setUp() public virtual override { @@ -125,10 +125,7 @@ contract DestinationVerifierSetConfigTest is BaseTest { address[] memory signerAddrs = _getSignerAddresses(signers); uint32 activationTime = 10; s_verifier.setConfigWithActivationTime( - signerAddrs, - FAULT_TOLERANCE, - new Common.AddressAndWeight[](0), - activationTime + signerAddrs, FAULT_TOLERANCE, new Common.AddressAndWeight[](0), activationTime ); } @@ -139,10 +136,7 @@ contract DestinationVerifierSetConfigTest is BaseTest { uint32 activationTime = uint32(block.timestamp) + 100; vm.expectRevert(abi.encodeWithSelector(DestinationVerifier.BadActivationTime.selector)); s_verifier.setConfigWithActivationTime( - signerAddrs, - FAULT_TOLERANCE, - new Common.AddressAndWeight[](0), - activationTime + signerAddrs, FAULT_TOLERANCE, new Common.AddressAndWeight[](0), activationTime ); } @@ -156,10 +150,7 @@ contract DestinationVerifierSetConfigTest is BaseTest { // setting a config with ealier timestamp retuls in failure vm.expectRevert(abi.encodeWithSelector(DestinationVerifier.BadActivationTime.selector)); s_verifier.setConfigWithActivationTime( - signerAddrs, - FAULT_TOLERANCE - 1, - new Common.AddressAndWeight[](0), - oldActivationTime + signerAddrs, FAULT_TOLERANCE - 1, new Common.AddressAndWeight[](0), oldActivationTime ); } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetFeeManagerTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetFeeManagerTest.t.sol index fdf75d6845..b259fadde6 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetFeeManagerTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetFeeManagerTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; contract VerifierSetAccessControllerTest is BaseTest { event FeeManagerSet(address oldFeeManager, address newFeeManager); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTest.t.sol index 476acbf806..09375c5da4 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; import {IDestinationVerifier} from "../../../v0.4.0/interfaces/IDestinationVerifier.sol"; import {IDestinationVerifierProxyVerifier} from "../../../v0.4.0/interfaces/IDestinationVerifierProxyVerifier.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; contract DestinationVerifierConstructorTest is BaseTest { bytes32[3] internal s_reportContext; @@ -27,8 +27,8 @@ contract DestinationVerifierConstructorTest is BaseTest { } function test_trueIfIsCorrectInterface() public view { - bool isInterface = s_verifier.supportsInterface(type(IDestinationVerifier).interfaceId) && - s_verifier.supportsInterface(type(IDestinationVerifierProxyVerifier).interfaceId); + bool isInterface = s_verifier.supportsInterface(type(IDestinationVerifier).interfaceId) + && s_verifier.supportsInterface(type(IDestinationVerifierProxyVerifier).interfaceId); assertEq(isInterface, true); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestBillingReport.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestBillingReport.t.sol index 574e169cf2..444967013f 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestBillingReport.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestBillingReport.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {VerifierWithFeeManager} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; +import {VerifierWithFeeManager} from "./BaseDestinationVerifierTest.t.sol"; contract VerifierBillingTests is VerifierWithFeeManager { bytes32[3] internal s_reportContext; @@ -52,11 +52,8 @@ contract VerifierBillingTests is VerifierWithFeeManager { weights[0] = Common.AddressAndWeight(signerAddrs[0], ONE_PERCENT * 100); s_verifier.setConfig(signerAddrs, FAULT_TOLERANCE, weights); - bytes memory signedReport = _generateV3EncodedBlob( - s_testReportThree, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(s_testReportThree, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); _approveNative(address(feeManager), DEFAULT_REPORT_NATIVE_FEE, USER); _verify(signedReport, address(native), 0, USER); assertEq(native.balanceOf(USER), DEFAULT_NATIVE_MINT_QUANTITY - DEFAULT_REPORT_NATIVE_FEE); @@ -70,11 +67,8 @@ contract VerifierBillingTests is VerifierWithFeeManager { Common.AddressAndWeight[] memory weights = new Common.AddressAndWeight[](0); s_verifier.setConfig(signerAddrs, FAULT_TOLERANCE, weights); - bytes memory signedReport = _generateV3EncodedBlob( - s_testReportThree, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(s_testReportThree, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); _verify(signedReport, address(native), DEFAULT_REPORT_NATIVE_FEE, USER); assertEq(USER.balance, DEFAULT_NATIVE_MINT_QUANTITY - DEFAULT_REPORT_NATIVE_FEE); @@ -87,11 +81,8 @@ contract VerifierBillingTests is VerifierWithFeeManager { Common.AddressAndWeight[] memory weights = new Common.AddressAndWeight[](0); s_verifier.setConfig(signerAddrs, FAULT_TOLERANCE, weights); - bytes memory signedReport = _generateV3EncodedBlob( - s_testReportThree, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(s_testReportThree, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); _verify(signedReport, address(native), DEFAULT_REPORT_NATIVE_FEE * 2, USER); assertEq(USER.balance, DEFAULT_NATIVE_MINT_QUANTITY - DEFAULT_REPORT_NATIVE_FEE); @@ -115,11 +106,8 @@ contract DestinationVerifierBulkVerifyBillingReport is VerifierWithFeeManager { } function test_verifyWithBulkLink() public { - bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(_generateV3Report(), s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); for (uint256 i = 0; i < NUMBERS_OF_REPORTS; i++) { @@ -135,11 +123,8 @@ contract DestinationVerifierBulkVerifyBillingReport is VerifierWithFeeManager { } function test_verifyWithBulkNative() public { - bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(_generateV3Report(), s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); for (uint256 i = 0; i < NUMBERS_OF_REPORTS; i++) { @@ -152,11 +137,8 @@ contract DestinationVerifierBulkVerifyBillingReport is VerifierWithFeeManager { } function test_verifyWithBulkNativeUnwrapped() public { - bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(_generateV3Report(), s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); for (uint256 i; i < NUMBERS_OF_REPORTS; i++) { @@ -170,11 +152,8 @@ contract DestinationVerifierBulkVerifyBillingReport is VerifierWithFeeManager { } function test_verifyWithBulkNativeUnwrappedReturnsChange() public { - bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(_generateV3Report(), s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); for (uint256 i = 0; i < NUMBERS_OF_REPORTS; i++) { diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol index 8ca954b8ca..ac604e0340 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {VerifierWithFeeManager} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; +import {VerifierWithFeeManager} from "./BaseDestinationVerifierTest.t.sol"; contract VerifierBillingTests is VerifierWithFeeManager { uint8 MINIMAL_FAULT_TOLERANCE = 2; @@ -38,20 +38,21 @@ contract VerifierBillingTests is VerifierWithFeeManager { s_testReport = generateReportAtTimestamp(block.timestamp); } - function generateReportAtTimestamp(uint256 timestamp) public pure returns (V3Report memory) { - return - V3Report({ - feedId: FEED_ID_V3, - observationsTimestamp: OBSERVATIONS_TIMESTAMP, - validFromTimestamp: uint32(timestamp), - nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), - linkFee: uint192(DEFAULT_REPORT_LINK_FEE), - // ask michael about this expires at, is it usually set at what blocks - expiresAt: uint32(timestamp) + 500, - benchmarkPrice: MEDIAN, - bid: BID, - ask: ASK - }); + function generateReportAtTimestamp( + uint256 timestamp + ) public pure returns (V3Report memory) { + return V3Report({ + feedId: FEED_ID_V3, + observationsTimestamp: OBSERVATIONS_TIMESTAMP, + validFromTimestamp: uint32(timestamp), + nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), + linkFee: uint192(DEFAULT_REPORT_LINK_FEE), + // ask michael about this expires at, is it usually set at what blocks + expiresAt: uint32(timestamp) + 500, + benchmarkPrice: MEDIAN, + bid: BID, + ask: ASK + }); } function getRecipientAndWeightsGroup2() public pure returns (Common.AddressAndWeight[] memory, address[] memory) { diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol index 6a90cbf373..d7ec9e4d6b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {MultipleVerifierWithMultipleFeeManagers} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; +import {MultipleVerifierWithMultipleFeeManagers} from "./BaseDestinationVerifierTest.t.sol"; contract MultiVerifierBillingTests is MultipleVerifierWithMultipleFeeManagers { uint8 MINIMAL_FAULT_TOLERANCE = 2; @@ -41,20 +41,21 @@ contract MultiVerifierBillingTests is MultipleVerifierWithMultipleFeeManagers { changePrank(originalAddr); } - function generateReportAtTimestamp(uint256 timestamp) public pure returns (V3Report memory) { - return - V3Report({ - feedId: FEED_ID_V3, - observationsTimestamp: OBSERVATIONS_TIMESTAMP, - validFromTimestamp: uint32(timestamp), - nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), - linkFee: uint192(DEFAULT_REPORT_LINK_FEE), - // ask michael about this expires at, is it usually set at what blocks - expiresAt: uint32(timestamp) + 500, - benchmarkPrice: MEDIAN, - bid: BID, - ask: ASK - }); + function generateReportAtTimestamp( + uint256 timestamp + ) public pure returns (V3Report memory) { + return V3Report({ + feedId: FEED_ID_V3, + observationsTimestamp: OBSERVATIONS_TIMESTAMP, + validFromTimestamp: uint32(timestamp), + nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), + linkFee: uint192(DEFAULT_REPORT_LINK_FEE), + // ask michael about this expires at, is it usually set at what blocks + expiresAt: uint32(timestamp) + 500, + benchmarkPrice: MEDIAN, + bid: BID, + ask: ASK + }); } function payRecipients(bytes32 poolId, address[] memory recipients, address sender) public { diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyBulkTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyBulkTest.t.sol index 1c57295bae..75108774e1 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyBulkTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyBulkTest.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; contract VerifierVerifyBulkTest is BaseTest { bytes32[3] internal s_reportContext; @@ -34,11 +34,8 @@ contract VerifierVerifyBulkTest is BaseTest { abi.encodeWithSelector(AccessControllerInterface.hasAccess.selector, USER), abi.encode(false) ); - bytes memory signedReport = _generateV3EncodedBlob( - s_testReportThree, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(s_testReportThree, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes[] memory signedReports = new bytes[](2); signedReports[0] = signedReport; diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol index e72cfd09b6..d954b60b11 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; -import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; -import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {DestinationVerifier} from "../../../v0.4.0/DestinationVerifier.sol"; +import {DestinationVerifierProxy} from "../../../v0.4.0/DestinationVerifierProxy.sol"; +import {BaseTest} from "./BaseDestinationVerifierTest.t.sol"; contract VerifierVerifyTest is BaseTest { bytes32[3] internal s_reportContext; @@ -278,11 +278,8 @@ contract VerifierVerifyTest is BaseTest { abi.encodeWithSelector(AccessControllerInterface.hasAccess.selector, USER), abi.encode(false) ); - bytes memory signedReport = _generateV3EncodedBlob( - s_testReportThree, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV3EncodedBlob(s_testReportThree, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(DestinationVerifier.AccessForbidden.selector)); @@ -603,10 +600,7 @@ contract VerifierVerifyTest is BaseTest { uint32 configATimestmap = 100; address[] memory signersAddrA = _getSignerAddresses(signersA); s_verifier.setConfigWithActivationTime( - signersAddrA, - MINIMAL_FAULT_TOLERANCE, - new Common.AddressAndWeight[](0), - configATimestmap + signersAddrA, MINIMAL_FAULT_TOLERANCE, new Common.AddressAndWeight[](0), configATimestmap ); // ConfigB (historical config) @@ -623,10 +617,7 @@ contract VerifierVerifyTest is BaseTest { signersB[6] = signers[14]; address[] memory signersAddrsB = _getSignerAddresses(signersB); s_verifier.setConfigWithActivationTime( - signersAddrsB, - MINIMAL_FAULT_TOLERANCE, - new Common.AddressAndWeight[](0), - configBTimestmap + signersAddrsB, MINIMAL_FAULT_TOLERANCE, new Common.AddressAndWeight[](0), configBTimestmap ); // ConfigC (config at current timestamp) @@ -703,11 +694,8 @@ contract VerifierVerifyTest is BaseTest { s_verifierProxy.verify(signedReportC, abi.encode(native)); // current report verified by historical report fails - bytes memory signedNewReportWithOldSignatures = _generateV3EncodedBlob( - s_testReportC, - s_reportContext, - reportSignersA - ); + bytes memory signedNewReportWithOldSignatures = + _generateV3EncodedBlob(s_testReportC, s_reportContext, reportSignersA); vm.expectRevert(abi.encodeWithSelector(DestinationVerifier.BadVerification.selector)); s_verifierProxy.verify(signedNewReportWithOldSignatures, abi.encode(native)); } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol index db603bd591..f7000385b9 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol @@ -2,16 +2,19 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IFeeManager} from "./interfaces/IFeeManager.sol"; + import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + +import {IWERC20} from "../../shared/interfaces/IWERC20.sol"; import {Common} from "../libraries/Common.sol"; +import {IFeeManager} from "./interfaces/IFeeManager.sol"; import {IRewardManager} from "./interfaces/IRewardManager.sol"; -import {IWERC20} from "../../shared/interfaces/IWERC20.sol"; + +import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; -import {Math} from "@openzeppelin/contracts@4.8.3/utils/math/Math.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; -import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {Math} from "@openzeppelin/contracts@4.8.3/utils/math/Math.sol"; /** * @title FeeManager @@ -137,10 +140,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { address _rewardManagerAddress ) ConfirmedOwner(msg.sender) { if ( - _linkAddress == address(0) || - _nativeAddress == address(0) || - _proxyAddress == address(0) || - _rewardManagerAddress == address(0) + _linkAddress == address(0) || _nativeAddress == address(0) || _proxyAddress == address(0) + || _rewardManagerAddress == address(0) ) revert InvalidAddress(); i_linkAddress = _linkAddress; @@ -167,7 +168,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == this.processFee.selector || interfaceId == this.processFeeBulk.selector; } @@ -177,11 +180,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { bytes calldata parameterPayload, address subscriber ) external payable override onlyProxy { - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _processFee( - payload, - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _processFee(payload, parameterPayload, subscriber); if (fee.amount == 0) { _transfer(subscriber, msg.value); @@ -212,19 +212,12 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 feesAndRewardsIndex; for (uint256 i; i < payloads.length; ++i) { - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _processFee( - payloads[i], - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _processFee(payloads[i], parameterPayload, subscriber); if (fee.amount != 0) { - feesAndRewards[feesAndRewardsIndex++] = IFeeManager.FeeAndReward( - bytes32(payloads[i]), - fee, - reward, - appliedDiscount - ); + feesAndRewards[feesAndRewardsIndex++] = + IFeeManager.FeeAndReward(bytes32(payloads[i]), fee, reward, appliedDiscount); unchecked { //keep track of some tallys to make downstream calculations more efficient @@ -275,10 +268,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 linkQuantity; uint256 nativeQuantity; uint256 expiresAt; - (, , , nativeQuantity, linkQuantity, expiresAt) = abi.decode( - report, - (bytes32, uint32, uint32, uint192, uint192, uint32) - ); + (,,, nativeQuantity, linkQuantity, expiresAt) = + abi.decode(report, (bytes32, uint32, uint32, uint192, uint192, uint32)); //read the timestamp bytes from the report data and verify it has not expired if (expiresAt < block.timestamp) { @@ -321,7 +312,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IFeeManager - function setNativeSurcharge(uint64 surcharge) external onlyOwner { + function setNativeSurcharge( + uint64 surcharge + ) external onlyOwner { if (surcharge > PERCENTAGE_SCALAR) revert InvalidSurcharge(); s_nativeSurcharge = surcharge; @@ -382,7 +375,9 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { * @notice Gets the current version of the report that is encoded as the last two bytes of the feed * @param feedId feed id to get the report version for */ - function _getReportVersion(bytes32 feedId) internal pure returns (bytes32) { + function _getReportVersion( + bytes32 feedId + ) internal pure returns (bytes32) { return REPORT_VERSION_MASK & feedId; } @@ -428,15 +423,11 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 totalNumberOfFees = numberOfLinkFees + numberOfNativeFees; for (uint256 i; i < totalNumberOfFees; ++i) { if (feesAndRewards[i].fee.assetAddress == i_linkAddress) { - linkRewards[linkRewardsIndex++] = IRewardManager.FeePayment( - feesAndRewards[i].configDigest, - uint192(feesAndRewards[i].reward.amount) - ); + linkRewards[linkRewardsIndex++] = + IRewardManager.FeePayment(feesAndRewards[i].configDigest, uint192(feesAndRewards[i].reward.amount)); } else { - nativeFeeLinkRewards[nativeFeeLinkRewardsIndex++] = IRewardManager.FeePayment( - feesAndRewards[i].configDigest, - uint192(feesAndRewards[i].reward.amount) - ); + nativeFeeLinkRewards[nativeFeeLinkRewardsIndex++] = + IRewardManager.FeePayment(feesAndRewards[i].configDigest, uint192(feesAndRewards[i].reward.amount)); totalNativeFee += feesAndRewards[i].fee.amount; totalNativeFeeLinkValue += feesAndRewards[i].reward.amount; } @@ -501,13 +492,15 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { function _transfer(address to, uint256 quantity) internal { if (quantity != 0) { - (bool success, ) = payable(to).call{value: quantity}(""); + (bool success,) = payable(to).call{value: quantity}(""); if (!success) revert InvalidReceivingAddress(); } } /// @inheritdoc IFeeManager - function payLinkDeficit(bytes32 configDigest) external onlyOwner { + function payLinkDeficit( + bytes32 configDigest + ) external onlyOwner { uint256 deficit = s_linkDeficit[configDigest]; if (deficit == 0) revert ZeroDeficit(); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol index 7facd3e494..c599b15071 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol @@ -2,10 +2,11 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IRewardManager} from "./interfaces/IRewardManager.sol"; -import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; + import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {Common} from "../libraries/Common.sol"; +import {IRewardManager} from "./interfaces/IRewardManager.sol"; +import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; /** @@ -66,7 +67,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { * @notice Constructor * @param linkAddress address of the wrapped LINK token */ - constructor(address linkAddress) ConfirmedOwner(msg.sender) { + constructor( + address linkAddress + ) ConfirmedOwner(msg.sender) { //ensure that the address ia not zero if (linkAddress == address(0)) revert InvalidAddress(); @@ -79,7 +82,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } // @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == this.onFeePaid.selector; } @@ -88,7 +93,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { _; } - modifier onlyOwnerOrRecipientInPool(bytes32 poolId) { + modifier onlyOwnerOrRecipientInPool( + bytes32 poolId + ) { if (msg.sender != owner() && s_rewardRecipientWeights[poolId][msg.sender] == 0) revert Unauthorized(); _; } @@ -120,7 +127,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IRewardManager - function claimRewards(bytes32[] memory poolIds) external override { + function claimRewards( + bytes32[] memory poolIds + ) external override { _claimRewards(msg.sender, poolIds); } @@ -271,7 +280,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IRewardManager - function setFeeManager(address newFeeManagerAddress) external onlyOwner { + function setFeeManager( + address newFeeManagerAddress + ) external onlyOwner { if (newFeeManagerAddress == address(0)) revert InvalidAddress(); s_feeManagerAddress = newFeeManagerAddress; diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol index 0d516dd027..bf3adfffd3 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol @@ -2,11 +2,13 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; + +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + +import {Common} from "../libraries/Common.sol"; import {IVerifier} from "./interfaces/IVerifier.sol"; import {IVerifierProxy} from "./interfaces/IVerifierProxy.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {Common} from "../libraries/Common.sol"; // OCR2 standard uint256 constant MAX_NUM_ORACLES = 31; @@ -132,7 +134,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { mapping(bytes32 => VerifierState) internal s_verifierStates; /// @param verifierProxyAddr The address of the VerifierProxy contract - constructor(address verifierProxyAddr) ConfirmedOwner(msg.sender) { + constructor( + address verifierProxyAddr + ) ConfirmedOwner(msg.sender) { if (verifierProxyAddr == address(0)) revert ZeroAddress(); i_verifierProxyAddr = verifierProxyAddr; } @@ -145,7 +149,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool isVerifier) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool isVerifier) { return interfaceId == this.verify.selector; } @@ -160,13 +166,8 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { address sender ) external override returns (bytes memory verifierResponse) { if (msg.sender != i_verifierProxyAddr) revert AccessForbidden(); - ( - bytes32[3] memory reportContext, - bytes memory reportData, - bytes32[] memory rs, - bytes32[] memory ss, - bytes32 rawVs - ) = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); + (bytes32[3] memory reportContext, bytes memory reportData, bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) + = abi.decode(signedReport, (bytes32[3], bytes, bytes32[], bytes32[], bytes32)); // reportContext consists of: // reportContext[0]: ConfigDigest @@ -319,7 +320,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifier - function activateConfig(bytes32 configDigest) external onlyOwner { + function activateConfig( + bytes32 configDigest + ) external onlyOwner { VerifierState storage verifierState = s_verifierStates[configDigest]; if (configDigest == bytes32("")) revert DigestEmpty(); @@ -329,7 +332,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifier - function deactivateConfig(bytes32 configDigest) external onlyOwner { + function deactivateConfig( + bytes32 configDigest + ) external onlyOwner { VerifierState storage verifierState = s_verifierStates[configDigest]; if (configDigest == bytes32("")) revert DigestEmpty(); @@ -339,7 +344,9 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifier - function latestConfigDetails(bytes32 configDigest) external view override returns (uint32 blockNumber) { + function latestConfigDetails( + bytes32 configDigest + ) external view override returns (uint32 blockNumber) { VerifierState storage verifierState = s_verifierStates[configDigest]; return (verifierState.latestConfigBlockNumber); } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/VerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/VerifierProxy.sol index ca2740943b..8dca31caf5 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/VerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/VerifierProxy.sol @@ -2,13 +2,15 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {IVerifierProxy} from "./interfaces/IVerifierProxy.sol"; -import {IVerifier} from "./interfaces/IVerifier.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + import {AccessControllerInterface} from "../../shared/interfaces/AccessControllerInterface.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; + import {Common} from "../libraries/Common.sol"; +import {IVerifier} from "./interfaces/IVerifier.sol"; +import {IVerifierFeeManager} from "./interfaces/IVerifierFeeManager.sol"; +import {IVerifierProxy} from "./interfaces/IVerifierProxy.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; /** * The verifier proxy contract is the gateway for all report verification requests @@ -88,7 +90,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { /// @notice The contract to control fees for report verification IVerifierFeeManager public s_feeManager; - constructor(AccessControllerInterface accessController) ConfirmedOwner(msg.sender) { + constructor( + AccessControllerInterface accessController + ) ConfirmedOwner(msg.sender) { s_accessController = accessController; } @@ -103,13 +107,17 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { _; } - modifier onlyValidVerifier(address verifierAddress) { + modifier onlyValidVerifier( + address verifierAddress + ) { if (verifierAddress == address(0)) revert ZeroAddress(); if (!IERC165(verifierAddress).supportsInterface(IVerifier.verify.selector)) revert VerifierInvalid(); _; } - modifier onlyUnsetConfigDigest(bytes32 configDigest) { + modifier onlyUnsetConfigDigest( + bytes32 configDigest + ) { address configDigestVerifier = s_verifiersByConfig[configDigest]; if (configDigestVerifier != address(0)) revert ConfigDigestAlreadySet(configDigest, configDigestVerifier); _; @@ -156,7 +164,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { return verifiedReports; } - function _verify(bytes calldata payload) internal returns (bytes memory verifiedReport) { + function _verify( + bytes calldata payload + ) internal returns (bytes memory verifiedReport) { // First 32 bytes of the signed report is the config digest bytes32 configDigest = bytes32(payload); address verifierAddress = s_verifiersByConfig[configDigest]; @@ -166,7 +176,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifierProxy - function initializeVerifier(address verifierAddress) external override onlyOwner onlyValidVerifier(verifierAddress) { + function initializeVerifier( + address verifierAddress + ) external override onlyOwner onlyValidVerifier(verifierAddress) { if (s_initializedVerifiers[verifierAddress]) revert VerifierAlreadyInitialized(verifierAddress); s_initializedVerifiers[verifierAddress] = true; @@ -194,7 +206,9 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifierProxy - function unsetVerifier(bytes32 configDigest) external override onlyOwner { + function unsetVerifier( + bytes32 configDigest + ) external override onlyOwner { address verifierAddress = s_verifiersByConfig[configDigest]; if (verifierAddress == address(0)) revert VerifierNotFound(configDigest); delete s_verifiersByConfig[configDigest]; @@ -202,24 +216,30 @@ contract VerifierProxy is IVerifierProxy, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IVerifierProxy - function getVerifier(bytes32 configDigest) external view override returns (address) { + function getVerifier( + bytes32 configDigest + ) external view override returns (address) { return s_verifiersByConfig[configDigest]; } /// @inheritdoc IVerifierProxy - function setAccessController(AccessControllerInterface accessController) external onlyOwner { + function setAccessController( + AccessControllerInterface accessController + ) external onlyOwner { address oldAccessController = address(s_accessController); s_accessController = accessController; emit AccessControllerSet(oldAccessController, address(accessController)); } /// @inheritdoc IVerifierProxy - function setFeeManager(IVerifierFeeManager feeManager) external onlyOwner { + function setFeeManager( + IVerifierFeeManager feeManager + ) external onlyOwner { if (address(feeManager) == address(0)) revert ZeroAddress(); if ( - !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFee.selector) || - !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFeeBulk.selector) + !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFee.selector) + || !IERC165(feeManager).supportsInterface(IVerifierFeeManager.processFeeBulk.selector) ) revert FeeManagerInvalid(); address oldFeeManager = address(s_feeManager); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/ChannelConfigStore.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/ChannelConfigStore.sol index 465292d9e0..5720ec9f5f 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/ChannelConfigStore.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/ChannelConfigStore.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.19; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; -import {IChannelConfigStore} from "./interfaces/IChannelConfigStore.sol"; + import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; +import {IChannelConfigStore} from "./interfaces/IChannelConfigStore.sol"; contract ChannelConfigStore is ConfirmedOwner, IChannelConfigStore, ITypeAndVersion { event NewChannelDefinition(uint256 indexed donId, uint32 version, string url, bytes32 sha); @@ -23,7 +24,9 @@ contract ChannelConfigStore is ConfirmedOwner, IChannelConfigStore, ITypeAndVers return "ChannelConfigStore 0.0.1"; } - function supportsInterface(bytes4 interfaceId) external pure returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure returns (bool) { return interfaceId == type(IChannelConfigStore).interfaceId; } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol index 0417229119..8b2ab37be2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol @@ -3,8 +3,9 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; import {ITypeAndVersion} from "../../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + import {IConfigurator} from "./interfaces/IConfigurator.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; // OCR2 standard uint256 constant MAX_NUM_ORACLES = 31; @@ -16,8 +17,8 @@ uint256 constant MIN_SUPPORTED_ONCHAIN_CONFIG_VERSION = 1; * @title Configurator * @author samsondav * @notice This contract is intended to be deployed on the source chain and acts as a OCR3 configurator for LLO/Mercury - **/ - + * + */ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 { /// @notice This error is thrown whenever trying to set a config /// with a fault tolerance of 0 @@ -161,9 +162,9 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 ConfigurationState memory configurationState = s_configurationStates[configId]; if ( - predecessorConfigDigest == bytes32(0) || - predecessorConfigDigest != - s_configurationStates[configId].configDigest[configurationState.isGreenProduction ? 1 : 0] + predecessorConfigDigest == bytes32(0) + || predecessorConfigDigest + != s_configurationStates[configId].configDigest[configurationState.isGreenProduction ? 1 : 0] ) revert InvalidPredecessorConfigDigest(predecessorConfigDigest); _setConfig( @@ -197,11 +198,13 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 // cause "gaps" to be created, but that seems unavoidable in such a scenario. function promoteStagingConfig(bytes32 configId, bool isGreenProduction) external onlyOwner { ConfigurationState storage configurationState = s_configurationStates[configId]; - if (isGreenProduction != configurationState.isGreenProduction) + if (isGreenProduction != configurationState.isGreenProduction) { revert IsGreenProductionMustMatchContractState(configId, !isGreenProduction); + } if (configurationState.configCount == 0) revert ConfigUnset(configId); - if (configurationState.configDigest[isGreenProduction ? 0 : 1] == bytes32(0)) + if (configurationState.configDigest[isGreenProduction ? 0 : 1] == bytes32(0)) { revert ConfigUnsetStaging(configId, isGreenProduction); + } bytes32 retiredConfigDigest = configurationState.configDigest[isGreenProduction ? 1 : 0]; if (retiredConfigDigest == bytes32(0)) revert ConfigUnsetProduction(configId, isGreenProduction); @@ -330,7 +333,9 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool isVerifier) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool isVerifier) { return interfaceId == type(IConfigurator).interfaceId; } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/ChannelConfigStore.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/ChannelConfigStore.t.sol index afea37f48a..7e64b8b793 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/ChannelConfigStore.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/ChannelConfigStore.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {IChannelConfigStore} from "../interfaces/IChannelConfigStore.sol"; -import {Test} from "forge-std/Test.sol"; import {ChannelConfigStore} from "../ChannelConfigStore.sol"; +import {IChannelConfigStore} from "../interfaces/IChannelConfigStore.sol"; import {ExposedChannelConfigStore} from "./mocks/ExposedChannelConfigStore.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title ChannelConfigStoreTest @@ -13,6 +13,7 @@ import {ExposedChannelConfigStore} from "./mocks/ExposedChannelConfigStore.sol"; */ contract ChannelConfigStoreTest is Test { ExposedChannelConfigStore public channelConfigStore; + event NewChannelDefinition(uint256 indexed donId, uint32 version, string url, bytes32 sha); function setUp() public virtual { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/BaseConfiguratorTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/BaseConfiguratorTest.t.sol index fb44c1f198..ab0cde98e0 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/BaseConfiguratorTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/BaseConfiguratorTest.t.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {IConfigurator} from "../../interfaces/IConfigurator.sol"; -import {Test} from "forge-std/Test.sol"; import {Configurator} from "../../Configurator.sol"; -import {ExposedConfigurator} from "../mocks/ExposedConfigurator.sol"; +import {IConfigurator} from "../../interfaces/IConfigurator.sol"; + import {ExposedChannelConfigStore} from "../mocks/ExposedChannelConfigStore.sol"; +import {ExposedConfigurator} from "../mocks/ExposedConfigurator.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title ConfiguratorTest @@ -73,7 +74,9 @@ contract BaseTest is Test { } } - function _getSigners(uint256 numSigners) internal view returns (bytes[] memory) { + function _getSigners( + uint256 numSigners + ) internal view returns (bytes[] memory) { bytes[] memory signers = new bytes[](numSigners); for (uint256 i; i < numSigners; i++) { signers[i] = s_signers[i]; @@ -81,7 +84,9 @@ contract BaseTest is Test { return signers; } - function _getOffchainTransmitters(uint256 numTransmitters) internal pure returns (bytes32[] memory) { + function _getOffchainTransmitters( + uint256 numTransmitters + ) internal pure returns (bytes32[] memory) { bytes32[] memory transmitters = new bytes32[](numTransmitters); for (uint256 i; i < numTransmitters; i++) { transmitters[i] = bytes32(101 + i); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorPromoteStagingConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorPromoteStagingConfigTest.t.sol index 604c9d266e..1954bec92a 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorPromoteStagingConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorPromoteStagingConfigTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseConfiguratorTest.t.sol"; import {Configurator} from "../../Configurator.sol"; +import {BaseTest} from "./BaseConfiguratorTest.t.sol"; contract ConfiguratorPromoteStagingConfigTest is BaseTest { function setUp() public virtual override { @@ -32,8 +32,7 @@ contract ConfiguratorPromoteStagingConfigTest is BaseTest { function test_revertsIfStagingConfigDigestIsZero() public { // isGreenProduction = false s_exposedConfigurator.exposedSetConfigurationState( - CONFIG_ID_1, - Configurator.ConfigurationState(1, uint32(block.number), false, [bytes32(0), bytes32(0)]) + CONFIG_ID_1, Configurator.ConfigurationState(1, uint32(block.number), false, [bytes32(0), bytes32(0)]) ); vm.expectRevert(abi.encodeWithSelector(Configurator.ConfigUnsetStaging.selector, CONFIG_ID_1, false)); @@ -41,8 +40,7 @@ contract ConfiguratorPromoteStagingConfigTest is BaseTest { // isGreenProduction = true s_exposedConfigurator.exposedSetConfigurationState( - CONFIG_ID_1, - Configurator.ConfigurationState(1, uint32(block.number), true, [bytes32(0), bytes32(0)]) + CONFIG_ID_1, Configurator.ConfigurationState(1, uint32(block.number), true, [bytes32(0), bytes32(0)]) ); vm.expectRevert(abi.encodeWithSelector(Configurator.ConfigUnsetStaging.selector, CONFIG_ID_1, true)); @@ -75,10 +73,7 @@ contract ConfiguratorPromoteStagingConfigTest is BaseTest { s_exposedConfigurator.exposedSetConfigurationState( CONFIG_ID_1, Configurator.ConfigurationState( - 1, - uint32(block.number), - false, - [keccak256("productionConfigDigest"), keccak256("stagingConfigDigest")] + 1, uint32(block.number), false, [keccak256("productionConfigDigest"), keccak256("stagingConfigDigest")] ) ); @@ -93,10 +88,7 @@ contract ConfiguratorPromoteStagingConfigTest is BaseTest { s_exposedConfigurator.exposedSetConfigurationState( CONFIG_ID_1, Configurator.ConfigurationState( - 1, - uint32(block.number), - true, - [keccak256("stagingConfigDigest"), keccak256("productionConfigDigest")] + 1, uint32(block.number), true, [keccak256("stagingConfigDigest"), keccak256("productionConfigDigest")] ) ); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol index c4c177ef4c..e1a0a9cd79 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseConfiguratorTest.t.sol"; import {Configurator} from "../../Configurator.sol"; +import {BaseTest} from "./BaseConfiguratorTest.t.sol"; contract ConfiguratorSetProductionConfigTest is BaseTest { function setUp() public virtual override { @@ -15,13 +15,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { vm.startPrank(USER); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - FAULT_TOLERANCE, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, FAULT_TOLERANCE, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -29,13 +23,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { bytes[] memory signers = new bytes[](MAX_ORACLES + 1); vm.expectRevert(abi.encodeWithSelector(Configurator.ExcessSigners.selector, signers.length, MAX_ORACLES)); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - FAULT_TOLERANCE, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, FAULT_TOLERANCE, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -43,13 +31,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { vm.expectRevert(abi.encodeWithSelector(Configurator.FaultToleranceMustBePositive.selector)); bytes[] memory signers = _getSigners(MAX_ORACLES); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - 0, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, 0, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -60,13 +42,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { abi.encodeWithSelector(Configurator.InsufficientSigners.selector, signers.length, FAULT_TOLERANCE * 3 + 1) ); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - FAULT_TOLERANCE, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, FAULT_TOLERANCE, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -79,32 +55,18 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { vm.expectRevert(abi.encodeWithSelector(Configurator.InvalidOnchainLength.selector, onchainConfig.length)); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); onchainConfig = abi.encode(uint256(0), bytes32(0)); vm.expectRevert(abi.encodeWithSelector(Configurator.UnsupportedOnchainConfigVersion.selector, uint256(0))); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); - onchainConfig = abi.encode( - uint256(1), - keccak256("any non-zero predecessor config digest is invalid for production") - ); + onchainConfig = + abi.encode(uint256(1), keccak256("any non-zero predecessor config digest is invalid for production")); vm.expectRevert( abi.encodeWithSelector( @@ -113,13 +75,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { ) ); s_configurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); } @@ -164,13 +120,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { ); s_exposedConfigurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); } @@ -215,18 +165,11 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { ); s_exposedConfigurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); - Configurator.ConfigurationState memory configurationState = s_exposedConfigurator.exposedReadConfigurationStates( - CONFIG_ID_1 - ); + Configurator.ConfigurationState memory configurationState = + s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); assertEq(configurationState.configDigest[0], cd1); assertEq(configurationState.configDigest[1], 0); // no staging config yet assertEq(configurationState.configCount, 1); @@ -267,13 +210,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { ); s_exposedConfigurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); configurationState = s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); @@ -319,13 +256,7 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { ); s_exposedConfigurator.setProductionConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); configurationState = s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol index cab35c4500..a482fe61f1 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseConfiguratorTest.t.sol"; import {Configurator} from "../../Configurator.sol"; +import {BaseTest} from "./BaseConfiguratorTest.t.sol"; contract ConfiguratorSetStagingConfigTest is BaseTest { function setUp() public virtual override { @@ -15,13 +15,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { vm.startPrank(USER); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - FAULT_TOLERANCE, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, FAULT_TOLERANCE, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -29,13 +23,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { bytes[] memory signers = new bytes[](MAX_ORACLES + 1); vm.expectRevert(abi.encodeWithSelector(Configurator.ExcessSigners.selector, signers.length, MAX_ORACLES)); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - FAULT_TOLERANCE, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, FAULT_TOLERANCE, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -43,13 +31,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { vm.expectRevert(abi.encodeWithSelector(Configurator.FaultToleranceMustBePositive.selector)); bytes[] memory signers = _getSigners(MAX_ORACLES); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - 0, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, 0, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -60,13 +42,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { abi.encodeWithSelector(Configurator.InsufficientSigners.selector, signers.length, FAULT_TOLERANCE * 3 + 1) ); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - s_offchaintransmitters, - FAULT_TOLERANCE, - bytes(""), - OFFCHAIN_CONFIG_VERSION, - bytes("") + CONFIG_ID_1, signers, s_offchaintransmitters, FAULT_TOLERANCE, bytes(""), OFFCHAIN_CONFIG_VERSION, bytes("") ); } @@ -79,26 +55,14 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { vm.expectRevert(abi.encodeWithSelector(Configurator.InvalidOnchainLength.selector, onchainConfig.length)); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); onchainConfig = abi.encode(uint256(0), keccak256("previousConfigDigest")); vm.expectRevert(abi.encodeWithSelector(Configurator.UnsupportedOnchainConfigVersion.selector, uint256(0))); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); onchainConfig = abi.encode(uint256(1), keccak256("previousConfigDigest")); @@ -107,26 +71,14 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { abi.encodeWithSelector(Configurator.InvalidPredecessorConfigDigest.selector, keccak256("previousConfigDigest")) ); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); onchainConfig = abi.encode(uint256(1), uint256(0)); vm.expectRevert(abi.encodeWithSelector(Configurator.InvalidPredecessorConfigDigest.selector, uint256(0))); s_configurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); } @@ -140,8 +92,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { bytes32 productionConfigDigest = keccak256("productionConfigDigest"); s_exposedConfigurator.exposedSetConfigurationState( - CONFIG_ID_1, - Configurator.ConfigurationState(1, uint32(block.number), false, [productionConfigDigest, bytes32(0)]) + CONFIG_ID_1, Configurator.ConfigurationState(1, uint32(block.number), false, [productionConfigDigest, bytes32(0)]) ); bytes memory onchainConfig = abi.encodePacked(uint256(1), productionConfigDigest); bytes memory offchainConfig = abi.encodePacked(keccak256("offchainConfig")); @@ -179,18 +130,11 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { ); s_exposedConfigurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); - Configurator.ConfigurationState memory configurationState = s_exposedConfigurator.exposedReadConfigurationStates( - CONFIG_ID_1 - ); + Configurator.ConfigurationState memory configurationState = + s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); assertEq(configurationState.configDigest[0], productionConfigDigest); assertEq(configurationState.configDigest[1], cd1); assertEq(configurationState.configCount, 2); @@ -231,13 +175,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { ); s_exposedConfigurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); configurationState = s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); @@ -284,13 +222,7 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { ); s_exposedConfigurator.setStagingConfig( - CONFIG_ID_1, - signers, - offchainTransmitters, - f, - onchainConfig, - OFFCHAIN_CONFIG_VERSION, - offchainConfig + CONFIG_ID_1, signers, offchainTransmitters, f, onchainConfig, OFFCHAIN_CONFIG_VERSION, offchainConfig ); configurationState = s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorTest.t.sol index 272cbb2e0d..1b5ebb4ea1 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseConfiguratorTest.t.sol"; import {Configurator} from "../../Configurator.sol"; import {IConfigurator} from "../../interfaces/IConfigurator.sol"; +import {BaseTest} from "./BaseConfiguratorTest.t.sol"; contract ConfiguratorTest is BaseTest { function setUp() public virtual override { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedChannelConfigStore.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedChannelConfigStore.sol index 1ffd51210f..417ebbfd3b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedChannelConfigStore.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedChannelConfigStore.sol @@ -9,7 +9,9 @@ import {ChannelConfigStore} from "../../ChannelConfigStore.sol"; contract ExposedChannelConfigStore is ChannelConfigStore { constructor() {} - function exposedReadChannelDefinitionStates(uint256 donId) public view returns (uint256) { + function exposedReadChannelDefinitionStates( + uint256 donId + ) public view returns (uint256) { return s_channelDefinitionVersions[donId]; } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedConfigurator.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedConfigurator.sol index 29a2bde54c..5d8cd5fa4e 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedConfigurator.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/mocks/ExposedConfigurator.sol @@ -9,7 +9,9 @@ import {Configurator} from "../../Configurator.sol"; contract ExposedConfigurator is Configurator { constructor() {} - function exposedReadConfigurationStates(bytes32 configId) public view returns (ConfigurationState memory) { + function exposedReadConfigurationStates( + bytes32 configId + ) public view returns (ConfigurationState memory) { return s_configurationStates[configId]; } @@ -33,18 +35,17 @@ contract ExposedConfigurator is Configurator { uint64 _encodedConfigVersion, bytes memory _encodedConfig ) public pure returns (bytes32) { - return - _configDigestFromConfigData( - _configId, - _chainId, - _contractAddress, - _configCount, - _signers, - _offchainTransmitters, - _f, - _onchainConfig, - _encodedConfigVersion, - _encodedConfig - ); + return _configDigestFromConfigData( + _configId, + _chainId, + _contractAddress, + _configCount, + _signers, + _offchainTransmitters, + _f, + _onchainConfig, + _encodedConfigVersion, + _encodedConfig + ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol index cb6b19fc0a..162eb92805 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; import {IVerifierFeeManager} from "./IVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IFeeManager is IERC165, IVerifierFeeManager { /** @@ -23,7 +23,9 @@ interface IFeeManager is IERC165, IVerifierFeeManager { * @notice Sets the native surcharge * @param surcharge surcharge to be paid if paying in native */ - function setNativeSurcharge(uint64 surcharge) external; + function setNativeSurcharge( + uint64 surcharge + ) external; /** * @notice Adds a subscriber to the fee manager @@ -52,7 +54,9 @@ interface IFeeManager is IERC165, IVerifierFeeManager { * @notice Admin function to pay the LINK deficit for a given config digest * @param configDigest the config digest to pay the deficit for */ - function payLinkDeficit(bytes32 configDigest) external; + function payLinkDeficit( + bytes32 configDigest + ) external; /** * @notice Adds a subscriber to the fee manager @@ -67,7 +71,7 @@ interface IFeeManager is IERC165, IVerifierFeeManager { * @param digest the digest linked to the fee and reward * @param fee the fee paid to verify the report * @param reward the reward paid upon verification - & @param appliedDiscount the discount applied to the reward + * & @param appliedDiscount the discount applied to the reward */ struct FeeAndReward { bytes32 configDigest; diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol index 55075384ed..644cde5b5e 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IRewardManager is IERC165 { /** @@ -16,7 +16,9 @@ interface IRewardManager is IERC165 { * @notice Claims the rewards in a specific pool * @param poolIds array of poolIds to claim rewards for */ - function claimRewards(bytes32[] calldata poolIds) external; + function claimRewards( + bytes32[] calldata poolIds + ) external; /** * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else updateRewardRecipients should be used. @@ -43,7 +45,9 @@ interface IRewardManager is IERC165 { * @notice Sets the fee manager. This needs to be done post construction to prevent a circular dependency. * @param newFeeManager address of the new verifier proxy */ - function setFeeManager(address newFeeManager) external; + function setFeeManager( + address newFeeManager + ) external; /** * @notice Gets a list of pool ids which have reward for a specific recipient. diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifier.sol index 2356b16832..a028504f48 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifier.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IVerifier is IERC165 { /** @@ -51,19 +51,25 @@ interface IVerifier is IERC165 { * @param configDigest The config digest to activate * @dev This function can be called by the contract admin to activate a configuration. */ - function activateConfig(bytes32 configDigest) external; + function activateConfig( + bytes32 configDigest + ) external; /** * @notice Deactivates the configuration for a config digest * @param configDigest The config digest to deactivate * @dev This function can be called by the contract admin to deactivate an incorrect configuration. */ - function deactivateConfig(bytes32 configDigest) external; + function deactivateConfig( + bytes32 configDigest + ) external; /** * @notice information about current offchain reporting protocol configuration * @param configDigest Config Digest to fetch data for * @return blockNumber block at which this config was set */ - function latestConfigDetails(bytes32 configDigest) external view returns (uint32 blockNumber); + function latestConfigDetails( + bytes32 configDigest + ) external view returns (uint32 blockNumber); } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierFeeManager.sol index c63bc22e17..5f2b0c68fd 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierFeeManager.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {Common} from "../../libraries/Common.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IVerifierFeeManager is IERC165 { /** diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierProxy.sol index 684d637407..0843e5d990 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IVerifierProxy.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {Common} from "../../libraries/Common.sol"; import {AccessControllerInterface} from "../../../shared/interfaces/AccessControllerInterface.sol"; +import {Common} from "../../libraries/Common.sol"; import {IVerifierFeeManager} from "./IVerifierFeeManager.sol"; interface IVerifierProxy { @@ -36,7 +36,9 @@ interface IVerifierProxy { * @notice Sets the verifier address initially, allowing `setVerifier` to be set by this Verifier in the future * @param verifierAddress The address of the verifier contract to initialize */ - function initializeVerifier(address verifierAddress) external; + function initializeVerifier( + address verifierAddress + ) external; /** * @notice Sets a new verifier for a config digest @@ -55,7 +57,9 @@ interface IVerifierProxy { * @notice Removes a verifier for a given config digest * @param configDigest The config digest of the verifier to remove */ - function unsetVerifier(bytes32 configDigest) external; + function unsetVerifier( + bytes32 configDigest + ) external; /** * @notice Retrieves the verifier address that verifies reports @@ -64,17 +68,23 @@ interface IVerifierProxy { * @return verifierAddress The address of the verifier contract that verifies * reports for a given config digest. */ - function getVerifier(bytes32 configDigest) external view returns (address verifierAddress); + function getVerifier( + bytes32 configDigest + ) external view returns (address verifierAddress); /** * @notice Called by the admin to set an access controller contract * @param accessController The new access controller to set */ - function setAccessController(AccessControllerInterface accessController) external; + function setAccessController( + AccessControllerInterface accessController + ) external; /** * @notice Updates the fee manager * @param feeManager The new fee manager */ - function setFeeManager(IVerifierFeeManager feeManager) external; + function setFeeManager( + IVerifierFeeManager feeManager + ) external; } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol index 02a51b32f8..e253a56072 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {FeeManager} from "../../FeeManager.sol"; -import {RewardManager} from "../../RewardManager.sol"; -import {Common} from "../../../libraries/Common.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; import {WERC20Mock} from "../../../../shared/mocks/WERC20Mock.sol"; +import {Common} from "../../../libraries/Common.sol"; +import {FeeManager} from "../../FeeManager.sol"; +import {RewardManager} from "../../RewardManager.sol"; + import {IRewardManager} from "../../interfaces/IRewardManager.sol"; import {FeeManagerProxy} from "../mocks/FeeManagerProxy.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title BaseFeeManagerTest @@ -167,55 +168,59 @@ contract BaseFeeManagerTest is Test { // solium-disable-next-line no-unused-vars function getFee(bytes memory report, address quote, address subscriber) public view returns (Common.Asset memory) { //get the fee - (Common.Asset memory fee, , ) = feeManager.getFeeAndReward(subscriber, report, quote); + (Common.Asset memory fee,,) = feeManager.getFeeAndReward(subscriber, report, quote); return fee; } function getReward(bytes memory report, address quote, address subscriber) public view returns (Common.Asset memory) { //get the reward - (, Common.Asset memory reward, ) = feeManager.getFeeAndReward(subscriber, report, quote); + (, Common.Asset memory reward,) = feeManager.getFeeAndReward(subscriber, report, quote); return reward; } function getAppliedDiscount(bytes memory report, address quote, address subscriber) public view returns (uint256) { //get the reward - (, , uint256 appliedDiscount) = feeManager.getFeeAndReward(subscriber, report, quote); + (,, uint256 appliedDiscount) = feeManager.getFeeAndReward(subscriber, report, quote); return appliedDiscount; } - function getV1Report(bytes32 feedId) public pure returns (bytes memory) { + function getV1Report( + bytes32 feedId + ) public pure returns (bytes memory) { return abi.encode(feedId, uint32(0), int192(0), int192(0), int192(0), uint64(0), bytes32(0), uint64(0), uint64(0)); } - function getV2Report(bytes32 feedId) public view returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(DEFAULT_REPORT_NATIVE_FEE), - uint192(DEFAULT_REPORT_LINK_FEE), - uint32(block.timestamp), - int192(0) - ); + function getV2Report( + bytes32 feedId + ) public view returns (bytes memory) { + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(DEFAULT_REPORT_NATIVE_FEE), + uint192(DEFAULT_REPORT_LINK_FEE), + uint32(block.timestamp), + int192(0) + ); } - function getV3Report(bytes32 feedId) public view returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(DEFAULT_REPORT_NATIVE_FEE), - uint192(DEFAULT_REPORT_LINK_FEE), - uint32(block.timestamp), - int192(0), - int192(0), - int192(0) - ); + function getV3Report( + bytes32 feedId + ) public view returns (bytes memory) { + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(DEFAULT_REPORT_NATIVE_FEE), + uint192(DEFAULT_REPORT_LINK_FEE), + uint32(block.timestamp), + int192(0), + int192(0), + int192(0) + ); } function getV3ReportWithCustomExpiryAndFee( @@ -224,18 +229,17 @@ contract BaseFeeManagerTest is Test { uint256 linkFee, uint256 nativeFee ) public pure returns (bytes memory) { - return - abi.encode( - feedId, - uint32(0), - uint32(0), - uint192(nativeFee), - uint192(linkFee), - uint32(expiry), - int192(0), - int192(0), - int192(0) - ); + return abi.encode( + feedId, + uint32(0), + uint32(0), + uint192(nativeFee), + uint192(linkFee), + uint32(expiry), + int192(0), + int192(0), + int192(0) + ); } function getLinkQuote() public view returns (address) { @@ -258,15 +262,21 @@ contract BaseFeeManagerTest is Test { changePrank(originalAddr); } - function getLinkBalance(address balanceAddress) public view returns (uint256) { + function getLinkBalance( + address balanceAddress + ) public view returns (uint256) { return link.balanceOf(balanceAddress); } - function getNativeBalance(address balanceAddress) public view returns (uint256) { + function getNativeBalance( + address balanceAddress + ) public view returns (uint256) { return native.balanceOf(balanceAddress); } - function getNativeUnwrappedBalance(address balanceAddress) public view returns (uint256) { + function getNativeUnwrappedBalance( + address balanceAddress + ) public view returns (uint256) { return balanceAddress.balance; } @@ -345,7 +355,9 @@ contract BaseFeeManagerTest is Test { changePrank(originalAddr); } - function getPayload(bytes memory reportPayload) public pure returns (bytes memory) { + function getPayload( + bytes memory reportPayload + ) public pure returns (bytes memory) { return abi.encode([DEFAULT_CONFIG_DIGEST, 0, 0], reportPayload, new bytes32[](1), new bytes32[](1), bytes32("")); } @@ -385,7 +397,9 @@ contract BaseFeeManagerTest is Test { changePrank(originalAddr); } - function getLinkDeficit(bytes32 configDigest) public view returns (uint256) { + function getLinkDeficit( + bytes32 configDigest + ) public view returns (uint256) { return feeManager.s_linkDeficit(configDigest); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol index c953b7f59d..c3b90209ac 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.getFeeAndReward.t.sol @@ -421,9 +421,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { //get the fee required by the feeManager Common.Asset memory fee = getFee( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), - getNativeQuote(), - USER + getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), getNativeQuote(), USER ); //fee should be zero @@ -439,9 +437,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { //get the fee required by the feeManager Common.Asset memory fee = getFee( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), - getNativeQuote(), - USER + getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, uint32(block.timestamp), 0, 0), getNativeQuote(), USER ); //fee should be zero @@ -558,10 +554,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { //get the fee required by the feeManager getFee( getV3ReportWithCustomExpiryAndFee( - DEFAULT_FEED_1_V3, - block.timestamp - 1, - DEFAULT_REPORT_LINK_FEE, - DEFAULT_REPORT_NATIVE_FEE + DEFAULT_FEED_1_V3, block.timestamp - 1, DEFAULT_REPORT_LINK_FEE, DEFAULT_REPORT_NATIVE_FEE ), getNativeQuote(), USER diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol index 62571946e4..392bad7cc8 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol @@ -2,8 +2,9 @@ pragma solidity 0.8.19; import {Common} from "../../../libraries/Common.sol"; -import "./BaseFeeManager.t.sol"; + import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import "./BaseFeeManager.t.sol"; /** * @title BaseFeeManagerTest @@ -79,11 +80,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_processFeeWithWithCorruptQuotePayload() public { //get the default payload bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV3Report(DEFAULT_FEED_1_V3), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV3Report(DEFAULT_FEED_1_V3), new bytes32[](1), new bytes32[](1), bytes32("") ); //expect an evm revert as the quote is corrupt @@ -291,11 +288,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_V1PayloadVerifies() public { //replicate a default payload bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV2Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV2Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); //processing the fee will transfer the link from the user to the rewardManager @@ -356,9 +349,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkWithNativeQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0)); //call processFee should not revert as the fee is 0 processFee(payload, PROXY, address(native), 0); @@ -366,9 +358,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkWithLinkQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, DEFAULT_REPORT_LINK_FEE, 0)); //approve the link to be transferred from the from the subscriber to the rewardManager approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, USER); @@ -388,9 +379,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { mintLink(address(feeManager), DEFAULT_REPORT_LINK_FEE); //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //approve the native to be transferred from the user approveNative(address(feeManager), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -413,9 +403,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_processFeeWithZeroLinkNonZeroNativeWithLinkQuote() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //call processFee should not revert as the fee is 0 processFee(payload, USER, address(link), 0); @@ -423,9 +412,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_processFeeWithZeroNativeNonZeroLinkReturnsChange() public { //get the default payload - bytes memory payload = getPayload( - getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE) - ); + bytes memory payload = + getPayload(getV3ReportWithCustomExpiryAndFee(DEFAULT_FEED_1_V3, block.timestamp, 0, DEFAULT_REPORT_NATIVE_FEE)); //call processFee should not revert as the fee is 0 processFee(payload, USER, address(link), DEFAULT_REPORT_NATIVE_FEE); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol index ce04848148..1e941173f6 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import "./BaseFeeManager.t.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import "./BaseFeeManager.t.sol"; /** * @title BaseFeeManagerTest @@ -81,11 +81,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { mintLink(address(feeManager), 1); bytes memory payloadV1 = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes memory linkPayloadV2 = getPayload(getV2Report(DEFAULT_FEED_1_V2)); @@ -114,11 +110,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { mintLink(address(feeManager), DEFAULT_REPORT_LINK_FEE * 4 + 1); bytes memory payloadV1 = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes memory nativePayloadV2 = getPayload(getV2Report(DEFAULT_FEED_1_V2)); @@ -143,11 +135,7 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { function test_processMultipleV1Reports() public { bytes memory payload = abi.encode( - [DEFAULT_CONFIG_DIGEST, 0, 0], - getV1Report(DEFAULT_FEED_1_V1), - new bytes32[](1), - new bytes32[](1), - bytes32("") + [DEFAULT_CONFIG_DIGEST, 0, 0], getV1Report(DEFAULT_FEED_1_V1), new bytes32[](1), new bytes32[](1), bytes32("") ); bytes[] memory payloads = new bytes[](NUMBER_OF_REPORTS); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol index c56c2dca28..985729a706 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "../verifier/BaseVerifierTest.t.sol"; import {SimpleWriteAccessController} from "../../../../shared/access/SimpleWriteAccessController.sol"; import {Common} from "../../../libraries/Common.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "../verifier/BaseVerifierTest.t.sol"; contract Verifier_setConfigV05 is BaseTest { address[] internal s_signerAddrs; @@ -73,9 +73,7 @@ contract Verifier_verifyWithFeeV05 is BaseTestWithConfiguredVerifierAndFeeManage function testVerifyProxyWithLinkFeeSuccess_gas() public { bytes memory signedLinkPayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); s_verifierProxy.verify(signedLinkPayload, abi.encode(link)); @@ -83,9 +81,7 @@ contract Verifier_verifyWithFeeV05 is BaseTestWithConfiguredVerifierAndFeeManage function testVerifyProxyWithNativeFeeSuccess_gas() public { bytes memory signedNativePayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); s_verifierProxy.verify(signedNativePayload, abi.encode(native)); @@ -132,9 +128,7 @@ contract Verifier_bulkVerifyWithFeeV05 is BaseTestWithConfiguredVerifierAndFeeMa function testBulkVerifyProxyWithLinkFeeSuccess_gas() public { bytes memory signedLinkPayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedLinkPayloads = new bytes[](NUMBER_OF_REPORTS_TO_VERIFY); @@ -147,9 +141,7 @@ contract Verifier_bulkVerifyWithFeeV05 is BaseTestWithConfiguredVerifierAndFeeMa function testBulkVerifyProxyWithNativeFeeSuccess_gas() public { bytes memory signedNativePayload = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedNativePayloads = new bytes[](NUMBER_OF_REPORTS_TO_VERIFY); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ErroredVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ErroredVerifier.sol index 2313ac6dd7..4da1b417ba 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ErroredVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ErroredVerifier.sol @@ -1,11 +1,13 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {IVerifier} from "../../interfaces/IVerifier.sol"; import {Common} from "../../../libraries/Common.sol"; +import {IVerifier} from "../../interfaces/IVerifier.sol"; contract ErroredVerifier is IVerifier { - function supportsInterface(bytes4 interfaceId) public pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) public pure override returns (bool) { return interfaceId == this.verify.selector; } @@ -49,15 +51,21 @@ contract ErroredVerifier is IVerifier { revert FailedToSetConfig(); } - function activateConfig(bytes32) external pure { + function activateConfig( + bytes32 + ) external pure { revert FailedToActivateConfig(); } - function deactivateConfig(bytes32) external pure { + function deactivateConfig( + bytes32 + ) external pure { revert FailedToDeactivateConfig(); } - function latestConfigDetails(bytes32) external pure override returns (uint32) { + function latestConfigDetails( + bytes32 + ) external pure override returns (uint32) { revert FailedToGetLatestConfigDetails(); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ExposedVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ExposedVerifier.sol index 1c004bf384..6eb6bb3d94 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ExposedVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/ExposedVerifier.sol @@ -52,18 +52,17 @@ contract ExposedVerifier { uint64 _encodedConfigVersion, bytes memory _encodedConfig ) public pure returns (bytes32) { - return - _configDigestFromConfigData( - _feedId, - _chainId, - _contractAddress, - _configCount, - _signers, - _offchainTransmitters, - _f, - _onchainConfig, - _encodedConfigVersion, - _encodedConfig - ); + return _configDigestFromConfigData( + _feedId, + _chainId, + _contractAddress, + _configCount, + _signers, + _offchainTransmitters, + _f, + _onchainConfig, + _encodedConfigVersion, + _encodedConfig + ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/FeeManagerProxy.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/FeeManagerProxy.sol index 9abb4c50c2..a00631fdab 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/FeeManagerProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/FeeManagerProxy.sol @@ -14,7 +14,9 @@ contract FeeManagerProxy { s_feeManager.processFeeBulk{value: msg.value}(payloads, parameterPayload, msg.sender); } - function setFeeManager(IFeeManager feeManager) public { + function setFeeManager( + IFeeManager feeManager + ) public { s_feeManager = feeManager; } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol index cac81cc181..674cb6ccbd 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol @@ -2,14 +2,17 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; -import {IFeeManager} from "../../interfaces/IFeeManager.sol"; + import {ITypeAndVersion} from "../../../../shared/interfaces/ITypeAndVersion.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + import {Common} from "../../../libraries/Common.sol"; +import {IFeeManager} from "../../interfaces/IFeeManager.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; + +import {IVerifierFeeManager} from "../../interfaces/IVerifierFeeManager.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; import {IERC20} from "@openzeppelin/contracts@4.8.3/interfaces/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC20.sol"; -import {IVerifierFeeManager} from "../../interfaces/IVerifierFeeManager.sol"; /** * @title MockFeeManager @@ -132,10 +135,8 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { address _rewardManagerAddress ) ConfirmedOwner(msg.sender) { if ( - _linkAddress == address(0) || - _nativeAddress == address(0) || - _proxyAddress == address(0) || - _rewardManagerAddress == address(0) + _linkAddress == address(0) || _nativeAddress == address(0) || _proxyAddress == address(0) + || _rewardManagerAddress == address(0) ) revert InvalidAddress(); i_linkAddress = _linkAddress; @@ -162,7 +163,9 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) external pure override returns (bool) { + function supportsInterface( + bytes4 interfaceId + ) external pure override returns (bool) { return interfaceId == this.processFee.selector || interfaceId == this.processFeeBulk.selector; } @@ -189,19 +192,12 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { uint256 feesAndRewardsIndex; for (uint256 i; i < payloads.length; ++i) { - (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = _processFee( - payloads[i], - parameterPayload, - subscriber - ); + (Common.Asset memory fee, Common.Asset memory reward, uint256 appliedDiscount) = + _processFee(payloads[i], parameterPayload, subscriber); if (fee.amount != 0) { - feesAndRewards[feesAndRewardsIndex++] = IFeeManager.FeeAndReward( - bytes32(payloads[i]), - fee, - reward, - appliedDiscount - ); + feesAndRewards[feesAndRewardsIndex++] = + IFeeManager.FeeAndReward(bytes32(payloads[i]), fee, reward, appliedDiscount); unchecked { //keep track of some tallys to make downstream calculations more efficient @@ -245,7 +241,9 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { } /// @inheritdoc IFeeManager - function setNativeSurcharge(uint64 surcharge) external onlyOwner { + function setNativeSurcharge( + uint64 surcharge + ) external onlyOwner { if (surcharge > PERCENTAGE_SCALAR) revert InvalidSurcharge(); s_nativeSurcharge = surcharge; @@ -300,7 +298,9 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { * @notice Gets the current version of the report that is encoded as the last two bytes of the feed * @param feedId feed id to get the report version for */ - function _getReportVersion(bytes32 feedId) internal pure returns (bytes32) { + function _getReportVersion( + bytes32 feedId + ) internal pure returns (bytes32) { return REPORT_VERSION_MASK & feedId; } @@ -336,7 +336,9 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { ) internal {} /// @inheritdoc IFeeManager - function payLinkDeficit(bytes32 configDigest) external onlyOwner { + function payLinkDeficit( + bytes32 configDigest + ) external onlyOwner { uint256 deficit = s_linkDeficit[configDigest]; emit LinkDeficitCleared(configDigest, deficit); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol index 21de68fb04..d51207a098 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; -import {RewardManager} from "../../RewardManager.sol"; + import {Common} from "../../../libraries/Common.sol"; +import {RewardManager} from "../../RewardManager.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {Test} from "forge-std/Test.sol"; /** * @title BaseRewardManagerTest @@ -192,11 +193,15 @@ contract BaseRewardManagerTest is Test { changePrank(originalAddr); } - function getAsset(uint256 quantity) public view returns (Common.Asset memory) { + function getAsset( + uint256 quantity + ) public view returns (Common.Asset memory) { return Common.Asset(address(asset), quantity); } - function getAssetBalance(address addr) public view returns (uint256) { + function getAssetBalance( + address addr + ) public view returns (uint256) { return asset.balanceOf(addr); } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol index efbe9fd6b3..1774be972b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest @@ -550,11 +550,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { function test_getRewardsAvailableToRecipientInBothPools() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[0].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[0].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); @@ -563,11 +560,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { function test_getRewardsAvailableToRecipientInSinglePool() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[1].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[1].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); @@ -585,11 +579,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { function test_getRewardsAvailableToRecipientInBothPoolsWhereAlreadyClaimed() public { //get index 0 as this recipient is in both default pools - bytes32[] memory poolIds = rewardManager.getAvailableRewardPoolIds( - getPrimaryRecipients()[0].addr, - 0, - type(uint256).max - ); + bytes32[] memory poolIds = + rewardManager.getAvailableRewardPoolIds(getPrimaryRecipients()[0].addr, 0, type(uint256).max); //check the recipient is in both pools assertEq(poolIds[0], PRIMARY_POOL_ID); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.general.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.general.t.sol index 87cc10b9fb..6dd88b79f2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.general.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.general.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; -import {RewardManager} from "../../RewardManager.sol"; import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; +import {RewardManager} from "../../RewardManager.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.payRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.payRecipients.t.sol index 89fac663ba..644dd8a9a2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.payRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.payRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {IRewardManager} from "../../interfaces/IRewardManager.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest @@ -141,10 +141,7 @@ contract RewardManagerPayRecipientsTest is BaseRewardManagerTest { } //check the pool has the remaining balance - assertEq( - getAssetBalance(address(rewardManager)), - POOL_DEPOSIT_AMOUNT - expectedRecipientAmount * recipients.length - ); + assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT - expectedRecipientAmount * recipients.length); } function test_payAllRecipientsFromNonAdminUser() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.setRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.setRecipients.t.sol index d3e6990bd9..5b675db04b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.setRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.setRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol index 0d3a2b69b3..4e47d96d34 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.updateRewardRecipients.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; import {Common} from "../../../libraries/Common.sol"; +import {BaseRewardManagerTest} from "./BaseRewardManager.t.sol"; /** * @title BaseRewardManagerTest @@ -294,12 +294,10 @@ contract RewardManagerUpdateRewardRecipientsTest is BaseRewardManagerTest { //manually check the balance of each recipient assertEq( - getAssetBalance(DEFAULT_RECIPIENT_1), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_1), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(DEFAULT_RECIPIENT_2), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_2), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( getAssetBalance(DEFAULT_RECIPIENT_3), @@ -343,8 +341,7 @@ contract RewardManagerUpdateRewardRecipientsTest is BaseRewardManagerTest { //manually check the balance of each recipient assertEq( - getAssetBalance(DEFAULT_RECIPIENT_1), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(DEFAULT_RECIPIENT_1), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( getAssetBalance(DEFAULT_RECIPIENT_2), @@ -439,12 +436,10 @@ contract RewardManagerUpdateRewardRecipientsMultiplePoolsTest is BaseRewardManag (POOL_DEPOSIT_AMOUNT * TEN_PERCENT * 4) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(recipients[2].addr), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(recipients[2].addr), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); assertEq( - getAssetBalance(recipients[3].addr), - (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount + getAssetBalance(recipients[3].addr), (POOL_DEPOSIT_AMOUNT * TEN_PERCENT) / POOL_SCALAR + expectedRecipientAmount ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol index 23996dfc67..249410351c 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol @@ -1,19 +1,22 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {Test} from "forge-std/Test.sol"; -import {VerifierProxy} from "../../VerifierProxy.sol"; -import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {IVerifier} from "../../interfaces/IVerifier.sol"; -import {ErroredVerifier} from "../mocks/ErroredVerifier.sol"; -import {Verifier} from "../../Verifier.sol"; -import {Strings} from "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; -import {FeeManager} from "../../FeeManager.sol"; -import {Common} from "../../../libraries/Common.sol"; + import {ERC20Mock} from "../../../../shared/mocks/ERC20Mock.sol"; import {WERC20Mock} from "../../../../shared/mocks/WERC20Mock.sol"; +import {Common} from "../../../libraries/Common.sol"; +import {FeeManager} from "../../FeeManager.sol"; + import {RewardManager} from "../../RewardManager.sol"; +import {Verifier} from "../../Verifier.sol"; +import {VerifierProxy} from "../../VerifierProxy.sol"; +import {IVerifier} from "../../interfaces/IVerifier.sol"; +import {ErroredVerifier} from "../mocks/ErroredVerifier.sol"; +import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; + +import {Strings} from "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; +import {Test} from "forge-std/Test.sol"; contract BaseTest is Test { uint256 internal constant MAX_ORACLES = 31; @@ -114,7 +117,9 @@ contract BaseTest is Test { } } - function _getSigners(uint256 numSigners) internal view returns (Signer[] memory) { + function _getSigners( + uint256 numSigners + ) internal view returns (Signer[] memory) { Signer[] memory signers = new Signer[](numSigners); for (uint256 i; i < numSigners; i++) { signers[i] = s_signers[i]; @@ -122,7 +127,9 @@ contract BaseTest is Test { return signers; } - function _getSignerAddresses(Signer[] memory signers) internal view returns (address[] memory) { + function _getSignerAddresses( + Signer[] memory signers + ) internal view returns (address[] memory) { address[] memory signerAddrs = new address[](signers.length); for (uint256 i = 0; i < signerAddrs.length; i++) { signerAddrs[i] = s_signers[i].signerAddress; @@ -150,19 +157,20 @@ contract BaseTest is Test { return (rs, ss, bytes32(vs)); } - function _encodeReport(V1Report memory report) internal pure returns (bytes memory) { - return - abi.encode( - report.feedId, - report.observationsTimestamp, - report.median, - report.bid, - report.ask, - report.blocknumberUpperBound, - report.upperBlockhash, - report.blocknumberLowerBound, - report.currentBlockTimestamp - ); + function _encodeReport( + V1Report memory report + ) internal pure returns (bytes memory) { + return abi.encode( + report.feedId, + report.observationsTimestamp, + report.median, + report.bid, + report.ask, + report.blocknumberUpperBound, + report.upperBlockhash, + report.blocknumberLowerBound, + report.currentBlockTimestamp + ); } function _generateV1EncodedBlob( @@ -171,11 +179,8 @@ contract BaseTest is Test { Signer[] memory signers ) internal pure returns (bytes memory) { bytes memory reportBytes = _encodeReport(report); - (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = _generateSignerSignatures( - reportBytes, - reportContext, - signers - ); + (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = + _generateSignerSignatures(reportBytes, reportContext, signers); return abi.encode(reportContext, reportBytes, rs, ss, rawVs); } @@ -193,7 +198,7 @@ contract BaseTest is Test { ) internal pure returns (bytes32) { // Convert addresses to bytes array to match configurator bytes[] memory signersAsBytes = new bytes[](signers.length); - for (uint i; i < signers.length; ++i) { + for (uint256 i; i < signers.length; ++i) { signersAsBytes[i] = abi.encodePacked(signers[i]); } @@ -229,31 +234,29 @@ contract BaseTest is Test { uint64 blocknumberLowerBound, uint32 currentBlockTimestamp ) internal pure returns (V1Report memory) { - return - V1Report({ - feedId: feedId, - observationsTimestamp: observationsTimestamp, - median: median, - bid: bid, - ask: ask, - blocknumberUpperBound: blocknumberUpperBound, - upperBlockhash: upperBlockhash, - blocknumberLowerBound: blocknumberLowerBound, - currentBlockTimestamp: currentBlockTimestamp - }); + return V1Report({ + feedId: feedId, + observationsTimestamp: observationsTimestamp, + median: median, + bid: bid, + ask: ask, + blocknumberUpperBound: blocknumberUpperBound, + upperBlockhash: upperBlockhash, + blocknumberLowerBound: blocknumberLowerBound, + currentBlockTimestamp: currentBlockTimestamp + }); } function _ccipReadURL(bytes32 feedId, uint256 commitmentBlock) internal pure returns (string memory url) { - return - string( - abi.encodePacked( - SERVER_URL, - "?feedIDHex=", - Strings.toHexString(uint256(feedId)), - "&L2Blocknumber=", - Strings.toString(commitmentBlock) - ) - ); + return string( + abi.encodePacked( + SERVER_URL, + "?feedIDHex=", + Strings.toHexString(uint256(feedId)), + "&L2Blocknumber=", + Strings.toString(commitmentBlock) + ) + ); } } @@ -310,10 +313,7 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { ); s_verifier.setConfig( - v1ConfigDigest, - _getSignerAddresses(signers), - FAULT_TOLERANCE, - new Common.AddressAndWeight[](0) + v1ConfigDigest, _getSignerAddresses(signers), FAULT_TOLERANCE, new Common.AddressAndWeight[](0) ); v3ConfigDigest = _configDigestFromConfigData( @@ -330,10 +330,7 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { ); s_verifier.setConfig( - v3ConfigDigest, - _getSignerAddresses(signers), - FAULT_TOLERANCE, - new Common.AddressAndWeight[](0) + v3ConfigDigest, _getSignerAddresses(signers), FAULT_TOLERANCE, new Common.AddressAndWeight[](0) ); link = new ERC20Mock(18); @@ -346,19 +343,20 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { rewardManager.setFeeManager(address(feeManager)); } - function _encodeReport(V3Report memory report) internal pure returns (bytes memory) { - return - abi.encode( - report.feedId, - report.observationsTimestamp, - report.validFromTimestamp, - report.nativeFee, - report.linkFee, - report.expiresAt, - report.benchmarkPrice, - report.bid, - report.ask - ); + function _encodeReport( + V3Report memory report + ) internal pure returns (bytes memory) { + return abi.encode( + report.feedId, + report.observationsTimestamp, + report.validFromTimestamp, + report.nativeFee, + report.linkFee, + report.expiresAt, + report.benchmarkPrice, + report.bid, + report.ask + ); } function _generateV3EncodedBlob( @@ -367,45 +365,42 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { Signer[] memory signers ) internal pure returns (bytes memory) { bytes memory reportBytes = _encodeReport(report); - (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = _generateSignerSignatures( - reportBytes, - reportContext, - signers - ); + (bytes32[] memory rs, bytes32[] memory ss, bytes32 rawVs) = + _generateSignerSignatures(reportBytes, reportContext, signers); return abi.encode(reportContext, reportBytes, rs, ss, rawVs); } function _generateV1Report() internal view returns (V1Report memory) { - return - _createV1Report( - FEED_ID, - OBSERVATIONS_TIMESTAMP, - MEDIAN, - BID, - ASK, - BLOCKNUMBER_UPPER_BOUND, - bytes32(blockhash(BLOCKNUMBER_UPPER_BOUND)), - BLOCKNUMBER_LOWER_BOUND, - uint32(block.timestamp) - ); + return _createV1Report( + FEED_ID, + OBSERVATIONS_TIMESTAMP, + MEDIAN, + BID, + ASK, + BLOCKNUMBER_UPPER_BOUND, + bytes32(blockhash(BLOCKNUMBER_UPPER_BOUND)), + BLOCKNUMBER_LOWER_BOUND, + uint32(block.timestamp) + ); } function _generateV3Report() internal view returns (V3Report memory) { - return - V3Report({ - feedId: FEED_ID_V3, - observationsTimestamp: OBSERVATIONS_TIMESTAMP, - validFromTimestamp: uint32(block.timestamp), - nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), - linkFee: uint192(DEFAULT_REPORT_LINK_FEE), - expiresAt: uint32(block.timestamp), - benchmarkPrice: MEDIAN, - bid: BID, - ask: ASK - }); + return V3Report({ + feedId: FEED_ID_V3, + observationsTimestamp: OBSERVATIONS_TIMESTAMP, + validFromTimestamp: uint32(block.timestamp), + nativeFee: uint192(DEFAULT_REPORT_NATIVE_FEE), + linkFee: uint192(DEFAULT_REPORT_LINK_FEE), + expiresAt: uint32(block.timestamp), + benchmarkPrice: MEDIAN, + bid: BID, + ask: ASK + }); } - function _generateReportContext(bytes32 configDigest) internal pure returns (bytes32[3] memory) { + function _generateReportContext( + bytes32 configDigest + ) internal pure returns (bytes32[3] memory) { bytes32[3] memory reportContext; reportContext[0] = configDigest; reportContext[1] = bytes32(abi.encode(uint32(5), uint8(1))); @@ -437,12 +432,7 @@ contract BaseTestWithConfiguredVerifierAndFeeManager is BaseTest { changePrank(originalAddr); } - function _verifyBulk( - bytes[] memory payload, - address feeAddress, - uint256 wrappedNativeValue, - address sender - ) internal { + function _verifyBulk(bytes[] memory payload, address feeAddress, uint256 wrappedNativeValue, address sender) internal { address originalAddr = msg.sender; changePrank(sender); @@ -485,10 +475,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes("") ); s_verifier.setConfig( - s_configDigestTwo, - _getSignerAddresses(secondSetOfSigners), - FAULT_TOLERANCE_TWO, - new Common.AddressAndWeight[](0) + s_configDigestTwo, _getSignerAddresses(secondSetOfSigners), FAULT_TOLERANCE_TWO, new Common.AddressAndWeight[](0) ); // Verifier 1, Feed 1, Config 3 @@ -526,10 +513,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes("") ); s_verifier.setConfig( - s_configDigestFour, - _getSignerAddresses(signers), - FAULT_TOLERANCE, - new Common.AddressAndWeight[](0) + s_configDigestFour, _getSignerAddresses(signers), FAULT_TOLERANCE, new Common.AddressAndWeight[](0) ); // Verifier 2, Feed 3, Config 1 @@ -547,10 +531,7 @@ contract BaseTestWithMultipleConfiguredDigests is BaseTestWithConfiguredVerifier bytes("") ); s_verifier_2.setConfig( - s_configDigestFive, - _getSignerAddresses(signers), - FAULT_TOLERANCE, - new Common.AddressAndWeight[](0) + s_configDigestFive, _getSignerAddresses(signers), FAULT_TOLERANCE, new Common.AddressAndWeight[](0) ); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierActivateConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierActivateConfigTest.t.sol index f5f3598210..9dd200807f 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierActivateConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierActivateConfigTest.t.sol @@ -1,8 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../Verifier.sol"; +import { + BaseTestWithConfiguredVerifierAndFeeManager, BaseTestWithMultipleConfiguredDigests +} from "./BaseVerifierTest.t.sol"; contract VerifierActivateConfigTestV05 is BaseTestWithConfiguredVerifierAndFeeManager { function test_revertsIfNotOwner() public { @@ -53,11 +55,8 @@ contract VerifierActivateConfigWithDeactivatedConfigTestV05 is BaseTestWithMulti s_verifier.activateConfig(s_configDigestTwo); changePrank(address(s_verifierProxy)); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); s_verifier.verify(signedReport, msg.sender); } } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyConstructorTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyConstructorTest.t.sol index 811a9b440e..b75309e5ac 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyConstructorTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyConstructorTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; -import {VerifierProxy} from "../../VerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; +import {VerifierProxy} from "../../VerifierProxy.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierProxyConstructorTest is BaseTest { function test_correctlySetsTheOwner() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol index d3c372797f..04346f3f19 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyInitializeVerifierTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; import {VerifierProxy} from "../../VerifierProxy.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierProxyInitializeVerifierTestV05 is BaseTest { bytes32 latestDigest; diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol index 03bd6d97ee..f06d54c991 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetAccessControllerTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierProxySetAccessControllerTest is BaseTest { event AccessControllerSet(address oldAccessController, address newAccessController); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetVerifierTest.t.sol index 4f849e59f6..45547a3733 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxySetVerifierTest.t.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; -import {IVerifier} from "../../interfaces/IVerifier.sol"; +import {Common} from "../../../libraries/Common.sol"; import {VerifierProxy} from "../../VerifierProxy.sol"; +import {IVerifier} from "../../interfaces/IVerifier.sol"; +import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; + import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; -import {Common} from "../../../libraries/Common.sol"; contract VerifierProxyInitializeVerifierTestV05 is BaseTestWithConfiguredVerifierAndFeeManager { function test_revertsIfNotCorrectVerifier() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyTest.t.sol index 1b44dda438..713f308ac8 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyTest.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; -import {VerifierProxy} from "../../VerifierProxy.sol"; import {FeeManager} from "../../FeeManager.sol"; +import {VerifierProxy} from "../../VerifierProxy.sol"; +import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; contract VerifierProxyInitializeVerifierTestV05 is BaseTestWithConfiguredVerifierAndFeeManager { function test_setFeeManagerZeroAddress() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol index 74da281a3c..58a239739b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierProxyUnsetVerifierTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; import {VerifierProxy} from "../../VerifierProxy.sol"; +import {BaseTest, BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; contract VerifierProxyUnsetVerifierTest is BaseTest { function test_revertsIfNotAdmin() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierSetConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierSetConfigTest.t.sol index 7c082a98bd..7d86289364 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierSetConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierSetConfigTest.t.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; -import {Verifier} from "../../Verifier.sol"; import {Common} from "../../../libraries/Common.sol"; +import {Verifier} from "../../Verifier.sol"; import {MockConfigurator} from "../mocks/MockConfigurator.sol"; +import {BaseTest, BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; contract VerifierSetConfigTestV05 is BaseTest { function setUp() public virtual override { @@ -433,18 +433,12 @@ contract VerifierSetConfigWhenThereAreMultipleDigestsTest05 is BaseTestWithMulti // Convert addresses to bytes array Signer[] memory signers = _getSigners(15); bytes[] memory signersAsBytes = new bytes[](signers.length); - for (uint i; i < signers.length; ++i) { + for (uint256 i; i < signers.length; ++i) { signersAsBytes[i] = abi.encodePacked(signers[i].signerAddress); } configurator.setStagingConfig( - FEED_ID, - signersAsBytes, - s_offchaintransmitters, - 4, - bytes(""), - VERIFIER_VERSION, - bytes("") + FEED_ID, signersAsBytes, s_offchaintransmitters, 4, bytes(""), VERIFIER_VERSION, bytes("") ); bytes32 expectedConfigDigest = _configDigestFromConfigData( @@ -460,7 +454,7 @@ contract VerifierSetConfigWhenThereAreMultipleDigestsTest05 is BaseTestWithMulti bytes("") ); - (, , bytes32 configDigest) = configurator.s_configurationStates(FEED_ID); + (,, bytes32 configDigest) = configurator.s_configurationStates(FEED_ID); assertEq(configDigest, expectedConfigDigest); } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTest.t.sol index 36933d18b4..e5a84db120 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTest} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../Verifier.sol"; +import {BaseTest} from "./BaseVerifierTest.t.sol"; contract VerifierConstructorTestV05 is BaseTest { function test_revertsIfInitializedWithEmptyVerifierProxy() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTestBillingReport.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTestBillingReport.t.sol index deb1d1fb4c..5173f27f58 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTestBillingReport.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierTestBillingReport.t.sol @@ -23,9 +23,7 @@ contract VerifierTestWithConfiguredVerifierAndFeeManager is BaseTestWithConfigur contract VerifierTestBillingReportV05 is VerifierTestWithConfiguredVerifierAndFeeManager { function test_verifyWithLink() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _approveLink(address(rewardManager), DEFAULT_REPORT_LINK_FEE, USER); @@ -37,9 +35,7 @@ contract VerifierTestBillingReportV05 is VerifierTestWithConfiguredVerifierAndFe function test_verifyWithNative() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _approveNative(address(feeManager), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -52,9 +48,7 @@ contract VerifierTestBillingReportV05 is VerifierTestWithConfiguredVerifierAndFe function test_verifyWithNativeUnwrapped() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _verify(signedReport, address(native), DEFAULT_REPORT_NATIVE_FEE, USER); @@ -65,9 +59,7 @@ contract VerifierTestBillingReportV05 is VerifierTestWithConfiguredVerifierAndFe function test_verifyWithNativeUnwrappedReturnsChange() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); _verify(signedReport, address(native), DEFAULT_REPORT_NATIVE_FEE * 2, USER); @@ -82,9 +74,7 @@ contract VerifierBulkVerifyBillingReportV05 is VerifierTestWithConfiguredVerifie function test_verifyWithBulkLink() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -102,9 +92,7 @@ contract VerifierBulkVerifyBillingReportV05 is VerifierTestWithConfiguredVerifie function test_verifyWithBulkNative() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -121,9 +109,7 @@ contract VerifierBulkVerifyBillingReportV05 is VerifierTestWithConfiguredVerifie function test_verifyWithBulkNativeUnwrapped() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -139,9 +125,7 @@ contract VerifierBulkVerifyBillingReportV05 is VerifierTestWithConfiguredVerifie function test_verifyWithBulkNativeUnwrappedReturnsChange() public { bytes memory signedReport = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](NUMBERS_OF_REPORTS); @@ -157,15 +141,11 @@ contract VerifierBulkVerifyBillingReportV05 is VerifierTestWithConfiguredVerifie function test_verifyMultiVersions() public { bytes memory signedReportV1 = _generateV1EncodedBlob( - _generateV1Report(), - _generateReportContext(v1ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV1Report(), _generateReportContext(v1ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes memory signedReportV3 = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](3); @@ -185,15 +165,11 @@ contract VerifierBulkVerifyBillingReportV05 is VerifierTestWithConfiguredVerifie function test_verifyMultiVersionsReturnsVerifiedReports() public { bytes memory signedReportV1 = _generateV1EncodedBlob( - _generateV1Report(), - _generateReportContext(v1ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV1Report(), _generateReportContext(v1ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes memory signedReportV3 = _generateV3EncodedBlob( - _generateV3Report(), - _generateReportContext(v3ConfigDigest), - _getSigners(FAULT_TOLERANCE + 1) + _generateV3Report(), _generateReportContext(v3ConfigDigest), _getSigners(FAULT_TOLERANCE + 1) ); bytes[] memory signedReports = new bytes[](3); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierUnsetConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierUnsetConfigTest.t.sol index 942ef3db3f..c2884e36cd 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierUnsetConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierUnsetConfigTest.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; import {Verifier} from "../../Verifier.sol"; +import {BaseTestWithMultipleConfiguredDigests} from "./BaseVerifierTest.t.sol"; contract VerificationdeactivateConfigWhenThereAreMultipleDigestsTestV05 is BaseTestWithMultipleConfiguredDigests { function test_revertsIfCalledByNonOwner() public { diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierVerifyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierVerifyTest.t.sol index 02ddb8c5ae..822f80e45a 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierVerifyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/VerifierVerifyTest.t.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.19; -import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; -import {Verifier} from "../../Verifier.sol"; -import {VerifierProxy} from "../../VerifierProxy.sol"; import {AccessControllerInterface} from "../../../../shared/interfaces/AccessControllerInterface.sol"; import {Common} from "../../../libraries/Common.sol"; +import {Verifier} from "../../Verifier.sol"; +import {VerifierProxy} from "../../VerifierProxy.sol"; +import {BaseTestWithConfiguredVerifierAndFeeManager} from "./BaseVerifierTest.t.sol"; contract VerifierVerifyTest is BaseTestWithConfiguredVerifierAndFeeManager { bytes32[3] internal s_reportContext; @@ -56,21 +56,15 @@ contract VerifierVerifyTest is BaseTestWithConfiguredVerifierAndFeeManager { contract VerifierProxyVerifyTestV05 is VerifierVerifyTest { function test_revertsIfNoVerifierConfigured() public { s_reportContext[0] = bytes32("corrupt-digest"); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(VerifierProxy.VerifierNotFound.selector, bytes32("corrupt-digest"))); s_verifierProxy.verify(signedReport, bytes("")); } function test_proxiesToTheCorrectVerifier() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); bytes memory response = s_verifierProxy.verify(signedReport, abi.encode(native)); assertReportsEqual(response, s_testReportOne); @@ -91,11 +85,8 @@ contract VerifierProxyAccessControlledVerificationTestV05 is VerifierVerifyTest abi.encodeWithSelector(AccessControllerInterface.hasAccess.selector, USER), abi.encode(false) ); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(VerifierProxy.AccessForbidden.selector)); changePrank(USER); @@ -109,11 +100,8 @@ contract VerifierProxyAccessControlledVerificationTestV05 is VerifierVerifyTest abi.encode(true) ); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(USER); bytes memory response = s_verifierProxy.verify(signedReport, bytes("")); @@ -123,11 +111,8 @@ contract VerifierProxyAccessControlledVerificationTestV05 is VerifierVerifyTest contract VerifierVerifySingleConfigDigestTestV05 is VerifierVerifyTest { function test_revertsIfVerifiedByNonProxy() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(Verifier.AccessForbidden.selector)); s_verifier.verify(signedReport, msg.sender); } @@ -154,11 +139,7 @@ contract VerifierVerifySingleConfigDigestTestV05 is VerifierVerifyTest { function test_revertsIfConfigDigestNotSet() public { bytes32[3] memory reportContext = s_reportContext; reportContext[0] = bytes32("wrong-context-digest"); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = _generateV1EncodedBlob(s_testReportOne, reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectRevert(abi.encodeWithSelector(Verifier.DigestInactive.selector, reportContext[0])); changePrank(address(s_verifierProxy)); s_verifier.verify(signedReport, msg.sender); @@ -201,11 +182,8 @@ contract VerifierVerifySingleConfigDigestTestV05 is VerifierVerifyTest { } function test_returnsThePriceAndBlockNumIfReportVerified() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); bytes memory response = s_verifier.verify(signedReport, msg.sender); @@ -213,11 +191,8 @@ contract VerifierVerifySingleConfigDigestTestV05 is VerifierVerifyTest { } function test_emitsAnEventIfReportVerified() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); vm.expectEmit(true, true, true, true, address(s_verifier)); emit ReportVerified(s_testReportOne.feedId, msg.sender); changePrank(address(s_verifierProxy)); @@ -249,32 +224,23 @@ contract VerifierVerifyMultipleConfigDigestTestV05 is VerifierVerifyTest { ); s_verifier.setConfig( - s_newConfigDigest, - _getSignerAddresses(_getSigners(20)), - FAULT_TOLERANCE_TWO, - new Common.AddressAndWeight[](0) + s_newConfigDigest, _getSignerAddresses(_getSigners(20)), FAULT_TOLERANCE_TWO, new Common.AddressAndWeight[](0) ); } function test_revertsIfVerifyingWithAnUnsetDigest() public { s_verifier.deactivateConfig(s_oldConfigDigest); - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); vm.expectRevert(abi.encodeWithSelector(Verifier.DigestInactive.selector, s_reportContext[0])); s_verifier.verify(signedReport, msg.sender); } function test_canVerifyOlderReportsWithOlderConfigs() public { - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE + 1)); changePrank(address(s_verifierProxy)); bytes memory response = s_verifier.verify(signedReport, msg.sender); assertReportsEqual(response, s_testReportOne); @@ -282,11 +248,8 @@ contract VerifierVerifyMultipleConfigDigestTestV05 is VerifierVerifyTest { function test_canVerifyNewerReportsWithNewerConfigs() public { s_reportContext[0] = s_newConfigDigest; - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); changePrank(address(s_verifierProxy)); bytes memory response = s_verifier.verify(signedReport, msg.sender); assertReportsEqual(response, s_testReportOne); @@ -295,11 +258,8 @@ contract VerifierVerifyMultipleConfigDigestTestV05 is VerifierVerifyTest { function test_revertsIfAReportIsVerifiedWithAnExistingButIncorrectDigest() public { // Try sending the older digest signed with the new set of signers s_reportContext[0] = s_oldConfigDigest; - bytes memory signedReport = _generateV1EncodedBlob( - s_testReportOne, - s_reportContext, - _getSigners(FAULT_TOLERANCE_TWO + 1) - ); + bytes memory signedReport = + _generateV1EncodedBlob(s_testReportOne, s_reportContext, _getSigners(FAULT_TOLERANCE_TWO + 1)); vm.expectRevert( abi.encodeWithSelector(Verifier.IncorrectSignatureCount.selector, FAULT_TOLERANCE_TWO + 1, FAULT_TOLERANCE + 1) ); diff --git a/contracts/src/v0.8/operatorforwarder/AuthorizedReceiver.sol b/contracts/src/v0.8/operatorforwarder/AuthorizedReceiver.sol index 919602b5ac..105272ab7a 100644 --- a/contracts/src/v0.8/operatorforwarder/AuthorizedReceiver.sol +++ b/contracts/src/v0.8/operatorforwarder/AuthorizedReceiver.sol @@ -12,7 +12,9 @@ abstract contract AuthorizedReceiver is IAuthorizedReceiver { // @notice Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow. // @param senders The addresses of the authorized Chainlink node - function setAuthorizedSenders(address[] calldata senders) external override validateAuthorizedSenderSetter { + function setAuthorizedSenders( + address[] calldata senders + ) external override validateAuthorizedSenderSetter { require(senders.length > 0, "Must have at least 1 sender"); // Set previous authorized senders to false uint256 authorizedSendersLength = s_authorizedSenderList.length; @@ -38,7 +40,9 @@ abstract contract AuthorizedReceiver is IAuthorizedReceiver { // @notice Use this to check if a node is authorized for fulfilling requests // @param sender The address of the Chainlink node // @return The authorization status of the node - function isAuthorizedSender(address sender) public view override returns (bool) { + function isAuthorizedSender( + address sender + ) public view override returns (bool) { return s_authorizedSenders[sender]; } diff --git a/contracts/src/v0.8/operatorforwarder/Chainlink.sol b/contracts/src/v0.8/operatorforwarder/Chainlink.sol index f3ee84cb11..356164e22e 100644 --- a/contracts/src/v0.8/operatorforwarder/Chainlink.sol +++ b/contracts/src/v0.8/operatorforwarder/Chainlink.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {CBORChainlink} from "../vendor/CBORChainlink.sol"; import {BufferChainlink} from "../vendor/BufferChainlink.sol"; +import {CBORChainlink} from "../vendor/CBORChainlink.sol"; /** * @title Library for common Chainlink functions diff --git a/contracts/src/v0.8/operatorforwarder/ChainlinkClient.sol b/contracts/src/v0.8/operatorforwarder/ChainlinkClient.sol index c619683cbb..356a3df6ec 100644 --- a/contracts/src/v0.8/operatorforwarder/ChainlinkClient.sol +++ b/contracts/src/v0.8/operatorforwarder/ChainlinkClient.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {Chainlink} from "./Chainlink.sol"; -import {ENSInterface} from "./interfaces/ENSInterface.sol"; import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; + +import {ENSResolver as ENSResolver_Chainlink} from "../vendor/ENSResolver.sol"; +import {Chainlink} from "./Chainlink.sol"; import {ChainlinkRequestInterface} from "./interfaces/ChainlinkRequestInterface.sol"; +import {ENSInterface} from "./interfaces/ENSInterface.sol"; import {OperatorInterface} from "./interfaces/OperatorInterface.sol"; import {PointerInterface} from "./interfaces/PointerInterface.sol"; -import {ENSResolver as ENSResolver_Chainlink} from "../vendor/ENSResolver.sol"; /** * @title The ChainlinkClient contract @@ -209,7 +210,9 @@ abstract contract ChainlinkClient { * @notice Sets the stored oracle address * @param oracleAddress The address of the oracle contract */ - function _setChainlinkOracle(address oracleAddress) internal { + function _setChainlinkOracle( + address oracleAddress + ) internal { s_oracle = OperatorInterface(oracleAddress); } @@ -217,7 +220,9 @@ abstract contract ChainlinkClient { * @notice Sets the LINK token address * @param linkAddress The address of the LINK token contract */ - function _setChainlinkToken(address linkAddress) internal { + function _setChainlinkToken( + address linkAddress + ) internal { s_link = LinkTokenInterface(linkAddress); } @@ -251,10 +256,7 @@ abstract contract ChainlinkClient { * @param oracleAddress The address of the oracle contract that will fulfill the request * @param requestId The request ID used for the response */ - function _addChainlinkExternalRequest( - address oracleAddress, - bytes32 requestId - ) internal notPendingRequest(requestId) { + function _addChainlinkExternalRequest(address oracleAddress, bytes32 requestId) internal notPendingRequest(requestId) { s_pendingRequests[requestId] = oracleAddress; } @@ -300,7 +302,9 @@ abstract contract ChainlinkClient { * Emits ChainlinkFulfilled event. * @param requestId The request ID for fulfillment */ - modifier recordChainlinkFulfillment(bytes32 requestId) { + modifier recordChainlinkFulfillment( + bytes32 requestId + ) { require(msg.sender == s_pendingRequests[requestId], "Source must be the oracle of the request"); delete s_pendingRequests[requestId]; emit ChainlinkFulfilled(requestId); @@ -311,7 +315,9 @@ abstract contract ChainlinkClient { * @dev Reverts if the request is already pending * @param requestId The request ID for fulfillment */ - modifier notPendingRequest(bytes32 requestId) { + modifier notPendingRequest( + bytes32 requestId + ) { require(s_pendingRequests[requestId] == address(0), "Request is already pending"); _; } diff --git a/contracts/src/v0.8/operatorforwarder/LinkTokenReceiver.sol b/contracts/src/v0.8/operatorforwarder/LinkTokenReceiver.sol index dab259ca04..a063881daa 100644 --- a/contracts/src/v0.8/operatorforwarder/LinkTokenReceiver.sol +++ b/contracts/src/v0.8/operatorforwarder/LinkTokenReceiver.sol @@ -21,7 +21,7 @@ abstract contract LinkTokenReceiver { mstore(add(data, 68), amount) // ensure correct amount is passed0.8.19 } // solhint-disable-next-line avoid-low-level-calls - (bool success, ) = address(this).delegatecall(data); // calls oracleRequest + (bool success,) = address(this).delegatecall(data); // calls oracleRequest require(success, "Unable to create request"); } @@ -38,7 +38,9 @@ abstract contract LinkTokenReceiver { // @dev Reverts if the given data does not begin with the `oracleRequest` function selector // @param data The data payload of the request - modifier permittedFunctionsForLINK(bytes memory data) { + modifier permittedFunctionsForLINK( + bytes memory data + ) { bytes4 funcSelector; assembly { // solhint-disable-next-line avoid-low-level-calls diff --git a/contracts/src/v0.8/operatorforwarder/Operator.sol b/contracts/src/v0.8/operatorforwarder/Operator.sol index ebf44205e0..b7a86d36cf 100644 --- a/contracts/src/v0.8/operatorforwarder/Operator.sol +++ b/contracts/src/v0.8/operatorforwarder/Operator.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {AuthorizedReceiver} from "./AuthorizedReceiver.sol"; -import {LinkTokenReceiver} from "./LinkTokenReceiver.sol"; import {ConfirmedOwner} from "../shared/access/ConfirmedOwner.sol"; + +import {IOwnable} from "../shared/interfaces/IOwnable.sol"; import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; +import {AuthorizedReceiver} from "./AuthorizedReceiver.sol"; +import {LinkTokenReceiver} from "./LinkTokenReceiver.sol"; import {IAuthorizedReceiver} from "./interfaces/IAuthorizedReceiver.sol"; -import {OperatorInterface} from "./interfaces/OperatorInterface.sol"; -import {IOwnable} from "../shared/interfaces/IOwnable.sol"; import {IWithdrawal} from "./interfaces/IWithdrawal.sol"; +import {OperatorInterface} from "./interfaces/OperatorInterface.sol"; import {OracleInterface} from "./interfaces/OracleInterface.sol"; import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; @@ -92,14 +93,8 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper uint256 dataVersion, bytes calldata data ) external override validateFromLINK { - (bytes32 requestId, uint256 expiration) = _verifyAndProcessOracleRequest( - sender, - payment, - callbackAddress, - callbackFunctionId, - nonce, - dataVersion - ); + (bytes32 requestId, uint256 expiration) = + _verifyAndProcessOracleRequest(sender, payment, callbackAddress, callbackFunctionId, nonce, dataVersion); emit OracleRequest(specId, sender, requestId, payment, sender, callbackFunctionId, expiration, dataVersion, data); } @@ -122,14 +117,8 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper uint256 dataVersion, bytes calldata data ) external override validateFromLINK { - (bytes32 requestId, uint256 expiration) = _verifyAndProcessOracleRequest( - sender, - payment, - sender, - callbackFunctionId, - nonce, - dataVersion - ); + (bytes32 requestId, uint256 expiration) = + _verifyAndProcessOracleRequest(sender, payment, sender, callbackFunctionId, nonce, dataVersion); emit OracleRequest(specId, sender, requestId, payment, sender, callbackFunctionId, expiration, dataVersion, data); } @@ -165,7 +154,7 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper // All updates to the oracle's fulfillment should come before calling the // callback(addr+functionId) as it is untrusted. // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern - (bool success, ) = callbackAddress.call(abi.encodeWithSelector(callbackFunctionId, requestId, data)); // solhint-disable-line avoid-low-level-calls + (bool success,) = callbackAddress.call(abi.encodeWithSelector(callbackFunctionId, requestId, data)); // solhint-disable-line avoid-low-level-calls return success; } @@ -202,7 +191,7 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper // All updates to the oracle's fulfillment should come before calling the // callback(addr+functionId) as it is untrusted. // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern - (bool success, ) = callbackAddress.call(abi.encodePacked(callbackFunctionId, data)); // solhint-disable-line avoid-low-level-calls + (bool success,) = callbackAddress.call(abi.encodePacked(callbackFunctionId, data)); // solhint-disable-line avoid-low-level-calls return success; } @@ -223,7 +212,9 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper // with future contracts. // @dev Must be the pending owner on the contract // @param ownable list of addresses of Ownable contracts to accept - function acceptOwnableContracts(address[] calldata ownable) public validateAuthorizedSenderSetter { + function acceptOwnableContracts( + address[] calldata ownable + ) public validateAuthorizedSenderSetter { for (uint256 i = 0; i < ownable.length; ++i) { s_owned[ownable[i]] = true; emit OwnableContractAccepted(ownable[i]); @@ -284,7 +275,7 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper function ownerForward(address to, bytes calldata data) external onlyOwner validateNotToLINK(to) { require(to.code.length != 0, "Must forward to a contract"); // solhint-disable-next-line avoid-low-level-calls - (bool status, ) = to.call(data); + (bool status,) = to.call(data); require(status, "Forwarded call failed"); } @@ -314,7 +305,7 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper for (uint256 i = 0; i < receivers.length; ++i) { uint256 sendAmount = amounts[i]; valueRemaining = valueRemaining - sendAmount; - (bool success, ) = receivers[i].call{value: sendAmount}(""); + (bool success,) = receivers[i].call{value: sendAmount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } require(valueRemaining == 0, "Too much ETH sent"); @@ -470,27 +461,35 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper // @dev Reverts if amount requested is greater than withdrawable balance // @param amount The given amount to compare to `s_withdrawableTokens` - modifier validateAvailableFunds(uint256 amount) { + modifier validateAvailableFunds( + uint256 amount + ) { require(_fundsAvailable() >= amount, "Amount requested is greater than withdrawable balance"); _; } // @dev Reverts if request ID does not exist // @param requestId The given request ID to check in stored `commitments` - modifier validateRequestId(bytes32 requestId) { + modifier validateRequestId( + bytes32 requestId + ) { require(s_commitments[requestId].paramsHash != 0, "Must have a valid requestId"); _; } // @dev Reverts if the callback address is the LINK token // @param to The callback address - modifier validateNotToLINK(address to) { + modifier validateNotToLINK( + address to + ) { require(to != address(i_linkToken), "Cannot call to LINK"); _; } // @dev Reverts if the target address is owned by the operator - modifier validateCallbackAddress(address callbackAddress) { + modifier validateCallbackAddress( + address callbackAddress + ) { require(!s_owned[callbackAddress], "Cannot call owned contract"); _; } diff --git a/contracts/src/v0.8/operatorforwarder/OperatorFactory.sol b/contracts/src/v0.8/operatorforwarder/OperatorFactory.sol index 1503535565..e7bf821b8f 100644 --- a/contracts/src/v0.8/operatorforwarder/OperatorFactory.sol +++ b/contracts/src/v0.8/operatorforwarder/OperatorFactory.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {Operator} from "./Operator.sol"; import {AuthorizedForwarder} from "./AuthorizedForwarder.sol"; +import {Operator} from "./Operator.sol"; // @title Operator Factory // @notice Creates Operator contracts for node operators @@ -16,7 +16,9 @@ contract OperatorFactory { event AuthorizedForwarderCreated(address indexed forwarder, address indexed owner, address indexed sender); // @param linkAddress address - constructor(address linkAddress) { + constructor( + address linkAddress + ) { linkToken = linkAddress; } @@ -67,7 +69,9 @@ contract OperatorFactory { } // @notice indicates whether this factory deployed an address - function created(address query) external view returns (bool) { + function created( + address query + ) external view returns (bool) { return s_created[query]; } } diff --git a/contracts/src/v0.8/operatorforwarder/interfaces/ENSInterface.sol b/contracts/src/v0.8/operatorforwarder/interfaces/ENSInterface.sol index 2592b693ad..d70684cbce 100644 --- a/contracts/src/v0.8/operatorforwarder/interfaces/ENSInterface.sol +++ b/contracts/src/v0.8/operatorforwarder/interfaces/ENSInterface.sol @@ -23,9 +23,15 @@ interface ENSInterface { function setTTL(bytes32 node, uint64 ttl) external; - function owner(bytes32 node) external view returns (address); + function owner( + bytes32 node + ) external view returns (address); - function resolver(bytes32 node) external view returns (address); + function resolver( + bytes32 node + ) external view returns (address); - function ttl(bytes32 node) external view returns (uint64); + function ttl( + bytes32 node + ) external view returns (uint64); } diff --git a/contracts/src/v0.8/operatorforwarder/interfaces/IAuthorizedReceiver.sol b/contracts/src/v0.8/operatorforwarder/interfaces/IAuthorizedReceiver.sol index 78140d5868..1a050c54b4 100644 --- a/contracts/src/v0.8/operatorforwarder/interfaces/IAuthorizedReceiver.sol +++ b/contracts/src/v0.8/operatorforwarder/interfaces/IAuthorizedReceiver.sol @@ -2,9 +2,13 @@ pragma solidity ^0.8.0; interface IAuthorizedReceiver { - function isAuthorizedSender(address sender) external view returns (bool); + function isAuthorizedSender( + address sender + ) external view returns (bool); function getAuthorizedSenders() external returns (address[] memory); - function setAuthorizedSenders(address[] calldata senders) external; + function setAuthorizedSenders( + address[] calldata senders + ) external; } diff --git a/contracts/src/v0.8/operatorforwarder/interfaces/OperatorInterface.sol b/contracts/src/v0.8/operatorforwarder/interfaces/OperatorInterface.sol index b457a50172..a088ba373c 100644 --- a/contracts/src/v0.8/operatorforwarder/interfaces/OperatorInterface.sol +++ b/contracts/src/v0.8/operatorforwarder/interfaces/OperatorInterface.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {OracleInterface} from "./OracleInterface.sol"; import {ChainlinkRequestInterface} from "./ChainlinkRequestInterface.sol"; +import {OracleInterface} from "./OracleInterface.sol"; // solhint-disable-next-line interface-starts-with-i interface OperatorInterface is OracleInterface, ChainlinkRequestInterface { diff --git a/contracts/src/v0.8/operatorforwarder/test/Broken.sol b/contracts/src/v0.8/operatorforwarder/test/Broken.sol index 6edfbd88d5..de6d9a8807 100644 --- a/contracts/src/v0.8/operatorforwarder/test/Broken.sol +++ b/contracts/src/v0.8/operatorforwarder/test/Broken.sol @@ -9,7 +9,9 @@ contract Broken { revert Unauthorized("param", 121); } - function revertWithMessage(string memory message) public pure { + function revertWithMessage( + string memory message + ) public pure { require(false, message); } diff --git a/contracts/src/v0.8/operatorforwarder/test/Factory.t.sol b/contracts/src/v0.8/operatorforwarder/test/Factory.t.sol index d54dc62046..ea16112ad1 100644 --- a/contracts/src/v0.8/operatorforwarder/test/Factory.t.sol +++ b/contracts/src/v0.8/operatorforwarder/test/Factory.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import {Deployer} from "./testhelpers/Deployer.t.sol"; import {AuthorizedForwarder} from "../AuthorizedForwarder.sol"; import {Operator} from "../Operator.sol"; +import {Deployer} from "./testhelpers/Deployer.t.sol"; contract FactoryTest is Deployer { function setUp() public { diff --git a/contracts/src/v0.8/operatorforwarder/test/Forwarder.t.sol b/contracts/src/v0.8/operatorforwarder/test/Forwarder.t.sol index cdc38080ae..faa189ef80 100644 --- a/contracts/src/v0.8/operatorforwarder/test/Forwarder.t.sol +++ b/contracts/src/v0.8/operatorforwarder/test/Forwarder.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import {Deployer} from "./testhelpers/Deployer.t.sol"; import {AuthorizedForwarder} from "../AuthorizedForwarder.sol"; +import {Deployer} from "./testhelpers/Deployer.t.sol"; contract ForwarderTest is Deployer { AuthorizedForwarder internal s_forwarder; @@ -70,7 +70,9 @@ contract ForwarderTest is Deployer { require(returnedSenders[0] == senders[0]); } - function testFuzz_Forward_Success(uint256 _value) public { + function testFuzz_Forward_Success( + uint256 _value + ) public { _addSenders(); vm.expectRevert("Not authorized sender"); diff --git a/contracts/src/v0.8/operatorforwarder/test/operator.t.sol b/contracts/src/v0.8/operatorforwarder/test/operator.t.sol index 870238b5e9..154177ec16 100644 --- a/contracts/src/v0.8/operatorforwarder/test/operator.t.sol +++ b/contracts/src/v0.8/operatorforwarder/test/operator.t.sol @@ -23,7 +23,9 @@ contract OperatorTest is Deployer { s_callback = new Callback(address(s_operator)); } - function testFuzz_SendRequest_Success(uint96 payment) public { + function testFuzz_SendRequest_Success( + uint96 payment + ) public { vm.assume(payment > 0); deal(address(s_link), address(s_client), payment); // We're going to cancel one request and fulfill the other @@ -47,7 +49,9 @@ contract OperatorTest is Deployer { assertEq(s_link.balanceOf(address(s_client)), payment); } - function testFuzz_SendRequestAndCancelRequest_Success(uint96 payment) public { + function testFuzz_SendRequestAndCancelRequest_Success( + uint96 payment + ) public { vm.assume(payment > 1); payment /= payment; @@ -72,12 +76,7 @@ contract OperatorTest is Deployer { // Fulfill one request uint256 expiration = block.timestamp + s_operator.EXPIRYTIME(); s_operator.fulfillOracleRequest( - requestId, - payment, - address(s_client), - s_client.FULFILL_SELECTOR(), - expiration, - bytes32(hex"01") + requestId, payment, address(s_client), s_client.FULFILL_SELECTOR(), expiration, bytes32(hex"01") ); // 1 payment withdrawable from fulfilling `requestId`, 1 payment in escrow assertEq(s_operator.withdrawable(), payment); @@ -280,12 +279,7 @@ contract OperatorTest is Deployer { vm.prank(BOB); vm.expectRevert(bytes("Not authorized sender")); s_operator.fulfillOracleRequest( - requestId, - payment, - address(s_callback), - callbackFunctionId, - expiration, - bytes32(keccak256(dataBytes)) + requestId, payment, address(s_callback), callbackFunctionId, expiration, bytes32(keccak256(dataBytes)) ); } } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Callback.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Callback.sol index 3d725714c0..92f375ba81 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Callback.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Callback.sol @@ -5,12 +5,16 @@ contract Callback { address private s_operator; uint256 private s_callbacksReceived = 0; - constructor(address _operator) { + constructor( + address _operator + ) { s_operator = _operator; } // Callback function for oracle request fulfillment - function callback(bytes32) public { + function callback( + bytes32 + ) public { // solhint-disable-next-line gas-custom-errors require(msg.sender == s_operator, "Only Operator can call this function"); s_callbacksReceived += 1; diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/ChainlinkClientHelper.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/ChainlinkClientHelper.sol index 1efd93114d..d41b002179 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/ChainlinkClientHelper.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/ChainlinkClientHelper.sol @@ -6,7 +6,9 @@ import {ChainlinkClient} from "../../ChainlinkClient.sol"; contract ChainlinkClientHelper is ChainlinkClient { bytes4 public constant FULFILL_SELECTOR = this.fulfill.selector; - constructor(address link) { + constructor( + address link + ) { _setChainlinkToken(link); } @@ -18,5 +20,7 @@ contract ChainlinkClientHelper is ChainlinkClient { _cancelChainlinkRequest(requestId, payment, this.fulfill.selector, expiration); } - function fulfill(bytes32) external {} + function fulfill( + bytes32 + ) external {} } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Chainlinked.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Chainlinked.sol index 67fda6452c..2fac5c2ff7 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Chainlinked.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Chainlinked.sol @@ -1,6 +1,6 @@ pragma solidity ^0.8.0; -import {ChainlinkClient, Chainlink} from "../../ChainlinkClient.sol"; +import {Chainlink, ChainlinkClient} from "../../ChainlinkClient.sol"; /** * @title The Chainlinked contract @@ -57,7 +57,9 @@ contract Chainlinked is ChainlinkClient { * @notice Sets the stored oracle address * @param _oracle The address of the oracle contract */ - function setOracle(address _oracle) internal { + function setOracle( + address _oracle + ) internal { _setChainlinkOracle(_oracle); } @@ -65,7 +67,9 @@ contract Chainlinked is ChainlinkClient { * @notice Sets the LINK token address * @param _link The address of the LINK token contract */ - function setLinkToken(address _link) internal { + function setLinkToken( + address _link + ) internal { _setChainlinkToken(_link); } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Consumer.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Consumer.sol index b422081084..b9e2a0b912 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Consumer.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Consumer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ChainlinkClient, ChainlinkRequestInterface, LinkTokenInterface} from "../../ChainlinkClient.sol"; import {Chainlink} from "../../Chainlink.sol"; +import {ChainlinkClient, ChainlinkRequestInterface, LinkTokenInterface} from "../../ChainlinkClient.sol"; contract Consumer is ChainlinkClient { using Chainlink for Chainlink.Request; @@ -10,10 +10,8 @@ contract Consumer is ChainlinkClient { bytes32 internal s_specId; bytes32 internal s_currentPrice; - event RequestFulfilled( - bytes32 indexed requestId, // User-defined ID - bytes32 indexed price - ); + event RequestFulfilled( // User-defined ID + bytes32 indexed requestId, bytes32 indexed price); function requestEthereumPrice(string memory _currency, uint256 _payment) public { requestEthereumPriceByCallback(_currency, _payment, address(this)); diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Deployer.t.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Deployer.t.sol index da746c7ff8..25b45441f1 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/Deployer.t.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/Deployer.t.sol @@ -3,11 +3,11 @@ pragma solidity ^0.8.0; import {Test} from "forge-std/Test.sol"; -import {MockReceiver} from "./MockReceiver.sol"; +import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol"; import {AuthorizedForwarder} from "../../AuthorizedForwarder.sol"; import {Operator} from "../../Operator.sol"; import {OperatorFactory} from "../../OperatorFactory.sol"; -import {LinkToken} from "../../../shared/token/ERC677/LinkToken.sol"; +import {MockReceiver} from "./MockReceiver.sol"; abstract contract Deployer is Test { OperatorFactory internal s_factory; diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/EmptyOracle.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/EmptyOracle.sol index 6a4c281995..687c40518e 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/EmptyOracle.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/EmptyOracle.sol @@ -8,9 +8,13 @@ import {OracleInterface} from "../../interfaces/OracleInterface.sol"; contract EmptyOracle is ChainlinkRequestInterface, OracleInterface { function cancelOracleRequest(bytes32, uint256, bytes4, uint256) external override {} function fulfillOracleRequest(bytes32, uint256, address, bytes4, uint256, bytes32) external override returns (bool) {} - function getAuthorizationStatus(address) external pure returns (bool) { + + function getAuthorizationStatus( + address + ) external pure returns (bool) { return false; } + function onTokenTransfer(address, uint256, bytes calldata) external pure {} function oracleRequest( address, diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/GasGuzzlingConsumer.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/GasGuzzlingConsumer.sol index 040eeec394..d6ed5ee05f 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/GasGuzzlingConsumer.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/GasGuzzlingConsumer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {Consumer} from "./Consumer.sol"; import {Chainlink} from "../../Chainlink.sol"; +import {Consumer} from "./Consumer.sol"; contract GasGuzzlingConsumer is Consumer { using Chainlink for Chainlink.Request; @@ -13,7 +13,9 @@ contract GasGuzzlingConsumer is Consumer { s_specId = _specId; } - function gassyRequestEthereumPrice(uint256 _payment) public { + function gassyRequestEthereumPrice( + uint256 _payment + ) public { Chainlink.Request memory req = _buildChainlinkRequest(s_specId, address(this), this.gassyFulfill.selector); req._add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY"); string[] memory path = new string[](1); @@ -26,7 +28,9 @@ contract GasGuzzlingConsumer is Consumer { while (true) {} } - function gassyMultiWordRequest(uint256 _payment) public { + function gassyMultiWordRequest( + uint256 _payment + ) public { Chainlink.Request memory req = _buildChainlinkRequest(s_specId, address(this), this.gassyMultiWordFulfill.selector); req._add("get", "https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR,JPY"); string[] memory path = new string[](1); diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/GetterSetter.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/GetterSetter.sol index 722362bc4a..45b8926808 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/GetterSetter.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/GetterSetter.sol @@ -14,7 +14,9 @@ contract GetterSetter { event Output(bytes32 b32, uint256 u256, bytes32 b322); - function setBytes32(bytes32 _value) public { + function setBytes32( + bytes32 _value + ) public { s_getBytes32 = _value; emit SetBytes32(msg.sender, _value); } @@ -24,7 +26,9 @@ contract GetterSetter { setBytes32(_value); } - function setBytes(bytes memory _value) public { + function setBytes( + bytes memory _value + ) public { s_getBytes = _value; emit SetBytes(msg.sender, _value); } @@ -38,7 +42,9 @@ contract GetterSetter { setBytes(_value); } - function setUint256(uint256 _value) public { + function setUint256( + uint256 _value + ) public { s_getUint256 = _value; emit SetUint256(msg.sender, _value); } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlink.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlink.sol index 11c863fbb9..d5e72c2b3f 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlink.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlink.sol @@ -1,7 +1,7 @@ pragma solidity ^0.8.0; -import {CBORChainlink as CBOR_Chainlink} from "../../../vendor/CBORChainlink.sol"; import {BufferChainlink as Buffer_Chainlink} from "../../../vendor/BufferChainlink.sol"; +import {CBORChainlink as CBOR_Chainlink} from "../../../vendor/CBORChainlink.sol"; // solhint-disable library MaliciousChainlink { diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol index 989c39c18b..3be8b7f21f 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol @@ -1,8 +1,8 @@ pragma solidity ^0.8.0; -import {MaliciousChainlink} from "./MaliciousChainlink.sol"; -import {Chainlinked, Chainlink} from "./Chainlinked.sol"; import {LinkTokenInterface} from "../../../shared/interfaces/LinkTokenInterface.sol"; +import {Chainlink, Chainlinked} from "./Chainlinked.sol"; +import {MaliciousChainlink} from "./MaliciousChainlink.sol"; // solhint-disable contract MaliciousChainlinked is Chainlinked { @@ -33,8 +33,7 @@ contract MaliciousChainlinked is Chainlinked { emit ChainlinkRequested(requestId); LinkTokenInterface link = LinkTokenInterface(chainlinkToken()); require( - link.transferAndCall(oracleAddress(), _amount, encodeTargetRequest(_req)), - "Unable to transferAndCall to oracle" + link.transferAndCall(oracleAddress(), _amount, encodeTargetRequest(_req)), "Unable to transferAndCall to oracle" ); s_maliciousRequests += 1; @@ -48,8 +47,7 @@ contract MaliciousChainlinked is Chainlinked { emit ChainlinkRequested(requestId); LinkTokenInterface link = LinkTokenInterface(chainlinkToken()); require( - link.transferAndCall(oracleAddress(), _amount, encodePriceRequest(_req)), - "Unable to transferAndCall to oracle" + link.transferAndCall(oracleAddress(), _amount, encodePriceRequest(_req)), "Unable to transferAndCall to oracle" ); s_maliciousRequests += 1; @@ -66,51 +64,53 @@ contract MaliciousChainlinked is Chainlinked { emit ChainlinkRequested(requestId); LinkTokenInterface link = LinkTokenInterface(chainlinkToken()); require( - link.transferAndCall(oracleAddress(), _wei, encodeWithdrawRequest(_req)), - "Unable to transferAndCall to oracle" + link.transferAndCall(oracleAddress(), _wei, encodeWithdrawRequest(_req)), "Unable to transferAndCall to oracle" ); s_maliciousRequests += 1; return requestId; } - function encodeWithdrawRequest(MaliciousChainlink.WithdrawRequest memory _req) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - bytes4(keccak256("withdraw(address,uint256)")), - _req.callbackAddress, - _req.callbackFunctionId, - _req.nonce, - _req.buf.buf - ); + function encodeWithdrawRequest( + MaliciousChainlink.WithdrawRequest memory _req + ) internal pure returns (bytes memory) { + return abi.encodeWithSelector( + bytes4(keccak256("withdraw(address,uint256)")), + _req.callbackAddress, + _req.callbackFunctionId, + _req.nonce, + _req.buf.buf + ); } - function encodeTargetRequest(Chainlink.Request memory _req) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - bytes4(keccak256("oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)")), - 0, // overridden by onTokenTransfer - 0, // overridden by onTokenTransfer - _req.id, - _req.callbackAddress, - _req.callbackFunctionId, - _req.nonce, - 1, - _req.buf.buf - ); + function encodeTargetRequest( + Chainlink.Request memory _req + ) internal pure returns (bytes memory) { + return abi.encodeWithSelector( + bytes4(keccak256("oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)")), + 0, // overridden by onTokenTransfer + 0, // overridden by onTokenTransfer + _req.id, + _req.callbackAddress, + _req.callbackFunctionId, + _req.nonce, + 1, + _req.buf.buf + ); } - function encodePriceRequest(Chainlink.Request memory _req) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - bytes4(keccak256("oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)")), - 0, // overridden by onTokenTransfer - 2000000000000000000, // overridden by onTokenTransfer - _req.id, - _req.callbackAddress, - _req.callbackFunctionId, - _req.nonce, - 1, - _req.buf.buf - ); + function encodePriceRequest( + Chainlink.Request memory _req + ) internal pure returns (bytes memory) { + return abi.encodeWithSelector( + bytes4(keccak256("oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)")), + 0, // overridden by onTokenTransfer + 2000000000000000000, // overridden by onTokenTransfer + _req.id, + _req.callbackAddress, + _req.callbackFunctionId, + _req.nonce, + 1, + _req.buf.buf + ); } } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousConsumer.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousConsumer.sol index bd731c7718..aa071b12f5 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousConsumer.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousConsumer.sol @@ -1,6 +1,6 @@ pragma solidity ^0.8.0; -import {Chainlinked, Chainlink} from "./Chainlinked.sol"; +import {Chainlink, Chainlinked} from "./Chainlinked.sol"; // solhint-disable contract MaliciousConsumer is Chainlinked { @@ -33,7 +33,7 @@ contract MaliciousConsumer is Chainlinked { } function stealEthCall(bytes32 _requestId, bytes32) public recordChainlinkFulfillment(_requestId) { - (bool success, ) = address(this).call{value: 100}(""); + (bool success,) = address(this).call{value: 100}(""); require(success, "Call failed"); } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousMultiWordConsumer.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousMultiWordConsumer.sol index ad65927b40..a59f0204bc 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousMultiWordConsumer.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousMultiWordConsumer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ChainlinkClient} from "../../ChainlinkClient.sol"; import {Chainlink} from "../../Chainlink.sol"; +import {ChainlinkClient} from "../../ChainlinkClient.sol"; contract MaliciousMultiWordConsumer is ChainlinkClient { uint256 private constant ORACLE_PAYMENT = 1 ether; @@ -34,7 +34,7 @@ contract MaliciousMultiWordConsumer is ChainlinkClient { } function stealEthCall(bytes32 _requestId, bytes memory) public recordChainlinkFulfillment(_requestId) { - (bool success, ) = address(this).call{value: 100}(""); // solhint-disable-line avoid-call-value + (bool success,) = address(this).call{value: 100}(""); // solhint-disable-line avoid-call-value // solhint-disable-next-line gas-custom-errors require(success, "Call failed"); } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousRequester.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousRequester.sol index 8864d8fdff..b8e1bbed06 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousRequester.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousRequester.sol @@ -1,8 +1,8 @@ pragma solidity ^0.8.0; -import {MaliciousChainlink} from "./MaliciousChainlink.sol"; -import {MaliciousChainlinked, Chainlink} from "./MaliciousChainlinked.sol"; import {ChainlinkRequestInterface} from "../../interfaces/ChainlinkRequestInterface.sol"; +import {MaliciousChainlink} from "./MaliciousChainlink.sol"; +import {Chainlink, MaliciousChainlinked} from "./MaliciousChainlinked.sol"; contract MaliciousRequester is MaliciousChainlinked { uint256 private constant ORACLE_PAYMENT = 1 ether; @@ -14,11 +14,8 @@ contract MaliciousRequester is MaliciousChainlinked { } function maliciousWithdraw() public { - MaliciousChainlink.WithdrawRequest memory req = newWithdrawRequest( - "specId", - address(this), - this.doesNothing.selector - ); + MaliciousChainlink.WithdrawRequest memory req = + newWithdrawRequest("specId", address(this), this.doesNothing.selector); chainlinkWithdrawRequest(req, ORACLE_PAYMENT); } @@ -28,12 +25,16 @@ contract MaliciousRequester is MaliciousChainlinked { return chainlinkRequest(req, ORACLE_PAYMENT); } - function maliciousPrice(bytes32 _id) public returns (bytes32 requestId) { + function maliciousPrice( + bytes32 _id + ) public returns (bytes32 requestId) { Chainlink.Request memory req = newRequest(_id, address(this), this.doesNothing.selector); return chainlinkPriceRequest(req, ORACLE_PAYMENT); } - function maliciousTargetConsumer(address _target) public returns (bytes32 requestId) { + function maliciousTargetConsumer( + address _target + ) public returns (bytes32 requestId) { Chainlink.Request memory req = newRequest("specId", _target, bytes4(keccak256("fulfill(bytes32,bytes32)"))); return chainlinkTargetRequest(_target, req, ORACLE_PAYMENT); } @@ -41,10 +42,7 @@ contract MaliciousRequester is MaliciousChainlinked { function maliciousRequestCancel(bytes32 _id, bytes memory _callbackFunc) public { ChainlinkRequestInterface oracle = ChainlinkRequestInterface(oracleAddress()); oracle.cancelOracleRequest( - request(_id, address(this), _callbackFunc), - ORACLE_PAYMENT, - this.maliciousRequestCancel.selector, - s_expiration + request(_id, address(this), _callbackFunc), ORACLE_PAYMENT, this.maliciousRequestCancel.selector, s_expiration ); } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MockReceiver.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MockReceiver.sol index 38a0c3d926..30737a4b86 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MockReceiver.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MockReceiver.sol @@ -4,7 +4,9 @@ pragma solidity ^0.8.0; contract MockReceiver { uint256 private s_value; - function receiveData(uint256 _value) public { + function receiveData( + uint256 _value + ) public { s_value = _value; } diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MultiWordConsumer.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MultiWordConsumer.sol index 50420807cf..f21c6d376f 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MultiWordConsumer.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MultiWordConsumer.sol @@ -1,7 +1,7 @@ pragma solidity ^0.8.0; -import {ChainlinkClient, ChainlinkRequestInterface, LinkTokenInterface} from "../../ChainlinkClient.sol"; import {Chainlink} from "../../Chainlink.sol"; +import {ChainlinkClient, ChainlinkRequestInterface, LinkTokenInterface} from "../../ChainlinkClient.sol"; contract MultiWordConsumer is ChainlinkClient { using Chainlink for Chainlink.Request; @@ -17,18 +17,13 @@ contract MultiWordConsumer is ChainlinkClient { uint256 private s_eurInt; uint256 private s_jpyInt; - event RequestFulfilled( - bytes32 indexed requestId, // User-defined ID - bytes indexed price - ); + event RequestFulfilled( // User-defined ID + bytes32 indexed requestId, bytes indexed price); event RequestMultipleFulfilled(bytes32 indexed requestId, bytes32 indexed usd, bytes32 indexed eur, bytes32 jpy); event RequestMultipleFulfilledWithCustomURLs( - bytes32 indexed requestId, - uint256 indexed usd, - uint256 indexed eur, - uint256 jpy + bytes32 indexed requestId, uint256 indexed usd, uint256 indexed eur, uint256 jpy ); constructor(address _link, address _oracle, bytes32 _specId) { @@ -37,7 +32,9 @@ contract MultiWordConsumer is ChainlinkClient { s_specId = _specId; } - function setSpecID(bytes32 _specId) public { + function setSpecID( + bytes32 _specId + ) public { s_specId = _specId; } @@ -60,10 +57,8 @@ contract MultiWordConsumer is ChainlinkClient { string memory _pathJPY, uint256 _payment ) public { - Chainlink.Request memory req = _buildOperatorRequest( - s_specId, - this.fulfillMultipleParametersWithCustomURLs.selector - ); + Chainlink.Request memory req = + _buildOperatorRequest(s_specId, this.fulfillMultipleParametersWithCustomURLs.selector); req._add("urlUSD", _urlUSD); req._add("pathUSD", _pathUSD); req._add("urlEUR", _urlEUR); diff --git a/contracts/src/v0.8/shared/access/AuthorizedCallers.sol b/contracts/src/v0.8/shared/access/AuthorizedCallers.sol index f805117c38..ccf85ece41 100644 --- a/contracts/src/v0.8/shared/access/AuthorizedCallers.sol +++ b/contracts/src/v0.8/shared/access/AuthorizedCallers.sol @@ -25,7 +25,9 @@ contract AuthorizedCallers is Ownable2StepMsgSender { EnumerableSet.AddressSet internal s_authorizedCallers; /// @param authorizedCallers the authorized callers to set - constructor(address[] memory authorizedCallers) { + constructor( + address[] memory authorizedCallers + ) { _applyAuthorizedCallerUpdates( AuthorizedCallerArgs({addedCallers: authorizedCallers, removedCallers: new address[](0)}) ); @@ -38,13 +40,17 @@ contract AuthorizedCallers is Ownable2StepMsgSender { /// @notice Updates the list of authorized callers /// @param authorizedCallerArgs Callers to add and remove. Removals are performed first. - function applyAuthorizedCallerUpdates(AuthorizedCallerArgs memory authorizedCallerArgs) external onlyOwner { + function applyAuthorizedCallerUpdates( + AuthorizedCallerArgs memory authorizedCallerArgs + ) external onlyOwner { _applyAuthorizedCallerUpdates(authorizedCallerArgs); } /// @notice Updates the list of authorized callers /// @param authorizedCallerArgs Callers to add and remove. Removals are performed first. - function _applyAuthorizedCallerUpdates(AuthorizedCallerArgs memory authorizedCallerArgs) internal { + function _applyAuthorizedCallerUpdates( + AuthorizedCallerArgs memory authorizedCallerArgs + ) internal { address[] memory removedCallers = authorizedCallerArgs.removedCallers; for (uint256 i = 0; i < removedCallers.length; ++i) { address caller = removedCallers[i]; diff --git a/contracts/src/v0.8/shared/access/ConfirmedOwner.sol b/contracts/src/v0.8/shared/access/ConfirmedOwner.sol index 5b0c1593cc..0e9aadc2ef 100644 --- a/contracts/src/v0.8/shared/access/ConfirmedOwner.sol +++ b/contracts/src/v0.8/shared/access/ConfirmedOwner.sol @@ -6,5 +6,7 @@ import {ConfirmedOwnerWithProposal} from "./ConfirmedOwnerWithProposal.sol"; /// @title The ConfirmedOwner contract /// @notice A contract with helpers for basic contract ownership. contract ConfirmedOwner is ConfirmedOwnerWithProposal { - constructor(address newOwner) ConfirmedOwnerWithProposal(newOwner, address(0)) {} + constructor( + address newOwner + ) ConfirmedOwnerWithProposal(newOwner, address(0)) {} } diff --git a/contracts/src/v0.8/shared/access/ConfirmedOwnerWithProposal.sol b/contracts/src/v0.8/shared/access/ConfirmedOwnerWithProposal.sol index 2a6dd94e10..4f5431c268 100644 --- a/contracts/src/v0.8/shared/access/ConfirmedOwnerWithProposal.sol +++ b/contracts/src/v0.8/shared/access/ConfirmedOwnerWithProposal.sol @@ -23,7 +23,9 @@ contract ConfirmedOwnerWithProposal is IOwnable { } /// @notice Allows an owner to begin transferring ownership to a new address. - function transferOwnership(address to) public override onlyOwner { + function transferOwnership( + address to + ) public override onlyOwner { _transferOwnership(to); } @@ -45,7 +47,9 @@ contract ConfirmedOwnerWithProposal is IOwnable { } /// @notice validate, transfer ownership, and emit relevant events - function _transferOwnership(address to) private { + function _transferOwnership( + address to + ) private { // solhint-disable-next-line gas-custom-errors require(to != msg.sender, "Cannot transfer to self"); diff --git a/contracts/src/v0.8/shared/access/Ownable2Step.sol b/contracts/src/v0.8/shared/access/Ownable2Step.sol index 5eac576072..bcf69a0853 100644 --- a/contracts/src/v0.8/shared/access/Ownable2Step.sol +++ b/contracts/src/v0.8/shared/access/Ownable2Step.sol @@ -40,13 +40,17 @@ contract Ownable2Step is IOwnable { /// @notice Allows an owner to begin transferring ownership to a new address. The new owner needs to call /// `acceptOwnership` to accept the transfer before any permissions are changed. /// @param to The address to which ownership will be transferred. - function transferOwnership(address to) public override onlyOwner { + function transferOwnership( + address to + ) public override onlyOwner { _transferOwnership(to); } /// @notice validate, transfer ownership, and emit relevant events /// @param to The address to which ownership will be transferred. - function _transferOwnership(address to) private { + function _transferOwnership( + address to + ) private { if (to == msg.sender) { revert CannotTransferToSelf(); } diff --git a/contracts/src/v0.8/shared/access/SimpleWriteAccessController.sol b/contracts/src/v0.8/shared/access/SimpleWriteAccessController.sol index 5a53bdf613..48e884fe49 100644 --- a/contracts/src/v0.8/shared/access/SimpleWriteAccessController.sol +++ b/contracts/src/v0.8/shared/access/SimpleWriteAccessController.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {ConfirmedOwner} from "./ConfirmedOwner.sol"; import {AccessControllerInterface} from "../interfaces/AccessControllerInterface.sol"; +import {ConfirmedOwner} from "./ConfirmedOwner.sol"; /// @title SimpleWriteAccessController /// @notice Gives access to accounts explicitly added to an access list by the controller's owner. @@ -28,7 +28,9 @@ contract SimpleWriteAccessController is AccessControllerInterface, ConfirmedOwne /// @notice Adds an address to the access list /// @param _user The address to add - function addAccess(address _user) external onlyOwner { + function addAccess( + address _user + ) external onlyOwner { if (!s_accessList[_user]) { s_accessList[_user] = true; @@ -38,7 +40,9 @@ contract SimpleWriteAccessController is AccessControllerInterface, ConfirmedOwne /// @notice Removes an address from the access list /// @param _user The address to remove - function removeAccess(address _user) external onlyOwner { + function removeAccess( + address _user + ) external onlyOwner { if (s_accessList[_user]) { s_accessList[_user] = false; diff --git a/contracts/src/v0.8/shared/call/CallWithExactGas.sol b/contracts/src/v0.8/shared/call/CallWithExactGas.sol index 6716dc1595..3236608514 100644 --- a/contracts/src/v0.8/shared/call/CallWithExactGas.sol +++ b/contracts/src/v0.8/shared/call/CallWithExactGas.sol @@ -116,9 +116,7 @@ library CallWithExactGas { // limit our copy to maxReturnBytes bytes let toCopy := returndatasize() - if gt(toCopy, maxReturnBytes) { - toCopy := maxReturnBytes - } + if gt(toCopy, maxReturnBytes) { toCopy := maxReturnBytes } // Store the length of the copied bytes mstore(retData, toCopy) // copy the bytes from retData[0:_toCopy] diff --git a/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol b/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol index 5d0c2f1b97..0197010acc 100644 --- a/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol +++ b/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol @@ -16,6 +16,7 @@ library CallWithExactGasZKSync { error NotEnoughGasForPubdata(); /// @notice We assume that no more than `CALL_RETURN_OVERHEAD` ergs are used for the O(1) operations at the end of the execution, /// as such relaying the return. + uint256 internal constant CALL_RETURN_OVERHEAD = 400; bytes4 internal constant NO_CONTRACT_SIG = 0x0c3b563c; @@ -69,9 +70,7 @@ library CallWithExactGasZKSync { assembly { // limit our copy to maxReturnBytes bytes let toCopy := returndatasize() - if gt(toCopy, _maxReturnBytes) { - toCopy := _maxReturnBytes - } + if gt(toCopy, _maxReturnBytes) { toCopy := _maxReturnBytes } // Store the length of the copied bytes mstore(returnData, toCopy) // copy the bytes from retData[0:_toCopy] @@ -82,9 +81,8 @@ library CallWithExactGasZKSync { // It is possible that pubdataPublishedAfter < pubdataPublishedBefore if the call, e.g. removes // some of the previously created state diffs - uint256 pubdataSpent = pubdataPublishedAfter > pubdataPublishedBefore - ? pubdataPublishedAfter - pubdataPublishedBefore - : 0; + uint256 pubdataSpent = + pubdataPublishedAfter > pubdataPublishedBefore ? pubdataPublishedAfter - pubdataPublishedBefore : 0; uint256 pubdataGasRate = SYSTEM_CONTEXT_CONTRACT.gasPerPubdataByte(); diff --git a/contracts/src/v0.8/shared/enumerable/EnumerableSetWithBytes16.sol b/contracts/src/v0.8/shared/enumerable/EnumerableSetWithBytes16.sol index b78096773a..3457602ba7 100644 --- a/contracts/src/v0.8/shared/enumerable/EnumerableSetWithBytes16.sol +++ b/contracts/src/v0.8/shared/enumerable/EnumerableSetWithBytes16.sol @@ -126,7 +126,9 @@ library EnumerableSet { /** * @dev Returns the number of values on the set. O(1). */ - function _length(Set storage set) private view returns (uint256) { + function _length( + Set storage set + ) private view returns (uint256) { return set._values.length; } @@ -152,7 +154,9 @@ library EnumerableSet { * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ - function _values(Set storage set) private view returns (bytes32[] memory) { + function _values( + Set storage set + ) private view returns (bytes32[] memory) { return set._values; } @@ -192,7 +196,9 @@ library EnumerableSet { /** * @dev Returns the number of values in the set. O(1). */ - function length(Bytes32Set storage set) internal view returns (uint256) { + function length( + Bytes32Set storage set + ) internal view returns (uint256) { return _length(set._inner); } @@ -218,7 +224,9 @@ library EnumerableSet { * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ - function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { + function values( + Bytes32Set storage set + ) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; @@ -266,7 +274,9 @@ library EnumerableSet { /** * @dev Returns the number of values in the set. O(1). */ - function length(AddressSet storage set) internal view returns (uint256) { + function length( + AddressSet storage set + ) internal view returns (uint256) { return _length(set._inner); } @@ -292,7 +302,9 @@ library EnumerableSet { * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ - function values(AddressSet storage set) internal view returns (address[] memory) { + function values( + AddressSet storage set + ) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; @@ -340,7 +352,9 @@ library EnumerableSet { /** * @dev Returns the number of values in the set. O(1). */ - function length(UintSet storage set) internal view returns (uint256) { + function length( + UintSet storage set + ) internal view returns (uint256) { return _length(set._inner); } @@ -366,7 +380,9 @@ library EnumerableSet { * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ - function values(UintSet storage set) internal view returns (uint256[] memory) { + function values( + UintSet storage set + ) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; @@ -414,7 +430,9 @@ library EnumerableSet { /** * @dev Returns the number of values in the set. O(1). */ - function length(Bytes16Set storage set) internal view returns (uint256) { + function length( + Bytes16Set storage set + ) internal view returns (uint256) { return _length(set._inner); } @@ -440,7 +458,9 @@ library EnumerableSet { * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ - function values(Bytes16Set storage set) internal view returns (bytes16[] memory) { + function values( + Bytes16Set storage set + ) internal view returns (bytes16[] memory) { bytes32[] memory store = _values(set._inner); bytes16[] memory result; diff --git a/contracts/src/v0.8/shared/interfaces/AggregatorInterface.sol b/contracts/src/v0.8/shared/interfaces/AggregatorInterface.sol index 0ee4aa56ff..473d557492 100644 --- a/contracts/src/v0.8/shared/interfaces/AggregatorInterface.sol +++ b/contracts/src/v0.8/shared/interfaces/AggregatorInterface.sol @@ -9,9 +9,13 @@ interface AggregatorInterface { function latestRound() external view returns (uint256); - function getAnswer(uint256 roundId) external view returns (int256); + function getAnswer( + uint256 roundId + ) external view returns (int256); - function getTimestamp(uint256 roundId) external view returns (uint256); + function getTimestamp( + uint256 roundId + ) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt); diff --git a/contracts/src/v0.8/shared/interfaces/IOwnable.sol b/contracts/src/v0.8/shared/interfaces/IOwnable.sol index 3141fe9a43..262ac43535 100644 --- a/contracts/src/v0.8/shared/interfaces/IOwnable.sol +++ b/contracts/src/v0.8/shared/interfaces/IOwnable.sol @@ -4,7 +4,9 @@ pragma solidity ^0.8.0; interface IOwnable { function owner() external returns (address); - function transferOwnership(address recipient) external; + function transferOwnership( + address recipient + ) external; function acceptOwnership() external; } diff --git a/contracts/src/v0.8/shared/interfaces/IWERC20.sol b/contracts/src/v0.8/shared/interfaces/IWERC20.sol index 9607353048..6cde2bab6a 100644 --- a/contracts/src/v0.8/shared/interfaces/IWERC20.sol +++ b/contracts/src/v0.8/shared/interfaces/IWERC20.sol @@ -4,5 +4,7 @@ pragma solidity ^0.8.0; interface IWERC20 { function deposit() external payable; - function withdraw(uint256) external; + function withdraw( + uint256 + ) external; } diff --git a/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol b/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol index b23736b108..6056986794 100644 --- a/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol +++ b/contracts/src/v0.8/shared/interfaces/LinkTokenInterface.sol @@ -7,7 +7,9 @@ interface LinkTokenInterface { function approve(address spender, uint256 value) external returns (bool success); - function balanceOf(address owner) external view returns (uint256 balance); + function balanceOf( + address owner + ) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); diff --git a/contracts/src/v0.8/shared/mocks/ERC20Mock.sol b/contracts/src/v0.8/shared/mocks/ERC20Mock.sol index 0ee5b50d5b..3a89f965db 100644 --- a/contracts/src/v0.8/shared/mocks/ERC20Mock.sol +++ b/contracts/src/v0.8/shared/mocks/ERC20Mock.sol @@ -6,7 +6,9 @@ import {ERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/ERC20.sol"; contract ERC20Mock is ERC20 { uint8 internal immutable i_decimals; - constructor(uint8 decimals_) ERC20("ERC20Mock", "E20M") { + constructor( + uint8 decimals_ + ) ERC20("ERC20Mock", "E20M") { i_decimals = decimals_; } diff --git a/contracts/src/v0.8/shared/mocks/MockV3Aggregator.sol b/contracts/src/v0.8/shared/mocks/MockV3Aggregator.sol index a405b7f6be..5839fdfe02 100644 --- a/contracts/src/v0.8/shared/mocks/MockV3Aggregator.sol +++ b/contracts/src/v0.8/shared/mocks/MockV3Aggregator.sol @@ -29,7 +29,9 @@ contract MockV3Aggregator is AggregatorV2V3Interface { updateAnswer(_initialAnswer); } - function updateAnswer(int256 _answer) public { + function updateAnswer( + int256 _answer + ) public { latestAnswer = _answer; latestTimestamp = block.timestamp; latestRound++; diff --git a/contracts/src/v0.8/shared/mocks/WERC20Mock.sol b/contracts/src/v0.8/shared/mocks/WERC20Mock.sol index 51bd56648e..3d2c775219 100644 --- a/contracts/src/v0.8/shared/mocks/WERC20Mock.sol +++ b/contracts/src/v0.8/shared/mocks/WERC20Mock.sol @@ -18,7 +18,9 @@ contract WERC20Mock is ERC20 { emit Deposit(msg.sender, msg.value); } - function withdraw(uint256 wad) public { + function withdraw( + uint256 wad + ) public { // solhint-disable-next-line gas-custom-errors, reason-string require(balanceOf(msg.sender) >= wad); _burn(msg.sender, wad); diff --git a/contracts/src/v0.8/shared/ocr2/OCR2Base.sol b/contracts/src/v0.8/shared/ocr2/OCR2Base.sol index 0783782618..4c7a1e2aa1 100644 --- a/contracts/src/v0.8/shared/ocr2/OCR2Base.sol +++ b/contracts/src/v0.8/shared/ocr2/OCR2Base.sol @@ -18,7 +18,9 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { bool internal immutable i_uniqueReports; - constructor(bool uniqueReports) OwnerIsCreator() { + constructor( + bool uniqueReports + ) OwnerIsCreator() { i_uniqueReports = uniqueReports; } @@ -30,6 +32,7 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { uint8 f; // ───╮ uint8 n; // ───╯ } + ConfigInfo internal s_configInfo; /// @dev Incremented each time a new config is posted. This count is incorporated @@ -226,18 +229,16 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { // The constant-length components of the msg.data sent to transmit. // See the "If we wanted to call sam" example on for example reasoning // https://solidity.readthedocs.io/en/v0.7.2/abi-spec.html - uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = - 4 + // function selector - 32 * - 3 + // 3 words containing reportContext - 32 + // word containing start location of abiencoded report value - 32 + // word containing location start of abiencoded rs value - 32 + // word containing start location of abiencoded ss value - 32 + // rawVs value - 32 + // word containing length of report - 32 + // word containing length rs - 32 + // word containing length of ss - 0; // placeholder + uint16 private constant TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT = 4 // function selector + + 32 * 3 // 3 words containing reportContext + + 32 // word containing start location of abiencoded report value + + 32 // word containing location start of abiencoded rs value + + 32 // word containing start location of abiencoded ss value + + 32 // rawVs value + + 32 // word containing length of report + + 32 // word containing length rs + + 32 // word containing length of ss + + 0; // placeholder function _requireExpectedMsgDataLength( bytes calldata report, @@ -245,13 +246,10 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + - report.length + // one byte per entry in report - rs.length * - 32 + // 32 bytes per entry in _rs - ss.length * - 32 + // 32 bytes per entry in _ss - 0; // placeholder + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte per entry in report + + rs.length * 32 // 32 bytes per entry in _rs + + ss.length * 32 // 32 bytes per entry in _ss + + 0; // placeholder require(msg.data.length == expected, "calldata length mismatch"); } diff --git a/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol b/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol index c5206cd05d..20f0a13592 100644 --- a/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol +++ b/contracts/src/v0.8/shared/test/access/AuthorizedCallers.t.sol @@ -167,10 +167,8 @@ contract AuthorizedCallers_applyAuthorizedCallerUpdates is AuthorizedCallers_set function test_OnlyCallableByOwner_Revert() public { vm.stopPrank(); - AuthorizedCallers.AuthorizedCallerArgs memory authorizedCallerArgs = AuthorizedCallers.AuthorizedCallerArgs({ - addedCallers: new address[](0), - removedCallers: new address[](0) - }); + AuthorizedCallers.AuthorizedCallerArgs memory authorizedCallerArgs = + AuthorizedCallers.AuthorizedCallerArgs({addedCallers: new address[](0), removedCallers: new address[](0)}); vm.expectRevert(Ownable2Step.OnlyCallableByOwner.selector); diff --git a/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol b/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol index 5e91988fe6..394cb58eb4 100644 --- a/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol +++ b/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol @@ -33,20 +33,15 @@ contract CallWithExactGas__callWithExactGas is CallWithExactGasSetup { bytes memory data = abi.encodeWithSelector(funcSelector, payload); vm.assume( - funcSelector != GenericReceiver.setRevert.selector && - funcSelector != GenericReceiver.setErr.selector && - funcSelector != 0x5100fc21 // s_toRevert(), which is public and therefore has a function selector + funcSelector != GenericReceiver.setRevert.selector && funcSelector != GenericReceiver.setErr.selector + && funcSelector != 0x5100fc21 // s_toRevert(), which is public and therefore has a function selector ); vm.expectCall(address(s_receiver), data); vm.resumeGasMetering(); - bool success = s_caller.callWithExactGas( - data, - address(s_receiver), - DEFAULT_GAS_LIMIT, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK - ); + bool success = + s_caller.callWithExactGas(data, address(s_receiver), DEFAULT_GAS_LIMIT, DEFAULT_GAS_FOR_CALL_EXACT_CHECK); assertTrue(success); } @@ -56,11 +51,7 @@ contract CallWithExactGas__callWithExactGas is CallWithExactGasSetup { uint256 overheadForCallWithExactGas = 364; bytes memory payload = abi.encodeWithSelector( - s_caller.callWithExactGas.selector, - "", - address(s_receiver), - DEFAULT_GAS_LIMIT, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK + s_caller.callWithExactGas.selector, "", address(s_receiver), DEFAULT_GAS_LIMIT, DEFAULT_GAS_FOR_CALL_EXACT_CHECK ); // Since only 63/64th of the gas gets passed, we compensate @@ -89,12 +80,8 @@ contract CallWithExactGas__callWithExactGas is CallWithExactGasSetup { vm.expectCall(address(s_receiver), data); - bool success = s_caller.callWithExactGas( - data, - address(s_receiver), - DEFAULT_GAS_LIMIT * 10, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK - ); + bool success = + s_caller.callWithExactGas(data, address(s_receiver), DEFAULT_GAS_LIMIT * 10, DEFAULT_GAS_FOR_CALL_EXACT_CHECK); assertFalse(success); } @@ -160,9 +147,8 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet vm.pauseGasMetering(); bytes memory data = abi.encodeWithSelector(funcSelector, payload); vm.assume( - funcSelector != GenericReceiver.setRevert.selector && - funcSelector != GenericReceiver.setErr.selector && - funcSelector != 0x5100fc21 // s_toRevert(), which is public and therefore has a function selector + funcSelector != GenericReceiver.setRevert.selector && funcSelector != GenericReceiver.setErr.selector + && funcSelector != 0x5100fc21 // s_toRevert(), which is public and therefore has a function selector ); uint16 maxRetBytes = 0; @@ -170,11 +156,7 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet vm.resumeGasMetering(); (bool success, bytes memory retData, uint256 gasUsed) = s_caller.callWithExactGasSafeReturnData( - data, - address(s_receiver), - DEFAULT_GAS_LIMIT, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK, - maxRetBytes + data, address(s_receiver), DEFAULT_GAS_LIMIT, DEFAULT_GAS_FOR_CALL_EXACT_CHECK, maxRetBytes ); assertTrue(success); @@ -203,10 +185,7 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet uint256 allowedGas = (DEFAULT_GAS_LIMIT + (DEFAULT_GAS_LIMIT / 64)); allowedGas += - extcodesizeGas + - DEFAULT_GAS_FOR_CALL_EXACT_CHECK + - overheadForRetDataInit + - overheadForCallWithExactGas; + extcodesizeGas + DEFAULT_GAS_FOR_CALL_EXACT_CHECK + overheadForRetDataInit + overheadForCallWithExactGas; // Due to EIP-150 we expect to lose 1/64, so we compensate for this allowedGas = (allowedGas * 64) / 63; @@ -222,7 +201,9 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet assertGt(gasUsed, 500); } - function testFuzz_CallWithExactGasSafeReturnData_ConsumeAllGas_Success(uint8 gasLimitMultiplier) external { + function testFuzz_CallWithExactGasSafeReturnData_ConsumeAllGas_Success( + uint8 gasLimitMultiplier + ) external { vm.assume(gasLimitMultiplier > 0); // Assume not zero to avoid zero gas being passed to s_gasConsumer uint16 maxRetBytes = 0; @@ -231,7 +212,7 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet // Default gas limit of 20k times the amount generated by the fuzzer uint256 gasLimit = DEFAULT_GAS_LIMIT * gasLimitMultiplier; - (bool success, , uint256 gasUsed) = s_caller.callWithExactGasSafeReturnData( + (bool success,, uint256 gasUsed) = s_caller.callWithExactGasSafeReturnData( abi.encodePacked(s_gasConsumer.consumeAllGas.selector), address(s_gasConsumer), gasLimit, @@ -260,7 +241,7 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet vm.expectCall(address(s_gasConsumer), abi.encodeWithSelector(s_gasConsumer.throwOutOfGasError.selector)); - (bool success, , ) = s_caller.callWithExactGasSafeReturnData( + (bool success,,) = s_caller.callWithExactGasSafeReturnData( abi.encodePacked(s_gasConsumer.throwOutOfGasError.selector), address(s_gasConsumer), DEFAULT_GAS_LIMIT, @@ -271,7 +252,9 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet assertFalse(success, "Error: External Call Succeeded where it should not"); } - function testFuzz_CallWithExactGasReceiverErrorSuccess(uint16 testRetBytes) public { + function testFuzz_CallWithExactGasReceiverErrorSuccess( + uint16 testRetBytes + ) public { uint16 maxReturnBytes = 500; // Bound with upper limit, otherwise the test runs out of gas. testRetBytes = uint16(bound(testRetBytes, 0, maxReturnBytes * 10)); @@ -288,11 +271,7 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet vm.expectCall(address(s_receiver), data); (bool success, bytes memory retData, uint256 gasUsed) = s_caller.callWithExactGasSafeReturnData( - data, - address(s_receiver), - DEFAULT_GAS_LIMIT * 10, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK, - maxReturnBytes + data, address(s_receiver), DEFAULT_GAS_LIMIT * 10, DEFAULT_GAS_FOR_CALL_EXACT_CHECK, maxReturnBytes ); assertFalse(success); @@ -374,18 +353,14 @@ contract CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract is CallWithE vm.pauseGasMetering(); bytes memory data = abi.encodeWithSelector(funcSelector, payload); vm.assume( - funcSelector != GenericReceiver.setRevert.selector && - funcSelector != GenericReceiver.setErr.selector && - funcSelector != 0x5100fc21 // s_toRevert(), which is public and therefore has a function selector + funcSelector != GenericReceiver.setRevert.selector && funcSelector != GenericReceiver.setErr.selector + && funcSelector != 0x5100fc21 // s_toRevert(), which is public and therefore has a function selector ); vm.expectCall(address(s_receiver), data); vm.resumeGasMetering(); (bool success, bool sufficientGas) = s_caller.callWithExactGasEvenIfTargetIsNoContract( - data, - address(s_receiver), - DEFAULT_GAS_LIMIT, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK + data, address(s_receiver), DEFAULT_GAS_LIMIT, DEFAULT_GAS_FOR_CALL_EXACT_CHECK ); assertTrue(success); @@ -438,10 +413,7 @@ contract CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract is CallWithE vm.expectCall(address(s_receiver), data); (bool success, bool sufficientGas) = s_caller.callWithExactGasEvenIfTargetIsNoContract( - data, - address(s_receiver), - DEFAULT_GAS_LIMIT * 10, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK + data, address(s_receiver), DEFAULT_GAS_LIMIT * 10, DEFAULT_GAS_FOR_CALL_EXACT_CHECK ); // We don't care if it reverts, we only care if we have enough gas @@ -454,10 +426,7 @@ contract CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract is CallWithE address addressWithoutContract = address(1337); (bool success, bool sufficientGas) = s_caller.callWithExactGasEvenIfTargetIsNoContract( - data, - addressWithoutContract, - DEFAULT_GAS_LIMIT, - DEFAULT_GAS_FOR_CALL_EXACT_CHECK + data, addressWithoutContract, DEFAULT_GAS_LIMIT, DEFAULT_GAS_FOR_CALL_EXACT_CHECK ); assertTrue(success); @@ -473,9 +442,8 @@ contract CallWithExactGas__callWithExactGasEvenIfTargetIsNoContract is CallWithE DEFAULT_GAS_FOR_CALL_EXACT_CHECK ); - (bool outerCallSuccess, bytes memory SuccessAndSufficientGas) = address(s_caller).call{ - gas: DEFAULT_GAS_FOR_CALL_EXACT_CHECK - 1 - }(payload); + (bool outerCallSuccess, bytes memory SuccessAndSufficientGas) = + address(s_caller).call{gas: DEFAULT_GAS_FOR_CALL_EXACT_CHECK - 1}(payload); // The call succeeds assertTrue(outerCallSuccess); diff --git a/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol b/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol index 8d4ba75d50..92b2af4625 100644 --- a/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol +++ b/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.19; import {CallWithExactGasZKSync} from "../../call/CallWithExactGasZKSync.sol"; -import {CallWithExactGasZKSyncHelper} from "./CallWithExactGasZKSyncHelper.sol"; + import {BaseTest} from "../BaseTest.t.sol"; +import {CallWithExactGasZKSyncHelper} from "./CallWithExactGasZKSyncHelper.sol"; import {MockSystemContext} from "../mocks/MockSystemContext.sol"; import {TestTarget} from "../testhelpers/TestTarget.sol"; @@ -36,11 +37,7 @@ contract CallWithExactGasZKSyncSetup is BaseTest { ) internal returns (bool success, bytes memory retData) { // Encode the call to the helper function: bytes memory payload = abi.encodeWithSelector( - CallWithExactGasZKSyncHelper.callWithExactGasSafeReturnData.selector, - _to, - _maxTotalGas, - _data, - _maxReturnBytes + CallWithExactGasZKSyncHelper.callWithExactGasSafeReturnData.selector, _to, _maxTotalGas, _data, _maxReturnBytes ); // Constrain the subcall to `allowedGas` @@ -111,7 +108,7 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact // With the overhead, the check should fail, triggering NotEnoughGasForPubdata. vm.expectRevert(NotEnoughGasForPubdata.selector); - (bool successCall, ) = _limitedGasCallWithExactGas( + (bool successCall,) = _limitedGasCallWithExactGas( 400_000, // subcall gas address(s_target), 200_000, // _maxTotalGas exactly 200k @@ -124,11 +121,7 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact /// @notice Succeeds under normal conditions, returning data. function test__callWithExactGasSafeReturnData_Success() public { (bool successCall, bytes memory retData) = _limitedGasCallWithExactGas( - 5_000_000, - address(s_target), - 4_000_000, - abi.encodeWithSelector(TestTarget.returnData.selector), - 10000 + 5_000_000, address(s_target), 4_000_000, abi.encodeWithSelector(TestTarget.returnData.selector), 10000 ); assertTrue(successCall, "Subcall itself must not revert"); (bool success, bytes memory returnedData, uint256 pubdata) = _decodeResult(retData); @@ -150,7 +143,7 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact ); assertTrue(successCall, "Subcall must not revert"); - (bool success, bytes memory returnedData, ) = _decodeResult(retData); + (bool success, bytes memory returnedData,) = _decodeResult(retData); assertTrue(success, "Target call must succeed"); assertEq(returnedData.length, 50, "Should have truncated the large data to 50 bytes"); } @@ -160,12 +153,8 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact // Expect the revert reason "CustomRevertReason" vm.expectRevert(bytes("CustomRevertReason")); - (bool successCall, ) = _limitedGasCallWithExactGas( - 1_000_000, - address(s_target), - 1_000_000, - abi.encodeWithSelector(TestTarget.revertWithReason.selector), - 100 + (bool successCall,) = _limitedGasCallWithExactGas( + 1_000_000, address(s_target), 1_000_000, abi.encodeWithSelector(TestTarget.revertWithReason.selector), 100 ); assertFalse(successCall, "Subcall itself must revert"); } @@ -174,11 +163,7 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact function test__callWithExactGasSafeReturnData_RevertWhen_TargetRevertsNoReason() public { vm.expectRevert(); // just expect some revert, no reason _limitedGasCallWithExactGas( - 1_000_000, - address(s_target), - 1_000_000, - abi.encodeWithSelector(TestTarget.revertNoReason.selector), - 100 + 1_000_000, address(s_target), 1_000_000, abi.encodeWithSelector(TestTarget.revertNoReason.selector), 100 ); } } diff --git a/contracts/src/v0.8/shared/test/helpers/BurnMintERC20WithDrip.sol b/contracts/src/v0.8/shared/test/helpers/BurnMintERC20WithDrip.sol index 35329c86b2..ade67b7a17 100644 --- a/contracts/src/v0.8/shared/test/helpers/BurnMintERC20WithDrip.sol +++ b/contracts/src/v0.8/shared/test/helpers/BurnMintERC20WithDrip.sol @@ -7,7 +7,9 @@ contract BurnMintERC20WithDrip is BurnMintERC20 { constructor(string memory name, string memory symbol) BurnMintERC20(name, symbol, 18, 0, 0) {} // Gives one full token to any given address. - function drip(address to) external { + function drip( + address to + ) external { _mint(to, 1e18); } } diff --git a/contracts/src/v0.8/shared/test/helpers/ChainReaderTester.sol b/contracts/src/v0.8/shared/test/helpers/ChainReaderTester.sol index 51017944ff..c2e2e2f97a 100644 --- a/contracts/src/v0.8/shared/test/helpers/ChainReaderTester.sol +++ b/contracts/src/v0.8/shared/test/helpers/ChainReaderTester.sol @@ -99,7 +99,9 @@ contract ChainReaderTester { ); } - function setAlterablePrimitiveValue(uint64 value) public { + function setAlterablePrimitiveValue( + uint64 value + ) public { s_value = value; } @@ -114,21 +116,22 @@ contract ChainReaderTester { MidLevelDynamicTestStruct calldata nestedDynamicStruct, MidLevelStaticTestStruct calldata nestedStaticStruct ) public pure returns (TestStruct memory) { - return - TestStruct( - field, - differentField, - oracleId, - oracleIds, - accountStruct, - accounts, - bigField, - nestedDynamicStruct, - nestedStaticStruct - ); + return TestStruct( + field, + differentField, + oracleId, + oracleIds, + accountStruct, + accounts, + bigField, + nestedDynamicStruct, + nestedStaticStruct + ); } - function getElementAtIndex(uint256 i) public view returns (TestStruct memory) { + function getElementAtIndex( + uint256 i + ) public view returns (TestStruct memory) { // See chain_reader_interface_tests.go in chainlink-relay return s_seen[i - 1]; } @@ -176,7 +179,9 @@ contract ChainReaderTester { ); } - function triggerEventWithDynamicTopic(string calldata field) public { + function triggerEventWithDynamicTopic( + string calldata field + ) public { emit TriggeredEventWithDynamicTopic(field, field); } diff --git a/contracts/src/v0.8/shared/test/helpers/LogEmitter.sol b/contracts/src/v0.8/shared/test/helpers/LogEmitter.sol index 4bf9e9e567..fa6b7db9ca 100644 --- a/contracts/src/v0.8/shared/test/helpers/LogEmitter.sol +++ b/contracts/src/v0.8/shared/test/helpers/LogEmitter.sol @@ -8,19 +8,25 @@ contract LogEmitter { event Log3(string); event Log4(uint256 indexed, uint256 indexed); - function EmitLog1(uint256[] memory v) public { + function EmitLog1( + uint256[] memory v + ) public { for (uint256 i = 0; i < v.length; i++) { emit Log1(v[i]); } } - function EmitLog2(uint256[] memory v) public { + function EmitLog2( + uint256[] memory v + ) public { for (uint256 i = 0; i < v.length; i++) { emit Log2(v[i]); } } - function EmitLog3(string[] memory v) public { + function EmitLog3( + string[] memory v + ) public { for (uint256 i = 0; i < v.length; i++) { emit Log3(v[i]); } diff --git a/contracts/src/v0.8/shared/test/helpers/VRFLogEmitter.sol b/contracts/src/v0.8/shared/test/helpers/VRFLogEmitter.sol index 18b99605ac..fb379a0e9b 100644 --- a/contracts/src/v0.8/shared/test/helpers/VRFLogEmitter.sol +++ b/contracts/src/v0.8/shared/test/helpers/VRFLogEmitter.sol @@ -25,14 +25,7 @@ contract VRFLogEmitter { address sender ) public { emit RandomWordsRequested( - keyHash, - requestId, - preSeed, - subId, - minimumRequestConfirmations, - callbackGasLimit, - numWords, - sender + keyHash, requestId, preSeed, subId, minimumRequestConfirmations, callbackGasLimit, numWords, sender ); } diff --git a/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol b/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol index 16af8ccffc..bf496a996d 100644 --- a/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol +++ b/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol @@ -63,12 +63,16 @@ contract MockSystemContext is ISystemContext { return 1; } - function getBlockHashEVM(uint256 _block) external view override returns (bytes32) { + function getBlockHashEVM( + uint256 _block + ) external view override returns (bytes32) { // Return a dummy value (or actual blockhash if you prefer) return blockhash(_block); } - function getBatchHash(uint256 _batchNumber) external pure override returns (bytes32) { + function getBatchHash( + uint256 _batchNumber + ) external pure override returns (bytes32) { // Return dummy return keccak256(abi.encodePacked("BatchHashMock", _batchNumber)); } @@ -106,22 +110,30 @@ contract MockSystemContext is ISystemContext { // --------------------------------------- /// @notice Lets you set the mock pubdata spent for testing - function setCurrentPubdataSpent(uint256 newVal) external { + function setCurrentPubdataSpent( + uint256 newVal + ) external { s_currentPubdataSpent = newVal; } /// @notice Lets you set the mock gas per pubdata byte for testing - function setGasPerPubdataByte(uint256 newVal) external { + function setGasPerPubdataByte( + uint256 newVal + ) external { s_gasPerPubdataByte = newVal; } /// @notice Lets you set the mock block number - function setMockBlockNumber(uint128 newVal) external { + function setMockBlockNumber( + uint128 newVal + ) external { s_mockBlockNumber = newVal; } /// @notice Lets you set the mock block timestamp - function setMockBlockTimestamp(uint128 newVal) external { + function setMockBlockTimestamp( + uint128 newVal + ) external { s_mockBlockTimestamp = newVal; } } diff --git a/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol b/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol index daf847985e..e50a2599ec 100644 --- a/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol +++ b/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol @@ -9,9 +9,7 @@ contract GasConsumer { } lt(0, 1) {} { // If 100 gas is remaining, then exit the loop by returning. 100 was determined by manual binary search to be // the minimal amount of gas needed but less than the cost of another loop - if lt(gas(), 100) { - return(0x0, 0x0) // Return with no return data - } + if lt(gas(), 100) { return(0x0, 0x0) } // Return with no return data } } } diff --git a/contracts/src/v0.8/shared/test/testhelpers/GenericReceiver.sol b/contracts/src/v0.8/shared/test/testhelpers/GenericReceiver.sol index 2c058012df..277849ef81 100644 --- a/contracts/src/v0.8/shared/test/testhelpers/GenericReceiver.sol +++ b/contracts/src/v0.8/shared/test/testhelpers/GenericReceiver.sol @@ -5,15 +5,21 @@ contract GenericReceiver { bool public s_toRevert; bytes private s_err; - constructor(bool toRevert) { + constructor( + bool toRevert + ) { s_toRevert = toRevert; } - function setRevert(bool toRevert) external { + function setRevert( + bool toRevert + ) external { s_toRevert = toRevert; } - function setErr(bytes memory err) external { + function setErr( + bytes memory err + ) external { s_err = err; } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent/BurnMintERC20PausableFreezableTransparentTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent/BurnMintERC20PausableFreezableTransparentTest.t.sol index ca906f9a2a..738c96d5b8 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent/BurnMintERC20PausableFreezableTransparentTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent/BurnMintERC20PausableFreezableTransparentTest.t.sol @@ -1,9 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BurnMintERC20PausableFreezableTransparent} from "../../../../../token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol"; +import {BurnMintERC20PausableFreezableTransparent} from + "../../../../../token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol"; import {BurnMintERC20Transparent} from "../../../../../token/ERC20/upgradeable/BurnMintERC20Transparent.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts@5.0.2/proxy/transparent/TransparentUpgradeableProxy.sol"; +import {TransparentUpgradeableProxy} from + "@openzeppelin/contracts@5.0.2/proxy/transparent/TransparentUpgradeableProxy.sol"; import {ERC20UpgradableBaseTest_freeze} from "../ERC20UpgradableBaseTest.freeze.t.sol"; import {ERC20UpgradableBaseTest_unfreeze} from "../ERC20UpgradableBaseTest.unfreeze.t.sol"; @@ -22,8 +24,7 @@ contract BurnMintERC20PausableFreezableTransparentTest is implementation, INITIAL_OWNER_ADDRESS_FOR_PROXY_ADMIN, abi.encodeCall( - BurnMintERC20Transparent.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN) + BurnMintERC20Transparent.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN) ) ) ); @@ -32,12 +33,10 @@ contract BurnMintERC20PausableFreezableTransparentTest is changePrank(DEFAULT_ADMIN); s_burnMintERC20PausableFreezableTransparent.grantRole( - s_burnMintERC20PausableFreezableTransparent.PAUSER_ROLE(), - DEFAULT_PAUSER + s_burnMintERC20PausableFreezableTransparent.PAUSER_ROLE(), DEFAULT_PAUSER ); s_burnMintERC20PausableFreezableTransparent.grantRole( - s_burnMintERC20PausableFreezableTransparent.FREEZER_ROLE(), - DEFAULT_FREEZER + s_burnMintERC20PausableFreezableTransparent.FREEZER_ROLE(), DEFAULT_FREEZER ); } @@ -55,8 +54,7 @@ contract BurnMintERC20PausableFreezableTransparentTest is function test_Freeze_RevertWhen_CallerDoesNotHaveFreezerRole() public { should_Freeze_RevertWhen_CallerDoesNotHaveFreezerRole( - address(s_burnMintERC20PausableFreezableTransparent), - s_burnMintERC20PausableFreezableTransparent.FREEZER_ROLE() + address(s_burnMintERC20PausableFreezableTransparent), s_burnMintERC20PausableFreezableTransparent.FREEZER_ROLE() ); } @@ -116,8 +114,7 @@ contract BurnMintERC20PausableFreezableTransparentTest is function test_Unfreeze_RevertWhen_CallerDoesNotHaveFreezerRole() public { should_Unfreeze_RevertWhen_CallerDoesNotHaveFreezerRole( - address(s_burnMintERC20PausableFreezableTransparent), - s_burnMintERC20PausableFreezableTransparent.FREEZER_ROLE() + address(s_burnMintERC20PausableFreezableTransparent), s_burnMintERC20PausableFreezableTransparent.FREEZER_ROLE() ); } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS/BurnMintERC20PausableFreezableUUPSTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS/BurnMintERC20PausableFreezableUUPSTest.t.sol index b415b6e276..a2e5a00905 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS/BurnMintERC20PausableFreezableUUPSTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS/BurnMintERC20PausableFreezableUUPSTest.t.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BurnMintERC20PausableFreezableUUPS} from "../../../../../token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol"; +import {BurnMintERC20PausableFreezableUUPS} from + "../../../../../token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol"; import {BurnMintERC20UUPS} from "../../../../../token/ERC20/upgradeable/BurnMintERC20UUPS.sol"; import {ERC20UpgradableBaseTest_freeze} from "../ERC20UpgradableBaseTest.freeze.t.sol"; import {ERC20UpgradableBaseTest_unfreeze} from "../ERC20UpgradableBaseTest.unfreeze.t.sol"; @@ -17,8 +18,7 @@ contract BurnMintERC20PausableFreezableUUPSTest is ERC20UpgradableBaseTest_freez new ERC1967Proxy( implementation, abi.encodeCall( - BurnMintERC20UUPS.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER) + BurnMintERC20UUPS.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER) ) ) ); @@ -27,10 +27,7 @@ contract BurnMintERC20PausableFreezableUUPSTest is ERC20UpgradableBaseTest_freez changePrank(DEFAULT_ADMIN); s_burnMintERC20PausableFreezableUUPS.grantRole(s_burnMintERC20PausableFreezableUUPS.PAUSER_ROLE(), DEFAULT_PAUSER); - s_burnMintERC20PausableFreezableUUPS.grantRole( - s_burnMintERC20PausableFreezableUUPS.FREEZER_ROLE(), - DEFAULT_FREEZER - ); + s_burnMintERC20PausableFreezableUUPS.grantRole(s_burnMintERC20PausableFreezableUUPS.FREEZER_ROLE(), DEFAULT_FREEZER); } // ================================================================ @@ -47,8 +44,7 @@ contract BurnMintERC20PausableFreezableUUPSTest is ERC20UpgradableBaseTest_freez function test_Freeze_RevertWhen_CallerDoesNotHaveFreezerRole() public { should_Freeze_RevertWhen_CallerDoesNotHaveFreezerRole( - address(s_burnMintERC20PausableFreezableUUPS), - s_burnMintERC20PausableFreezableUUPS.FREEZER_ROLE() + address(s_burnMintERC20PausableFreezableUUPS), s_burnMintERC20PausableFreezableUUPS.FREEZER_ROLE() ); } @@ -108,8 +104,7 @@ contract BurnMintERC20PausableFreezableUUPSTest is ERC20UpgradableBaseTest_freez function test_Unfreeze_RevertWhen_CallerDoesNotHaveFreezerRole() public { should_Unfreeze_RevertWhen_CallerDoesNotHaveFreezerRole( - address(s_burnMintERC20PausableFreezableUUPS), - s_burnMintERC20PausableFreezableUUPS.FREEZER_ROLE() + address(s_burnMintERC20PausableFreezableUUPS), s_burnMintERC20PausableFreezableUUPS.FREEZER_ROLE() ); } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableTransparent/BurnMintERC20PausableTransparentTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableTransparent/BurnMintERC20PausableTransparentTest.t.sol index 617d827e94..041cf5f741 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableTransparent/BurnMintERC20PausableTransparentTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableTransparent/BurnMintERC20PausableTransparentTest.t.sol @@ -1,10 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BurnMintERC20PausableTransparent} from "../../../../../token/ERC20/upgradeable/BurnMintERC20PausableTransparent.sol"; +import {BurnMintERC20PausableTransparent} from + "../../../../../token/ERC20/upgradeable/BurnMintERC20PausableTransparent.sol"; import {BurnMintERC20Transparent} from "../../../../../token/ERC20/upgradeable/BurnMintERC20Transparent.sol"; import {ERC20UpgradableBaseTest_pausing} from "../ERC20UpgradableBaseTest.pausing.t.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts@5.0.2/proxy/transparent/TransparentUpgradeableProxy.sol"; +import {TransparentUpgradeableProxy} from + "@openzeppelin/contracts@5.0.2/proxy/transparent/TransparentUpgradeableProxy.sol"; contract BurnMintERC20PausableTransparentTest is ERC20UpgradableBaseTest_pausing { BurnMintERC20PausableTransparent internal s_burnMintERC20PausableTransparent; @@ -17,8 +19,7 @@ contract BurnMintERC20PausableTransparentTest is ERC20UpgradableBaseTest_pausing implementation, INITIAL_OWNER_ADDRESS_FOR_PROXY_ADMIN, abi.encodeCall( - BurnMintERC20Transparent.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN) + BurnMintERC20Transparent.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN) ) ) ); @@ -44,15 +45,13 @@ contract BurnMintERC20PausableTransparentTest is ERC20UpgradableBaseTest_pausing function test_Pause_RevertWhen_CallerDoesNotHavePauserRole() public { should_Pause_RevertWhen_CallerDoesNotHavePauserRole( - address(s_burnMintERC20PausableTransparent), - s_burnMintERC20PausableTransparent.PAUSER_ROLE() + address(s_burnMintERC20PausableTransparent), s_burnMintERC20PausableTransparent.PAUSER_ROLE() ); } function test_Unpause_RevertWhen_CallerDoesNotHaveDefaultAdminRole() public { should_Unpause_RevertWhen_CallerDoesNotHaveDefaultAdminRole( - address(s_burnMintERC20PausableTransparent), - s_burnMintERC20PausableTransparent.DEFAULT_ADMIN_ROLE() + address(s_burnMintERC20PausableTransparent), s_burnMintERC20PausableTransparent.DEFAULT_ADMIN_ROLE() ); } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol index 1cb15c5047..51f054ac03 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol @@ -32,11 +32,15 @@ contract MockBurnMintERC20PausableUUPSV2 is BurnMintERC20PausableUUPS { } } - function initializeFreezerRole(address defaultFreezer) public onlyRole(UPGRADER_ROLE) { + function initializeFreezerRole( + address defaultFreezer + ) public onlyRole(UPGRADER_ROLE) { _grantRole(FREEZER_ROLE, defaultFreezer); } - function freeze(address account) public onlyRole(FREEZER_ROLE) { + function freeze( + address account + ) public onlyRole(FREEZER_ROLE) { MockBurnMintERC20PausableUUPSV2Storage storage $ = _getV2Storage(); $.s_isFrozen[account] = true; } @@ -61,8 +65,7 @@ contract BurnMintERC20PausableUUPS_upgrade is ERC20UpgradableBaseTest_pausing { new ERC1967Proxy( implementation, abi.encodeCall( - BurnMintERC20UUPS.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER) + BurnMintERC20UUPS.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER) ) ) ); @@ -106,8 +109,7 @@ contract BurnMintERC20PausableUUPS_upgrade is ERC20UpgradableBaseTest_pausing { changePrank(STRANGER); vm.expectRevert( abi.encodeWithSelector( - MockBurnMintERC20PausableUUPSV2.MockBurnMintERC20PausableUUPSV2__AccountFrozen.selector, - STRANGER + MockBurnMintERC20PausableUUPSV2.MockBurnMintERC20PausableUUPSV2__AccountFrozen.selector, STRANGER ) ); newImplementation.transfer(OWNER, AMOUNT); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPSTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPSTest.t.sol index 4b3b3f94e7..477cf96204 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPSTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPSTest.t.sol @@ -16,8 +16,7 @@ contract BurnMintERC20PausableUUPSTest is ERC20UpgradableBaseTest_pausing { new ERC1967Proxy( implementation, abi.encodeCall( - BurnMintERC20UUPS.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER) + BurnMintERC20UUPS.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER) ) ) ); @@ -43,15 +42,13 @@ contract BurnMintERC20PausableUUPSTest is ERC20UpgradableBaseTest_pausing { function test_Pause_RevertWhen_CallerDoesNotHavePauserRole() public { should_Pause_RevertWhen_CallerDoesNotHavePauserRole( - address(s_burnMintERC20PausableUUPS), - s_burnMintERC20PausableUUPS.PAUSER_ROLE() + address(s_burnMintERC20PausableUUPS), s_burnMintERC20PausableUUPS.PAUSER_ROLE() ); } function test_Unpause_RevertWhen_CallerDoesNotHaveDefaultAdminRole() public { should_Unpause_RevertWhen_CallerDoesNotHaveDefaultAdminRole( - address(s_burnMintERC20PausableUUPS), - s_burnMintERC20PausableUUPS.DEFAULT_ADMIN_ROLE() + address(s_burnMintERC20PausableUUPS), s_burnMintERC20PausableUUPS.DEFAULT_ADMIN_ROLE() ); } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol index 3991d99c5d..6f1247c6f0 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol @@ -1,8 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BurnMintERC20Transparent, Initializable} from "../../../../../token/ERC20/upgradeable/BurnMintERC20Transparent.sol"; -import {TransparentUpgradeableProxy} from "@openzeppelin/contracts@5.0.2/proxy/transparent/TransparentUpgradeableProxy.sol"; +import { + BurnMintERC20Transparent, Initializable +} from "../../../../../token/ERC20/upgradeable/BurnMintERC20Transparent.sol"; +import {TransparentUpgradeableProxy} from + "@openzeppelin/contracts@5.0.2/proxy/transparent/TransparentUpgradeableProxy.sol"; import {ERC20UpgradableBaseTest_approve} from "../ERC20UpgradableBaseTest.approve.t.sol"; import {ERC20UpgradableBaseTest_burn} from "../ERC20UpgradableBaseTest.burn.t.sol"; @@ -54,14 +57,8 @@ contract BurnMintERC20TransparentTest is function setUp() public virtual override { ERC20UpgradableBaseTest.setUp(); - s_burnMintERC20Transparent = deployBurnMintERC20Transparent( - NAME, - SYMBOL, - DECIMALS, - MAX_SUPPLY, - PRE_MINT, - DEFAULT_ADMIN - ); + s_burnMintERC20Transparent = + deployBurnMintERC20Transparent(NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN); s_burnMintERC20Transparent.grantMintAndBurnRoles(i_mockPool); } @@ -76,14 +73,8 @@ contract BurnMintERC20TransparentTest is function test_Initialize_WithPreMint() public { uint256 newPreMint = 1e18; - BurnMintERC20Transparent newBurnMintERC20Transparent = deployBurnMintERC20Transparent( - NAME, - SYMBOL, - DECIMALS, - MAX_SUPPLY, - newPreMint, - DEFAULT_ADMIN - ); + BurnMintERC20Transparent newBurnMintERC20Transparent = + deployBurnMintERC20Transparent(NAME, SYMBOL, DECIMALS, MAX_SUPPLY, newPreMint, DEFAULT_ADMIN); should_Initialize_WithPreMint(address(newBurnMintERC20Transparent), newPreMint); } @@ -100,8 +91,7 @@ contract BurnMintERC20TransparentTest is implementation, INITIAL_OWNER_ADDRESS_FOR_PROXY_ADMIN, abi.encodeCall( - BurnMintERC20Transparent.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, newPreMint, DEFAULT_ADMIN) + BurnMintERC20Transparent.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, newPreMint, DEFAULT_ADMIN) ) ); } @@ -139,8 +129,7 @@ contract BurnMintERC20TransparentTest is function test_Approve_RevertWhen_RecipientIsImplementationItself() public { should_Approve_RevertWhen_RecipientIsImplementationItself( - address(s_burnMintERC20Transparent), - BurnMintERC20Transparent.BurnMintERC20Transparent__InvalidRecipient.selector + address(s_burnMintERC20Transparent), BurnMintERC20Transparent.BurnMintERC20Transparent__InvalidRecipient.selector ); } @@ -154,22 +143,19 @@ contract BurnMintERC20TransparentTest is function test_Mint_RevertWhen_CallerDoesNotHaveMinterRole() public { should_Mint_RevertWhen_CallerDoesNotHaveMinterRole( - address(s_burnMintERC20Transparent), - s_burnMintERC20Transparent.MINTER_ROLE() + address(s_burnMintERC20Transparent), s_burnMintERC20Transparent.MINTER_ROLE() ); } function test_Mint_RevertWhen_AmountExceedsMaxSupply() public { should_Mint_RevertWhen_AmountExceedsMaxSupply( - address(s_burnMintERC20Transparent), - BurnMintERC20Transparent.BurnMintERC20Transparent__MaxSupplyExceeded.selector + address(s_burnMintERC20Transparent), BurnMintERC20Transparent.BurnMintERC20Transparent__MaxSupplyExceeded.selector ); } function test_Mint_RevertWhen_RecipientIsImplementationItself() public { should_Mint_RevertWhen_RecipientIsImplementationItself( - address(s_burnMintERC20Transparent), - BurnMintERC20Transparent.BurnMintERC20Transparent__InvalidRecipient.selector + address(s_burnMintERC20Transparent), BurnMintERC20Transparent.BurnMintERC20Transparent__InvalidRecipient.selector ); } @@ -179,8 +165,7 @@ contract BurnMintERC20TransparentTest is function test_Burn_RevertWhen_CallerDoesNotHaveBurnerRole() public { should_Burn_RevertWhen_CallerDoesNotHaveBurnerRole( - address(s_burnMintERC20Transparent), - s_burnMintERC20Transparent.BURNER_ROLE() + address(s_burnMintERC20Transparent), s_burnMintERC20Transparent.BURNER_ROLE() ); } @@ -190,8 +175,7 @@ contract BurnMintERC20TransparentTest is function test_BurnFrom_RevertWhen_CallerDoesNotHaveBurnerRole() public { should_BurnFrom_RevertWhen_CallerDoesNotHaveBurnerRole( - address(s_burnMintERC20Transparent), - s_burnMintERC20Transparent.BURNER_ROLE() + address(s_burnMintERC20Transparent), s_burnMintERC20Transparent.BURNER_ROLE() ); } @@ -201,8 +185,7 @@ contract BurnMintERC20TransparentTest is function test_BurnFrom_alias_RevertWhen_CallerDoesNotHaveBurnerRole() public { should_BurnFrom_alias_RevertWhen_CallerDoesNotHaveBurnerRole( - address(s_burnMintERC20Transparent), - s_burnMintERC20Transparent.BURNER_ROLE() + address(s_burnMintERC20Transparent), s_burnMintERC20Transparent.BURNER_ROLE() ); } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol index 0461262512..e6ac6f5068 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol @@ -1,7 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {BurnMintERC20UUPS, Initializable, UUPSUpgradeable} from "../../../../../token/ERC20/upgradeable/BurnMintERC20UUPS.sol"; +import { + BurnMintERC20UUPS, + Initializable, + UUPSUpgradeable +} from "../../../../../token/ERC20/upgradeable/BurnMintERC20UUPS.sol"; import {IERC1822Proxiable} from "@openzeppelin/contracts@5.0.2/interfaces/draft-IERC1822.sol"; import {ERC1967Proxy} from "@openzeppelin/contracts@5.0.2/proxy/ERC1967/ERC1967Proxy.sol"; @@ -46,8 +50,7 @@ contract BurnMintERC20UUPSTest is new ERC1967Proxy( implementation, abi.encodeCall( - BurnMintERC20UUPS.initialize, - (name, symbol, decimals, maxSupply, preMint, defaultAdmin, defaultUpgrader) + BurnMintERC20UUPS.initialize, (name, symbol, decimals, maxSupply, preMint, defaultAdmin, defaultUpgrader) ) ) ); @@ -58,15 +61,8 @@ contract BurnMintERC20UUPSTest is function setUp() public virtual override { ERC20UpgradableBaseTest.setUp(); - s_burnMintERC20UUPS = deployBurnMintERC20UUPS( - NAME, - SYMBOL, - DECIMALS, - MAX_SUPPLY, - PRE_MINT, - DEFAULT_ADMIN, - DEFAULT_UPGRADER - ); + s_burnMintERC20UUPS = + deployBurnMintERC20UUPS(NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER); // Grant mint and burn role to the mock pool address s_burnMintERC20UUPS.grantMintAndBurnRoles(i_mockPool); @@ -83,15 +79,8 @@ contract BurnMintERC20UUPSTest is function test_Initialize_WithPreMint() public { uint256 newPreMint = 1e18; - BurnMintERC20UUPS newBurnMintERC20UUPS = deployBurnMintERC20UUPS( - NAME, - SYMBOL, - DECIMALS, - MAX_SUPPLY, - newPreMint, - DEFAULT_ADMIN, - DEFAULT_UPGRADER - ); + BurnMintERC20UUPS newBurnMintERC20UUPS = + deployBurnMintERC20UUPS(NAME, SYMBOL, DECIMALS, MAX_SUPPLY, newPreMint, DEFAULT_ADMIN, DEFAULT_UPGRADER); should_Initialize_WithPreMint(address(newBurnMintERC20UUPS), newPreMint); } @@ -100,15 +89,12 @@ contract BurnMintERC20UUPSTest is uint256 newPreMint = MAX_SUPPLY + 1; address implementation = address(new BurnMintERC20UUPS()); - vm.expectRevert( - abi.encodeWithSelector(BurnMintERC20UUPS.BurnMintERC20UUPS__MaxSupplyExceeded.selector, newPreMint) - ); + vm.expectRevert(abi.encodeWithSelector(BurnMintERC20UUPS.BurnMintERC20UUPS__MaxSupplyExceeded.selector, newPreMint)); new ERC1967Proxy( implementation, abi.encodeCall( - BurnMintERC20UUPS.initialize, - (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, newPreMint, DEFAULT_ADMIN, DEFAULT_UPGRADER) + BurnMintERC20UUPS.initialize, (NAME, SYMBOL, DECIMALS, MAX_SUPPLY, newPreMint, DEFAULT_ADMIN, DEFAULT_UPGRADER) ) ); } @@ -159,8 +145,7 @@ contract BurnMintERC20UUPSTest is function test_Approve_RevertWhen_RecipientIsImplementationItself() public { should_Approve_RevertWhen_RecipientIsImplementationItself( - address(s_burnMintERC20UUPS), - BurnMintERC20UUPS.BurnMintERC20UUPS__InvalidRecipient.selector + address(s_burnMintERC20UUPS), BurnMintERC20UUPS.BurnMintERC20UUPS__InvalidRecipient.selector ); } @@ -178,15 +163,13 @@ contract BurnMintERC20UUPSTest is function test_Mint_RevertWhen_AmountExceedsMaxSupply() public { should_Mint_RevertWhen_AmountExceedsMaxSupply( - address(s_burnMintERC20UUPS), - BurnMintERC20UUPS.BurnMintERC20UUPS__MaxSupplyExceeded.selector + address(s_burnMintERC20UUPS), BurnMintERC20UUPS.BurnMintERC20UUPS__MaxSupplyExceeded.selector ); } function test_Mint_RevertWhen_RecipientIsImplementationItself() public { should_Mint_RevertWhen_RecipientIsImplementationItself( - address(s_burnMintERC20UUPS), - BurnMintERC20UUPS.BurnMintERC20UUPS__InvalidRecipient.selector + address(s_burnMintERC20UUPS), BurnMintERC20UUPS.BurnMintERC20UUPS__InvalidRecipient.selector ); } @@ -204,8 +187,7 @@ contract BurnMintERC20UUPSTest is function test_BurnFrom_RevertWhen_CallerDoesNotHaveBurnerRole() public { should_BurnFrom_RevertWhen_CallerDoesNotHaveBurnerRole( - address(s_burnMintERC20UUPS), - s_burnMintERC20UUPS.BURNER_ROLE() + address(s_burnMintERC20UUPS), s_burnMintERC20UUPS.BURNER_ROLE() ); } @@ -215,8 +197,7 @@ contract BurnMintERC20UUPSTest is function test_BurnFrom_alias_RevertWhen_CallerDoesNotHaveBurnerRole() public { should_BurnFrom_alias_RevertWhen_CallerDoesNotHaveBurnerRole( - address(s_burnMintERC20UUPS), - s_burnMintERC20UUPS.BURNER_ROLE() + address(s_burnMintERC20UUPS), s_burnMintERC20UUPS.BURNER_ROLE() ); } @@ -226,9 +207,7 @@ contract BurnMintERC20UUPSTest is function test_GrantMintAndBurnRoles() public { should_GrantMintAndBurnRoles( - address(s_burnMintERC20UUPS), - s_burnMintERC20UUPS.MINTER_ROLE(), - s_burnMintERC20UUPS.BURNER_ROLE() + address(s_burnMintERC20UUPS), s_burnMintERC20UUPS.MINTER_ROLE(), s_burnMintERC20UUPS.BURNER_ROLE() ); } diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.approve.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.approve.t.sol index bb69c72e9b..a498668177 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.approve.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.approve.t.sol @@ -7,7 +7,9 @@ import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_approve is ERC20UpgradableBaseTest { - function should_Approve(address implementation) public { + function should_Approve( + address implementation + ) public { changePrank(i_mockPool); IBurnMintERC20Upgradeable(implementation).mint(STRANGER, AMOUNT); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burn.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burn.t.sol index c1f7a94482..86d26915e2 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burn.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burn.t.sol @@ -8,7 +8,9 @@ import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_burn is ERC20UpgradableBaseTest { - function should_Burn(address implementation) public { + function should_Burn( + address implementation + ) public { changePrank(i_mockPool); IBurnMintERC20Upgradeable(implementation).mint(STRANGER, AMOUNT); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom.t.sol index d741148d91..010d9b8f30 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom.t.sol @@ -8,7 +8,9 @@ import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_burnFrom is ERC20UpgradableBaseTest { - function should_BurnFrom(address implementation) public { + function should_BurnFrom( + address implementation + ) public { changePrank(i_mockPool); IBurnMintERC20Upgradeable(implementation).mint(STRANGER, AMOUNT); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom_alias.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom_alias.t.sol index 4eae7b8e50..eeaf821202 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom_alias.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.burnFrom_alias.t.sol @@ -8,7 +8,9 @@ import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_burnFrom_alias is ERC20UpgradableBaseTest { - function should_BurnFrom_alias(address implementation) public { + function should_BurnFrom_alias( + address implementation + ) public { changePrank(i_mockPool); IBurnMintERC20Upgradeable(implementation).mint(STRANGER, AMOUNT); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.freeze.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.freeze.t.sol index c4cc61dfb1..f7062ce454 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.freeze.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.freeze.t.sol @@ -2,14 +2,17 @@ pragma solidity ^0.8.24; import {IBurnMintERC20Upgradeable} from "../../../../../shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol"; -import {PausableUpgradeable} from "../../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; +import {PausableUpgradeable} from + "../../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; import {IAccessControl} from "@openzeppelin/contracts@5.0.2/access/IAccessControl.sol"; import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest, IERC20UpgradeableBase} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_freeze is ERC20UpgradableBaseTest { - function should_Freeze(address implementation) public { + function should_Freeze( + address implementation + ) public { changePrank(DEFAULT_FREEZER); vm.expectEmit(); @@ -19,7 +22,9 @@ contract ERC20UpgradableBaseTest_freeze is ERC20UpgradableBaseTest { assertTrue(IERC20UpgradeableBase(implementation).isFrozen(OWNER)); } - function should_Freeze_EvenWhenImplementationIsPaused(address implementation) public { + function should_Freeze_EvenWhenImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); assertTrue(PausableUpgradeable(implementation).paused()); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.mint.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.mint.t.sol index c1473d2250..b247b6b602 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.mint.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.mint.t.sol @@ -7,7 +7,9 @@ import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest, IERC20UpgradeableBase} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_mint is ERC20UpgradableBaseTest { - function should_Mint(address implementation) public { + function should_Mint( + address implementation + ) public { changePrank(i_mockPool); uint256 balanceBefore = IERC20UpgradeableBase(implementation).balanceOf(STRANGER); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.pausing.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.pausing.t.sol index 688839131f..adb188bf1d 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.pausing.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.pausing.t.sol @@ -2,14 +2,17 @@ pragma solidity ^0.8.24; import {IBurnMintERC20Upgradeable} from "../../../../../shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol"; -import {PausableUpgradeable} from "../../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; +import {PausableUpgradeable} from + "../../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; import {IAccessControl} from "@openzeppelin/contracts@5.0.2/access/IAccessControl.sol"; import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest, IERC20UpgradeableBase} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { - function should_Pause(address implementation) public { + function should_Pause( + address implementation + ) public { changePrank(DEFAULT_PAUSER); vm.expectEmit(); @@ -20,7 +23,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { assertTrue(PausableUpgradeable(implementation).paused()); } - function should_Unpause(address implementation) public { + function should_Unpause( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); @@ -67,7 +72,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { IERC20UpgradeableBase(implementation).unpause(); } - function should_Mint_RevertWhen_ImplementationIsPaused(address implementation) public { + function should_Mint_RevertWhen_ImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); @@ -77,7 +84,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { IBurnMintERC20Upgradeable(implementation).mint(STRANGER, AMOUNT); } - function should_Transfer_RevertWhen_ImplementationIsPaused(address implementation) public { + function should_Transfer_RevertWhen_ImplementationIsPaused( + address implementation + ) public { changePrank(i_mockPool); IBurnMintERC20Upgradeable(implementation).mint(STRANGER, AMOUNT); @@ -89,7 +98,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { IERC20(implementation).transfer(OWNER, AMOUNT); } - function should_Burn_RevertWhen_ImplementationIsPaused(address implementation) public { + function should_Burn_RevertWhen_ImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); @@ -100,7 +111,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { IBurnMintERC20Upgradeable(implementation).burn(0); } - function should_BurnFrom_RevertWhen_ImplementationIsPaused(address implementation) public { + function should_BurnFrom_RevertWhen_ImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); @@ -110,7 +123,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { IBurnMintERC20Upgradeable(implementation).burnFrom(STRANGER, 0); } - function should_BurnFrom_alias_RevertWhen_ImplementationIsPaused(address implementation) public { + function should_BurnFrom_alias_RevertWhen_ImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); @@ -120,7 +135,9 @@ contract ERC20UpgradableBaseTest_pausing is ERC20UpgradableBaseTest { IBurnMintERC20Upgradeable(implementation).burn(STRANGER, 0); } - function should_Approve_RevertWhen_ImplementationIsPaused(address implementation) public { + function should_Approve_RevertWhen_ImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_PAUSER); IERC20UpgradeableBase(implementation).pause(); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.roles.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.roles.t.sol index f560ec0267..910afac1c5 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.roles.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.roles.t.sol @@ -24,11 +24,15 @@ contract ERC20UpgradableBaseTest_roles is ERC20UpgradableBaseTest { assertTrue(IAccessControl(implementation).hasRole(BURNER_ROLE, STRANGER)); } - function should_GetCCIPAdmin(address implementation) public view { + function should_GetCCIPAdmin( + address implementation + ) public view { assertEq(IGetCCIPAdmin(implementation).getCCIPAdmin(), DEFAULT_ADMIN); } - function should_SetCCIPAdmin(address implementation) public { + function should_SetCCIPAdmin( + address implementation + ) public { changePrank(DEFAULT_ADMIN); vm.expectEmit(); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.supportsInterface.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.supportsInterface.t.sol index 31df7d07bb..242c752f52 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.supportsInterface.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.supportsInterface.t.sol @@ -10,7 +10,9 @@ import {IERC165} from "@openzeppelin/contracts@5.0.2/utils/introspection/IERC165 import {ERC20UpgradableBaseTest} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_supportsInterface is ERC20UpgradableBaseTest { - function should_SupportsInterface(IERC165 implementation) public view { + function should_SupportsInterface( + IERC165 implementation + ) public view { assertTrue(implementation.supportsInterface(type(IERC20).interfaceId)); assertTrue(implementation.supportsInterface(type(IBurnMintERC20Upgradeable).interfaceId)); assertTrue(implementation.supportsInterface(type(IERC165).interfaceId)); diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.t.sol index 67f918f7a2..904b09d2a0 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.t.sol @@ -12,15 +12,25 @@ interface IERC20UpgradeableBase is IBurnMintERC20Upgradeable, IERC20Metadata, IG event AccountUnfrozen(address indexed account); function maxSupply() external view returns (uint256); - function grantMintAndBurnRoles(address burnAndMinter) external; - function setCCIPAdmin(address newAdmin) external; + function grantMintAndBurnRoles( + address burnAndMinter + ) external; + function setCCIPAdmin( + address newAdmin + ) external; function pause() external; function unpause() external; - function freeze(address account) external; - function unfreeze(address account) external; - function isFrozen(address account) external view returns (bool); + function freeze( + address account + ) external; + function unfreeze( + address account + ) external; + function isFrozen( + address account + ) external view returns (bool); } contract ERC20UpgradableBaseTest is BaseTest { diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.unfreeze.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.unfreeze.t.sol index 5219a723ad..4630d8f70b 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.unfreeze.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/ERC20UpgradableBaseTest.unfreeze.t.sol @@ -2,14 +2,17 @@ pragma solidity ^0.8.24; import {IBurnMintERC20Upgradeable} from "../../../../../shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol"; -import {PausableUpgradeable} from "../../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; +import {PausableUpgradeable} from + "../../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; import {IAccessControl} from "@openzeppelin/contracts@5.0.2/access/IAccessControl.sol"; import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {ERC20UpgradableBaseTest, IERC20UpgradeableBase} from "./ERC20UpgradableBaseTest.t.sol"; contract ERC20UpgradableBaseTest_unfreeze is ERC20UpgradableBaseTest { - function should_Unfreeze(address implementation) public { + function should_Unfreeze( + address implementation + ) public { changePrank(DEFAULT_FREEZER); IERC20UpgradeableBase(implementation).freeze(OWNER); @@ -28,7 +31,9 @@ contract ERC20UpgradableBaseTest_unfreeze is ERC20UpgradableBaseTest { IERC20(implementation).approve(STRANGER, AMOUNT); } - function should_Unfreeze_EvenWhenImplementationIsPaused(address implementation) public { + function should_Unfreeze_EvenWhenImplementationIsPaused( + address implementation + ) public { changePrank(DEFAULT_FREEZER); IERC20UpgradeableBase(implementation).freeze(OWNER); assertTrue(IERC20UpgradeableBase(implementation).isFrozen(OWNER)); @@ -42,10 +47,7 @@ contract ERC20UpgradableBaseTest_unfreeze is ERC20UpgradableBaseTest { assertFalse(IERC20UpgradeableBase(implementation).isFrozen(OWNER)); } - function should_Unfreeze_RevertWhen_CallerDoesNotHaveFreezerRole( - address implementation, - bytes32 FREEZER_ROLE - ) public { + function should_Unfreeze_RevertWhen_CallerDoesNotHaveFreezerRole(address implementation, bytes32 FREEZER_ROLE) public { changePrank(DEFAULT_FREEZER); IERC20UpgradeableBase(implementation).freeze(OWNER); diff --git a/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol b/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol index ff87e31838..1e22c14fd1 100644 --- a/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol @@ -116,9 +116,7 @@ contract BurnMintERC677_mint is BurnMintERC677Setup { // Mint max supply s_burnMintERC677.mint(OWNER, s_burnMintERC677.maxSupply()); - vm.expectRevert( - abi.encodeWithSelector(BurnMintERC677.MaxSupplyExceeded.selector, s_burnMintERC677.maxSupply() + 1) - ); + vm.expectRevert(abi.encodeWithSelector(BurnMintERC677.MaxSupplyExceeded.selector, s_burnMintERC677.maxSupply() + 1)); // Attempt to mint 1 more than max supply s_burnMintERC677.mint(OWNER, 1); diff --git a/contracts/src/v0.8/shared/test/util/SortedSetValidationUtil.t.sol b/contracts/src/v0.8/shared/test/util/SortedSetValidationUtil.t.sol index 31187740d4..e47f14ea86 100644 --- a/contracts/src/v0.8/shared/test/util/SortedSetValidationUtil.t.sol +++ b/contracts/src/v0.8/shared/test/util/SortedSetValidationUtil.t.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import {BaseTest} from "../BaseTest.t.sol"; import {SortedSetValidationUtil} from "../../../shared/util/SortedSetValidationUtil.sol"; +import {BaseTest} from "../BaseTest.t.sol"; contract SortedSetValidationUtilBaseTest is BaseTest { uint256 constant OFFSET = 5; diff --git a/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol b/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol index 027cd35cec..068ae1b18b 100644 --- a/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol +++ b/contracts/src/v0.8/shared/token/ERC20/BurnMintERC20.sol @@ -53,13 +53,12 @@ contract BurnMintERC20 is IBurnMintERC20, IGetCCIPAdmin, IERC165, ERC20Burnable, } /// @inheritdoc IERC165 - function supportsInterface(bytes4 interfaceId) public pure virtual override(AccessControl, IERC165) returns (bool) { - return - interfaceId == type(IERC20).interfaceId || - interfaceId == type(IBurnMintERC20).interfaceId || - interfaceId == type(IERC165).interfaceId || - interfaceId == type(IAccessControl).interfaceId || - interfaceId == type(IGetCCIPAdmin).interfaceId; + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override(AccessControl, IERC165) returns (bool) { + return interfaceId == type(IERC20).interfaceId || interfaceId == type(IBurnMintERC20).interfaceId + || interfaceId == type(IERC165).interfaceId || interfaceId == type(IAccessControl).interfaceId + || interfaceId == type(IGetCCIPAdmin).interfaceId; } // ================================================================ @@ -99,7 +98,9 @@ contract BurnMintERC20 is IBurnMintERC20, IGetCCIPAdmin, IERC165, ERC20Burnable, /// @inheritdoc ERC20Burnable /// @dev Uses OZ ERC20 _burn to disallow burning from address(0). /// @dev Decreases the total supply. - function burn(uint256 amount) public virtual override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) { + function burn( + uint256 amount + ) public virtual override(IBurnMintERC20, ERC20Burnable) onlyRole(BURNER_ROLE) { super.burn(amount); } @@ -138,7 +139,9 @@ contract BurnMintERC20 is IBurnMintERC20, IGetCCIPAdmin, IERC165, ERC20Burnable, /// @notice grants both mint and burn roles to `burnAndMinter`. /// @dev calls public functions so this function does not require /// access controls. This is handled in the inner functions. - function grantMintAndBurnRoles(address burnAndMinter) external virtual { + function grantMintAndBurnRoles( + address burnAndMinter + ) external virtual { grantRole(MINTER_ROLE, burnAndMinter); grantRole(BURNER_ROLE, burnAndMinter); } @@ -152,7 +155,9 @@ contract BurnMintERC20 is IBurnMintERC20, IGetCCIPAdmin, IERC165, ERC20Burnable, /// @dev only the owner can call this function, NOT the current ccipAdmin, and 1-step ownership transfer is used. /// @param newAdmin The address to transfer the CCIPAdmin role to. Setting to address(0) is a valid way to revoke /// the role - function setCCIPAdmin(address newAdmin) external virtual onlyRole(DEFAULT_ADMIN_ROLE) { + function setCCIPAdmin( + address newAdmin + ) external virtual onlyRole(DEFAULT_ADMIN_ROLE) { address currentAdmin = s_ccipAdmin; s_ccipAdmin = newAdmin; diff --git a/contracts/src/v0.8/shared/token/ERC20/IBurnMintERC20.sol b/contracts/src/v0.8/shared/token/ERC20/IBurnMintERC20.sol index cb9cd62418..46af5cd9d4 100644 --- a/contracts/src/v0.8/shared/token/ERC20/IBurnMintERC20.sol +++ b/contracts/src/v0.8/shared/token/ERC20/IBurnMintERC20.sol @@ -13,7 +13,9 @@ interface IBurnMintERC20 is IERC20 { /// @notice Burns tokens from the sender. /// @param amount The number of tokens to be burned. /// @dev this function decreases the total supply. - function burn(uint256 amount) external; + function burn( + uint256 amount + ) external; /// @notice Burns tokens from a given address.. /// @param account The address to burn tokens from. diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol index dc7d3ea43c..8e97f0b7eb 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol @@ -45,7 +45,9 @@ contract BurnMintERC20PausableFreezableTransparent is BurnMintERC20PausableTrans /// @notice Freezes an account, disallowing transfers, minting and burning from/to it. /// @dev Requires the caller to have the FREEZER_ROLE. /// @dev Can be called even if the contract is paused. - function freeze(address account) public onlyRole(FREEZER_ROLE) { + function freeze( + address account + ) public onlyRole(FREEZER_ROLE) { if (account == address(0)) revert BurnMintERC20PausableFreezableTransparent__InvalidRecipient(account); if (account == address(this)) revert BurnMintERC20PausableFreezableTransparent__InvalidRecipient(account); @@ -60,7 +62,9 @@ contract BurnMintERC20PausableFreezableTransparent is BurnMintERC20PausableTrans /// @notice Unfreezes an account /// @dev Requires the caller to have the FREEZER_ROLE. /// @dev Can be called even if the contract is paused. - function unfreeze(address account) public onlyRole(FREEZER_ROLE) { + function unfreeze( + address account + ) public onlyRole(FREEZER_ROLE) { BurnMintERC20PausableFreezableTransparentStorage storage $ = _getBurnMintERC20PausableFreezableTransparentStorage(); if (!$.isFrozen[account]) revert BurnMintERC20PausableFreezableTransparent__AccountNotFrozen(account); @@ -69,7 +73,9 @@ contract BurnMintERC20PausableFreezableTransparent is BurnMintERC20PausableTrans emit AccountUnfrozen(account); } - function isFrozen(address account) public view returns (bool) { + function isFrozen( + address account + ) public view returns (bool) { return _getBurnMintERC20PausableFreezableTransparentStorage().isFrozen[account]; } diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol index 7206f833ee..3568e094a8 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol @@ -45,7 +45,9 @@ contract BurnMintERC20PausableFreezableUUPS is BurnMintERC20PausableUUPS { /// @notice Freezes an account, disallowing transfers, minting and burning from/to it. /// @dev Requires the caller to have the FREEZER_ROLE. /// @dev Can be called even if the contract is paused. - function freeze(address account) public onlyRole(FREEZER_ROLE) { + function freeze( + address account + ) public onlyRole(FREEZER_ROLE) { if (account == address(0)) revert BurnMintERC20PausableFreezableUUPS__InvalidRecipient(account); if (account == address(this)) revert BurnMintERC20PausableFreezableUUPS__InvalidRecipient(account); @@ -60,7 +62,9 @@ contract BurnMintERC20PausableFreezableUUPS is BurnMintERC20PausableUUPS { /// @notice Unfreezes an account /// @dev Requires the caller to have the FREEZER_ROLE. /// @dev Can be called even if the contract is paused. - function unfreeze(address account) public onlyRole(FREEZER_ROLE) { + function unfreeze( + address account + ) public onlyRole(FREEZER_ROLE) { BurnMintERC20PausableFreezableUUPSStorage storage $ = _getBurnMintERC20PausableFreezableUUPSStorage(); if (!$.isFrozen[account]) revert BurnMintERC20PausableFreezableUUPS__AccountNotFrozen(account); @@ -69,7 +73,9 @@ contract BurnMintERC20PausableFreezableUUPS is BurnMintERC20PausableUUPS { emit AccountUnfrozen(account); } - function isFrozen(address account) public view returns (bool) { + function isFrozen( + address account + ) public view returns (bool) { return _getBurnMintERC20PausableFreezableUUPSStorage().isFrozen[account]; } diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableTransparent.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableTransparent.sol index 680ac642a2..5ddeaeb7f1 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableTransparent.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableTransparent.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {PausableUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; +import {PausableUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; import {BurnMintERC20Transparent} from "./BurnMintERC20Transparent.sol"; contract BurnMintERC20PausableTransparent is BurnMintERC20Transparent, PausableUpgradeable { diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableUUPS.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableUUPS.sol index 60f9697baf..d4da7db81c 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableUUPS.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableUUPS.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; -import {PausableUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; +import {PausableUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/utils/PausableUpgradeable.sol"; import {BurnMintERC20UUPS} from "./BurnMintERC20UUPS.sol"; contract BurnMintERC20PausableUUPS is BurnMintERC20UUPS, PausableUpgradeable { diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol index 3e69d274ea..adf06b393f 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol @@ -4,9 +4,12 @@ pragma solidity ^0.8.24; import {IGetCCIPAdmin} from "../../../../shared/interfaces/IGetCCIPAdmin.sol"; import {IBurnMintERC20Upgradeable} from "../../../../shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol"; -import {AccessControlDefaultAdminRulesUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/access/extensions/AccessControlDefaultAdminRulesUpgradeable.sol"; -import {Initializable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/proxy/utils/Initializable.sol"; -import {ERC20BurnableUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; +import {AccessControlDefaultAdminRulesUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/access/extensions/AccessControlDefaultAdminRulesUpgradeable.sol"; +import {Initializable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/proxy/utils/Initializable.sol"; +import {ERC20BurnableUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import {IAccessControl} from "@openzeppelin/contracts@5.0.2/access/IAccessControl.sol"; import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {IERC165} from "@openzeppelin/contracts@5.0.2/utils/introspection/IERC165.sol"; @@ -99,12 +102,9 @@ contract BurnMintERC20Transparent is function supportsInterface( bytes4 interfaceId ) public pure virtual override(AccessControlDefaultAdminRulesUpgradeable, IERC165) returns (bool) { - return - interfaceId == type(IERC20).interfaceId || - interfaceId == type(IBurnMintERC20Upgradeable).interfaceId || - interfaceId == type(IERC165).interfaceId || - interfaceId == type(IAccessControl).interfaceId || - interfaceId == type(IGetCCIPAdmin).interfaceId; + return interfaceId == type(IERC20).interfaceId || interfaceId == type(IBurnMintERC20Upgradeable).interfaceId + || interfaceId == type(IERC165).interfaceId || interfaceId == type(IAccessControl).interfaceId + || interfaceId == type(IGetCCIPAdmin).interfaceId; } // ================================================================ @@ -190,7 +190,9 @@ contract BurnMintERC20Transparent is /// @notice grants both mint and burn roles to `burnAndMinter`. /// @dev calls public functions so this function does not require /// access controls. This is handled in the inner functions. - function grantMintAndBurnRoles(address burnAndMinter) external { + function grantMintAndBurnRoles( + address burnAndMinter + ) external { grantRole(MINTER_ROLE, burnAndMinter); grantRole(BURNER_ROLE, burnAndMinter); } @@ -205,7 +207,9 @@ contract BurnMintERC20Transparent is /// @dev only the owner can call this function, NOT the current ccipAdmin, and 1-step ownership transfer is used. /// @param newAdmin The address to transfer the CCIPAdmin role to. Setting to address(0) is a valid way to revoke /// the role - function setCCIPAdmin(address newAdmin) external onlyRole(DEFAULT_ADMIN_ROLE) { + function setCCIPAdmin( + address newAdmin + ) external onlyRole(DEFAULT_ADMIN_ROLE) { BurnMintERC20TransparentStorage storage $ = _getBurnMintERC20TransparentStorage(); address currentAdmin = $.ccipAdmin; diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol index 75f98ba3eb..dd88d321ad 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol @@ -4,10 +4,14 @@ pragma solidity ^0.8.24; import {IGetCCIPAdmin} from "../../../../shared/interfaces/IGetCCIPAdmin.sol"; import {IBurnMintERC20Upgradeable} from "../../../../shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol"; -import {AccessControlDefaultAdminRulesUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/access/extensions/AccessControlDefaultAdminRulesUpgradeable.sol"; -import {Initializable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/proxy/utils/Initializable.sol"; -import {UUPSUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/proxy/utils/UUPSUpgradeable.sol"; -import {ERC20BurnableUpgradeable} from "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; +import {AccessControlDefaultAdminRulesUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/access/extensions/AccessControlDefaultAdminRulesUpgradeable.sol"; +import {Initializable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/proxy/utils/Initializable.sol"; +import {UUPSUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/proxy/utils/UUPSUpgradeable.sol"; +import {ERC20BurnableUpgradeable} from + "../../../../vendor/openzeppelin-solidity-upgradeable/v5.0.2/contracts/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import {IAccessControl} from "@openzeppelin/contracts@5.0.2/access/IAccessControl.sol"; import {IERC20} from "@openzeppelin/contracts@5.0.2/interfaces/IERC20.sol"; import {IERC1822Proxiable} from "@openzeppelin/contracts@5.0.2/interfaces/draft-IERC1822.sol"; @@ -98,7 +102,9 @@ contract BurnMintERC20UUPS is _grantRole(UPGRADER_ROLE, defaultUpgrader); } - function _authorizeUpgrade(address newImplementation) internal override onlyRole(UPGRADER_ROLE) {} + function _authorizeUpgrade( + address newImplementation + ) internal override onlyRole(UPGRADER_ROLE) {} // ================================================================ // │ ERC165 │ @@ -108,13 +114,9 @@ contract BurnMintERC20UUPS is function supportsInterface( bytes4 interfaceId ) public pure virtual override(AccessControlDefaultAdminRulesUpgradeable, IERC165) returns (bool) { - return - interfaceId == type(IERC20).interfaceId || - interfaceId == type(IBurnMintERC20Upgradeable).interfaceId || - interfaceId == type(IERC165).interfaceId || - interfaceId == type(IAccessControl).interfaceId || - interfaceId == type(IERC1822Proxiable).interfaceId || - interfaceId == type(IGetCCIPAdmin).interfaceId; + return interfaceId == type(IERC20).interfaceId || interfaceId == type(IBurnMintERC20Upgradeable).interfaceId + || interfaceId == type(IERC165).interfaceId || interfaceId == type(IAccessControl).interfaceId + || interfaceId == type(IERC1822Proxiable).interfaceId || interfaceId == type(IGetCCIPAdmin).interfaceId; } // ================================================================ @@ -198,7 +200,9 @@ contract BurnMintERC20UUPS is /// @notice grants both mint and burn roles to `burnAndMinter`. /// @dev calls public functions so this function does not require /// access controls. This is handled in the inner functions. - function grantMintAndBurnRoles(address burnAndMinter) external { + function grantMintAndBurnRoles( + address burnAndMinter + ) external { grantRole(MINTER_ROLE, burnAndMinter); grantRole(BURNER_ROLE, burnAndMinter); } @@ -212,7 +216,9 @@ contract BurnMintERC20UUPS is /// @dev only the owner can call this function, NOT the current ccipAdmin, and 1-step ownership transfer is used. /// @param newAdmin The address to transfer the CCIPAdmin role to. Setting to address(0) is a valid way to revoke /// the role - function setCCIPAdmin(address newAdmin) external onlyRole(DEFAULT_ADMIN_ROLE) { + function setCCIPAdmin( + address newAdmin + ) external onlyRole(DEFAULT_ADMIN_ROLE) { BurnMintERC20UUPSStorage storage $ = _getBurnMintERC20UUPSStorage(); address currentAdmin = $.ccipAdmin; diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol index c88e913982..b268d3ff48 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/IBurnMintERC20Upgradeable.sol @@ -13,7 +13,9 @@ interface IBurnMintERC20Upgradeable is IERC20 { /// @notice Burns tokens from the sender. /// @param amount The number of tokens to be burned. /// @dev this function decreases the total supply. - function burn(uint256 amount) external; + function burn( + uint256 amount + ) external; /// @notice Burns tokens from a given address.. /// @param account The address to burn tokens from. diff --git a/contracts/src/v0.8/shared/token/ERC20/zksync/WETH9ZKSync.sol b/contracts/src/v0.8/shared/token/ERC20/zksync/WETH9ZKSync.sol index d412246e78..0f6560dbfb 100644 --- a/contracts/src/v0.8/shared/token/ERC20/zksync/WETH9ZKSync.sol +++ b/contracts/src/v0.8/shared/token/ERC20/zksync/WETH9ZKSync.sol @@ -49,12 +49,14 @@ contract WETH9ZKSync { _deposit(); } - function withdraw(uint256 wad) external { + function withdraw( + uint256 wad + ) external { require(balanceOf[msg.sender] >= wad); balanceOf[msg.sender] -= wad; // payable(msg.sender).transfer(wad) should be avoided // slither-disable-next-line low-level-calls - (bool success, ) = msg.sender.call{value: wad}(""); + (bool success,) = msg.sender.call{value: wad}(""); require(success, "Transfer failed"); emit Withdrawal(msg.sender, wad); } diff --git a/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol b/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol index c8d89de209..5dee874db3 100644 --- a/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol +++ b/contracts/src/v0.8/shared/token/ERC677/BurnMintERC677.sol @@ -4,13 +4,13 @@ pragma solidity ^0.8.4; import {IBurnMintERC20} from "../ERC20/IBurnMintERC20.sol"; import {IERC677} from "./IERC677.sol"; -import {ERC677} from "./ERC677.sol"; import {OwnerIsCreator} from "../../access/OwnerIsCreator.sol"; +import {ERC677} from "./ERC677.sol"; +import {IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/IERC20.sol"; import {ERC20Burnable} from "@openzeppelin/contracts@4.8.3/token/ERC20/extensions/ERC20Burnable.sol"; -import {EnumerableSet} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableSet.sol"; import {IERC165} from "@openzeppelin/contracts@4.8.3/utils/introspection/IERC165.sol"; -import {IERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/IERC20.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableSet.sol"; /// @notice A basic ERC677 compatible token contract with burn and minting roles. /// @dev The total supply can be limited during deployment. @@ -42,12 +42,11 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner i_maxSupply = maxSupply_; } - function supportsInterface(bytes4 interfaceId) public pure virtual override returns (bool) { - return - interfaceId == type(IERC20).interfaceId || - interfaceId == type(IERC677).interfaceId || - interfaceId == type(IBurnMintERC20).interfaceId || - interfaceId == type(IERC165).interfaceId; + function supportsInterface( + bytes4 interfaceId + ) public pure virtual override returns (bool) { + return interfaceId == type(IERC20).interfaceId || interfaceId == type(IERC677).interfaceId + || interfaceId == type(IBurnMintERC20).interfaceId || interfaceId == type(IERC165).interfaceId; } // ================================================================ @@ -90,7 +89,9 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @param recipient the account we transfer/approve to. /// @dev Reverts with an empty revert to be compatible with the existing link token when /// the recipient is this contract address. - modifier validAddress(address recipient) virtual { + modifier validAddress( + address recipient + ) virtual { // solhint-disable-next-line reason-string, gas-custom-errors if (recipient == address(this)) revert(); _; @@ -103,7 +104,9 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @inheritdoc ERC20Burnable /// @dev Uses OZ ERC20 _burn to disallow burning from address(0). /// @dev Decreases the total supply. - function burn(uint256 amount) public virtual override(IBurnMintERC20, ERC20Burnable) onlyBurner { + function burn( + uint256 amount + ) public virtual override(IBurnMintERC20, ERC20Burnable) onlyBurner { super.burn(amount); } @@ -138,14 +141,18 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @notice grants both mint and burn roles to `burnAndMinter`. /// @dev calls public functions so this function does not require /// access controls. This is handled in the inner functions. - function grantMintAndBurnRoles(address burnAndMinter) external virtual { + function grantMintAndBurnRoles( + address burnAndMinter + ) external virtual { grantMintRole(burnAndMinter); grantBurnRole(burnAndMinter); } /// @notice Grants mint role to the given address. /// @dev only the owner can call this function. - function grantMintRole(address minter) public virtual onlyOwner { + function grantMintRole( + address minter + ) public virtual onlyOwner { if (s_minters.add(minter)) { emit MintAccessGranted(minter); } @@ -153,7 +160,9 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @notice Grants burn role to the given address. /// @dev only the owner can call this function. - function grantBurnRole(address burner) public virtual onlyOwner { + function grantBurnRole( + address burner + ) public virtual onlyOwner { if (s_burners.add(burner)) { emit BurnAccessGranted(burner); } @@ -161,7 +170,9 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @notice Revokes mint role for the given address. /// @dev only the owner can call this function. - function revokeMintRole(address minter) public virtual onlyOwner { + function revokeMintRole( + address minter + ) public virtual onlyOwner { if (s_minters.remove(minter)) { emit MintAccessRevoked(minter); } @@ -169,7 +180,9 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @notice Revokes burn role from the given address. /// @dev only the owner can call this function - function revokeBurnRole(address burner) public virtual onlyOwner { + function revokeBurnRole( + address burner + ) public virtual onlyOwner { if (s_burners.remove(burner)) { emit BurnAccessRevoked(burner); } @@ -191,13 +204,17 @@ contract BurnMintERC677 is IBurnMintERC20, ERC677, IERC165, ERC20Burnable, Owner /// @notice Checks whether a given address is a minter for this token. /// @return true if the address is allowed to mint. - function isMinter(address minter) public view virtual returns (bool) { + function isMinter( + address minter + ) public view virtual returns (bool) { return s_minters.contains(minter); } /// @notice Checks whether a given address is a burner for this token. /// @return true if the address is allowed to burn. - function isBurner(address burner) public view virtual returns (bool) { + function isBurner( + address burner + ) public view virtual returns (bool) { return s_burners.contains(burner); } diff --git a/contracts/src/v0.8/shared/token/ERC677/ERC677.sol b/contracts/src/v0.8/shared/token/ERC677/ERC677.sol index 6dd00bc787..f49fa7f5a7 100644 --- a/contracts/src/v0.8/shared/token/ERC677/ERC677.sol +++ b/contracts/src/v0.8/shared/token/ERC677/ERC677.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import {IERC677} from "./IERC677.sol"; import {IERC677Receiver} from "../../interfaces/IERC677Receiver.sol"; +import {IERC677} from "./IERC677.sol"; import {ERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/ERC20.sol"; diff --git a/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol b/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol index d541f5f848..a326efb0da 100644 --- a/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; -import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import {OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; /// @dev A library that abstracts out opcodes that behave differently across chains. /// @dev The methods below return values that are pertinent to the given chain. @@ -54,7 +55,9 @@ library ChainSpecificUtil { * @notice Otherwise, it uses the blockhash opcode. * @notice Note that the blockhash opcode will return the L2 blockhash on Optimism. */ - function _getBlockhash(uint64 blockNumber) internal view returns (bytes32) { + function _getBlockhash( + uint64 blockNumber + ) internal view returns (bytes32) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { if ((_getBlockNumber() - blockNumber) > 256 || blockNumber >= _getBlockNumber()) { @@ -87,7 +90,9 @@ library ChainSpecificUtil { * @notice On Optimism, the provided calldata is passed to the OVM_GasPriceOracle predeploy * @notice and getL1Fee is called to get the fees. */ - function _getCurrentTxL1GasFees(bytes memory txCallData) internal view returns (uint256) { + function _getCurrentTxL1GasFees( + bytes memory txCallData + ) internal view returns (uint256) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { return ARBGAS.getCurrentTxL1GasFees(); @@ -101,10 +106,12 @@ library ChainSpecificUtil { * @notice Returns the gas cost in wei of calldataSizeBytes of calldata being posted * @notice to L1. */ - function _getL1CalldataGasCost(uint256 calldataSizeBytes) internal view returns (uint256) { + function _getL1CalldataGasCost( + uint256 calldataSizeBytes + ) internal view returns (uint256) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { - (, uint256 l1PricePerByte, , , , ) = ARBGAS.getPricesInWei(); + (, uint256 l1PricePerByte,,,,) = ARBGAS.getPricesInWei(); // see https://developer.arbitrum.io/devs-how-tos/how-to-estimate-gas#where-do-we-get-all-this-information-from // for the justification behind the 140 number. return l1PricePerByte * (calldataSizeBytes + 140); @@ -117,28 +124,27 @@ library ChainSpecificUtil { /** * @notice Return true if and only if the provided chain ID is an Arbitrum chain ID. */ - function _isArbitrumChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == ARB_MAINNET_CHAIN_ID || - chainId == ARB_GOERLI_TESTNET_CHAIN_ID || - chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; + function _isArbitrumChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == ARB_MAINNET_CHAIN_ID || chainId == ARB_GOERLI_TESTNET_CHAIN_ID + || chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; } /** * @notice Return true if and only if the provided chain ID is an Optimism chain ID. * @notice Note that optimism chain id's are also OP stack chain id's (e.g. Base). */ - function _isOptimismChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == OP_MAINNET_CHAIN_ID || - chainId == OP_GOERLI_CHAIN_ID || - chainId == OP_SEPOLIA_CHAIN_ID || - chainId == BASE_MAINNET_CHAIN_ID || - chainId == BASE_GOERLI_CHAIN_ID || - chainId == BASE_SEPOLIA_CHAIN_ID; + function _isOptimismChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_CHAIN_ID || chainId == OP_SEPOLIA_CHAIN_ID + || chainId == BASE_MAINNET_CHAIN_ID || chainId == BASE_GOERLI_CHAIN_ID || chainId == BASE_SEPOLIA_CHAIN_ID; } - function _calculateOptimismL1DataFee(uint256 calldataSizeBytes) internal view returns (uint256) { + function _calculateOptimismL1DataFee( + uint256 calldataSizeBytes + ) internal view returns (uint256) { // from: https://community.optimism.io/docs/developers/build/transaction-fees/#the-l1-data-fee // l1_data_fee = l1_gas_price * (tx_data_gas + fixed_overhead) * dynamic_overhead // tx_data_gas = count_zero_bytes(tx_data) * 4 + count_non_zero_bytes(tx_data) * 16 diff --git a/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol b/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol index fec11e494b..27107c042b 100644 --- a/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol +++ b/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol @@ -50,7 +50,9 @@ library SortedSetValidationUtil { /// @dev Iterates through the array to check that each element is greater than the previous. /// @param set The array of bytes32 to validate. /// @custom:revert NotASortedSet If any element is not greater than its predecessor or if any two consecutive elements are equal. - function _checkIsValidSet(bytes32[] memory set) private pure { + function _checkIsValidSet( + bytes32[] memory set + ) private pure { for (uint256 i = 1; i < set.length; ++i) { if (set[i] <= set[i - 1]) { revert NotASortedSet(set); diff --git a/contracts/src/v0.8/vrf/AuthorizedReceiver.sol b/contracts/src/v0.8/vrf/AuthorizedReceiver.sol index dc718102d2..af011b6763 100644 --- a/contracts/src/v0.8/vrf/AuthorizedReceiver.sol +++ b/contracts/src/v0.8/vrf/AuthorizedReceiver.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; import {IAuthorizedReceiver} from "./interfaces/IAuthorizedReceiver.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; abstract contract AuthorizedReceiver is IAuthorizedReceiver { using EnumerableSet for EnumerableSet.AddressSet; @@ -20,7 +20,9 @@ abstract contract AuthorizedReceiver is IAuthorizedReceiver { * @notice Sets the fulfillment permission for a given node. Use `true` to allow, `false` to disallow. * @param senders The addresses of the authorized Chainlink node */ - function setAuthorizedSenders(address[] calldata senders) external override validateAuthorizedSenderSetter { + function setAuthorizedSenders( + address[] calldata senders + ) external override validateAuthorizedSenderSetter { if (senders.length == 0) { revert EmptySendersList(); } @@ -47,7 +49,9 @@ abstract contract AuthorizedReceiver is IAuthorizedReceiver { * @param sender The address of the Chainlink node * @return The authorization status of the node */ - function isAuthorizedSender(address sender) public view override returns (bool) { + function isAuthorizedSender( + address sender + ) public view override returns (bool) { return s_authorizedSenders.contains(sender); } diff --git a/contracts/src/v0.8/vrf/BatchBlockhashStore.sol b/contracts/src/v0.8/vrf/BatchBlockhashStore.sol index 4ed6f28d38..b2f8a7426a 100644 --- a/contracts/src/v0.8/vrf/BatchBlockhashStore.sol +++ b/contracts/src/v0.8/vrf/BatchBlockhashStore.sol @@ -15,7 +15,9 @@ contract BatchBlockhashStore { // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i BlockhashStore public immutable BHS; - constructor(address blockhashStoreAddr) { + constructor( + address blockhashStoreAddr + ) { BHS = BlockhashStore(blockhashStoreAddr); } @@ -25,7 +27,9 @@ contract BatchBlockhashStore { * @param blockNumbers the block numbers to store the blockhashes of. Must be available via the * blockhash() instruction, otherwise this function call will revert. */ - function store(uint256[] memory blockNumbers) public { + function store( + uint256[] memory blockNumbers + ) public { for (uint256 i = 0; i < blockNumbers.length; i++) { // skip the block if it's not storeable, the caller will have to check // after the transaction is mined to see if the blockhash was truly stored. @@ -56,12 +60,14 @@ contract BatchBlockhashStore { * param. If the blockhash is not found, 0x0 is returned instead of the real blockhash, indicating * that it is not in the blockhash store. */ - function getBlockhashes(uint256[] memory blockNumbers) external view returns (bytes32[] memory) { + function getBlockhashes( + uint256[] memory blockNumbers + ) external view returns (bytes32[] memory) { bytes32[] memory blockHashes = new bytes32[](blockNumbers.length); for (uint256 i = 0; i < blockNumbers.length; i++) { try BHS.getBlockhash(blockNumbers[i]) returns (bytes32 bh) { blockHashes[i] = bh; - } catch Error(string memory /* reason */) { + } catch Error(string memory) /* reason */ { blockHashes[i] = 0x0; } } @@ -73,7 +79,9 @@ contract BatchBlockhashStore { * using the blockhash() instruction. * @param blockNumber the block number to check if it's storeable with blockhash() */ - function _storeableBlock(uint256 blockNumber) private view returns (bool) { + function _storeableBlock( + uint256 blockNumber + ) private view returns (bool) { // handle edge case on simulated chains which possibly have < 256 blocks total. return ChainSpecificUtil._getBlockNumber() <= 256 ? true : blockNumber >= (ChainSpecificUtil._getBlockNumber() - 256); @@ -84,7 +92,11 @@ contract BatchBlockhashStore { interface BlockhashStore { function storeVerifyHeader(uint256 n, bytes memory header) external; - function store(uint256 n) external; + function store( + uint256 n + ) external; - function getBlockhash(uint256 n) external view returns (bytes32); + function getBlockhash( + uint256 n + ) external view returns (bytes32); } diff --git a/contracts/src/v0.8/vrf/BatchVRFCoordinatorV2.sol b/contracts/src/v0.8/vrf/BatchVRFCoordinatorV2.sol index bcea106e59..abe494815b 100644 --- a/contracts/src/v0.8/vrf/BatchVRFCoordinatorV2.sol +++ b/contracts/src/v0.8/vrf/BatchVRFCoordinatorV2.sol @@ -16,7 +16,9 @@ contract BatchVRFCoordinatorV2 { event ErrorReturned(uint256 indexed requestId, string reason); event RawErrorReturned(uint256 indexed requestId, bytes lowLevelData); - constructor(address coordinatorAddr) { + constructor( + address coordinatorAddr + ) { COORDINATOR = VRFCoordinatorV2(coordinatorAddr); } @@ -29,7 +31,7 @@ contract BatchVRFCoordinatorV2 { // solhint-disable-next-line gas-custom-errors require(proofs.length == rcs.length, "input array arg lengths mismatch"); for (uint256 i = 0; i < proofs.length; i++) { - try COORDINATOR.fulfillRandomWords(proofs[i], rcs[i]) returns (uint96 /* payment */) { + try COORDINATOR.fulfillRandomWords(proofs[i], rcs[i]) returns (uint96 /* payment */ ) { continue; } catch Error(string memory reason) { uint256 requestId = _getRequestIdFromProof(proofs[i]); @@ -45,7 +47,9 @@ contract BatchVRFCoordinatorV2 { * @notice Returns the proving key hash associated with this public key. * @param publicKey the key to return the hash of. */ - function _hashOfKey(uint256[2] memory publicKey) internal pure returns (bytes32) { + function _hashOfKey( + uint256[2] memory publicKey + ) internal pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -53,7 +57,9 @@ contract BatchVRFCoordinatorV2 { * @notice Returns the request ID of the request associated with the given proof. * @param proof the VRF proof provided by the VRF oracle. */ - function _getRequestIdFromProof(VRFTypes.Proof memory proof) internal pure returns (uint256) { + function _getRequestIdFromProof( + VRFTypes.Proof memory proof + ) internal pure returns (uint256) { bytes32 keyHash = _hashOfKey(proof.pk); return uint256(keccak256(abi.encode(keyHash, proof.seed))); } diff --git a/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol b/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol index eabc061e3f..4f53916fab 100644 --- a/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol +++ b/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; -import {ArbSys} from "../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {ArbGasInfo} from "../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import {OVM_GasPriceOracle} from "../vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import {ArbSys} from "../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {OVM_GasPriceOracle} from + "../vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; /// @dev A library that abstracts out opcodes that behave differently across chains. /// @dev The methods below return values that are pertinent to the given chain. @@ -54,7 +55,9 @@ library ChainSpecificUtil { * @notice Otherwise, it uses the blockhash opcode. * @notice Note that the blockhash opcode will return the L2 blockhash on Optimism. */ - function _getBlockhash(uint64 blockNumber) internal view returns (bytes32) { + function _getBlockhash( + uint64 blockNumber + ) internal view returns (bytes32) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { if ((_getBlockNumber() - blockNumber) > 256 || blockNumber >= _getBlockNumber()) { @@ -87,7 +90,9 @@ library ChainSpecificUtil { * @notice On Optimism, the provided calldata is passed to the OVM_GasPriceOracle predeploy * @notice and getL1Fee is called to get the fees. */ - function _getCurrentTxL1GasFees(bytes memory txCallData) internal view returns (uint256) { + function _getCurrentTxL1GasFees( + bytes memory txCallData + ) internal view returns (uint256) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { return ARBGAS.getCurrentTxL1GasFees(); @@ -101,10 +106,12 @@ library ChainSpecificUtil { * @notice Returns the gas cost in wei of calldataSizeBytes of calldata being posted * @notice to L1. */ - function _getL1CalldataGasCost(uint256 calldataSizeBytes) internal view returns (uint256) { + function _getL1CalldataGasCost( + uint256 calldataSizeBytes + ) internal view returns (uint256) { uint256 chainid = block.chainid; if (_isArbitrumChainId(chainid)) { - (, uint256 l1PricePerByte, , , , ) = ARBGAS.getPricesInWei(); + (, uint256 l1PricePerByte,,,,) = ARBGAS.getPricesInWei(); // see https://developer.arbitrum.io/devs-how-tos/how-to-estimate-gas#where-do-we-get-all-this-information-from // for the justification behind the 140 number. return l1PricePerByte * (calldataSizeBytes + 140); @@ -117,28 +124,27 @@ library ChainSpecificUtil { /** * @notice Return true if and only if the provided chain ID is an Arbitrum chain ID. */ - function _isArbitrumChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == ARB_MAINNET_CHAIN_ID || - chainId == ARB_GOERLI_TESTNET_CHAIN_ID || - chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; + function _isArbitrumChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == ARB_MAINNET_CHAIN_ID || chainId == ARB_GOERLI_TESTNET_CHAIN_ID + || chainId == ARB_SEPOLIA_TESTNET_CHAIN_ID; } /** * @notice Return true if and only if the provided chain ID is an Optimism chain ID. * @notice Note that optimism chain id's are also OP stack chain id's (e.g. Base). */ - function _isOptimismChainId(uint256 chainId) internal pure returns (bool) { - return - chainId == OP_MAINNET_CHAIN_ID || - chainId == OP_GOERLI_CHAIN_ID || - chainId == OP_SEPOLIA_CHAIN_ID || - chainId == BASE_MAINNET_CHAIN_ID || - chainId == BASE_GOERLI_CHAIN_ID || - chainId == BASE_SEPOLIA_CHAIN_ID; + function _isOptimismChainId( + uint256 chainId + ) internal pure returns (bool) { + return chainId == OP_MAINNET_CHAIN_ID || chainId == OP_GOERLI_CHAIN_ID || chainId == OP_SEPOLIA_CHAIN_ID + || chainId == BASE_MAINNET_CHAIN_ID || chainId == BASE_GOERLI_CHAIN_ID || chainId == BASE_SEPOLIA_CHAIN_ID; } - function _calculateOptimismL1DataFee(uint256 calldataSizeBytes) internal view returns (uint256) { + function _calculateOptimismL1DataFee( + uint256 calldataSizeBytes + ) internal view returns (uint256) { // from: https://community.optimism.io/docs/developers/build/transaction-fees/#the-l1-data-fee // l1_data_fee = l1_gas_price * (tx_data_gas + fixed_overhead) * dynamic_overhead // tx_data_gas = count_zero_bytes(tx_data) * 4 + count_non_zero_bytes(tx_data) * 16 diff --git a/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol b/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol index 161800fcd4..32576eee5a 100644 --- a/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol +++ b/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "../automation/interfaces/AutomationCompatibleInterface.sol"; +import {AutomationCompatibleInterface as KeeperCompatibleInterface} from + "../automation/interfaces/AutomationCompatibleInterface.sol"; import {VRFConsumerBaseV2} from "./VRFConsumerBaseV2.sol"; import {VRFCoordinatorV2Interface} from "./interfaces/VRFCoordinatorV2Interface.sol"; @@ -35,6 +36,7 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 { uint32 callbackGasLimit; uint256 randomness; } + mapping(uint256 => RequestRecord) public s_requests; /* request ID */ /* request record */ constructor( @@ -64,7 +66,7 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 { // solhint-disable-next-line chainlink-solidity/explicit-returns function checkUpkeep( bytes calldata /* checkData */ - ) external view override returns (bool upkeepNeeded, bytes memory /* performData */) { + ) external view override returns (bool upkeepNeeded, bytes memory /* performData */ ) { upkeepNeeded = (block.timestamp - s_lastTimeStamp) > UPKEEP_INTERVAL; } @@ -72,7 +74,9 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 { * @notice Requests random words from the VRF coordinator if UPKEEP_INTERVAL seconds have elapsed * since the last upkeep or since construction of the contract. */ - function performUpkeep(bytes calldata /* performData */) external override { + function performUpkeep( + bytes calldata /* performData */ + ) external override { if ((block.timestamp - s_lastTimeStamp) > UPKEEP_INTERVAL) { s_lastTimeStamp = block.timestamp; @@ -108,12 +112,8 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 { 150000, // callback gas limit 1 // num words ); - s_requests[requestId] = RequestRecord({ - requestId: requestId, - fulfilled: false, - callbackGasLimit: 150000, - randomness: 0 - }); + s_requests[requestId] = + RequestRecord({requestId: requestId, fulfilled: false, callbackGasLimit: 150000, randomness: 0}); s_vrfRequestCounter++; } } diff --git a/contracts/src/v0.8/vrf/VRF.sol b/contracts/src/v0.8/vrf/VRF.sol index 7f11569311..9c249a068d 100644 --- a/contracts/src/v0.8/vrf/VRF.sol +++ b/contracts/src/v0.8/vrf/VRF.sol @@ -1,143 +1,144 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -/** **************************************************************************** - * @notice Verification of verifiable-random-function (VRF) proofs, following - * @notice https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 - * @notice See https://eprint.iacr.org/2017/099.pdf for security proofs. - - * @dev Bibliographic references: - - * @dev Goldberg, et al., "Verifiable Random Functions (VRFs)", Internet Draft - * @dev draft-irtf-cfrg-vrf-05, IETF, Aug 11 2019, - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05 - - * @dev Papadopoulos, et al., "Making NSEC5 Practical for DNSSEC", Cryptology - * @dev ePrint Archive, Report 2017/099, https://eprint.iacr.org/2017/099.pdf - * **************************************************************************** - * @dev USAGE - - * @dev The main entry point is _randomValueFromVRFProof. See its docstring. - * **************************************************************************** - * @dev PURPOSE - - * @dev Reggie the Random Oracle (not his real job) wants to provide randomness - * @dev to Vera the verifier in such a way that Vera can be sure he's not - * @dev making his output up to suit himself. Reggie provides Vera a public key - * @dev to which he knows the secret key. Each time Vera provides a seed to - * @dev Reggie, he gives back a value which is computed completely - * @dev deterministically from the seed and the secret key. - - * @dev Reggie provides a proof by which Vera can verify that the output was - * @dev correctly computed once Reggie tells it to her, but without that proof, - * @dev the output is computationally indistinguishable to her from a uniform - * @dev random sample from the output space. - - * @dev The purpose of this contract is to perform that verification. - * **************************************************************************** - * @dev DESIGN NOTES - - * @dev The VRF algorithm verified here satisfies the full uniqueness, full - * @dev collision resistance, and full pseudo-randomness security properties. - * @dev See "SECURITY PROPERTIES" below, and - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-3 - - * @dev An elliptic curve point is generally represented in the solidity code - * @dev as a uint256[2], corresponding to its affine coordinates in - * @dev GF(FIELD_SIZE). - - * @dev For the sake of efficiency, this implementation deviates from the spec - * @dev in some minor ways: - - * @dev - Keccak hash rather than the SHA256 hash recommended in - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 - * @dev Keccak costs much less gas on the EVM, and provides similar security. - - * @dev - Secp256k1 curve instead of the P-256 or ED25519 curves recommended in - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 - * @dev For curve-point multiplication, it's much cheaper to abuse ECRECOVER - - * @dev - _hashToCurve recursively hashes until it finds a curve x-ordinate. On - * @dev the EVM, this is slightly more efficient than the recommendation in - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.1.1 - * @dev step 5, to concatenate with a nonce then hash, and rehash with the - * @dev nonce updated until a valid x-ordinate is found. - - * @dev - _hashToCurve does not include a cipher version string or the byte 0x1 - * @dev in the hash message, as recommended in step 5.B of the draft - * @dev standard. They are unnecessary here because no variation in the - * @dev cipher suite is allowed. - - * @dev - Similarly, the hash input in _scalarFromCurvePoints does not include a - * @dev commitment to the cipher suite, either, which differs from step 2 of - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.3 - * @dev . Also, the hash input is the concatenation of the uncompressed - * @dev points, not the compressed points as recommended in step 3. - - * @dev - In the calculation of the challenge value "c", the "u" value (i.e. - * @dev the value computed by Reggie as the nonce times the secp256k1 - * @dev generator point, see steps 5 and 7 of - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 - * @dev ) is replaced by its ethereum address, i.e. the lower 160 bits of the - * @dev keccak hash of the original u. This is because we only verify the - * @dev calculation of u up to its address, by abusing ECRECOVER. - * **************************************************************************** - * @dev SECURITY PROPERTIES - - * @dev Here are the security properties for this VRF: - - * @dev Full uniqueness: For any seed and valid VRF public key, there is - * @dev exactly one VRF output which can be proved to come from that seed, in - * @dev the sense that the proof will pass _verifyVRFProof. - - * @dev Full collision resistance: It's cryptographically infeasible to find - * @dev two seeds with same VRF output from a fixed, valid VRF key - - * @dev Full pseudorandomness: Absent the proofs that the VRF outputs are - * @dev derived from a given seed, the outputs are computationally - * @dev indistinguishable from randomness. - - * @dev https://eprint.iacr.org/2017/099.pdf, Appendix B contains the proofs - * @dev for these properties. - - * @dev For secp256k1, the key validation described in section - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.6 - * @dev is unnecessary, because secp256k1 has cofactor 1, and the - * @dev representation of the public key used here (affine x- and y-ordinates - * @dev of the secp256k1 point on the standard y^2=x^3+7 curve) cannot refer to - * @dev the point at infinity. - * **************************************************************************** - * @dev OTHER SECURITY CONSIDERATIONS - * - * @dev The seed input to the VRF could in principle force an arbitrary amount - * @dev of work in _hashToCurve, by requiring extra rounds of hashing and - * @dev checking whether that's yielded the x ordinate of a secp256k1 point. - * @dev However, under the Random Oracle Model the probability of choosing a - * @dev point which forces n extra rounds in _hashToCurve is 2⁻ⁿ. The base cost - * @dev for calling _hashToCurve is about 25,000 gas, and each round of checking - * @dev for a valid x ordinate costs about 15,555 gas, so to find a seed for - * @dev which _hashToCurve would cost more than 2,017,000 gas, one would have to - * @dev try, in expectation, about 2¹²⁸ seeds, which is infeasible for any - * @dev foreseeable computational resources. (25,000 + 128 * 15,555 < 2,017,000.) - - * @dev Since the gas block limit for the Ethereum main net is 10,000,000 gas, - * @dev this means it is infeasible for an adversary to prevent correct - * @dev operation of this contract by choosing an adverse seed. - - * @dev (See TestMeasureHashToCurveGasCost for verification of the gas cost for - * @dev _hashToCurve.) - - * @dev It may be possible to make a secure constant-time _hashToCurve function. - * @dev See notes in _hashToCurve docstring. -*/ +/** + * + * @notice Verification of verifiable-random-function (VRF) proofs, following + * @notice https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 + * @notice See https://eprint.iacr.org/2017/099.pdf for security proofs. + * + * @dev Bibliographic references: + * + * @dev Goldberg, et al., "Verifiable Random Functions (VRFs)", Internet Draft + * @dev draft-irtf-cfrg-vrf-05, IETF, Aug 11 2019, + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05 + * + * @dev Papadopoulos, et al., "Making NSEC5 Practical for DNSSEC", Cryptology + * @dev ePrint Archive, Report 2017/099, https://eprint.iacr.org/2017/099.pdf + * **************************************************************************** + * @dev USAGE + * + * @dev The main entry point is _randomValueFromVRFProof. See its docstring. + * **************************************************************************** + * @dev PURPOSE + * + * @dev Reggie the Random Oracle (not his real job) wants to provide randomness + * @dev to Vera the verifier in such a way that Vera can be sure he's not + * @dev making his output up to suit himself. Reggie provides Vera a public key + * @dev to which he knows the secret key. Each time Vera provides a seed to + * @dev Reggie, he gives back a value which is computed completely + * @dev deterministically from the seed and the secret key. + * + * @dev Reggie provides a proof by which Vera can verify that the output was + * @dev correctly computed once Reggie tells it to her, but without that proof, + * @dev the output is computationally indistinguishable to her from a uniform + * @dev random sample from the output space. + * + * @dev The purpose of this contract is to perform that verification. + * **************************************************************************** + * @dev DESIGN NOTES + * + * @dev The VRF algorithm verified here satisfies the full uniqueness, full + * @dev collision resistance, and full pseudo-randomness security properties. + * @dev See "SECURITY PROPERTIES" below, and + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-3 + * + * @dev An elliptic curve point is generally represented in the solidity code + * @dev as a uint256[2], corresponding to its affine coordinates in + * @dev GF(FIELD_SIZE). + * + * @dev For the sake of efficiency, this implementation deviates from the spec + * @dev in some minor ways: + * + * @dev - Keccak hash rather than the SHA256 hash recommended in + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 + * @dev Keccak costs much less gas on the EVM, and provides similar security. + * + * @dev - Secp256k1 curve instead of the P-256 or ED25519 curves recommended in + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 + * @dev For curve-point multiplication, it's much cheaper to abuse ECRECOVER + * + * @dev - _hashToCurve recursively hashes until it finds a curve x-ordinate. On + * @dev the EVM, this is slightly more efficient than the recommendation in + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.1.1 + * @dev step 5, to concatenate with a nonce then hash, and rehash with the + * @dev nonce updated until a valid x-ordinate is found. + * + * @dev - _hashToCurve does not include a cipher version string or the byte 0x1 + * @dev in the hash message, as recommended in step 5.B of the draft + * @dev standard. They are unnecessary here because no variation in the + * @dev cipher suite is allowed. + * + * @dev - Similarly, the hash input in _scalarFromCurvePoints does not include a + * @dev commitment to the cipher suite, either, which differs from step 2 of + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.3 + * @dev . Also, the hash input is the concatenation of the uncompressed + * @dev points, not the compressed points as recommended in step 3. + * + * @dev - In the calculation of the challenge value "c", the "u" value (i.e. + * @dev the value computed by Reggie as the nonce times the secp256k1 + * @dev generator point, see steps 5 and 7 of + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 + * @dev ) is replaced by its ethereum address, i.e. the lower 160 bits of the + * @dev keccak hash of the original u. This is because we only verify the + * @dev calculation of u up to its address, by abusing ECRECOVER. + * **************************************************************************** + * @dev SECURITY PROPERTIES + * + * @dev Here are the security properties for this VRF: + * + * @dev Full uniqueness: For any seed and valid VRF public key, there is + * @dev exactly one VRF output which can be proved to come from that seed, in + * @dev the sense that the proof will pass _verifyVRFProof. + * + * @dev Full collision resistance: It's cryptographically infeasible to find + * @dev two seeds with same VRF output from a fixed, valid VRF key + * + * @dev Full pseudorandomness: Absent the proofs that the VRF outputs are + * @dev derived from a given seed, the outputs are computationally + * @dev indistinguishable from randomness. + * + * @dev https://eprint.iacr.org/2017/099.pdf, Appendix B contains the proofs + * @dev for these properties. + * + * @dev For secp256k1, the key validation described in section + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.6 + * @dev is unnecessary, because secp256k1 has cofactor 1, and the + * @dev representation of the public key used here (affine x- and y-ordinates + * @dev of the secp256k1 point on the standard y^2=x^3+7 curve) cannot refer to + * @dev the point at infinity. + * **************************************************************************** + * @dev OTHER SECURITY CONSIDERATIONS + * + * @dev The seed input to the VRF could in principle force an arbitrary amount + * @dev of work in _hashToCurve, by requiring extra rounds of hashing and + * @dev checking whether that's yielded the x ordinate of a secp256k1 point. + * @dev However, under the Random Oracle Model the probability of choosing a + * @dev point which forces n extra rounds in _hashToCurve is 2⁻ⁿ. The base cost + * @dev for calling _hashToCurve is about 25,000 gas, and each round of checking + * @dev for a valid x ordinate costs about 15,555 gas, so to find a seed for + * @dev which _hashToCurve would cost more than 2,017,000 gas, one would have to + * @dev try, in expectation, about 2¹²⁸ seeds, which is infeasible for any + * @dev foreseeable computational resources. (25,000 + 128 * 15,555 < 2,017,000.) + * + * @dev Since the gas block limit for the Ethereum main net is 10,000,000 gas, + * @dev this means it is infeasible for an adversary to prevent correct + * @dev operation of this contract by choosing an adverse seed. + * + * @dev (See TestMeasureHashToCurveGasCost for verification of the gas cost for + * @dev _hashToCurve.) + * + * @dev It may be possible to make a secure constant-time _hashToCurve function. + * @dev See notes in _hashToCurve docstring. + */ contract VRF { // See https://www.secg.org/sec2-v2.pdf, section 2.4.1, for these constants. // Number of points in Secp256k1 uint256 private constant GROUP_ORDER = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141; // Prime characteristic of the galois field over which Secp256k1 is defined uint256 private constant FIELD_SIZE = - // solium-disable-next-line indentation - 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; + // solium-disable-next-line indentation + 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; uint256 private constant WORD_LENGTH_BYTES = 0x20; // (base^exponent) % FIELD_SIZE @@ -153,14 +154,15 @@ contract VRF { bigModExpContractInputs[5] = FIELD_SIZE; uint256[1] memory output; assembly { - callResult := staticcall( - not(0), // Gas cost: no limit - 0x05, // Bigmodexp contract address - bigModExpContractInputs, - 0xc0, // Length of input segment: 6*0x20-bytes - output, - 0x20 // Length of output segment - ) + callResult := + staticcall( + not(0), // Gas cost: no limit + 0x05, // Bigmodexp contract address + bigModExpContractInputs, + 0xc0, // Length of input segment: 6*0x20-bytes + output, + 0x20 // Length of output segment + ) } if (callResult == 0) { // solhint-disable-next-line gas-custom-errors @@ -174,19 +176,25 @@ contract VRF { uint256 private constant SQRT_POWER = (FIELD_SIZE + 1) >> 2; // Computes a s.t. a^2 = x in the field. Assumes a exists - function _squareRoot(uint256 x) internal view returns (uint256) { + function _squareRoot( + uint256 x + ) internal view returns (uint256) { return _bigModExp(x, SQRT_POWER); } // The value of y^2 given that (x,y) is on secp256k1. - function _ySquared(uint256 x) internal pure returns (uint256) { + function _ySquared( + uint256 x + ) internal pure returns (uint256) { // Curve is y^2=x^3+7. See section 2.4.1 of https://www.secg.org/sec2-v2.pdf uint256 xCubed = mulmod(x, mulmod(x, x, FIELD_SIZE), FIELD_SIZE); return addmod(xCubed, 7, FIELD_SIZE); } // True iff p is on secp256k1 - function _isOnCurve(uint256[2] memory p) internal pure returns (bool) { + function _isOnCurve( + uint256[2] memory p + ) internal pure returns (bool) { // Section 2.3.6. in https://www.secg.org/sec1-v2.pdf // requires each ordinate to be in [0, ..., FIELD_SIZE-1] // solhint-disable-next-line gas-custom-errors @@ -197,7 +205,9 @@ contract VRF { } // Hash x uniformly into {0, ..., FIELD_SIZE-1}. - function _fieldHash(bytes memory b) internal pure returns (uint256 x_) { + function _fieldHash( + bytes memory b + ) internal pure returns (uint256 x_) { x_ = uint256(keccak256(b)); // Rejecting if x >= FIELD_SIZE corresponds to step 2.1 in section 2.3.4 of // http://www.secg.org/sec1-v2.pdf , which is part of the definition of @@ -214,7 +224,9 @@ contract VRF { // step 5.C, which references arbitrary_string_to_point, defined in // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 as // returning the point with given x ordinate, and even y ordinate. - function _newCandidateSecp256k1Point(bytes memory b) internal view returns (uint256[2] memory p) { + function _newCandidateSecp256k1Point( + bytes memory b + ) internal view returns (uint256[2] memory p) { unchecked { p[0] = _fieldHash(b); p[1] = _squareRoot(_ySquared(p[0])); @@ -253,7 +265,8 @@ contract VRF { return rv; } - /** ********************************************************************* + /** + * * @notice Check that product==scalar*multiplicand * * @dev Based on Vitalik Buterin's idea in ethresear.ch post cited below. @@ -311,38 +324,39 @@ contract VRF { return (x3, z3); } - /** ************************************************************************** - @notice Computes elliptic-curve sum, in projective co-ordinates - - @dev Using projective coordinates avoids costly divisions - - @dev To use this with p and q in affine coordinates, call - @dev _projectiveECAdd(px, py, qx, qy). This will return - @dev the addition of (px, py, 1) and (qx, qy, 1), in the - @dev secp256k1 group. - - @dev This can be used to calculate the z which is the inverse to zInv - @dev in isValidVRFOutput. But consider using a faster - @dev re-implementation such as ProjectiveECAdd in the golang vrf package. - - @dev This function assumes [px,py,1],[qx,qy,1] are valid projective - coordinates of secp256k1 points. That is safe in this contract, - because this method is only used by _linearCombination, which checks - points are on the curve via ecrecover. - ************************************************************************** - @param px The first affine coordinate of the first summand - @param py The second affine coordinate of the first summand - @param qx The first affine coordinate of the second summand - @param qy The second affine coordinate of the second summand - - (px,py) and (qx,qy) must be distinct, valid secp256k1 points. - ************************************************************************** - Return values are projective coordinates of [px,py,1]+[qx,qy,1] as points - on secp256k1, in P²(𝔽ₙ) - @return sx - @return sy - @return sz - */ + /** + * + * @notice Computes elliptic-curve sum, in projective co-ordinates + * + * @dev Using projective coordinates avoids costly divisions + * + * @dev To use this with p and q in affine coordinates, call + * @dev _projectiveECAdd(px, py, qx, qy). This will return + * @dev the addition of (px, py, 1) and (qx, qy, 1), in the + * @dev secp256k1 group. + * + * @dev This can be used to calculate the z which is the inverse to zInv + * @dev in isValidVRFOutput. But consider using a faster + * @dev re-implementation such as ProjectiveECAdd in the golang vrf package. + * + * @dev This function assumes [px,py,1],[qx,qy,1] are valid projective + * coordinates of secp256k1 points. That is safe in this contract, + * because this method is only used by _linearCombination, which checks + * points are on the curve via ecrecover. + * + * @param px The first affine coordinate of the first summand + * @param py The second affine coordinate of the first summand + * @param qx The first affine coordinate of the second summand + * @param qy The second affine coordinate of the second summand + * + * (px,py) and (qx,qy) must be distinct, valid secp256k1 points. + * + * Return values are projective coordinates of [px,py,1]+[qx,qy,1] as points + * on secp256k1, in P²(𝔽ₙ) + * @return sx + * @return sy + * @return sz + */ function _projectiveECAdd( uint256 px, uint256 py, @@ -572,15 +586,7 @@ contract VRF { */ function _randomValueFromVRFProof(Proof calldata proof, uint256 seed) internal view returns (uint256 output) { _verifyVRFProof( - proof.pk, - proof.gamma, - proof.c, - proof.s, - seed, - proof.uWitness, - proof.cGammaWitness, - proof.sHashWitness, - proof.zInv + proof.pk, proof.gamma, proof.c, proof.s, seed, proof.uWitness, proof.cGammaWitness, proof.sHashWitness, proof.zInv ); output = uint256(keccak256(abi.encode(VRF_RANDOM_OUTPUT_HASH_PREFIX, proof.gamma))); return output; diff --git a/contracts/src/v0.8/vrf/VRFConsumerBase.sol b/contracts/src/v0.8/vrf/VRFConsumerBase.sol index 3d73b70c1d..8c98cff2d3 100644 --- a/contracts/src/v0.8/vrf/VRFConsumerBase.sol +++ b/contracts/src/v0.8/vrf/VRFConsumerBase.sol @@ -5,7 +5,8 @@ import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; import {VRFRequestIDBase} from "./VRFRequestIDBase.sol"; -/** **************************************************************************** +/** + * * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE diff --git a/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol b/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol index ad7025fc98..559ca004e2 100644 --- a/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol +++ b/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -/** **************************************************************************** +/** + * * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE @@ -97,12 +98,15 @@ pragma solidity ^0.8.4; abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i + address private immutable vrfCoordinator; /** * @param _vrfCoordinator address of VRFCoordinator contract */ - constructor(address _vrfCoordinator) { + constructor( + address _vrfCoordinator + ) { vrfCoordinator = _vrfCoordinator; } diff --git a/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol b/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol index ab0eecd6c4..c1eb8b6500 100644 --- a/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol +++ b/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol @@ -1,16 +1,18 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; -import {BlockhashStoreInterface} from "./interfaces/BlockhashStoreInterface.sol"; +import {ConfirmedOwner} from "../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../shared/interfaces/AggregatorV3Interface.sol"; -import {VRFCoordinatorV2Interface} from "./interfaces/VRFCoordinatorV2Interface.sol"; -import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; import {IERC677Receiver} from "../shared/interfaces/IERC677Receiver.sol"; +import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; +import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; + +import {ChainSpecificUtil} from "./ChainSpecificUtil_v0_8_6.sol"; import {VRF} from "./VRF.sol"; -import {ConfirmedOwner} from "../shared/access/ConfirmedOwner.sol"; import {VRFConsumerBaseV2} from "./VRFConsumerBaseV2.sol"; -import {ChainSpecificUtil} from "./ChainSpecificUtil_v0_8_6.sol"; +import {BlockhashStoreInterface} from "./interfaces/BlockhashStoreInterface.sol"; +import {VRFCoordinatorV2Interface} from "./interfaces/VRFCoordinatorV2Interface.sol"; + contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinatorV2Interface, IERC677Receiver { // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i LinkTokenInterface public immutable LINK; @@ -23,6 +25,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // This bound ensures we are able to loop over them as needed. // Should a user require more consumers, they can use multiple subscriptions. uint16 public constant MAX_CONSUMERS = 100; + error TooManyConsumers(); error InsufficientBalance(); error InvalidConsumer(uint64 subId, address consumer); @@ -33,15 +36,18 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato error PendingRequestExists(); error MustBeRequestedOwner(address proposedOwner); error BalanceInvariantViolated(uint256 internalBalance, uint256 externalBalance); // Should never happen + event FundsRecovered(address to, uint256 amount); // We use the subscription struct (1 word) // at fulfillment time. + struct Subscription { // There are only 1e9*1e18 = 1e27 juels in existence, so the balance can fit in uint96 (2^96 ~ 7e28) uint96 balance; // Common link balance used for all consumer requests. uint64 reqCount; // For fee tiers } // We use the config for the mgmt APIs + struct SubscriptionConfig { address owner; // Owner can fund/withdraw/cancel the sub. address requestedOwner; // For safely transferring sub ownership. @@ -54,6 +60,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato address[] consumers; } // Note a nonce of 0 indicates an the consumer is not assigned to that subscription. + mapping(address => mapping(uint64 => uint64)) /* consumer */ /* subId */ /* nonce */ private s_consumers; mapping(uint64 => SubscriptionConfig) /* subId */ /* subscriptionConfig */ private s_subscriptionConfigs; mapping(uint64 => Subscription) /* subId */ /* subscription */ private s_subscriptions; @@ -65,6 +72,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // A discrepancy with this contract's link balance indicates someone // sent tokens using transfer and so we may need to use recoverFunds. uint96 private s_totalBalance; + event SubscriptionCreated(uint64 indexed subId, address owner); event SubscriptionFunded(uint64 indexed subId, uint256 oldBalance, uint256 newBalance); event SubscriptionConsumerAdded(uint64 indexed subId, address consumer); @@ -80,6 +88,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); error NumWordsTooBig(uint32 have, uint32 want); @@ -92,6 +101,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato error BlockhashNotInStore(uint256 blockNum); error PaymentTooLarge(); error Reentrant(); + struct RequestCommitment { uint64 blockNum; uint64 subId; @@ -99,10 +109,12 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato uint32 numWords; address sender; } + mapping(bytes32 => address) /* keyHash */ /* oracle */ private s_provingKeys; bytes32[] private s_provingKeyHashes; mapping(address => uint96) /* oracle */ /* LINK balance */ private s_withdrawableTokens; mapping(uint256 => bytes32) /* requestID */ /* commitment */ private s_requestCommitments; + event ProvingKeyRegistered(bytes32 keyHash, address indexed oracle); event ProvingKeyDeregistered(bytes32 keyHash, address indexed oracle); event RandomWordsRequested( @@ -129,9 +141,11 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // We make it configurable in case those operations are repriced. uint32 gasAfterPaymentCalculation; } + int256 private s_fallbackWeiPerUnitLink; Config private s_config; FeeConfig private s_feeConfig; + struct FeeConfig { // Flat fee charged per fulfillment in millionths of link // So fee range is [0, 2^32/10^6]. @@ -145,6 +159,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato uint24 reqsForTier4; uint24 reqsForTier5; } + event ConfigSet( uint16 minimumRequestConfirmations, uint32 maxGasLimit, @@ -179,7 +194,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @notice Deregisters a proving key to an oracle. * @param publicProvingKey key that oracle can use to submit vrf fulfillments */ - function deregisterProvingKey(uint256[2] calldata publicProvingKey) external onlyOwner { + function deregisterProvingKey( + uint256[2] calldata publicProvingKey + ) external onlyOwner { bytes32 kh = hashOfKey(publicProvingKey); address oracle = s_provingKeys[kh]; if (oracle == address(0)) { @@ -201,7 +218,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @notice Returns the proving key hash key associated with this public key * @param publicKey the key to return the hash of */ - function hashOfKey(uint256[2] memory publicKey) public pure returns (bytes32) { + function hashOfKey( + uint256[2] memory publicKey + ) public pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -224,9 +243,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato ) external onlyOwner { if (minimumRequestConfirmations > MAX_REQUEST_CONFIRMATIONS) { revert InvalidRequestConfirmations( - minimumRequestConfirmations, - minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + minimumRequestConfirmations, minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } if (fallbackWeiPerUnitLink <= 0) { @@ -310,7 +327,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @param subId subscription id * @dev notably can be called even if there are pending requests, outstanding ones may fail onchain */ - function ownerCancelSubscription(uint64 subId) external onlyOwner { + function ownerCancelSubscription( + uint64 subId + ) external onlyOwner { if (s_subscriptionConfigs[subId].owner == address(0)) { revert InvalidSubscription(); } @@ -321,7 +340,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @notice Recover link sent with transfer instead of transferAndCall. * @param to address to send link to */ - function recoverFunds(address to) external onlyOwner { + function recoverFunds( + address to + ) external onlyOwner { uint256 externalBalance = LINK.balanceOf(address(this)); uint256 internalBalance = uint256(s_totalBalance); if (internalBalance > externalBalance) { @@ -364,13 +385,10 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato revert InvalidConsumer(subId, msg.sender); } // Input validation using the config storage word. - if ( - requestConfirmations < s_config.minimumRequestConfirmations || requestConfirmations > MAX_REQUEST_CONFIRMATIONS - ) { + if (requestConfirmations < s_config.minimumRequestConfirmations || requestConfirmations > MAX_REQUEST_CONFIRMATIONS) + { revert InvalidRequestConfirmations( - requestConfirmations, - s_config.minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + requestConfirmations, s_config.minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } // No lower bound on the requested gas limit. A user could request 0 @@ -392,14 +410,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato abi.encode(requestId, ChainSpecificUtil._getBlockNumber(), subId, callbackGasLimit, numWords, msg.sender) ); emit RandomWordsRequested( - keyHash, - requestId, - preSeed, - subId, - requestConfirmations, - callbackGasLimit, - numWords, - msg.sender + keyHash, requestId, preSeed, subId, requestConfirmations, callbackGasLimit, numWords, msg.sender ); s_consumers[msg.sender][subId] = nonce; @@ -411,7 +422,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @param requestId id of request * @dev used to determine if a request is fulfilled or not */ - function getCommitment(uint256 requestId) external view returns (bytes32) { + function getCommitment( + uint256 requestId + ) external view returns (bytes32) { return s_requestCommitments[requestId]; } @@ -438,19 +451,13 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) @@ -498,7 +505,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @param reqCount number of requests * @return feePPM fee in LINK PPM */ - function getFeeTier(uint64 reqCount) public view returns (uint32) { + function getFeeTier( + uint64 reqCount + ) public view returns (uint32) { FeeConfig memory fc = s_feeConfig; if (0 <= reqCount && reqCount <= fc.reqsForTier2) { return fc.fulfillmentFlatFeeLinkPPMTier1; @@ -522,10 +531,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @return payment amount billed to the subscription * @dev simulated offchain to determine if sufficient balance is present to fulfill the request */ - function fulfillRandomWords( - Proof calldata proof, - RequestCommitment memory rc - ) external nonReentrant returns (uint96) { + function fulfillRandomWords(Proof calldata proof, RequestCommitment memory rc) external nonReentrant returns (uint96) { uint256 startGas = gasleft(); (bytes32 keyHash, uint256 requestId, uint256 randomness) = _getRandomnessFromProof(proof, rc); @@ -557,12 +563,8 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // We also add the flat link fee to the payment amount. // Its specified in millionths of link, if s_config.fulfillmentFlatFeeLinkPPM = 1 // 1 link / 1e6 = 1e18 juels / 1e6 = 1e12 juels. - uint96 payment = _calculatePaymentAmount( - startGas, - s_config.gasAfterPaymentCalculation, - getFeeTier(reqCount), - tx.gasprice - ); + uint96 payment = + _calculatePaymentAmount(startGas, s_config.gasAfterPaymentCalculation, getFeeTier(reqCount), tx.gasprice); if (s_subscriptions[rc.subId].balance < payment) { revert InsufficientBalance(); } @@ -588,8 +590,8 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato // Will return non-zero on chains that have this enabled uint256 l1CostWei = ChainSpecificUtil._getCurrentTxL1GasFees(msg.data); // (1e18 juels/link) ((wei/gas * gas) + l1wei) / (wei/link) = juels - uint256 paymentNoFee = (1e18 * (weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei)) / - uint256(weiPerUnitLink); + uint256 paymentNoFee = (1e18 * (weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei)) + / uint256(weiPerUnitLink); uint256 fee = 1e12 * uint256(fulfillmentFlatFeeLinkPPM); if (paymentNoFee > (1e27 - fee)) { revert PaymentTooLarge(); // Payment + fee cannot be more than all of the link in existence. @@ -602,7 +604,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 weiPerUnitLink; - (, weiPerUnitLink, , timestamp, ) = LINK_ETH_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_ETH_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (staleFallback && stalenessSeconds < block.timestamp - timestamp) { weiPerUnitLink = s_fallbackWeiPerUnitLink; @@ -626,7 +628,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato } } - function onTokenTransfer(address /* sender */, uint256 amount, bytes calldata data) external override nonReentrant { + function onTokenTransfer(address, /* sender */ uint256 amount, bytes calldata data) external override nonReentrant { if (msg.sender != address(LINK)) { revert OnlyCallableFromLink(); } @@ -674,11 +676,8 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato uint64 currentSubId = s_currentSubId; address[] memory consumers = new address[](0); s_subscriptions[currentSubId] = Subscription({balance: 0, reqCount: 0}); - s_subscriptionConfigs[currentSubId] = SubscriptionConfig({ - owner: msg.sender, - requestedOwner: address(0), - consumers: consumers - }); + s_subscriptionConfigs[currentSubId] = + SubscriptionConfig({owner: msg.sender, requestedOwner: address(0), consumers: consumers}); emit SubscriptionCreated(currentSubId, msg.sender); return currentSubId; @@ -701,7 +700,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato /** * @inheritdoc VRFCoordinatorV2Interface */ - function acceptSubscriptionOwnerTransfer(uint64 subId) external override nonReentrant { + function acceptSubscriptionOwnerTransfer( + uint64 subId + ) external override nonReentrant { if (s_subscriptionConfigs[subId].owner == address(0)) { revert InvalidSubscription(); } @@ -794,15 +795,14 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato * @dev Looping is bounded to MAX_CONSUMERS*(number of keyhashes). * @dev Used to disable subscription canceling while outstanding request are present. */ - function pendingRequestExists(uint64 subId) public view override returns (bool) { + function pendingRequestExists( + uint64 subId + ) public view override returns (bool) { SubscriptionConfig memory subConfig = s_subscriptionConfigs[subId]; for (uint256 i = 0; i < subConfig.consumers.length; i++) { for (uint256 j = 0; j < s_provingKeyHashes.length; j++) { - (uint256 reqId, ) = _computeRequestId( - s_provingKeyHashes[j], - subConfig.consumers[i], - subId, - s_consumers[subConfig.consumers[i]][subId] + (uint256 reqId,) = _computeRequestId( + s_provingKeyHashes[j], subConfig.consumers[i], subId, s_consumers[subConfig.consumers[i]][subId] ); if (s_requestCommitments[reqId] != 0) { return true; @@ -812,7 +812,9 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato return false; } - modifier onlySubOwner(uint64 subId) { + modifier onlySubOwner( + uint64 subId + ) { address owner = s_subscriptionConfigs[subId].owner; if (owner == address(0)) { revert InvalidSubscription(); diff --git a/contracts/src/v0.8/vrf/VRFOwner.sol b/contracts/src/v0.8/vrf/VRFOwner.sol index 6b6b22b6db..21a5c82dc5 100644 --- a/contracts/src/v0.8/vrf/VRFOwner.sol +++ b/contracts/src/v0.8/vrf/VRFOwner.sol @@ -42,11 +42,15 @@ struct Config { interface IVRFCoordinatorV2 { function acceptOwnership() external; - function transferOwnership(address to) external; + function transferOwnership( + address to + ) external; function registerProvingKey(address oracle, uint256[2] calldata publicProvingKey) external; - function deregisterProvingKey(uint256[2] calldata publicProvingKey) external; + function deregisterProvingKey( + uint256[2] calldata publicProvingKey + ) external; function setConfig( uint16 minimumRequestConfirmations, @@ -84,11 +88,17 @@ interface IVRFCoordinatorV2 { function getFallbackWeiPerUnitLink() external view returns (int256); - function ownerCancelSubscription(uint64 subId) external; + function ownerCancelSubscription( + uint64 subId + ) external; - function recoverFunds(address to) external; + function recoverFunds( + address to + ) external; - function hashOfKey(uint256[2] memory publicKey) external pure returns (bytes32); + function hashOfKey( + uint256[2] memory publicKey + ) external pure returns (bytes32); function fulfillRandomWords( VRFTypes.Proof calldata proof, @@ -109,7 +119,9 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { event RandomWordsForced(uint256 indexed requestId, uint64 indexed subId, address indexed sender); - constructor(address _vrfCoordinator) ConfirmedOwner(msg.sender) { + constructor( + address _vrfCoordinator + ) ConfirmedOwner(msg.sender) { // solhint-disable-next-line gas-custom-errors require(_vrfCoordinator != address(0), "vrf coordinator address must be non-zero"); s_vrfCoordinator = IVRFCoordinatorV2(_vrfCoordinator); @@ -126,7 +138,9 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { * @notice Transfers ownership of the VRF coordinator to the specified address. * @param to the address to transfer ownership of the VRF Coordinator to. */ - function transferVRFOwnership(address to) external onlyOwner { + function transferVRFOwnership( + address to + ) external onlyOwner { s_vrfCoordinator.transferOwnership(to); } @@ -151,7 +165,9 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { * @notice Deregisters a proving key to an oracle. * @param publicProvingKey key that oracle can use to submit vrf fulfillments */ - function deregisterProvingKey(uint256[2] calldata publicProvingKey) external onlyOwner { + function deregisterProvingKey( + uint256[2] calldata publicProvingKey + ) external onlyOwner { s_vrfCoordinator.deregisterProvingKey(publicProvingKey); } @@ -217,7 +233,9 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { * @param subId subscription id * @dev notably can be called even if there are pending requests, outstanding ones may fail onchain */ - function ownerCancelSubscription(uint64 subId) external onlyOwner { + function ownerCancelSubscription( + uint64 subId + ) external onlyOwner { s_vrfCoordinator.ownerCancelSubscription(subId); } @@ -225,7 +243,9 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { * @notice Recover link sent with transfer instead of transferAndCall. * @param to address to send link to */ - function recoverFunds(address to) external onlyOwner { + function recoverFunds( + address to + ) external onlyOwner { s_vrfCoordinator.recoverFunds(to); } @@ -236,12 +256,8 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { * @return Config struct containing all relevant configs from the VRF coordinator. */ function _getConfigs() private view returns (Config memory) { - ( - uint16 minimumRequestConfirmations, - uint32 maxGasLimit, - uint32 stalenessSeconds, - uint32 gasAfterPaymentCalculation - ) = s_vrfCoordinator.getConfig(); + (uint16 minimumRequestConfirmations, uint32 maxGasLimit, uint32 stalenessSeconds, uint32 gasAfterPaymentCalculation) + = s_vrfCoordinator.getConfig(); ( uint32 fulfillmentFlatFeeLinkPPMTier1, uint32 fulfillmentFlatFeeLinkPPMTier2, @@ -254,25 +270,24 @@ contract VRFOwner is ConfirmedOwner, AuthorizedReceiver { uint24 reqsForTier5 ) = s_vrfCoordinator.getFeeConfig(); int256 fallbackWeiPerUnitLink = s_vrfCoordinator.getFallbackWeiPerUnitLink(); - return - Config({ - minimumRequestConfirmations: minimumRequestConfirmations, - maxGasLimit: maxGasLimit, - stalenessSeconds: stalenessSeconds, - gasAfterPaymentCalculation: gasAfterPaymentCalculation, - fallbackWeiPerUnitLink: fallbackWeiPerUnitLink, - feeConfig: FeeConfig({ - fulfillmentFlatFeeLinkPPMTier1: fulfillmentFlatFeeLinkPPMTier1, - fulfillmentFlatFeeLinkPPMTier2: fulfillmentFlatFeeLinkPPMTier2, - fulfillmentFlatFeeLinkPPMTier3: fulfillmentFlatFeeLinkPPMTier3, - fulfillmentFlatFeeLinkPPMTier4: fulfillmentFlatFeeLinkPPMTier4, - fulfillmentFlatFeeLinkPPMTier5: fulfillmentFlatFeeLinkPPMTier5, - reqsForTier2: reqsForTier2, - reqsForTier3: reqsForTier3, - reqsForTier4: reqsForTier4, - reqsForTier5: reqsForTier5 - }) - }); + return Config({ + minimumRequestConfirmations: minimumRequestConfirmations, + maxGasLimit: maxGasLimit, + stalenessSeconds: stalenessSeconds, + gasAfterPaymentCalculation: gasAfterPaymentCalculation, + fallbackWeiPerUnitLink: fallbackWeiPerUnitLink, + feeConfig: FeeConfig({ + fulfillmentFlatFeeLinkPPMTier1: fulfillmentFlatFeeLinkPPMTier1, + fulfillmentFlatFeeLinkPPMTier2: fulfillmentFlatFeeLinkPPMTier2, + fulfillmentFlatFeeLinkPPMTier3: fulfillmentFlatFeeLinkPPMTier3, + fulfillmentFlatFeeLinkPPMTier4: fulfillmentFlatFeeLinkPPMTier4, + fulfillmentFlatFeeLinkPPMTier5: fulfillmentFlatFeeLinkPPMTier5, + reqsForTier2: reqsForTier2, + reqsForTier3: reqsForTier3, + reqsForTier4: reqsForTier4, + reqsForTier5: reqsForTier5 + }) + }); } /** diff --git a/contracts/src/v0.8/vrf/VRFV2Wrapper.sol b/contracts/src/v0.8/vrf/VRFV2Wrapper.sol index 584136e3be..dbc311a1e7 100644 --- a/contracts/src/v0.8/vrf/VRFV2Wrapper.sol +++ b/contracts/src/v0.8/vrf/VRFV2Wrapper.sol @@ -3,14 +3,16 @@ pragma solidity ^0.8.6; import {ConfirmedOwner} from "../shared/access/ConfirmedOwner.sol"; + +import {AggregatorV3Interface} from "../shared/interfaces/AggregatorV3Interface.sol"; import {ITypeAndVersion} from "../shared/interfaces/ITypeAndVersion.sol"; -import {VRFConsumerBaseV2} from "./VRFConsumerBaseV2.sol"; import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; -import {AggregatorV3Interface} from "../shared/interfaces/AggregatorV3Interface.sol"; + +import {ChainSpecificUtil} from "./ChainSpecificUtil_v0_8_6.sol"; +import {VRFConsumerBaseV2} from "./VRFConsumerBaseV2.sol"; +import {VRFV2WrapperConsumerBase} from "./VRFV2WrapperConsumerBase.sol"; import {VRFCoordinatorV2Interface} from "./interfaces/VRFCoordinatorV2Interface.sol"; import {VRFV2WrapperInterface} from "./interfaces/VRFV2WrapperInterface.sol"; -import {VRFV2WrapperConsumerBase} from "./VRFV2WrapperConsumerBase.sol"; -import {ChainSpecificUtil} from "./ChainSpecificUtil_v0_8_6.sol"; /** * @notice A wrapper for VRFCoordinatorV2 that provides an interface better suited to one-off @@ -95,6 +97,7 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF int256 requestWeiPerUnitLink; uint256 juelsPaid; } + mapping(uint256 => Callback) /* requestID */ /* callback */ public s_callbacks; constructor( @@ -116,7 +119,9 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF * @notice setFulfillmentTxSize sets the size of the fulfillment transaction in bytes. * @param size is the size of the fulfillment transaction in bytes. */ - function setFulfillmentTxSize(uint32 size) external onlyOwner { + function setFulfillmentTxSize( + uint32 size + ) external onlyOwner { s_fulfillmentTxSizeBytes = size; } @@ -151,9 +156,9 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF s_configured = true; // Get other configuration from coordinator - (, , s_stalenessSeconds, ) = COORDINATOR.getConfig(); + (,, s_stalenessSeconds,) = COORDINATOR.getConfig(); s_fallbackWeiPerUnitLink = COORDINATOR.getFallbackWeiPerUnitLink(); - (s_fulfillmentFlatFeeLinkPPM, , , , , , , , ) = COORDINATOR.getFeeConfig(); + (s_fulfillmentFlatFeeLinkPPM,,,,,,,,) = COORDINATOR.getFeeConfig(); } /** @@ -250,9 +255,10 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF // costWei is the base fee denominated in wei (native) // costWei takes into account the L1 posting costs of the VRF fulfillment // transaction, if we are on an L2. - uint256 costWei = (_requestGasPrice * - (_gas + s_wrapperGasOverhead + s_coordinatorGasOverhead) + - ChainSpecificUtil._getL1CalldataGasCost(s_fulfillmentTxSizeBytes)); + uint256 costWei = ( + _requestGasPrice * (_gas + s_wrapperGasOverhead + s_coordinatorGasOverhead) + + ChainSpecificUtil._getL1CalldataGasCost(s_fulfillmentTxSizeBytes) + ); // (1e18 juels/link) * ((wei/gas * (gas)) + l1wei) / (wei/link) == 1e18 juels * wei/link / (wei/link) == 1e18 juels * wei/link * link/wei == juels // baseFee is the base fee denominated in juels (link) uint256 baseFee = (1e18 * costWei) / uint256(_weiPerUnitLink); @@ -281,10 +287,8 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF // solhint-disable-next-line gas-custom-errors require(msg.sender == address(LINK), "only callable from LINK"); - (uint32 callbackGasLimit, uint16 requestConfirmations, uint32 numWords) = abi.decode( - _data, - (uint32, uint16, uint32) - ); + (uint32 callbackGasLimit, uint16 requestConfirmations, uint32 numWords) = + abi.decode(_data, (uint32, uint16, uint32)); uint32 eip150Overhead = _getEIP150Overhead(callbackGasLimit); int256 weiPerUnitLink = _getFeedData(); uint256 price = _calculateRequestPrice(callbackGasLimit, tx.gasprice, weiPerUnitLink); @@ -356,7 +360,7 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF bool staleFallback = s_stalenessSeconds > 0; uint256 timestamp; int256 weiPerUnitLink; - (, weiPerUnitLink, , timestamp, ) = LINK_ETH_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_ETH_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (staleFallback && s_stalenessSeconds < block.timestamp - timestamp) { weiPerUnitLink = s_fallbackWeiPerUnitLink; @@ -369,7 +373,9 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF /** * @dev Calculates extra amount of gas required for running an assembly call() post-EIP150. */ - function _getEIP150Overhead(uint32 gas) private pure returns (uint32) { + function _getEIP150Overhead( + uint32 gas + ) private pure returns (uint32) { return gas / 63 + 1; } @@ -386,19 +392,13 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) diff --git a/contracts/src/v0.8/vrf/VRFV2WrapperConsumerBase.sol b/contracts/src/v0.8/vrf/VRFV2WrapperConsumerBase.sol index 79104318f1..67c6004cf3 100644 --- a/contracts/src/v0.8/vrf/VRFV2WrapperConsumerBase.sol +++ b/contracts/src/v0.8/vrf/VRFV2WrapperConsumerBase.sol @@ -4,7 +4,8 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../shared/interfaces/LinkTokenInterface.sol"; import {VRFV2WrapperInterface} from "./interfaces/VRFV2WrapperInterface.sol"; -/** ******************************************************************************* +/** + * * @notice Interface for contracts using VRF randomness through the VRF V2 wrapper * ******************************************************************************** * @dev PURPOSE diff --git a/contracts/src/v0.8/vrf/dev/ArbitrumL1Fees.sol b/contracts/src/v0.8/vrf/dev/ArbitrumL1Fees.sol index 5f56084370..3cfa153528 100644 --- a/contracts/src/v0.8/vrf/dev/ArbitrumL1Fees.sol +++ b/contracts/src/v0.8/vrf/dev/ArbitrumL1Fees.sol @@ -21,8 +21,10 @@ abstract contract ArbitrumL1Fees { /** * @notice Returns the gas cost in wei of calldataSizeBytes of calldata being posted to L1 */ - function _getL1CostWeiForCalldataSize(uint256 calldataSizeBytes) internal view returns (uint256) { - (, uint256 l1PricePerByte, , , , ) = ARBGAS.getPricesInWei(); + function _getL1CostWeiForCalldataSize( + uint256 calldataSizeBytes + ) internal view returns (uint256) { + (, uint256 l1PricePerByte,,,,) = ARBGAS.getPricesInWei(); // see https://developer.arbitrum.io/devs-how-tos/how-to-estimate-gas#where-do-we-get-all-this-information-from // for the justification behind the 140 number. return l1PricePerByte * (calldataSizeBytes + 140); diff --git a/contracts/src/v0.8/vrf/dev/BatchVRFCoordinatorV2Plus.sol b/contracts/src/v0.8/vrf/dev/BatchVRFCoordinatorV2Plus.sol index 69e0c2af55..68cfcb5b73 100644 --- a/contracts/src/v0.8/vrf/dev/BatchVRFCoordinatorV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/BatchVRFCoordinatorV2Plus.sol @@ -16,7 +16,9 @@ contract BatchVRFCoordinatorV2Plus { event ErrorReturned(uint256 indexed requestId, string reason); event RawErrorReturned(uint256 indexed requestId, bytes lowLevelData); - constructor(address coordinatorAddr) { + constructor( + address coordinatorAddr + ) { COORDINATOR = IVRFCoordinatorV2PlusFulfill(coordinatorAddr); } @@ -32,7 +34,7 @@ contract BatchVRFCoordinatorV2Plus { // solhint-disable-next-line gas-custom-errors require(proofs.length == rcs.length, "input array arg lengths mismatch"); for (uint256 i = 0; i < proofs.length; ++i) { - try COORDINATOR.fulfillRandomWords(proofs[i], rcs[i], false) returns (uint96 /* payment */) { + try COORDINATOR.fulfillRandomWords(proofs[i], rcs[i], false) returns (uint96 /* payment */ ) { continue; } catch Error(string memory reason) { uint256 requestId = _getRequestIdFromProof(proofs[i]); @@ -48,7 +50,9 @@ contract BatchVRFCoordinatorV2Plus { * @notice Returns the proving key hash associated with this public key. * @param publicKey the key to return the hash of. */ - function _hashOfKey(uint256[2] memory publicKey) internal pure returns (bytes32) { + function _hashOfKey( + uint256[2] memory publicKey + ) internal pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -56,7 +60,9 @@ contract BatchVRFCoordinatorV2Plus { * @notice Returns the request ID of the request associated with the given proof. * @param proof the VRF proof provided by the VRF oracle. */ - function _getRequestIdFromProof(VRFTypes.Proof memory proof) internal pure returns (uint256) { + function _getRequestIdFromProof( + VRFTypes.Proof memory proof + ) internal pure returns (uint256) { bytes32 keyHash = _hashOfKey(proof.pk); return uint256(keccak256(abi.encode(keyHash, proof.seed))); } diff --git a/contracts/src/v0.8/vrf/dev/BlockhashStore.sol b/contracts/src/v0.8/vrf/dev/BlockhashStore.sol index 8889060922..19145a5d4c 100644 --- a/contracts/src/v0.8/vrf/dev/BlockhashStore.sol +++ b/contracts/src/v0.8/vrf/dev/BlockhashStore.sol @@ -20,7 +20,9 @@ contract BlockhashStore { * @notice stores blockhash of a given block, assuming it is available through BLOCKHASH * @param n the number of the block whose blockhash should be stored */ - function store(uint256 n) public { + function store( + uint256 n + ) public { bytes32 h = ChainSpecificUtil._getBlockhash(uint64(n)); // solhint-disable-next-line gas-custom-errors require(h != 0x0, "blockhash(n) failed"); @@ -62,7 +64,7 @@ contract BlockhashStore { bytes32 parentHash; assembly { parentHash := mload(add(header, 36)) // 36 = 32 byte offset for length prefix of ABI-encoded array - // + 4 byte offset of PARENTHASH (see above) + // + 4 byte offset of PARENTHASH (see above) } s_blockhashes[n] = parentHash; @@ -72,7 +74,9 @@ contract BlockhashStore { * @notice gets a blockhash from the store. If no hash is known, this function reverts. * @param n the number of the block whose blockhash should be returned */ - function getBlockhash(uint256 n) external view returns (bytes32) { + function getBlockhash( + uint256 n + ) external view returns (bytes32) { bytes32 h = s_blockhashes[n]; // solhint-disable-next-line gas-custom-errors require(h != 0x0, "blockhash not found in store"); diff --git a/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol b/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol index bf8181d4d8..6e9f978d3a 100644 --- a/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol +++ b/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol @@ -2,7 +2,8 @@ pragma solidity ^0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {GasPriceOracle as OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; +import {GasPriceOracle as OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; /// @dev An abstract contract that provides Optimism specific L1 fee calculations. abstract contract OptimismL1Fees is ConfirmedOwner { @@ -59,30 +60,37 @@ abstract contract OptimismL1Fees is ConfirmedOwner { emit L1FeeCalculationSet(mode, coefficient); } - function _getL1CostWeiForCalldata(bytes calldata data) internal view returns (uint256) { + function _getL1CostWeiForCalldata( + bytes calldata data + ) internal view returns (uint256) { if (s_l1FeeCalculationMode == L1_GAS_FEES_MODE) { return OVM_GASPRICEORACLE.getL1Fee(bytes.concat(data, L1_FEE_DATA_PADDING)); } return _getL1CostWeiForCalldataSize(data.length); } - function _getL1CostWeiForCalldataSize(uint256 calldataSizeBytes) internal view returns (uint256) { + function _getL1CostWeiForCalldataSize( + uint256 calldataSizeBytes + ) internal view returns (uint256) { uint8 l1FeeCalculationMode = s_l1FeeCalculationMode; if (l1FeeCalculationMode == L1_CALLDATA_GAS_COST_MODE) { // estimate based on unsigned fully RLP-encoded transaction size so we have to account for paddding bytes as well - return - (s_l1FeeCoefficient * _calculateOptimismL1DataFee(calldataSizeBytes + L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE)) / - 100; + return ( + s_l1FeeCoefficient * _calculateOptimismL1DataFee(calldataSizeBytes + L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE) + ) / 100; } else if (l1FeeCalculationMode == L1_GAS_FEES_UPPER_BOUND_MODE) { // getL1FeeUpperBound expects unsigned fully RLP-encoded transaction size so we have to account for paddding bytes as well - return - (s_l1FeeCoefficient * - OVM_GASPRICEORACLE.getL1FeeUpperBound(calldataSizeBytes + L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE)) / 100; + return ( + s_l1FeeCoefficient + * OVM_GASPRICEORACLE.getL1FeeUpperBound(calldataSizeBytes + L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE) + ) / 100; } revert InvalidL1FeeCalculationMode(l1FeeCalculationMode); } - function _calculateOptimismL1DataFee(uint256 calldataSizeBytes) internal view returns (uint256) { + function _calculateOptimismL1DataFee( + uint256 calldataSizeBytes + ) internal view returns (uint256) { // reference: https://docs.optimism.io/stack/transactions/fees#ecotone // also: https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da // we treat all bytes in the calldata payload as non-zero bytes (cost: 16 gas) because accurate estimation is too expensive diff --git a/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol b/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol index 1117f3253a..c2deb6c587 100644 --- a/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol +++ b/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; -import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; import {IVRFSubscriptionV2Plus} from "./interfaces/IVRFSubscriptionV2Plus.sol"; +import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscriptionV2Plus { using EnumerableSet for EnumerableSet.UintSet; @@ -20,6 +20,7 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr // This bound ensures we are able to loop over them as needed. // Should a user require more consumers, they can use multiple subscriptions. uint16 public constant MAX_CONSUMERS = 100; + error TooManyConsumers(); error InsufficientBalance(); error InvalidConsumer(uint256 subId, address consumer); @@ -30,8 +31,10 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr error PendingRequestExists(); error MustBeRequestedOwner(address proposedOwner); error BalanceInvariantViolated(uint256 internalBalance, uint256 externalBalance); // Should never happen + event FundsRecovered(address to, uint256 amount); event NativeFundsRecovered(address to, uint256 amount); + error LinkAlreadySet(); error FailedToSendNative(); error FailedToTransferLink(); @@ -49,6 +52,7 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr uint64 reqCount; } // We use the config for the mgmt APIs + struct SubscriptionConfig { address owner; // Owner can fund/withdraw/cancel the sub. address requestedOwner; // For safely transferring sub ownership. @@ -60,12 +64,14 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr // consumer is valid without reading all the consumers from storage. address[] consumers; } + struct ConsumerConfig { bool active; uint64 nonce; uint64 pendingReqCount; } // Note a nonce of 0 indicates the consumer is not assigned to that subscription. + mapping(address => mapping(uint256 => ConsumerConfig)) /* consumerAddress */ /* subId */ /* consumerConfig */ internal s_consumers; mapping(uint256 => SubscriptionConfig) /* subId */ /* subscriptionConfig */ internal s_subscriptionConfigs; @@ -134,9 +140,11 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr // linkPremiumPercentage = 10 means 10% of the total gas costs is added. only integral percentage is allowed uint8 linkPremiumPercentage; } + Config public s_config; error Reentrant(); + modifier nonReentrant() { _nonReentrant(); _; @@ -148,17 +156,22 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr } } - function _requireSufficientBalance(bool condition) internal pure { + function _requireSufficientBalance( + bool condition + ) internal pure { if (!condition) { revert InsufficientBalance(); } } - function _requireValidSubscription(address subOwner) internal pure { + function _requireValidSubscription( + address subOwner + ) internal pure { if (subOwner == address(0)) { revert InvalidSubscription(); } } + constructor() ConfirmedOwner(msg.sender) {} /** @@ -181,7 +194,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr * @param subId subscription id * @dev notably can be called even if there are pending requests, outstanding ones may fail onchain */ - function ownerCancelSubscription(uint256 subId) external onlyOwner { + function ownerCancelSubscription( + uint256 subId + ) external onlyOwner { address subOwner = s_subscriptionConfigs[subId].owner; _requireValidSubscription(subOwner); _cancelSubscriptionHelper(subId, subOwner); @@ -191,7 +206,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr * @notice Recover link sent with transfer instead of transferAndCall. * @param to address to send link to */ - function recoverFunds(address to) external onlyOwner { + function recoverFunds( + address to + ) external onlyOwner { // If LINK is not set, we cannot recover funds. // It is possible that this coordinator address was funded with LINK // by accident by a user but the LINK token needs to be set first @@ -219,7 +236,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr * @notice Recover native sent with transfer/call/send instead of fundSubscription. * @param to address to send native to */ - function recoverNativeFunds(address payable to) external onlyOwner { + function recoverNativeFunds( + address payable to + ) external onlyOwner { uint256 externalBalance = address(this).balance; uint256 internalBalance = uint256(s_totalNativeBalance); if (internalBalance > externalBalance) { @@ -227,7 +246,7 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr } if (internalBalance < externalBalance) { uint256 amount = externalBalance - internalBalance; - (bool sent, ) = to.call{value: amount}(""); + (bool sent,) = to.call{value: amount}(""); if (!sent) { revert FailedToSendNative(); } @@ -241,7 +260,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr * @param recipient where to send the funds * @param amount amount to withdraw */ - function withdraw(address recipient) external nonReentrant onlyOwner { + function withdraw( + address recipient + ) external nonReentrant onlyOwner { if (address(LINK) == address(0)) { revert LinkNotSet(); } @@ -257,7 +278,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr * @param recipient where to send the funds * @param amount amount to withdraw */ - function withdrawNative(address payable recipient) external nonReentrant onlyOwner { + function withdrawNative( + address payable recipient + ) external nonReentrant onlyOwner { uint96 amount = s_withdrawableNative; _requireSufficientBalance(amount > 0); // Prevent re-entrancy by updating state before transfer. @@ -266,7 +289,7 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr _mustSendNative(recipient, amount); } - function onTokenTransfer(address /* sender */, uint256 amount, bytes calldata data) external override nonReentrant { + function onTokenTransfer(address, /* sender */ uint256 amount, bytes calldata data) external override nonReentrant { if (msg.sender != address(LINK)) { revert OnlyCallableFromLink(); } @@ -286,7 +309,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr /** * @inheritdoc IVRFSubscriptionV2Plus */ - function fundSubscriptionWithNative(uint256 subId) external payable override nonReentrant { + function fundSubscriptionWithNative( + uint256 subId + ) external payable override nonReentrant { _requireValidSubscription(s_subscriptionConfigs[subId].owner); // We do not check that the msg.sender is the subscription owner, // anyone can fund a subscription. @@ -345,19 +370,15 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr function createSubscription() external override nonReentrant returns (uint256 subId) { // Generate a subscription id that is globally unique. uint64 currentSubNonce = s_currentSubNonce; - subId = uint256( - keccak256(abi.encodePacked(msg.sender, blockhash(block.number - 1), address(this), currentSubNonce)) - ); + subId = + uint256(keccak256(abi.encodePacked(msg.sender, blockhash(block.number - 1), address(this), currentSubNonce))); // Increment the subscription nonce counter. s_currentSubNonce = currentSubNonce + 1; // Initialize storage variables. address[] memory consumers = new address[](0); s_subscriptions[subId] = Subscription({balance: 0, nativeBalance: 0, reqCount: 0}); - s_subscriptionConfigs[subId] = SubscriptionConfig({ - owner: msg.sender, - requestedOwner: address(0), - consumers: consumers - }); + s_subscriptionConfigs[subId] = + SubscriptionConfig({owner: msg.sender, requestedOwner: address(0), consumers: consumers}); // Update the s_subIds set, which tracks all subscription ids created in this contract. s_subIds.add(subId); @@ -383,7 +404,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr /** * @inheritdoc IVRFSubscriptionV2Plus */ - function acceptSubscriptionOwnerTransfer(uint256 subId) external override nonReentrant { + function acceptSubscriptionOwnerTransfer( + uint256 subId + ) external override nonReentrant { address oldOwner = s_subscriptionConfigs[subId].owner; _requireValidSubscription(oldOwner); if (s_subscriptionConfigs[subId].requestedOwner != msg.sender) { @@ -418,7 +441,9 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr emit SubscriptionConsumerAdded(subId, consumer); } - function _deleteSubscription(uint256 subId) internal returns (uint96 balance, uint96 nativeBalance) { + function _deleteSubscription( + uint256 subId + ) internal returns (uint96 balance, uint96 nativeBalance) { address[] storage consumers = s_subscriptionConfigs[subId].consumers; balance = s_subscriptions[subId].balance; nativeBalance = s_subscriptions[subId].nativeBalance; @@ -453,12 +478,16 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr emit SubscriptionCanceled(subId, to, balance, nativeBalance); } - modifier onlySubOwner(uint256 subId) { + modifier onlySubOwner( + uint256 subId + ) { _onlySubOwner(subId); _; } - function _onlySubOwner(uint256 subId) internal view { + function _onlySubOwner( + uint256 subId + ) internal view { address subOwner = s_subscriptionConfigs[subId].owner; _requireValidSubscription(subOwner); if (msg.sender != subOwner) { @@ -467,7 +496,7 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr } function _mustSendNative(address to, uint256 amount) internal { - (bool success, ) = to.call{value: amount}(""); + (bool success,) = to.call{value: amount}(""); if (!success) { revert FailedToSendNative(); } diff --git a/contracts/src/v0.8/vrf/dev/TrustedBlockhashStore.sol b/contracts/src/v0.8/vrf/dev/TrustedBlockhashStore.sol index b6a770168e..3a1382ea70 100644 --- a/contracts/src/v0.8/vrf/dev/TrustedBlockhashStore.sol +++ b/contracts/src/v0.8/vrf/dev/TrustedBlockhashStore.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {ChainSpecificUtil} from "../../shared/util/ChainSpecificUtil.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {ChainSpecificUtil} from "../../shared/util/ChainSpecificUtil.sol"; import {BlockhashStore} from "./BlockhashStore.sol"; contract TrustedBlockhashStore is ConfirmedOwner, BlockhashStore { @@ -13,7 +13,9 @@ contract TrustedBlockhashStore is ConfirmedOwner, BlockhashStore { mapping(address => bool) public s_whitelistStatus; address[] public s_whitelist; - constructor(address[] memory whitelist) ConfirmedOwner(msg.sender) { + constructor( + address[] memory whitelist + ) ConfirmedOwner(msg.sender) { setWhitelist(whitelist); } @@ -21,7 +23,9 @@ contract TrustedBlockhashStore is ConfirmedOwner, BlockhashStore { * @notice sets the whitelist of addresses that can store blockhashes * @param whitelist the whitelist of addresses that can store blockhashes */ - function setWhitelist(address[] memory whitelist) public onlyOwner { + function setWhitelist( + address[] memory whitelist + ) public onlyOwner { address[] memory previousWhitelist = s_whitelist; s_whitelist = whitelist; diff --git a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol index 83600b6c86..0161dadbdd 100644 --- a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Plus.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {IVRFCoordinatorV2Plus} from "./interfaces/IVRFCoordinatorV2Plus.sol"; import {IVRFMigratableConsumerV2Plus} from "./interfaces/IVRFMigratableConsumerV2Plus.sol"; -import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -/** **************************************************************************** +/** + * * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE @@ -110,7 +111,9 @@ abstract contract VRFConsumerBaseV2Plus is IVRFMigratableConsumerV2Plus, Confirm /** * @param _vrfCoordinator address of VRFCoordinator contract */ - constructor(address _vrfCoordinator) ConfirmedOwner(msg.sender) { + constructor( + address _vrfCoordinator + ) ConfirmedOwner(msg.sender) { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } @@ -147,7 +150,9 @@ abstract contract VRFConsumerBaseV2Plus is IVRFMigratableConsumerV2Plus, Confirm /** * @inheritdoc IVRFMigratableConsumerV2Plus */ - function setCoordinator(address _vrfCoordinator) external override onlyOwnerOrCoordinator { + function setCoordinator( + address _vrfCoordinator + ) external override onlyOwnerOrCoordinator { if (_vrfCoordinator == address(0)) { revert ZeroAddress(); } diff --git a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol index 0de1b42ce4..0de66bd3ad 100644 --- a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol +++ b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol @@ -1,7 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -/** **************************************************************************** +/** + * * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE @@ -95,7 +96,6 @@ pragma solidity ^0.8.4; * @dev responding to the request (however this is not enforced in the contract * @dev and so remains effective only in the case of unmodified oracle software). */ - import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; /** @@ -107,6 +107,7 @@ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Ini abstract contract VRFConsumerBaseV2Upgradeable is Initializable { error OnlyCoordinatorCanFulfill(address have, address want); // solhint-disable-next-line chainlink-solidity/prefix-storage-variables-with-s-underscore + address private vrfCoordinator; // See https://github.com/OpenZeppelin/openzeppelin-sdk/issues/37. @@ -120,7 +121,9 @@ abstract contract VRFConsumerBaseV2Upgradeable is Initializable { * @dev addresses on your preferred network. */ // solhint-disable-next-line func-name-mixedcase - function __VRFConsumerBaseV2_init(address _vrfCoordinator) internal onlyInitializing { + function __VRFConsumerBaseV2_init( + address _vrfCoordinator + ) internal onlyInitializing { if (_vrfCoordinator == address(0)) { // solhint-disable-next-line gas-custom-errors revert("must give valid coordinator address"); diff --git a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol index 8652367f79..8f6ad07446 100644 --- a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol @@ -1,13 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BlockhashStoreInterface} from "../interfaces/BlockhashStoreInterface.sol"; import {VRF} from "../../vrf/VRF.sol"; import {VRFTypes} from "../VRFTypes.sol"; -import {VRFConsumerBaseV2Plus, IVRFMigratableConsumerV2Plus} from "./VRFConsumerBaseV2Plus.sol"; +import {BlockhashStoreInterface} from "../interfaces/BlockhashStoreInterface.sol"; + import {SubscriptionAPI} from "./SubscriptionAPI.sol"; -import {VRFV2PlusClient} from "./libraries/VRFV2PlusClient.sol"; +import {IVRFMigratableConsumerV2Plus, VRFConsumerBaseV2Plus} from "./VRFConsumerBaseV2Plus.sol"; + import {IVRFCoordinatorV2PlusMigration} from "./interfaces/IVRFCoordinatorV2PlusMigration.sol"; +import {VRFV2PlusClient} from "./libraries/VRFV2PlusClient.sol"; // solhint-disable-next-line no-unused-import import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "./interfaces/IVRFCoordinatorV2Plus.sol"; @@ -25,6 +27,7 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; // upper bound limit for premium percentages to make sure fee calculations don't overflow uint8 private constant PREMIUM_PERCENTAGE_MAX = 155; + error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); error NumWordsTooBig(uint32 have, uint32 want); @@ -49,6 +52,7 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { mapping(bytes32 => ProvingKey) /* keyHash */ /* provingKey */ public s_provingKeys; bytes32[] public s_provingKeyHashes; mapping(uint256 => bytes32) /* requestID */ /* commitment */ public s_requestCommitments; + event ProvingKeyRegistered(bytes32 keyHash, uint64 maxGas); event ProvingKeyDeregistered(bytes32 keyHash, uint64 maxGas); @@ -92,7 +96,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { event FallbackWeiPerUnitLinkUsed(uint256 requestId, int256 fallbackWeiPerUnitLink); - constructor(address blockhashStore) SubscriptionAPI() { + constructor( + address blockhashStore + ) SubscriptionAPI() { BLOCKHASH_STORE = BlockhashStoreInterface(blockhashStore); } @@ -114,7 +120,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { * @notice Deregisters a proving key. * @param publicProvingKey key that oracle can use to submit vrf fulfillments */ - function deregisterProvingKey(uint256[2] calldata publicProvingKey) external onlyOwner { + function deregisterProvingKey( + uint256[2] calldata publicProvingKey + ) external onlyOwner { bytes32 kh = hashOfKey(publicProvingKey); ProvingKey memory key = s_provingKeys[kh]; if (!key.exists) { @@ -137,7 +145,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { * @notice Returns the proving key hash key associated with this public key * @param publicKey the key to return the hash of */ - function hashOfKey(uint256[2] calldata publicKey) public pure returns (bytes32) { + function hashOfKey( + uint256[2] calldata publicKey + ) public pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -166,9 +176,7 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { ) external onlyOwner { if (minimumRequestConfirmations > MAX_REQUEST_CONFIRMATIONS) { revert InvalidRequestConfirmations( - minimumRequestConfirmations, - minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + minimumRequestConfirmations, minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } if (fallbackWeiPerUnitLink <= 0) { @@ -211,7 +219,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { /// @dev Convert the extra args bytes into a struct /// @param extraArgs The extra args bytes /// @return The extra args struct - function _fromBytes(bytes calldata extraArgs) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { if (extraArgs.length == 0) { return VRFV2PlusClient.ExtraArgsV1({nativePayment: false}); } @@ -260,13 +270,11 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { } // Input validation using the config storage word. if ( - req.requestConfirmations < s_config.minimumRequestConfirmations || - req.requestConfirmations > MAX_REQUEST_CONFIRMATIONS + req.requestConfirmations < s_config.minimumRequestConfirmations + || req.requestConfirmations > MAX_REQUEST_CONFIRMATIONS ) { revert InvalidRequestConfirmations( - req.requestConfirmations, - s_config.minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + req.requestConfirmations, s_config.minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } // No lower bound on the requested gas limit. A user could request 0 @@ -330,19 +338,13 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) @@ -372,8 +374,10 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { revert NoCorrespondingRequest(); } if ( - commitment != - keccak256(abi.encode(requestId, rc.blockNum, rc.subId, rc.callbackGasLimit, rc.numWords, rc.sender, rc.extraArgs)) + commitment + != keccak256( + abi.encode(requestId, rc.blockNum, rc.subId, rc.callbackGasLimit, rc.numWords, rc.sender, rc.extraArgs) + ) ) { revert IncorrectCommitment(); } @@ -572,12 +576,12 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { // Will return non-zero on chains that have this enabled uint256 l1CostWei = _getL1CostWei(msg.data); // (1e18 juels/link) ((wei/gas * gas) + l1wei) / (wei/link) = juels - uint256 paymentNoFee = (1e18 * - (weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei)) / - uint256(weiPerUnitLink); + uint256 paymentNoFee = ( + 1e18 * (weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei) + ) / uint256(weiPerUnitLink); // calculate the flat fee in wei - uint256 flatFeeWei = 1e12 * - uint256(s_config.fulfillmentFlatFeeNativePPM - s_config.fulfillmentFlatFeeLinkDiscountPPM); + uint256 flatFeeWei = + 1e12 * uint256(s_config.fulfillmentFlatFeeNativePPM - s_config.fulfillmentFlatFeeLinkDiscountPPM); uint256 flatFeeJuels = (1e18 * flatFeeWei) / uint256(weiPerUnitLink); // emit this event only if this is an L2 chain that needs to cover for L1 gas fees if (l1CostWei > 0) { @@ -598,7 +602,7 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { function _getFeedData() private view returns (int256 weiPerUnitLink, bool isFeedStale) { uint32 stalenessSeconds = s_config.stalenessSeconds; uint256 timestamp; - (, weiPerUnitLink, , timestamp, ) = LINK_NATIVE_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_NATIVE_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time isFeedStale = stalenessSeconds > 0 && stalenessSeconds < block.timestamp - timestamp; if (isFeedStale) { @@ -620,7 +624,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { * @notice If the blockNumber is more than 256 blocks in the past, returns the empty string. * @notice Override this function in chain specific way if needed (L2 chains). */ - function _getBlockhash(uint64 blockNumber) internal view virtual returns (bytes32) { + function _getBlockhash( + uint64 blockNumber + ) internal view virtual returns (bytes32) { return blockhash(blockNumber); } @@ -628,14 +634,18 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { * @notice Returns the L1 fee for the calldata payload (always return 0 on L1 chains). * @notice Override this function in chain specific way for L2 chains. */ - function _getL1CostWei(bytes calldata /* data */) internal view virtual returns (uint256) { + function _getL1CostWei( + bytes calldata /* data */ + ) internal view virtual returns (uint256) { return 0; } /** * @inheritdoc IVRFSubscriptionV2Plus */ - function pendingRequestExists(uint256 subId) public view override returns (bool) { + function pendingRequestExists( + uint256 subId + ) public view override returns (bool) { address[] storage consumers = s_subscriptionConfigs[subId].consumers; uint256 consumersLength = consumers.length; for (uint256 i = 0; i < consumersLength; ++i) { @@ -682,10 +692,11 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { _cancelSubscriptionHelper(subId, to); } - /*************************************************************************** + /** + * * Section: Migration - ***************************************************************************/ - + * + */ address[] internal s_migrationTargets; /// @dev Emitted when new coordinator is registered as migratable target @@ -716,7 +727,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { uint96 nativeBalance; } - function _isTargetRegistered(address target) internal view returns (bool) { + function _isTargetRegistered( + address target + ) internal view returns (bool) { uint256 migrationTargetsLength = s_migrationTargets.length; for (uint256 i = 0; i < migrationTargetsLength; ++i) { if (s_migrationTargets[i] == target) { @@ -726,7 +739,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { return false; } - function registerMigratableCoordinator(address target) external onlyOwner { + function registerMigratableCoordinator( + address target + ) external onlyOwner { if (_isTargetRegistered(target)) { revert CoordinatorAlreadyRegistered(target); } @@ -734,7 +749,9 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { emit CoordinatorRegistered(target); } - function deregisterMigratableCoordinator(address target) external onlyOwner { + function deregisterMigratableCoordinator( + address target + ) external onlyOwner { uint256 nTargets = s_migrationTargets.length; for (uint256 i = 0; i < nTargets; ++i) { if (s_migrationTargets[i] == target) { @@ -751,7 +768,7 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { if (!_isTargetRegistered(newCoordinator)) { revert CoordinatorNotRegistered(newCoordinator); } - (uint96 balance, uint96 nativeBalance, , address subOwner, address[] memory consumers) = getSubscription(subId); + (uint96 balance, uint96 nativeBalance,, address subOwner, address[] memory consumers) = getSubscription(subId); if (subOwner != msg.sender) { revert MustBeSubOwner(subOwner); } diff --git a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Arbitrum.sol b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Arbitrum.sol index aa27ecf9ef..486e9f2664 100644 --- a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Arbitrum.sol +++ b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Arbitrum.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.19; import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; -import {VRFCoordinatorV2_5} from "./VRFCoordinatorV2_5.sol"; + import {ArbitrumL1Fees} from "./ArbitrumL1Fees.sol"; +import {VRFCoordinatorV2_5} from "./VRFCoordinatorV2_5.sol"; /// @dev VRFCoordinatorV2_5_Arbitrum combines VRFCoordinatorV2_5 base contract with /// @dev Arbitrum specific opcodes and L1 gas fee calculations. @@ -13,13 +14,17 @@ contract VRFCoordinatorV2_5_Arbitrum is VRFCoordinatorV2_5, ArbitrumL1Fees { address private constant ARBSYS_ADDR = address(0x0000000000000000000000000000000000000064); ArbSys private constant ARBSYS = ArbSys(ARBSYS_ADDR); - constructor(address blockhashStore) VRFCoordinatorV2_5(blockhashStore) {} + constructor( + address blockhashStore + ) VRFCoordinatorV2_5(blockhashStore) {} /** * @notice Override getBlockhash from VRFCoordinatorV2_5 * @notice When on a known Arbitrum chain, it uses ArbSys.arbBlockHash to get the blockhash. */ - function _getBlockhash(uint64 blockNumber) internal view override returns (bytes32) { + function _getBlockhash( + uint64 blockNumber + ) internal view override returns (bytes32) { uint64 currentBlockNumber = uint64(_getBlockNumber()); if (blockNumber >= currentBlockNumber || (currentBlockNumber - blockNumber) > 256) { return ""; @@ -36,7 +41,9 @@ contract VRFCoordinatorV2_5_Arbitrum is VRFCoordinatorV2_5, ArbitrumL1Fees { } /// @notice Override getL1CostWei function from VRFCoordinatorV2_5 to activate Arbitrum getL1Fee computation - function _getL1CostWei(bytes calldata /* data */) internal view override returns (uint256) { + function _getL1CostWei( + bytes calldata /* data */ + ) internal view override returns (uint256) { return _getL1CostWeiForCalldata(); } } diff --git a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Optimism.sol b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Optimism.sol index 9db1c84895..c9d00f0130 100644 --- a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Optimism.sol +++ b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5_Optimism.sol @@ -1,20 +1,24 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {VRFCoordinatorV2_5} from "./VRFCoordinatorV2_5.sol"; import {OptimismL1Fees} from "./OptimismL1Fees.sol"; +import {VRFCoordinatorV2_5} from "./VRFCoordinatorV2_5.sol"; /// @dev VRFCoordinatorV2_5_Optimism combines VRFCoordinatorV2_5 base contract with /// @dev Optimism specific opcodes and L1 gas fee calculations. /// @dev This coordinator contract is used for all chains in the OP stack (e.g. Base). contract VRFCoordinatorV2_5_Optimism is VRFCoordinatorV2_5, OptimismL1Fees { - constructor(address blockhashStore) VRFCoordinatorV2_5(blockhashStore) {} + constructor( + address blockhashStore + ) VRFCoordinatorV2_5(blockhashStore) {} /// @notice no need to override getBlockhash and getBlockNumber from VRFCoordinatorV2_5 /// @notice on OP stack, they will work with the default implementation /// @notice Override getL1CostWei function from VRFCoordinatorV2_5 to activate Optimism getL1Fee computation - function _getL1CostWei(bytes calldata data) internal view override returns (uint256) { + function _getL1CostWei( + bytes calldata data + ) internal view override returns (uint256) { return _getL1CostWeiForCalldata(data); } } diff --git a/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol b/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol index a7a16a067c..d6b21e2775 100644 --- a/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol +++ b/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol @@ -2,10 +2,12 @@ pragma solidity 0.8.6; +import {AutomationCompatibleInterface as KeeperCompatibleInterface} from + "../../automation/interfaces/AutomationCompatibleInterface.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "../../automation/interfaces/AutomationCompatibleInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; import {Pausable} from "@openzeppelin/contracts@4.9.6/security/Pausable.sol"; /** @@ -113,11 +115,10 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat Target memory target; for (uint256 idx = 0; idx < watchList.length; idx++) { target = s_targets[watchList[idx]]; - (uint96 subscriptionBalance, , , ) = COORDINATOR.getSubscription(watchList[idx]); + (uint96 subscriptionBalance,,,) = COORDINATOR.getSubscription(watchList[idx]); if ( - target.lastTopUpTimestamp + minWaitPeriod <= block.timestamp && - contractBalance >= target.topUpAmountJuels && - subscriptionBalance < target.minBalanceJuels + target.lastTopUpTimestamp + minWaitPeriod <= block.timestamp && contractBalance >= target.topUpAmountJuels + && subscriptionBalance < target.minBalanceJuels ) { needsFunding[count] = watchList[idx]; count++; @@ -136,24 +137,21 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat * @notice Send funds to the subscriptions provided. * @param needsFunding the list of subscriptions to fund */ - function topUp(uint64[] memory needsFunding) public whenNotPaused { + function topUp( + uint64[] memory needsFunding + ) public whenNotPaused { uint256 minWaitPeriodSeconds = s_minWaitPeriodSeconds; uint256 contractBalance = LINKTOKEN.balanceOf(address(this)); Target memory target; for (uint256 idx = 0; idx < needsFunding.length; idx++) { target = s_targets[needsFunding[idx]]; - (uint96 subscriptionBalance, , , ) = COORDINATOR.getSubscription(needsFunding[idx]); + (uint96 subscriptionBalance,,,) = COORDINATOR.getSubscription(needsFunding[idx]); if ( - target.isActive && - target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp && - subscriptionBalance < target.minBalanceJuels && - contractBalance >= target.topUpAmountJuels + target.isActive && target.lastTopUpTimestamp + minWaitPeriodSeconds <= block.timestamp + && subscriptionBalance < target.minBalanceJuels && contractBalance >= target.topUpAmountJuels ) { - bool success = LINKTOKEN.transferAndCall( - address(COORDINATOR), - target.topUpAmountJuels, - abi.encode(needsFunding[idx]) - ); + bool success = + LINKTOKEN.transferAndCall(address(COORDINATOR), target.topUpAmountJuels, abi.encode(needsFunding[idx])); if (success) { s_targets[needsFunding[idx]].lastTopUpTimestamp = uint56(block.timestamp); contractBalance -= target.topUpAmountJuels; @@ -186,7 +184,9 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat * @notice Called by the keeper to send funds to underfunded addresses. * @param performData the abi encoded list of addresses to fund */ - function performUpkeep(bytes calldata performData) external override onlyKeeperRegistry whenNotPaused { + function performUpkeep( + bytes calldata performData + ) external override onlyKeeperRegistry whenNotPaused { uint64[] memory needsFunding = abi.decode(performData, (uint64[])); topUp(needsFunding); } @@ -206,7 +206,9 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat /** * @notice Sets the LINK token address. */ - function setLinkTokenAddress(address linkTokenAddress) public onlyOwner { + function setLinkTokenAddress( + address linkTokenAddress + ) public onlyOwner { // solhint-disable-next-line gas-custom-errors, reason-string require(linkTokenAddress != address(0)); emit LinkTokenAddressUpdated(address(LINKTOKEN), linkTokenAddress); @@ -216,7 +218,9 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat /** * @notice Sets the VRF coordinator address. */ - function setVRFCoordinatorV2Address(address coordinatorAddress) public onlyOwner { + function setVRFCoordinatorV2Address( + address coordinatorAddress + ) public onlyOwner { // solhint-disable-next-line gas-custom-errors, reason-string require(coordinatorAddress != address(0)); emit VRFCoordinatorV2AddressUpdated(address(COORDINATOR), coordinatorAddress); @@ -226,7 +230,9 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat /** * @notice Sets the keeper registry address. */ - function setKeeperRegistryAddress(address keeperRegistryAddress) public onlyOwner { + function setKeeperRegistryAddress( + address keeperRegistryAddress + ) public onlyOwner { // solhint-disable-next-line gas-custom-errors, reason-string require(keeperRegistryAddress != address(0)); emit KeeperRegistryAddressUpdated(s_keeperRegistryAddress, keeperRegistryAddress); @@ -236,7 +242,9 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat /** * @notice Sets the minimum wait period (in seconds) for subscription ids between funding. */ - function setMinWaitPeriodSeconds(uint256 period) public onlyOwner { + function setMinWaitPeriodSeconds( + uint256 period + ) public onlyOwner { emit MinWaitPeriodUpdated(s_minWaitPeriodSeconds, period); s_minWaitPeriodSeconds = period; } diff --git a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol index fced582264..57236f9408 100644 --- a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol +++ b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol @@ -2,13 +2,15 @@ pragma solidity 0.8.19; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; + +import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -import {VRFConsumerBaseV2Plus} from "./VRFConsumerBaseV2Plus.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; -import {VRFV2PlusClient} from "./libraries/VRFV2PlusClient.sol"; -import {IVRFV2PlusWrapper} from "./interfaces/IVRFV2PlusWrapper.sol"; +import {VRFConsumerBaseV2Plus} from "./VRFConsumerBaseV2Plus.sol"; + import {VRFV2PlusWrapperConsumerBase} from "./VRFV2PlusWrapperConsumerBase.sol"; +import {IVRFV2PlusWrapper} from "./interfaces/IVRFV2PlusWrapper.sol"; +import {VRFV2PlusClient} from "./libraries/VRFV2PlusClient.sol"; /** * @notice A wrapper for VRFCoordinatorV2 that provides an interface better suited to one-off @@ -159,6 +161,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P uint64 requestGasPrice; } /* Storage Slot 6: BEGIN */ + mapping(uint256 => Callback) /* requestID */ /* callback */ public s_callbacks; /* Storage Slot 6: END */ @@ -190,7 +193,9 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * @notice setFulfillmentTxSize sets the size of the fulfillment transaction in bytes. * @param _size is the size of the fulfillment transaction in bytes. */ - function setFulfillmentTxSize(uint32 _size) external onlyOwner { + function setFulfillmentTxSize( + uint32 _size + ) external onlyOwner { s_fulfillmentTxSizeBytes = _size; emit FulfillmentTxSizeSet(_size); @@ -375,7 +380,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P uint32 _callbackGasLimit, uint32 _numWords ) external view override onlyConfiguredNotDisabled returns (uint256) { - (int256 weiPerUnitLink, ) = _getFeedData(); + (int256 weiPerUnitLink,) = _getFeedData(); return _calculateRequestPrice(_callbackGasLimit, _numWords, tx.gasprice, weiPerUnitLink); } @@ -400,7 +405,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P uint32 _numWords, uint256 _requestGasPriceWei ) external view override onlyConfiguredNotDisabled returns (uint256) { - (int256 weiPerUnitLink, ) = _getFeedData(); + (int256 weiPerUnitLink,) = _getFeedData(); return _calculateRequestPrice(_callbackGasLimit, _numWords, _requestGasPriceWei, weiPerUnitLink); } @@ -431,14 +436,14 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // coordinatorCostWei takes into account the L1 posting costs of the VRF fulfillment transaction, if we are on an L2. // (wei/gas) * gas + l1wei - uint256 coordinatorCostWei = _requestGasPrice * - (_gas + _getCoordinatorGasOverhead(_numWords, true)) + - _getL1CostWei(); + uint256 coordinatorCostWei = + _requestGasPrice * (_gas + _getCoordinatorGasOverhead(_numWords, true)) + _getL1CostWei(); // coordinatorCostWithPremiumAndFlatFeeWei is the coordinator cost with the percentage premium and flat fee applied // coordinator cost * premium multiplier + flat fee - uint256 coordinatorCostWithPremiumAndFlatFeeWei = ((coordinatorCostWei * - (s_coordinatorNativePremiumPercentage + 100)) / 100) + (1e12 * uint256(s_fulfillmentFlatFeeNativePPM)); + uint256 coordinatorCostWithPremiumAndFlatFeeWei = ( + (coordinatorCostWei * (s_coordinatorNativePremiumPercentage + 100)) / 100 + ) + (1e12 * uint256(s_fulfillmentFlatFeeNativePPM)); return wrapperCostWei + coordinatorCostWithPremiumAndFlatFeeWei; } @@ -455,15 +460,14 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // coordinatorCostWei takes into account the L1 posting costs of the VRF fulfillment transaction, if we are on an L2. // (wei/gas) * gas + l1wei - uint256 coordinatorCostWei = _requestGasPrice * - (_gas + _getCoordinatorGasOverhead(_numWords, false)) + - _getL1CostWei(); + uint256 coordinatorCostWei = + _requestGasPrice * (_gas + _getCoordinatorGasOverhead(_numWords, false)) + _getL1CostWei(); // coordinatorCostWithPremiumAndFlatFeeWei is the coordinator cost with the percentage premium and flat fee applied // coordinator cost * premium multiplier + flat fee - uint256 coordinatorCostWithPremiumAndFlatFeeWei = ((coordinatorCostWei * - (s_coordinatorLinkPremiumPercentage + 100)) / 100) + - (1e12 * uint256(s_fulfillmentFlatFeeNativePPM - s_fulfillmentFlatFeeLinkDiscountPPM)); + uint256 coordinatorCostWithPremiumAndFlatFeeWei = ( + (coordinatorCostWei * (s_coordinatorLinkPremiumPercentage + 100)) / 100 + ) + (1e12 * uint256(s_fulfillmentFlatFeeNativePPM - s_fulfillmentFlatFeeLinkDiscountPPM)); // requestPrice is denominated in juels (link) // (1e18 juels/link) * wei / (wei/link) = juels @@ -487,10 +491,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // solhint-disable-next-line gas-custom-errors require(msg.sender == address(i_link), "only callable from LINK"); - (uint32 callbackGasLimit, uint16 requestConfirmations, uint32 numWords, bytes memory extraArgs) = abi.decode( - _data, - (uint32, uint16, uint32, bytes) - ); + (uint32 callbackGasLimit, uint16 requestConfirmations, uint32 numWords, bytes memory extraArgs) = + abi.decode(_data, (uint32, uint16, uint32, bytes)); checkPaymentMode(extraArgs, true); uint32 eip150Overhead = _getEIP150Overhead(callbackGasLimit); (int256 weiPerUnitLink, bool isFeedStale) = _getFeedData(); @@ -508,11 +510,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P extraArgs: extraArgs // empty extraArgs defaults to link payment }); uint256 requestId = s_vrfCoordinator.requestRandomWords(req); - s_callbacks[requestId] = Callback({ - callbackAddress: _sender, - callbackGasLimit: callbackGasLimit, - requestGasPrice: uint64(tx.gasprice) - }); + s_callbacks[requestId] = + Callback({callbackAddress: _sender, callbackGasLimit: callbackGasLimit, requestGasPrice: uint64(tx.gasprice)}); lastRequestId = requestId; if (isFeedStale) { @@ -567,11 +566,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P extraArgs: extraArgs }); requestId = s_vrfCoordinator.requestRandomWords(req); - s_callbacks[requestId] = Callback({ - callbackAddress: msg.sender, - callbackGasLimit: _callbackGasLimit, - requestGasPrice: uint64(tx.gasprice) - }); + s_callbacks[requestId] = + Callback({callbackAddress: msg.sender, callbackGasLimit: _callbackGasLimit, requestGasPrice: uint64(tx.gasprice)}); return requestId; } @@ -581,7 +577,9 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * * @param _recipient is the address that should receive the LINK funds. */ - function withdraw(address _recipient) external onlyOwner { + function withdraw( + address _recipient + ) external onlyOwner { uint256 amount = i_link.balanceOf(address(this)); if (!i_link.transfer(_recipient, amount)) { revert FailedToTransferLink(); @@ -595,9 +593,11 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * * @param _recipient is the address that should receive the native funds. */ - function withdrawNative(address _recipient) external onlyOwner { + function withdrawNative( + address _recipient + ) external onlyOwner { uint256 amount = address(this).balance; - (bool success, ) = payable(_recipient).call{value: amount}(""); + (bool success,) = payable(_recipient).call{value: amount}(""); // solhint-disable-next-line gas-custom-errors require(success, "failed to withdraw native"); @@ -652,7 +652,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P function _getFeedData() private view returns (int256 weiPerUnitLink, bool isFeedStale) { uint32 stalenessSeconds = s_stalenessSeconds; uint256 timestamp; - (, weiPerUnitLink, , timestamp, ) = i_link_native_feed.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = i_link_native_feed.latestRoundData(); // solhint-disable-next-line not-rely-on-time isFeedStale = stalenessSeconds > 0 && stalenessSeconds < block.timestamp - timestamp; if (isFeedStale) { @@ -666,7 +666,9 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P /** * @dev Calculates extra amount of gas required for running an assembly call() post-EIP150. */ - function _getEIP150Overhead(uint32 gas) private pure returns (uint32) { + function _getEIP150Overhead( + uint32 gas + ) private pure returns (uint32) { return gas / 63 + 1; } @@ -691,19 +693,13 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) diff --git a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol index 89a7dcbf06..b8818364ee 100644 --- a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol +++ b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapperConsumerBase.sol @@ -37,7 +37,9 @@ abstract contract VRFV2PlusWrapperConsumerBase { /** * @param _vrfV2PlusWrapper is the address of the VRFV2Wrapper contract */ - constructor(address _vrfV2PlusWrapper) { + constructor( + address _vrfV2PlusWrapper + ) { IVRFV2PlusWrapper vrfV2PlusWrapper = IVRFV2PlusWrapper(_vrfV2PlusWrapper); i_linkToken = LinkTokenInterface(vrfV2PlusWrapper.link()); @@ -65,9 +67,7 @@ abstract contract VRFV2PlusWrapperConsumerBase { ) internal returns (uint256 requestId, uint256 reqPrice) { reqPrice = i_vrfV2PlusWrapper.calculateRequestPrice(_callbackGasLimit, _numWords); i_linkToken.transferAndCall( - address(i_vrfV2PlusWrapper), - reqPrice, - abi.encode(_callbackGasLimit, _requestConfirmations, _numWords, extraArgs) + address(i_vrfV2PlusWrapper), reqPrice, abi.encode(_callbackGasLimit, _requestConfirmations, _numWords, extraArgs) ); return (i_vrfV2PlusWrapper.lastRequestId(), reqPrice); } @@ -82,10 +82,7 @@ abstract contract VRFV2PlusWrapperConsumerBase { requestPrice = i_vrfV2PlusWrapper.calculateRequestPriceNative(_callbackGasLimit, _numWords); return ( i_vrfV2PlusWrapper.requestRandomWordsInNative{value: requestPrice}( - _callbackGasLimit, - _requestConfirmations, - _numWords, - extraArgs + _callbackGasLimit, _requestConfirmations, _numWords, extraArgs ), requestPrice ); diff --git a/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2Plus.sol b/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2Plus.sol index b0d5a80169..84bc935d63 100644 --- a/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2Plus.sol @@ -32,5 +32,7 @@ interface IVRFCoordinatorV2Plus is IVRFSubscriptionV2Plus { * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ - function requestRandomWords(VRFV2PlusClient.RandomWordsRequest calldata req) external returns (uint256 requestId); + function requestRandomWords( + VRFV2PlusClient.RandomWordsRequest calldata req + ) external returns (uint256 requestId); } diff --git a/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusInternal.sol b/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusInternal.sol index 22e714cc94..7c7cdcaaf3 100644 --- a/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusInternal.sol +++ b/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusInternal.sol @@ -24,12 +24,7 @@ interface IVRFCoordinatorV2PlusInternal is IVRFCoordinatorV2Plus { ); event RandomWordsFulfilled( - uint256 indexed requestId, - uint256 outputSeed, - uint256 indexed subId, - uint96 payment, - bool success, - bool onlyPremium + uint256 indexed requestId, uint256 outputSeed, uint256 indexed subId, uint96 payment, bool success, bool onlyPremium ); struct RequestCommitment { @@ -54,7 +49,9 @@ interface IVRFCoordinatorV2PlusInternal is IVRFCoordinatorV2Plus { } // solhint-disable-next-line func-name-mixedcase - function s_requestCommitments(uint256 requestID) external view returns (bytes32); + function s_requestCommitments( + uint256 requestID + ) external view returns (bytes32); function fulfillRandomWords( Proof calldata proof, diff --git a/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusMigration.sol b/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusMigration.sol index f77aaa76fc..0529e6c28f 100644 --- a/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusMigration.sol +++ b/contracts/src/v0.8/vrf/dev/interfaces/IVRFCoordinatorV2PlusMigration.sol @@ -10,5 +10,7 @@ interface IVRFCoordinatorV2PlusMigration { * @notice supports transfer of native currency * @param encodedData - user data from older version of coordinator */ - function onMigration(bytes calldata encodedData) external payable; + function onMigration( + bytes calldata encodedData + ) external payable; } diff --git a/contracts/src/v0.8/vrf/dev/interfaces/IVRFMigratableConsumerV2Plus.sol b/contracts/src/v0.8/vrf/dev/interfaces/IVRFMigratableConsumerV2Plus.sol index 67d12b886e..7a419507b8 100644 --- a/contracts/src/v0.8/vrf/dev/interfaces/IVRFMigratableConsumerV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/interfaces/IVRFMigratableConsumerV2Plus.sol @@ -9,5 +9,7 @@ interface IVRFMigratableConsumerV2Plus { /// @notice Sets the VRF Coordinator address /// @notice This method should only be callable by the coordinator or contract owner - function setCoordinator(address vrfCoordinator) external; + function setCoordinator( + address vrfCoordinator + ) external; } diff --git a/contracts/src/v0.8/vrf/dev/interfaces/IVRFSubscriptionV2Plus.sol b/contracts/src/v0.8/vrf/dev/interfaces/IVRFSubscriptionV2Plus.sol index b178ffb98b..83b0a4a4d1 100644 --- a/contracts/src/v0.8/vrf/dev/interfaces/IVRFSubscriptionV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/interfaces/IVRFSubscriptionV2Plus.sol @@ -31,7 +31,9 @@ interface IVRFSubscriptionV2Plus { * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ - function acceptSubscriptionOwnerTransfer(uint256 subId) external; + function acceptSubscriptionOwnerTransfer( + uint256 subId + ) external; /** * @notice Request subscription owner transfer. @@ -78,7 +80,9 @@ interface IVRFSubscriptionV2Plus { * @return true if there exists at least one unfulfilled request for the subscription, false * otherwise. */ - function pendingRequestExists(uint256 subId) external view returns (bool); + function pendingRequestExists( + uint256 subId + ) external view returns (bool); /** * @notice Paginate through all active VRF subscriptions. @@ -94,5 +98,7 @@ interface IVRFSubscriptionV2Plus { * @param subId - ID of the subscription * @notice This method expects msg.value to be greater than or equal to 0. */ - function fundSubscriptionWithNative(uint256 subId) external payable; + function fundSubscriptionWithNative( + uint256 subId + ) external payable; } diff --git a/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol b/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol index 31ed4de888..266b89a155 100644 --- a/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol +++ b/contracts/src/v0.8/vrf/dev/libraries/VRFV2PlusClient.sol @@ -5,6 +5,7 @@ pragma solidity ^0.8.4; library VRFV2PlusClient { // extraArgs will evolve to support new features bytes4 public constant EXTRA_ARGS_V1_TAG = bytes4(keccak256("VRF ExtraArgsV1")); + struct ExtraArgsV1 { bool nativePayment; } @@ -18,7 +19,9 @@ library VRFV2PlusClient { bytes extraArgs; } - function _argsToBytes(ExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts) { + function _argsToBytes( + ExtraArgsV1 memory extraArgs + ) internal pure returns (bytes memory bts) { return abi.encodeWithSelector(EXTRA_ARGS_V1_TAG, extraArgs); } } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5.sol b/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5.sol index 4c12eef7e7..9d0f133aaa 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5.sol @@ -1,14 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import {VRFCoordinatorV2_5} from "../VRFCoordinatorV2_5.sol"; import {VRFTypes} from "../../VRFTypes.sol"; +import {VRFCoordinatorV2_5} from "../VRFCoordinatorV2_5.sol"; import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract ExposedVRFCoordinatorV2_5 is VRFCoordinatorV2_5 { using EnumerableSet for EnumerableSet.UintSet; - constructor(address blockhashStore) VRFCoordinatorV2_5(blockhashStore) {} + constructor( + address blockhashStore + ) VRFCoordinatorV2_5(blockhashStore) {} function computeRequestIdExternal( bytes32 keyHash, @@ -19,7 +21,9 @@ contract ExposedVRFCoordinatorV2_5 is VRFCoordinatorV2_5 { return _computeRequestId(keyHash, sender, subId, nonce); } - function isTargetRegisteredExternal(address target) external view returns (bool) { + function isTargetRegisteredExternal( + address target + ) external view returns (bool) { return _isTargetRegistered(target); } @@ -34,23 +38,33 @@ contract ExposedVRFCoordinatorV2_5 is VRFCoordinatorV2_5 { return s_subIds.length(); } - function getSubscriptionConfig(uint256 subId) external view returns (SubscriptionConfig memory) { + function getSubscriptionConfig( + uint256 subId + ) external view returns (SubscriptionConfig memory) { return s_subscriptionConfigs[subId]; } - function getSubscriptionStruct(uint256 subId) external view returns (Subscription memory) { + function getSubscriptionStruct( + uint256 subId + ) external view returns (Subscription memory) { return s_subscriptions[subId]; } - function setTotalBalanceTestingOnlyXXX(uint96 newBalance) external { + function setTotalBalanceTestingOnlyXXX( + uint96 newBalance + ) external { s_totalBalance = newBalance; } - function setTotalNativeBalanceTestingOnlyXXX(uint96 newBalance) external { + function setTotalNativeBalanceTestingOnlyXXX( + uint96 newBalance + ) external { s_totalNativeBalance = newBalance; } - function setWithdrawableTokensTestingOnlyXXX(uint96 newBalance) external { + function setWithdrawableTokensTestingOnlyXXX( + uint96 newBalance + ) external { s_withdrawableTokens = newBalance; } @@ -58,7 +72,9 @@ contract ExposedVRFCoordinatorV2_5 is VRFCoordinatorV2_5 { return s_withdrawableTokens; } - function setWithdrawableNativeTestingOnlyXXX(uint96 newBalance) external { + function setWithdrawableNativeTestingOnlyXXX( + uint96 newBalance + ) external { s_withdrawableNative = newBalance; } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol b/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol index 8224b53b55..ad91aaa4a0 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol @@ -4,13 +4,17 @@ pragma solidity ^0.8.4; import {VRFCoordinatorV2_5_Arbitrum} from "../VRFCoordinatorV2_5_Arbitrum.sol"; contract ExposedVRFCoordinatorV2_5_Arbitrum is VRFCoordinatorV2_5_Arbitrum { - constructor(address blockhashStore) VRFCoordinatorV2_5_Arbitrum(blockhashStore) {} + constructor( + address blockhashStore + ) VRFCoordinatorV2_5_Arbitrum(blockhashStore) {} function getBlockNumberExternal() external view returns (uint256) { return _getBlockNumber(); } - function getBlockhashExternal(uint64 blockNumber) external view returns (bytes32) { + function getBlockhashExternal( + uint64 blockNumber + ) external view returns (bytes32) { return _getBlockhash(blockNumber); } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol b/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol index 3009e54456..aac019841f 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol @@ -4,13 +4,17 @@ pragma solidity ^0.8.4; import {VRFCoordinatorV2_5_Optimism} from "../VRFCoordinatorV2_5_Optimism.sol"; contract ExposedVRFCoordinatorV2_5_Optimism is VRFCoordinatorV2_5_Optimism { - constructor(address blockhashStore) VRFCoordinatorV2_5_Optimism(blockhashStore) {} + constructor( + address blockhashStore + ) VRFCoordinatorV2_5_Optimism(blockhashStore) {} function getBlockNumberExternal() external view returns (uint256) { return _getBlockNumber(); } - function getBlockhashExternal(uint64 blockNumber) external view returns (bytes32) { + function getBlockhashExternal( + uint64 blockNumber + ) external view returns (bytes32) { return _getBlockhash(blockNumber); } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol index 65a88df2c1..0327427337 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFConsumerV2PlusUpgradeableExample.sol @@ -2,10 +2,12 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../../shared/interfaces/LinkTokenInterface.sol"; -import {IVRFCoordinatorV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; + import {VRFConsumerBaseV2Upgradeable} from "../VRFConsumerBaseV2Upgradeable.sol"; -import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; +import {IVRFCoordinatorV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; + import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; +import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract VRFConsumerV2PlusUpgradeableExample is Initializable, VRFConsumerBaseV2Upgradeable { uint256[] public s_randomWords; @@ -30,7 +32,9 @@ contract VRFConsumerV2PlusUpgradeableExample is Initializable, VRFConsumerBaseV2 s_randomWords = randomWords; } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = COORDINATOR.createSubscription(); COORDINATOR.addConsumer(s_subId, address(this)); @@ -39,14 +43,18 @@ contract VRFConsumerV2PlusUpgradeableExample is Initializable, VRFConsumerBaseV2 LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "sub not set"); // Approve the link transfer. LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol index 88085c89d8..939b1d334a 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol @@ -1,14 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BlockhashStoreInterface} from "../../interfaces/BlockhashStoreInterface.sol"; -import {VRFOld} from "./VRFOld.sol"; -import {VRFTypes} from "../../VRFTypes.sol"; -import {VRFConsumerBaseV2Plus, IVRFMigratableConsumerV2Plus} from "../VRFConsumerBaseV2Plus.sol"; import {ChainSpecificUtil} from "../../../shared/util/ChainSpecificUtil.sol"; +import {VRFTypes} from "../../VRFTypes.sol"; +import {BlockhashStoreInterface} from "../../interfaces/BlockhashStoreInterface.sol"; + import {SubscriptionAPI} from "../SubscriptionAPI.sol"; -import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; +import {IVRFMigratableConsumerV2Plus, VRFConsumerBaseV2Plus} from "../VRFConsumerBaseV2Plus.sol"; + import {IVRFCoordinatorV2PlusMigration} from "../interfaces/IVRFCoordinatorV2PlusMigration.sol"; +import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; +import {VRFOld} from "./VRFOld.sol"; // solhint-disable-next-line no-unused-import import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; @@ -26,6 +28,7 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; // upper bound limit for premium percentages to make sure fee calculations don't overflow uint8 private constant PREMIUM_PERCENTAGE_MAX = 155; + error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); error NumWordsTooBig(uint32 have, uint32 want); @@ -50,6 +53,7 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu mapping(bytes32 => ProvingKey) /* keyHash */ /* provingKey */ public s_provingKeys; bytes32[] public s_provingKeyHashes; mapping(uint256 => bytes32) /* requestID */ /* commitment */ public s_requestCommitments; + event ProvingKeyRegistered(bytes32 keyHash, uint64 maxGas); event ProvingKeyDeregistered(bytes32 keyHash, uint64 maxGas); @@ -91,7 +95,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu event FallbackWeiPerUnitLinkUsed(uint256 requestId, int256 fallbackWeiPerUnitLink); - constructor(address blockhashStore) SubscriptionAPI() { + constructor( + address blockhashStore + ) SubscriptionAPI() { BLOCKHASH_STORE = BlockhashStoreInterface(blockhashStore); } @@ -113,7 +119,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu * @notice Deregisters a proving key. * @param publicProvingKey key that oracle can use to submit vrf fulfillments */ - function deregisterProvingKey(uint256[2] calldata publicProvingKey) external onlyOwner { + function deregisterProvingKey( + uint256[2] calldata publicProvingKey + ) external onlyOwner { bytes32 kh = hashOfKey(publicProvingKey); ProvingKey memory key = s_provingKeys[kh]; if (!key.exists) { @@ -136,7 +144,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu * @notice Returns the proving key hash key associated with this public key * @param publicKey the key to return the hash of */ - function hashOfKey(uint256[2] memory publicKey) public pure returns (bytes32) { + function hashOfKey( + uint256[2] memory publicKey + ) public pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -165,9 +175,7 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu ) external onlyOwner { if (minimumRequestConfirmations > MAX_REQUEST_CONFIRMATIONS) { revert InvalidRequestConfirmations( - minimumRequestConfirmations, - minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + minimumRequestConfirmations, minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } if (fallbackWeiPerUnitLink <= 0) { @@ -210,7 +218,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu /// @dev Convert the extra args bytes into a struct /// @param extraArgs The extra args bytes /// @return The extra args struct - function _fromBytes(bytes calldata extraArgs) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { if (extraArgs.length == 0) { return VRFV2PlusClient.ExtraArgsV1({nativePayment: false}); } @@ -261,13 +271,11 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu } // Input validation using the config storage word. if ( - req.requestConfirmations < s_config.minimumRequestConfirmations || - req.requestConfirmations > MAX_REQUEST_CONFIRMATIONS + req.requestConfirmations < s_config.minimumRequestConfirmations + || req.requestConfirmations > MAX_REQUEST_CONFIRMATIONS ) { revert InvalidRequestConfirmations( - req.requestConfirmations, - s_config.minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + req.requestConfirmations, s_config.minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } // No lower bound on the requested gas limit. A user could request 0 @@ -339,19 +347,13 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) @@ -381,8 +383,10 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu revert NoCorrespondingRequest(); } if ( - commitment != - keccak256(abi.encode(requestId, rc.blockNum, rc.subId, rc.callbackGasLimit, rc.numWords, rc.sender, rc.extraArgs)) + commitment + != keccak256( + abi.encode(requestId, rc.blockNum, rc.subId, rc.callbackGasLimit, rc.numWords, rc.sender, rc.extraArgs) + ) ) { revert IncorrectCommitment(); } @@ -581,12 +585,12 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu // Will return non-zero on chains that have this enabled uint256 l1CostWei = ChainSpecificUtil._getCurrentTxL1GasFees(msg.data); // (1e18 juels/link) ((wei/gas * gas) + l1wei) / (wei/link) = juels - uint256 paymentNoFee = (1e18 * - (weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei)) / - uint256(weiPerUnitLink); + uint256 paymentNoFee = ( + 1e18 * (weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei) + ) / uint256(weiPerUnitLink); // calculate the flat fee in wei - uint256 flatFeeWei = 1e12 * - uint256(s_config.fulfillmentFlatFeeNativePPM - s_config.fulfillmentFlatFeeLinkDiscountPPM); + uint256 flatFeeWei = + 1e12 * uint256(s_config.fulfillmentFlatFeeNativePPM - s_config.fulfillmentFlatFeeLinkDiscountPPM); uint256 flatFeeJuels = (1e18 * flatFeeWei) / uint256(weiPerUnitLink); uint256 payment; if (onlyPremium) { @@ -603,7 +607,7 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu function _getFeedData() private view returns (int256 weiPerUnitLink, bool isFeedStale) { uint32 stalenessSeconds = s_config.stalenessSeconds; uint256 timestamp; - (, weiPerUnitLink, , timestamp, ) = LINK_NATIVE_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_NATIVE_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time isFeedStale = stalenessSeconds > 0 && stalenessSeconds < block.timestamp - timestamp; if (isFeedStale) { @@ -615,7 +619,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu /** * @inheritdoc IVRFSubscriptionV2Plus */ - function pendingRequestExists(uint256 subId) public view override returns (bool) { + function pendingRequestExists( + uint256 subId + ) public view override returns (bool) { address[] storage consumers = s_subscriptionConfigs[subId].consumers; uint256 consumersLength = consumers.length; if (consumersLength == 0) { @@ -666,10 +672,11 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu _cancelSubscriptionHelper(subId, to); } - /*************************************************************************** + /** + * * Section: Migration - ***************************************************************************/ - + * + */ address[] internal s_migrationTargets; /// @dev Emitted when new coordinator is registered as migratable target @@ -700,7 +707,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu uint96 nativeBalance; } - function _isTargetRegistered(address target) internal view returns (bool) { + function _isTargetRegistered( + address target + ) internal view returns (bool) { uint256 migrationTargetsLength = s_migrationTargets.length; for (uint256 i = 0; i < migrationTargetsLength; ++i) { if (s_migrationTargets[i] == target) { @@ -710,7 +719,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu return false; } - function registerMigratableCoordinator(address target) external onlyOwner { + function registerMigratableCoordinator( + address target + ) external onlyOwner { if (_isTargetRegistered(target)) { revert CoordinatorAlreadyRegistered(target); } @@ -718,7 +729,9 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu emit CoordinatorRegistered(target); } - function deregisterMigratableCoordinator(address target) external onlyOwner { + function deregisterMigratableCoordinator( + address target + ) external onlyOwner { uint256 nTargets = s_migrationTargets.length; for (uint256 i = 0; i < nTargets; ++i) { if (s_migrationTargets[i] == target) { @@ -735,7 +748,7 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu if (!_isTargetRegistered(newCoordinator)) { revert CoordinatorNotRegistered(newCoordinator); } - (uint96 balance, uint96 nativeBalance, , address subOwner, address[] memory consumers) = getSubscription(subId); + (uint96 balance, uint96 nativeBalance,, address subOwner, address[] memory consumers) = getSubscription(subId); // solhint-disable-next-line gas-custom-errors require(subOwner == msg.sender, "Not subscription owner"); // solhint-disable-next-line gas-custom-errors diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol index 977c31527e..645765426a 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol @@ -3,14 +3,16 @@ pragma solidity 0.8.19; import {BlockhashStoreInterface} from "../../interfaces/BlockhashStoreInterface.sol"; // solhint-disable-next-line no-unused-import -import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; + +import {ChainSpecificUtil} from "../../../shared/util/ChainSpecificUtil.sol"; import {VRF} from "../../../vrf/VRF.sol"; import {VRFTypes} from "../../VRFTypes.sol"; -import {VRFConsumerBaseV2Plus, IVRFMigratableConsumerV2Plus} from "../VRFConsumerBaseV2Plus.sol"; -import {ChainSpecificUtil} from "../../../shared/util/ChainSpecificUtil.sol"; import {SubscriptionAPI} from "../SubscriptionAPI.sol"; -import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; +import {IVRFMigratableConsumerV2Plus, VRFConsumerBaseV2Plus} from "../VRFConsumerBaseV2Plus.sol"; +import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; + import {IVRFCoordinatorV2PlusMigration} from "../interfaces/IVRFCoordinatorV2PlusMigration.sol"; +import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; contract VRFCoordinatorV2PlusUpgradedVersion is @@ -22,6 +24,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is using EnumerableSet for EnumerableSet.UintSet; /// @dev should always be available // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i + BlockhashStoreInterface public immutable BLOCKHASH_STORE; // Set this maximum to 200 to give us a 56 block window to fulfill @@ -33,6 +36,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; // upper bound limit for premium percentages to make sure fee calculations don't overflow uint8 private constant PREMIUM_PERCENTAGE_MAX = 155; + error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); error NumWordsTooBig(uint32 have, uint32 want); @@ -62,6 +66,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is mapping(bytes32 => ProvingKey) /* keyHash */ /* provingKey */ public s_provingKeys; bytes32[] public s_provingKeyHashes; mapping(uint256 => bytes32) /* requestID */ /* commitment */ public s_requestCommitments; + event ProvingKeyRegistered(bytes32 keyHash, uint64 maxGas); event RandomWordsRequested( @@ -102,7 +107,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is event FallbackWeiPerUnitLinkUsed(uint256 requestId, int256 fallbackWeiPerUnitLink); - constructor(address blockhashStore) SubscriptionAPI() { + constructor( + address blockhashStore + ) SubscriptionAPI() { BLOCKHASH_STORE = BlockhashStoreInterface(blockhashStore); } @@ -124,7 +131,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is * @notice Returns the proving key hash key associated with this public key * @param publicKey the key to return the hash of */ - function hashOfKey(uint256[2] memory publicKey) public pure returns (bytes32) { + function hashOfKey( + uint256[2] memory publicKey + ) public pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -153,9 +162,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is ) external onlyOwner { if (minimumRequestConfirmations > MAX_REQUEST_CONFIRMATIONS) { revert InvalidRequestConfirmations( - minimumRequestConfirmations, - minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + minimumRequestConfirmations, minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } if (fallbackWeiPerUnitLink <= 0) { @@ -208,7 +215,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is /// @dev Convert the extra args bytes into a struct /// @param extraArgs The extra args bytes /// @return The extra args struct - function _fromBytes(bytes calldata extraArgs) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { if (extraArgs.length == 0) { return VRFV2PlusClient.ExtraArgsV1({nativePayment: false}); } @@ -259,13 +268,11 @@ contract VRFCoordinatorV2PlusUpgradedVersion is } // Input validation using the config storage word. if ( - req.requestConfirmations < s_config.minimumRequestConfirmations || - req.requestConfirmations > MAX_REQUEST_CONFIRMATIONS + req.requestConfirmations < s_config.minimumRequestConfirmations + || req.requestConfirmations > MAX_REQUEST_CONFIRMATIONS ) { revert InvalidRequestConfirmations( - req.requestConfirmations, - s_config.minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + req.requestConfirmations, s_config.minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } // No lower bound on the requested gas limit. A user could request 0 @@ -337,19 +344,13 @@ contract VRFCoordinatorV2PlusUpgradedVersion is // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) @@ -379,8 +380,10 @@ contract VRFCoordinatorV2PlusUpgradedVersion is revert NoCorrespondingRequest(); } if ( - commitment != - keccak256(abi.encode(requestId, rc.blockNum, rc.subId, rc.callbackGasLimit, rc.numWords, rc.sender, rc.extraArgs)) + commitment + != keccak256( + abi.encode(requestId, rc.blockNum, rc.subId, rc.callbackGasLimit, rc.numWords, rc.sender, rc.extraArgs) + ) ) { revert IncorrectCommitment(); } @@ -579,12 +582,12 @@ contract VRFCoordinatorV2PlusUpgradedVersion is // Will return non-zero on chains that have this enabled uint256 l1CostWei = ChainSpecificUtil._getCurrentTxL1GasFees(msg.data); // (1e18 juels/link) ((wei/gas * gas) + l1wei) / (wei/link) = juels - uint256 paymentNoFee = (1e18 * - (weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei)) / - uint256(weiPerUnitLink); + uint256 paymentNoFee = ( + 1e18 * (weiPerUnitGas * (s_config.gasAfterPaymentCalculation + startGas - gasleft()) + l1CostWei) + ) / uint256(weiPerUnitLink); // calculate the flat fee in wei - uint256 flatFeeWei = 1e12 * - uint256(s_config.fulfillmentFlatFeeNativePPM - s_config.fulfillmentFlatFeeLinkDiscountPPM); + uint256 flatFeeWei = + 1e12 * uint256(s_config.fulfillmentFlatFeeNativePPM - s_config.fulfillmentFlatFeeLinkDiscountPPM); uint256 flatFeeJuels = (1e18 * flatFeeWei) / uint256(weiPerUnitLink); uint256 payment; if (onlyPremium) { @@ -601,7 +604,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is function _getFeedData() private view returns (int256 weiPerUnitLink, bool isFeedStale) { uint32 stalenessSeconds = s_config.stalenessSeconds; uint256 timestamp; - (, weiPerUnitLink, , timestamp, ) = LINK_NATIVE_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_NATIVE_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time isFeedStale = stalenessSeconds > 0 && stalenessSeconds < block.timestamp - timestamp; if (isFeedStale) { @@ -613,7 +616,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is /** * @inheritdoc IVRFSubscriptionV2Plus */ - function pendingRequestExists(uint256 subId) public view override returns (bool) { + function pendingRequestExists( + uint256 subId + ) public view override returns (bool) { address[] storage consumers = s_subscriptionConfigs[subId].consumers; uint256 consumersLength = consumers.length; if (consumersLength == 0) { @@ -664,10 +669,11 @@ contract VRFCoordinatorV2PlusUpgradedVersion is _cancelSubscriptionHelper(subId, to); } - /*************************************************************************** + /** + * * Section: Migration - ***************************************************************************/ - + * + */ address[] internal s_migrationTargets; /// @dev Emitted when new coordinator is registered as migratable target @@ -695,7 +701,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is uint96 nativeBalance; } - function _isTargetRegistered(address target) internal view returns (bool) { + function _isTargetRegistered( + address target + ) internal view returns (bool) { uint256 migrationTargetsLength = s_migrationTargets.length; for (uint256 i = 0; i < migrationTargetsLength; ++i) { if (s_migrationTargets[i] == target) { @@ -705,7 +713,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is return false; } - function registerMigratableCoordinator(address target) external onlyOwner { + function registerMigratableCoordinator( + address target + ) external onlyOwner { if (_isTargetRegistered(target)) { revert CoordinatorAlreadyRegistered(target); } @@ -717,7 +727,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is if (!_isTargetRegistered(newCoordinator)) { revert CoordinatorNotRegistered(newCoordinator); } - (uint96 balance, uint96 nativeBalance, , address subOwner, address[] memory consumers) = getSubscription(subId); + (uint96 balance, uint96 nativeBalance,, address subOwner, address[] memory consumers) = getSubscription(subId); // solhint-disable-next-line gas-custom-errors require(subOwner == msg.sender, "Not subscription owner"); // solhint-disable-next-line gas-custom-errors @@ -759,7 +769,9 @@ contract VRFCoordinatorV2PlusUpgradedVersion is /** * @inheritdoc IVRFCoordinatorV2PlusMigration */ - function onMigration(bytes calldata encodedData) external payable override { + function onMigration( + bytes calldata encodedData + ) external payable override { V1MigrationData memory migrationData = abi.decode(encodedData, (V1MigrationData)); if (migrationData.fromVersion != 1) { @@ -783,18 +795,12 @@ contract VRFCoordinatorV2PlusUpgradedVersion is } for (uint256 i = 0; i < migrationData.consumers.length; i++) { - s_consumers[migrationData.consumers[i]][migrationData.subId] = ConsumerConfig({ - active: true, - nonce: 0, - pendingReqCount: 0 - }); + s_consumers[migrationData.consumers[i]][migrationData.subId] = + ConsumerConfig({active: true, nonce: 0, pendingReqCount: 0}); } - s_subscriptions[migrationData.subId] = Subscription({ - nativeBalance: migrationData.nativeBalance, - balance: migrationData.linkBalance, - reqCount: 0 - }); + s_subscriptions[migrationData.subId] = + Subscription({nativeBalance: migrationData.nativeBalance, balance: migrationData.linkBalance, reqCount: 0}); s_subscriptionConfigs[migrationData.subId] = SubscriptionConfig({ owner: migrationData.subOwner, consumers: migrationData.consumers, diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol index 712092a198..97a1f7a1f6 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import {IVRFCoordinatorV2PlusMigration} from "../interfaces/IVRFCoordinatorV2PlusMigration.sol"; import {VRFConsumerBaseV2Plus} from "../VRFConsumerBaseV2Plus.sol"; +import {IVRFCoordinatorV2PlusMigration} from "../interfaces/IVRFCoordinatorV2PlusMigration.sol"; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; /// @dev this contract is only meant for testing migration @@ -35,9 +35,11 @@ contract VRFCoordinatorV2Plus_V2Example is IVRFCoordinatorV2PlusMigration { s_prevCoordinator = prevCoordinator; } - /*************************************************************************** + /** + * * Section: Subscription - **************************************************************************/ + * + */ /// @dev Emitted when a subscription for a given ID cannot be found error InvalidSubscription(); @@ -61,9 +63,11 @@ contract VRFCoordinatorV2Plus_V2Example is IVRFCoordinatorV2PlusMigration { ); } - /*************************************************************************** + /** + * * Section: Migration - **************************************************************************/ + * + */ /// @notice emitted when caller is not a previous version of VRF coordinator /// @param sender caller @@ -90,7 +94,9 @@ contract VRFCoordinatorV2Plus_V2Example is IVRFCoordinatorV2PlusMigration { /** * @inheritdoc IVRFCoordinatorV2PlusMigration */ - function onMigration(bytes calldata encodedData) external payable override { + function onMigration( + bytes calldata encodedData + ) external payable override { if (msg.sender != s_prevCoordinator) { revert MustBePreviousCoordinator(msg.sender, s_prevCoordinator); } @@ -128,30 +134,39 @@ contract VRFCoordinatorV2Plus_V2Example is IVRFCoordinatorV2PlusMigration { s_totalLinkBalance += migrationData.linkBalance; } - /*************************************************************************** + /** + * * Section: Request/Response - **************************************************************************/ - - function requestRandomWords(VRFV2PlusClient.RandomWordsRequest calldata req) external returns (uint256 requestId) { + * + */ + function requestRandomWords( + VRFV2PlusClient.RandomWordsRequest calldata req + ) external returns (uint256 requestId) { Subscription memory sub = s_subscriptions[req.subId]; sub.reqCount = sub.reqCount + 1; return _handleRequest(msg.sender); } - function _handleRequest(address requester) private returns (uint256) { + function _handleRequest( + address requester + ) private returns (uint256) { s_requestId = s_requestId + 1; uint256 requestId = s_requestId; s_requestConsumerMapping[s_requestId] = requester; return requestId; } - function generateFakeRandomness(uint256 requestID) public pure returns (uint256[] memory) { + function generateFakeRandomness( + uint256 requestID + ) public pure returns (uint256[] memory) { uint256[] memory randomness = new uint256[](1); randomness[0] = uint256(keccak256(abi.encode(requestID, "not random"))); return randomness; } - function fulfillRandomWords(uint256 requestId) external { + function fulfillRandomWords( + uint256 requestId + ) external { VRFConsumerBaseV2Plus consumer = VRFConsumerBaseV2Plus(s_requestConsumerMapping[requestId]); consumer.rawFulfillRandomWords(requestId, generateFakeRandomness(requestId)); } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol index f638b9744e..c243f05d8f 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol @@ -35,7 +35,9 @@ contract VRFMaliciousConsumerV2Plus is VRFConsumerBaseV2Plus { s_vrfCoordinator.requestRandomWords(req); } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = s_vrfCoordinator.createSubscription(); s_vrfCoordinator.addConsumer(s_subId, address(this)); @@ -44,7 +46,9 @@ contract VRFMaliciousConsumerV2Plus is VRFConsumerBaseV2Plus { LINKTOKEN.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { @@ -52,7 +56,9 @@ contract VRFMaliciousConsumerV2Plus is VRFConsumerBaseV2Plus { } } - function requestRandomness(bytes32 keyHash) external returns (uint256) { + function requestRandomness( + bytes32 keyHash + ) external returns (uint256) { s_keyHash = keyHash; VRFV2PlusClient.RandomWordsRequest memory req = VRFV2PlusClient.RandomWordsRequest({ keyHash: keyHash, diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFOld.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFOld.sol index 137235fd0a..6f238ddf48 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFOld.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFOld.sol @@ -1,143 +1,144 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -/** **************************************************************************** - * @notice Verification of verifiable-random-function (VRF) proofs, following - * @notice https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 - * @notice See https://eprint.iacr.org/2017/099.pdf for security proofs. - - * @dev Bibliographic references: - - * @dev Goldberg, et al., "Verifiable Random Functions (VRFs)", Internet Draft - * @dev draft-irtf-cfrg-vrf-05, IETF, Aug 11 2019, - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05 - - * @dev Papadopoulos, et al., "Making NSEC5 Practical for DNSSEC", Cryptology - * @dev ePrint Archive, Report 2017/099, https://eprint.iacr.org/2017/099.pdf - * **************************************************************************** - * @dev USAGE - - * @dev The main entry point is _randomValueFromVRFProof. See its docstring. - * **************************************************************************** - * @dev PURPOSE - - * @dev Reggie the Random Oracle (not his real job) wants to provide randomness - * @dev to Vera the verifier in such a way that Vera can be sure he's not - * @dev making his output up to suit himself. Reggie provides Vera a public key - * @dev to which he knows the secret key. Each time Vera provides a seed to - * @dev Reggie, he gives back a value which is computed completely - * @dev deterministically from the seed and the secret key. - - * @dev Reggie provides a proof by which Vera can verify that the output was - * @dev correctly computed once Reggie tells it to her, but without that proof, - * @dev the output is computationally indistinguishable to her from a uniform - * @dev random sample from the output space. - - * @dev The purpose of this contract is to perform that verification. - * **************************************************************************** - * @dev DESIGN NOTES - - * @dev The VRF algorithm verified here satisfies the full uniqueness, full - * @dev collision resistance, and full pseudo-randomness security properties. - * @dev See "SECURITY PROPERTIES" below, and - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-3 - - * @dev An elliptic curve point is generally represented in the solidity code - * @dev as a uint256[2], corresponding to its affine coordinates in - * @dev GF(FIELD_SIZE). - - * @dev For the sake of efficiency, this implementation deviates from the spec - * @dev in some minor ways: - - * @dev - Keccak hash rather than the SHA256 hash recommended in - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 - * @dev Keccak costs much less gas on the EVM, and provides similar security. - - * @dev - Secp256k1 curve instead of the P-256 or ED25519 curves recommended in - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 - * @dev For curve-point multiplication, it's much cheaper to abuse ECRECOVER - - * @dev - _hashToCurve recursively hashes until it finds a curve x-ordinate. On - * @dev the EVM, this is slightly more efficient than the recommendation in - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.1.1 - * @dev step 5, to concatenate with a nonce then hash, and rehash with the - * @dev nonce updated until a valid x-ordinate is found. - - * @dev - _hashToCurve does not include a cipher version string or the byte 0x1 - * @dev in the hash message, as recommended in step 5.B of the draft - * @dev standard. They are unnecessary here because no variation in the - * @dev cipher suite is allowed. - - * @dev - Similarly, the hash input in _scalarFromCurvePoints does not include a - * @dev commitment to the cipher suite, either, which differs from step 2 of - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.3 - * @dev . Also, the hash input is the concatenation of the uncompressed - * @dev points, not the compressed points as recommended in step 3. - - * @dev - In the calculation of the challenge value "c", the "u" value (i.e. - * @dev the value computed by Reggie as the nonce times the secp256k1 - * @dev generator point, see steps 5 and 7 of - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 - * @dev ) is replaced by its ethereum address, i.e. the lower 160 bits of the - * @dev keccak hash of the original u. This is because we only verify the - * @dev calculation of u up to its address, by abusing ECRECOVER. - * **************************************************************************** - * @dev SECURITY PROPERTIES - - * @dev Here are the security properties for this VRF: - - * @dev Full uniqueness: For any seed and valid VRF public key, there is - * @dev exactly one VRF output which can be proved to come from that seed, in - * @dev the sense that the proof will pass _verifyVRFProof. - - * @dev Full collision resistance: It's cryptographically infeasible to find - * @dev two seeds with same VRF output from a fixed, valid VRF key - - * @dev Full pseudorandomness: Absent the proofs that the VRF outputs are - * @dev derived from a given seed, the outputs are computationally - * @dev indistinguishable from randomness. - - * @dev https://eprint.iacr.org/2017/099.pdf, Appendix B contains the proofs - * @dev for these properties. - - * @dev For secp256k1, the key validation described in section - * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.6 - * @dev is unnecessary, because secp256k1 has cofactor 1, and the - * @dev representation of the public key used here (affine x- and y-ordinates - * @dev of the secp256k1 point on the standard y^2=x^3+7 curve) cannot refer to - * @dev the point at infinity. - * **************************************************************************** - * @dev OTHER SECURITY CONSIDERATIONS - * - * @dev The seed input to the VRF could in principle force an arbitrary amount - * @dev of work in _hashToCurve, by requiring extra rounds of hashing and - * @dev checking whether that's yielded the x ordinate of a secp256k1 point. - * @dev However, under the Random Oracle Model the probability of choosing a - * @dev point which forces n extra rounds in _hashToCurve is 2⁻ⁿ. The base cost - * @dev for calling _hashToCurve is about 25,000 gas, and each round of checking - * @dev for a valid x ordinate costs about 15,555 gas, so to find a seed for - * @dev which _hashToCurve would cost more than 2,017,000 gas, one would have to - * @dev try, in expectation, about 2¹²⁸ seeds, which is infeasible for any - * @dev foreseeable computational resources. (25,000 + 128 * 15,555 < 2,017,000.) - - * @dev Since the gas block limit for the Ethereum main net is 10,000,000 gas, - * @dev this means it is infeasible for an adversary to prevent correct - * @dev operation of this contract by choosing an adverse seed. - - * @dev (See TestMeasureHashToCurveGasCost for verification of the gas cost for - * @dev _hashToCurve.) - - * @dev It may be possible to make a secure constant-time _hashToCurve function. - * @dev See notes in _hashToCurve docstring. -*/ +/** + * + * @notice Verification of verifiable-random-function (VRF) proofs, following + * @notice https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 + * @notice See https://eprint.iacr.org/2017/099.pdf for security proofs. + * + * @dev Bibliographic references: + * + * @dev Goldberg, et al., "Verifiable Random Functions (VRFs)", Internet Draft + * @dev draft-irtf-cfrg-vrf-05, IETF, Aug 11 2019, + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05 + * + * @dev Papadopoulos, et al., "Making NSEC5 Practical for DNSSEC", Cryptology + * @dev ePrint Archive, Report 2017/099, https://eprint.iacr.org/2017/099.pdf + * **************************************************************************** + * @dev USAGE + * + * @dev The main entry point is _randomValueFromVRFProof. See its docstring. + * **************************************************************************** + * @dev PURPOSE + * + * @dev Reggie the Random Oracle (not his real job) wants to provide randomness + * @dev to Vera the verifier in such a way that Vera can be sure he's not + * @dev making his output up to suit himself. Reggie provides Vera a public key + * @dev to which he knows the secret key. Each time Vera provides a seed to + * @dev Reggie, he gives back a value which is computed completely + * @dev deterministically from the seed and the secret key. + * + * @dev Reggie provides a proof by which Vera can verify that the output was + * @dev correctly computed once Reggie tells it to her, but without that proof, + * @dev the output is computationally indistinguishable to her from a uniform + * @dev random sample from the output space. + * + * @dev The purpose of this contract is to perform that verification. + * **************************************************************************** + * @dev DESIGN NOTES + * + * @dev The VRF algorithm verified here satisfies the full uniqueness, full + * @dev collision resistance, and full pseudo-randomness security properties. + * @dev See "SECURITY PROPERTIES" below, and + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-3 + * + * @dev An elliptic curve point is generally represented in the solidity code + * @dev as a uint256[2], corresponding to its affine coordinates in + * @dev GF(FIELD_SIZE). + * + * @dev For the sake of efficiency, this implementation deviates from the spec + * @dev in some minor ways: + * + * @dev - Keccak hash rather than the SHA256 hash recommended in + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 + * @dev Keccak costs much less gas on the EVM, and provides similar security. + * + * @dev - Secp256k1 curve instead of the P-256 or ED25519 curves recommended in + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 + * @dev For curve-point multiplication, it's much cheaper to abuse ECRECOVER + * + * @dev - _hashToCurve recursively hashes until it finds a curve x-ordinate. On + * @dev the EVM, this is slightly more efficient than the recommendation in + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.1.1 + * @dev step 5, to concatenate with a nonce then hash, and rehash with the + * @dev nonce updated until a valid x-ordinate is found. + * + * @dev - _hashToCurve does not include a cipher version string or the byte 0x1 + * @dev in the hash message, as recommended in step 5.B of the draft + * @dev standard. They are unnecessary here because no variation in the + * @dev cipher suite is allowed. + * + * @dev - Similarly, the hash input in _scalarFromCurvePoints does not include a + * @dev commitment to the cipher suite, either, which differs from step 2 of + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.4.3 + * @dev . Also, the hash input is the concatenation of the uncompressed + * @dev points, not the compressed points as recommended in step 3. + * + * @dev - In the calculation of the challenge value "c", the "u" value (i.e. + * @dev the value computed by Reggie as the nonce times the secp256k1 + * @dev generator point, see steps 5 and 7 of + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.3 + * @dev ) is replaced by its ethereum address, i.e. the lower 160 bits of the + * @dev keccak hash of the original u. This is because we only verify the + * @dev calculation of u up to its address, by abusing ECRECOVER. + * **************************************************************************** + * @dev SECURITY PROPERTIES + * + * @dev Here are the security properties for this VRF: + * + * @dev Full uniqueness: For any seed and valid VRF public key, there is + * @dev exactly one VRF output which can be proved to come from that seed, in + * @dev the sense that the proof will pass _verifyVRFProof. + * + * @dev Full collision resistance: It's cryptographically infeasible to find + * @dev two seeds with same VRF output from a fixed, valid VRF key + * + * @dev Full pseudorandomness: Absent the proofs that the VRF outputs are + * @dev derived from a given seed, the outputs are computationally + * @dev indistinguishable from randomness. + * + * @dev https://eprint.iacr.org/2017/099.pdf, Appendix B contains the proofs + * @dev for these properties. + * + * @dev For secp256k1, the key validation described in section + * @dev https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.6 + * @dev is unnecessary, because secp256k1 has cofactor 1, and the + * @dev representation of the public key used here (affine x- and y-ordinates + * @dev of the secp256k1 point on the standard y^2=x^3+7 curve) cannot refer to + * @dev the point at infinity. + * **************************************************************************** + * @dev OTHER SECURITY CONSIDERATIONS + * + * @dev The seed input to the VRF could in principle force an arbitrary amount + * @dev of work in _hashToCurve, by requiring extra rounds of hashing and + * @dev checking whether that's yielded the x ordinate of a secp256k1 point. + * @dev However, under the Random Oracle Model the probability of choosing a + * @dev point which forces n extra rounds in _hashToCurve is 2⁻ⁿ. The base cost + * @dev for calling _hashToCurve is about 25,000 gas, and each round of checking + * @dev for a valid x ordinate costs about 15,555 gas, so to find a seed for + * @dev which _hashToCurve would cost more than 2,017,000 gas, one would have to + * @dev try, in expectation, about 2¹²⁸ seeds, which is infeasible for any + * @dev foreseeable computational resources. (25,000 + 128 * 15,555 < 2,017,000.) + * + * @dev Since the gas block limit for the Ethereum main net is 10,000,000 gas, + * @dev this means it is infeasible for an adversary to prevent correct + * @dev operation of this contract by choosing an adverse seed. + * + * @dev (See TestMeasureHashToCurveGasCost for verification of the gas cost for + * @dev _hashToCurve.) + * + * @dev It may be possible to make a secure constant-time _hashToCurve function. + * @dev See notes in _hashToCurve docstring. + */ contract VRFOld { // See https://www.secg.org/sec2-v2.pdf, section 2.4.1, for these constants. // Number of points in Secp256k1 uint256 private constant GROUP_ORDER = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141; // Prime characteristic of the galois field over which Secp256k1 is defined uint256 private constant FIELD_SIZE = - // solium-disable-next-line indentation - 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; + // solium-disable-next-line indentation + 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F; uint256 private constant WORD_LENGTH_BYTES = 0x20; // (base^exponent) % FIELD_SIZE @@ -153,14 +154,15 @@ contract VRFOld { bigModExpContractInputs[5] = FIELD_SIZE; uint256[1] memory output; assembly { - callResult := staticcall( - not(0), // Gas cost: no limit - 0x05, // Bigmodexp contract address - bigModExpContractInputs, - 0xc0, // Length of input segment: 6*0x20-bytes - output, - 0x20 // Length of output segment - ) + callResult := + staticcall( + not(0), // Gas cost: no limit + 0x05, // Bigmodexp contract address + bigModExpContractInputs, + 0xc0, // Length of input segment: 6*0x20-bytes + output, + 0x20 // Length of output segment + ) } if (callResult == 0) { // solhint-disable-next-line gas-custom-errors @@ -174,19 +176,25 @@ contract VRFOld { uint256 private constant SQRT_POWER = (FIELD_SIZE + 1) >> 2; // Computes a s.t. a^2 = x in the field. Assumes a exists - function _squareRoot(uint256 x) internal view returns (uint256) { + function _squareRoot( + uint256 x + ) internal view returns (uint256) { return _bigModExp(x, SQRT_POWER); } // The value of y^2 given that (x,y) is on secp256k1. - function _ySquared(uint256 x) internal pure returns (uint256) { + function _ySquared( + uint256 x + ) internal pure returns (uint256) { // Curve is y^2=x^3+7. See section 2.4.1 of https://www.secg.org/sec2-v2.pdf uint256 xCubed = mulmod(x, mulmod(x, x, FIELD_SIZE), FIELD_SIZE); return addmod(xCubed, 7, FIELD_SIZE); } // True iff p is on secp256k1 - function _isOnCurve(uint256[2] memory p) internal pure returns (bool) { + function _isOnCurve( + uint256[2] memory p + ) internal pure returns (bool) { // Section 2.3.6. in https://www.secg.org/sec1-v2.pdf // requires each ordinate to be in [0, ..., FIELD_SIZE-1] // solhint-disable-next-line gas-custom-errors @@ -197,7 +205,9 @@ contract VRFOld { } // Hash x uniformly into {0, ..., FIELD_SIZE-1}. - function _fieldHash(bytes memory b) internal pure returns (uint256 x_) { + function _fieldHash( + bytes memory b + ) internal pure returns (uint256 x_) { x_ = uint256(keccak256(b)); // Rejecting if x >= FIELD_SIZE corresponds to step 2.1 in section 2.3.4 of // http://www.secg.org/sec1-v2.pdf , which is part of the definition of @@ -214,7 +224,9 @@ contract VRFOld { // step 5.C, which references arbitrary_string_to_point, defined in // https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-vrf-05#section-5.5 as // returning the point with given x ordinate, and even y ordinate. - function _newCandidateSecp256k1Point(bytes memory b) internal view returns (uint256[2] memory p) { + function _newCandidateSecp256k1Point( + bytes memory b + ) internal view returns (uint256[2] memory p) { unchecked { p[0] = _fieldHash(b); p[1] = _squareRoot(_ySquared(p[0])); @@ -253,7 +265,8 @@ contract VRFOld { return rv; } - /** ********************************************************************* + /** + * * @notice Check that product==scalar*multiplicand * * @dev Based on Vitalik Buterin's idea in ethresear.ch post cited below. @@ -311,38 +324,39 @@ contract VRFOld { return (x3, z3); } - /** ************************************************************************** - @notice Computes elliptic-curve sum, in projective co-ordinates - - @dev Using projective coordinates avoids costly divisions - - @dev To use this with p and q in affine coordinates, call - @dev _projectiveECAdd(px, py, qx, qy). This will return - @dev the addition of (px, py, 1) and (qx, qy, 1), in the - @dev secp256k1 group. - - @dev This can be used to calculate the z which is the inverse to zInv - @dev in isValidVRFOutput. But consider using a faster - @dev re-implementation such as ProjectiveECAdd in the golang vrf package. - - @dev This function assumes [px,py,1],[qx,qy,1] are valid projective - coordinates of secp256k1 points. That is safe in this contract, - because this method is only used by _linearCombination, which checks - points are on the curve via ecrecover. - ************************************************************************** - @param px The first affine coordinate of the first summand - @param py The second affine coordinate of the first summand - @param qx The first affine coordinate of the second summand - @param qy The second affine coordinate of the second summand - - (px,py) and (qx,qy) must be distinct, valid secp256k1 points. - ************************************************************************** - Return values are projective coordinates of [px,py,1]+[qx,qy,1] as points - on secp256k1, in P²(𝔽ₙ) - @return sx - @return sy - @return sz - */ + /** + * + * @notice Computes elliptic-curve sum, in projective co-ordinates + * + * @dev Using projective coordinates avoids costly divisions + * + * @dev To use this with p and q in affine coordinates, call + * @dev _projectiveECAdd(px, py, qx, qy). This will return + * @dev the addition of (px, py, 1) and (qx, qy, 1), in the + * @dev secp256k1 group. + * + * @dev This can be used to calculate the z which is the inverse to zInv + * @dev in isValidVRFOutput. But consider using a faster + * @dev re-implementation such as ProjectiveECAdd in the golang vrf package. + * + * @dev This function assumes [px,py,1],[qx,qy,1] are valid projective + * coordinates of secp256k1 points. That is safe in this contract, + * because this method is only used by _linearCombination, which checks + * points are on the curve via ecrecover. + * + * @param px The first affine coordinate of the first summand + * @param py The second affine coordinate of the first summand + * @param qx The first affine coordinate of the second summand + * @param qy The second affine coordinate of the second summand + * + * (px,py) and (qx,qy) must be distinct, valid secp256k1 points. + * + * Return values are projective coordinates of [px,py,1]+[qx,qy,1] as points + * on secp256k1, in P²(𝔽ₙ) + * @return sx + * @return sy + * @return sz + */ function _projectiveECAdd( uint256 px, uint256 py, @@ -572,15 +586,7 @@ contract VRFOld { */ function _randomValueFromVRFProof(Proof memory proof, uint256 seed) internal view returns (uint256 output) { _verifyVRFProof( - proof.pk, - proof.gamma, - proof.c, - proof.s, - seed, - proof.uWitness, - proof.cGammaWitness, - proof.sHashWitness, - proof.zInv + proof.pk, proof.gamma, proof.c, proof.s, seed, proof.uWitness, proof.cGammaWitness, proof.sHashWitness, proof.zInv ); output = uint256(keccak256(abi.encode(VRF_RANDOM_OUTPUT_HASH_PREFIX, proof.gamma))); return output; diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusConsumerExample.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusConsumerExample.sol index d142f505f2..f9ff436b75 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusConsumerExample.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusConsumerExample.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; import {LinkTokenInterface} from "../../../shared/interfaces/LinkTokenInterface.sol"; -import {IVRFCoordinatorV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; import {VRFConsumerBaseV2Plus} from "../VRFConsumerBaseV2Plus.sol"; -import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; +import {IVRFCoordinatorV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; + import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; /// @notice This contract is used for testing only and should not be used for production. @@ -20,6 +21,7 @@ contract VRFV2PlusConsumerExample is ConfirmedOwner, VRFConsumerBaseV2Plus { uint256 requestId; uint256[] randomWords; } + mapping(uint256 /* request id */ => Response /* response */) public s_requests; constructor(address vrfCoordinator, address link) VRFConsumerBaseV2Plus(vrfCoordinator) { @@ -47,13 +49,17 @@ contract VRFV2PlusConsumerExample is ConfirmedOwner, VRFConsumerBaseV2Plus { s_vrfCoordinatorApiV1.fundSubscriptionWithNative{value: msg.value}(s_subId); } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { _subscribe(); // Approve the link transfer. s_linkToken.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "sub not set"); s_linkToken.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_subId)); @@ -89,17 +95,15 @@ contract VRFV2PlusConsumerExample is ConfirmedOwner, VRFConsumerBaseV2Plus { extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: nativePayment})) }); uint256 requestId = s_vrfCoordinator.requestRandomWords(req); - Response memory resp = Response({ - requestId: requestId, - randomWords: new uint256[](0), - fulfilled: false, - requester: msg.sender - }); + Response memory resp = + Response({requestId: requestId, randomWords: new uint256[](0), fulfilled: false, requester: msg.sender}); s_requests[requestId] = resp; s_recentRequestId = requestId; } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { @@ -107,7 +111,9 @@ contract VRFV2PlusConsumerExample is ConfirmedOwner, VRFConsumerBaseV2Plus { } } - function setSubId(uint256 subId) external { + function setSubId( + uint256 subId + ) external { s_subId = subId; } } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol index f70c0331cd..756f84fbc0 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol @@ -34,7 +34,9 @@ contract VRFV2PlusLoadTestWithMetrics is VRFConsumerBaseV2Plus { mapping(uint256 => RequestStatus) /* requestId */ /* requestStatus */ public s_requests; - constructor(address _vrfCoordinator) VRFConsumerBaseV2Plus(_vrfCoordinator) {} + constructor( + address _vrfCoordinator + ) VRFConsumerBaseV2Plus(_vrfCoordinator) {} // solhint-disable-next-line chainlink-solidity/prefix-internal-functions-with-underscore function fulfillRandomWords(uint256 _requestId, uint256[] calldata _randomWords) internal override { @@ -43,27 +45,20 @@ contract VRFV2PlusLoadTestWithMetrics is VRFConsumerBaseV2Plus { s_requests[_requestId].fulfilmentTimestamp = block.timestamp; s_requests[_requestId].fulfilmentBlockNumber = ChainSpecificUtil._getBlockNumber(); - uint256 responseTimeInBlocks = s_requests[_requestId].fulfilmentBlockNumber - - s_requests[_requestId].requestBlockNumber; - uint256 responseTimeInSeconds = s_requests[_requestId].fulfilmentTimestamp - - s_requests[_requestId].requestTimestamp; + uint256 responseTimeInBlocks = + s_requests[_requestId].fulfilmentBlockNumber - s_requests[_requestId].requestBlockNumber; + uint256 responseTimeInSeconds = s_requests[_requestId].fulfilmentTimestamp - s_requests[_requestId].requestTimestamp; - ( - s_slowestResponseTimeInBlocks, - s_fastestResponseTimeInBlocks, - s_averageResponseTimeInBlocksMillions - ) = _calculateMetrics( + (s_slowestResponseTimeInBlocks, s_fastestResponseTimeInBlocks, s_averageResponseTimeInBlocksMillions) = + _calculateMetrics( responseTimeInBlocks, s_fastestResponseTimeInBlocks, s_slowestResponseTimeInBlocks, s_averageResponseTimeInBlocksMillions, s_responseCount ); - ( - s_slowestResponseTimeInSeconds, - s_fastestResponseTimeInSeconds, - s_averageResponseTimeInSecondsMillions - ) = _calculateMetrics( + (s_slowestResponseTimeInSeconds, s_fastestResponseTimeInSeconds, s_averageResponseTimeInSecondsMillions) = + _calculateMetrics( responseTimeInSeconds, s_fastestResponseTimeInSeconds, s_slowestResponseTimeInSeconds, diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusMaliciousMigrator.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusMaliciousMigrator.sol index 16797bb939..3e4303df46 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusMaliciousMigrator.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusMaliciousMigrator.sol @@ -1,21 +1,25 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; -import {IVRFMigratableConsumerV2Plus} from "../interfaces/IVRFMigratableConsumerV2Plus.sol"; import {IVRFCoordinatorV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; +import {IVRFMigratableConsumerV2Plus} from "../interfaces/IVRFMigratableConsumerV2Plus.sol"; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; contract VRFV2PlusMaliciousMigrator is IVRFMigratableConsumerV2Plus { IVRFCoordinatorV2Plus internal s_vrfCoordinator; - constructor(address _vrfCoordinator) { + constructor( + address _vrfCoordinator + ) { s_vrfCoordinator = IVRFCoordinatorV2Plus(_vrfCoordinator); } /** * @inheritdoc IVRFMigratableConsumerV2Plus */ - function setCoordinator(address /* _vrfCoordinator */) public override { + function setCoordinator( + address /* _vrfCoordinator */ + ) public override { // try to re-enter, should revert // args don't really matter s_vrfCoordinator.requestRandomWords( diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusRevertingExample.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusRevertingExample.sol index e52369b5c7..43c3167450 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusRevertingExample.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusRevertingExample.sol @@ -24,7 +24,9 @@ contract VRFV2PlusRevertingExample is VRFConsumerBaseV2Plus { revert(); } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = s_vrfCoordinator.createSubscription(); s_vrfCoordinator.addConsumer(s_subId, address(this)); @@ -33,14 +35,18 @@ contract VRFV2PlusRevertingExample is VRFConsumerBaseV2Plus { LINKTOKEN.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "sub not set"); // Approve the link transfer. LINKTOKEN.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusSingleConsumerExample.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusSingleConsumerExample.sol index 2ae45db9c4..ac32f0ce1b 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusSingleConsumerExample.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusSingleConsumerExample.sol @@ -20,6 +20,7 @@ contract VRFV2PlusSingleConsumerExample is VRFConsumerBaseV2Plus { bytes32 keyHash; bool nativePayment; } + RequestConfig public s_requestConfig; uint256[] public s_randomWords; uint256 public s_requestId; @@ -73,7 +74,9 @@ contract VRFV2PlusSingleConsumerExample is VRFConsumerBaseV2Plus { // This method is analogous to VRFv1, except the amount // should be selected based on the keyHash (each keyHash functions like a "gas lane" // with different link costs). - function fundAndRequestRandomWords(uint256 amount) external onlyOwner { + function fundAndRequestRandomWords( + uint256 amount + ) external onlyOwner { RequestConfig memory rc = s_requestConfig; LINKTOKEN.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_requestConfig.subId)); VRFV2PlusClient.RandomWordsRequest memory req = VRFV2PlusClient.RandomWordsRequest({ @@ -89,7 +92,9 @@ contract VRFV2PlusSingleConsumerExample is VRFConsumerBaseV2Plus { } // Assumes this contract owns link - function topUpSubscription(uint256 amount) external onlyOwner { + function topUpSubscription( + uint256 amount + ) external onlyOwner { LINKTOKEN.transferAndCall(address(s_vrfCoordinator), amount, abi.encode(s_requestConfig.subId)); } @@ -97,7 +102,9 @@ contract VRFV2PlusSingleConsumerExample is VRFConsumerBaseV2Plus { LINKTOKEN.transfer(to, amount); } - function unsubscribe(address to) external onlyOwner { + function unsubscribe( + address to + ) external onlyOwner { // Returns funds to this address s_vrfCoordinator.cancelSubscription(s_requestConfig.subId, to); s_requestConfig.subId = 0; diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol index 9510b1ba0e..11167e2254 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {VRFV2PlusWrapperConsumerBase} from "../VRFV2PlusWrapperConsumerBase.sol"; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; +import {VRFV2PlusWrapperConsumerBase} from "../VRFV2PlusWrapperConsumerBase.sol"; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; contract VRFV2PlusWrapperConsumerExample is VRFV2PlusWrapperConsumerBase, ConfirmedOwner { @@ -19,7 +19,9 @@ contract VRFV2PlusWrapperConsumerExample is VRFV2PlusWrapperConsumerBase, Confir mapping(uint256 => RequestStatus) /* requestId */ /* requestStatus */ public s_requests; - constructor(address _vrfV2Wrapper) ConfirmedOwner(msg.sender) VRFV2PlusWrapperConsumerBase(_vrfV2Wrapper) {} + constructor( + address _vrfV2Wrapper + ) ConfirmedOwner(msg.sender) VRFV2PlusWrapperConsumerBase(_vrfV2Wrapper) {} function makeRequest( uint32 _callbackGasLimit, @@ -67,14 +69,18 @@ contract VRFV2PlusWrapperConsumerExample is VRFV2PlusWrapperConsumerBase, Confir /// @notice withdrawLink withdraws the amount specified in amount to the owner /// @param amount the amount to withdraw, in juels - function withdrawLink(uint256 amount) external onlyOwner { + function withdrawLink( + uint256 amount + ) external onlyOwner { i_linkToken.transfer(owner(), amount); } /// @notice withdrawNative withdraws the amount specified in amount to the owner /// @param amount the amount to withdraw, in wei - function withdrawNative(uint256 amount) external onlyOwner { - (bool success, ) = payable(owner()).call{value: amount}(""); + function withdrawNative( + uint256 amount + ) external onlyOwner { + (bool success,) = payable(owner()).call{value: amount}(""); // solhint-disable-next-line gas-custom-errors require(success, "withdrawNative failed"); } diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperLoadTestConsumer.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperLoadTestConsumer.sol index ae76fed365..5094b8f3dd 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperLoadTestConsumer.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFV2PlusWrapperLoadTestConsumer.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {VRFV2PlusWrapperConsumerBase} from "../VRFV2PlusWrapperConsumerBase.sol"; import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; import {ChainSpecificUtil} from "../../../shared/util/ChainSpecificUtil.sol"; +import {VRFV2PlusWrapperConsumerBase} from "../VRFV2PlusWrapperConsumerBase.sol"; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; contract VRFV2PlusWrapperLoadTestConsumer is VRFV2PlusWrapperConsumerBase, ConfirmedOwner { @@ -34,7 +34,9 @@ contract VRFV2PlusWrapperLoadTestConsumer is VRFV2PlusWrapperConsumerBase, Confi mapping(uint256 => RequestStatus) /* requestId */ /* requestStatus */ public s_requests; - constructor(address _vrfV2PlusWrapper) ConfirmedOwner(msg.sender) VRFV2PlusWrapperConsumerBase(_vrfV2PlusWrapper) {} + constructor( + address _vrfV2PlusWrapper + ) ConfirmedOwner(msg.sender) VRFV2PlusWrapperConsumerBase(_vrfV2PlusWrapper) {} function makeRequests( uint32 _callbackGasLimit, @@ -44,12 +46,8 @@ contract VRFV2PlusWrapperLoadTestConsumer is VRFV2PlusWrapperConsumerBase, Confi ) external { for (uint16 i = 0; i < _requestCount; i++) { bytes memory extraArgs = VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})); - (uint256 requestId, uint256 paid) = requestRandomness( - _callbackGasLimit, - _requestConfirmations, - _numWords, - extraArgs - ); + (uint256 requestId, uint256 paid) = + requestRandomness(_callbackGasLimit, _requestConfirmations, _numWords, extraArgs); s_lastRequestId = requestId; uint256 requestBlockNumber = ChainSpecificUtil._getBlockNumber(); @@ -77,12 +75,8 @@ contract VRFV2PlusWrapperLoadTestConsumer is VRFV2PlusWrapperConsumerBase, Confi ) external { for (uint16 i = 0; i < _requestCount; i++) { bytes memory extraArgs = VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true})); - (uint256 requestId, uint256 paid) = requestRandomnessPayInNative( - _callbackGasLimit, - _requestConfirmations, - _numWords, - extraArgs - ); + (uint256 requestId, uint256 paid) = + requestRandomnessPayInNative(_callbackGasLimit, _requestConfirmations, _numWords, extraArgs); s_lastRequestId = requestId; uint256 requestBlockNumber = ChainSpecificUtil._getBlockNumber(); @@ -183,14 +177,18 @@ contract VRFV2PlusWrapperLoadTestConsumer is VRFV2PlusWrapperConsumerBase, Confi /// @notice withdrawLink withdraws the amount specified in amount to the owner /// @param amount the amount to withdraw, in juels - function withdrawLink(uint256 amount) external onlyOwner { + function withdrawLink( + uint256 amount + ) external onlyOwner { i_linkToken.transfer(owner(), amount); } /// @notice withdrawNative withdraws the amount specified in amount to the owner /// @param amount the amount to withdraw, in wei - function withdrawNative(uint256 amount) external onlyOwner { - (bool success, ) = payable(owner()).call{value: amount}(""); + function withdrawNative( + uint256 amount + ) external onlyOwner { + (bool success,) = payable(owner()).call{value: amount}(""); // solhint-disable-next-line gas-custom-errors require(success, "withdrawNative failed"); } diff --git a/contracts/src/v0.8/vrf/interfaces/BlockhashStoreInterface.sol b/contracts/src/v0.8/vrf/interfaces/BlockhashStoreInterface.sol index 6a42b5b964..091bf419c6 100644 --- a/contracts/src/v0.8/vrf/interfaces/BlockhashStoreInterface.sol +++ b/contracts/src/v0.8/vrf/interfaces/BlockhashStoreInterface.sol @@ -3,5 +3,7 @@ pragma solidity ^0.8.0; // solhint-disable-next-line interface-starts-with-i interface BlockhashStoreInterface { - function getBlockhash(uint256 number) external view returns (bytes32); + function getBlockhash( + uint256 number + ) external view returns (bytes32); } diff --git a/contracts/src/v0.8/vrf/interfaces/IAuthorizedReceiver.sol b/contracts/src/v0.8/vrf/interfaces/IAuthorizedReceiver.sol index 78140d5868..1a050c54b4 100644 --- a/contracts/src/v0.8/vrf/interfaces/IAuthorizedReceiver.sol +++ b/contracts/src/v0.8/vrf/interfaces/IAuthorizedReceiver.sol @@ -2,9 +2,13 @@ pragma solidity ^0.8.0; interface IAuthorizedReceiver { - function isAuthorizedSender(address sender) external view returns (bool); + function isAuthorizedSender( + address sender + ) external view returns (bool); function getAuthorizedSenders() external returns (address[] memory); - function setAuthorizedSenders(address[] calldata senders) external; + function setAuthorizedSenders( + address[] calldata senders + ) external; } diff --git a/contracts/src/v0.8/vrf/interfaces/VRFCoordinatorV2Interface.sol b/contracts/src/v0.8/vrf/interfaces/VRFCoordinatorV2Interface.sol index 3cb9934d5c..4513546b97 100644 --- a/contracts/src/v0.8/vrf/interfaces/VRFCoordinatorV2Interface.sol +++ b/contracts/src/v0.8/vrf/interfaces/VRFCoordinatorV2Interface.sol @@ -79,7 +79,9 @@ interface VRFCoordinatorV2Interface { * @dev will revert if original owner of subId has * not requested that msg.sender become the new owner. */ - function acceptSubscriptionOwnerTransfer(uint64 subId) external; + function acceptSubscriptionOwnerTransfer( + uint64 subId + ) external; /** * @notice Add a consumer to a VRF subscription. @@ -109,5 +111,7 @@ interface VRFCoordinatorV2Interface { * @return true if there exists at least one unfulfilled request for the subscription, false * otherwise. */ - function pendingRequestExists(uint64 subId) external view returns (bool); + function pendingRequestExists( + uint64 subId + ) external view returns (bool); } diff --git a/contracts/src/v0.8/vrf/interfaces/VRFV2WrapperInterface.sol b/contracts/src/v0.8/vrf/interfaces/VRFV2WrapperInterface.sol index daac158668..96fdb8cb55 100644 --- a/contracts/src/v0.8/vrf/interfaces/VRFV2WrapperInterface.sol +++ b/contracts/src/v0.8/vrf/interfaces/VRFV2WrapperInterface.sol @@ -18,7 +18,9 @@ interface VRFV2WrapperInterface { * * @param _callbackGasLimit is the gas limit used to estimate the price. */ - function calculateRequestPrice(uint32 _callbackGasLimit) external view returns (uint256); + function calculateRequestPrice( + uint32 _callbackGasLimit + ) external view returns (uint256); /** * @notice Estimates the price of a VRF request with a specific gas limit and gas price. diff --git a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol index e192f749ab..e3a2267952 100644 --- a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol +++ b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol @@ -11,7 +11,9 @@ contract VRFCoordinatorMock { event RandomnessRequest(address indexed sender, bytes32 indexed keyHash, uint256 indexed seed, uint256 fee); - constructor(address linkAddress) { + constructor( + address linkAddress + ) { LINK = LinkTokenInterface(linkAddress); } @@ -26,7 +28,7 @@ contract VRFCoordinatorMock { uint256 b = 206000; require(gasleft() >= b, "not enough gas for consumer"); // solhint-disable-next-line avoid-low-level-calls, no-unused-vars - (bool success, ) = consumerContract.call(resp); + (bool success,) = consumerContract.call(resp); } modifier onlyLINK() { diff --git a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol index 9617b76426..f244296901 100644 --- a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol +++ b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol @@ -2,9 +2,9 @@ // A mock for testing code that relies on VRFCoordinatorV2. pragma solidity ^0.8.4; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; -import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; // solhint-disable chainlink-solidity/prefix-immutable-variables-with-i // solhint-disable gas-custom-errors @@ -45,14 +45,17 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { // Reentrancy protection. bool reentrancyLock; } + Config private s_config; uint64 internal s_currentSubId; uint256 internal s_nextRequestId = 1; uint256 internal s_nextPreSeed = 100; + struct Subscription { address owner; uint96 balance; } + mapping(uint64 => Subscription) internal s_subscriptions; /* subId */ /* subscription */ mapping(uint64 => address[]) internal s_consumers; /* subId */ /* consumers */ @@ -61,6 +64,7 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { uint32 callbackGasLimit; uint32 numWords; } + mapping(uint256 => Request) internal s_requests; /* requestId */ /* request */ constructor(uint96 _baseFee, uint96 _gasPriceLink) ConfirmedOwner(msg.sender) { @@ -135,7 +139,7 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { VRFConsumerBaseV2 v; bytes memory callReq = abi.encodeWithSelector(v.rawFulfillRandomWords.selector, _requestId, _words); s_config.reentrancyLock = true; - (bool success, ) = _consumer.call{gas: req.callbackGasLimit}(callReq); + (bool success,) = _consumer.call{gas: req.callbackGasLimit}(callReq); s_config.reentrancyLock = false; uint96 payment = uint96(BASE_FEE + ((startGas - gasleft()) * GAS_PRICE_LINK)); @@ -179,14 +183,7 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { s_requests[requestId] = Request({subId: _subId, callbackGasLimit: _callbackGasLimit, numWords: _numWords}); emit RandomWordsRequested( - _keyHash, - requestId, - preSeed, - _subId, - _minimumRequestConfirmations, - _callbackGasLimit, - _numWords, - msg.sender + _keyHash, requestId, preSeed, _subId, _minimumRequestConfirmations, _callbackGasLimit, _numWords, msg.sender ); return requestId; } @@ -212,7 +209,9 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { delete (s_subscriptions[_subId]); } - modifier onlySubOwner(uint64 _subId) { + modifier onlySubOwner( + uint64 _subId + ) { address owner = s_subscriptions[_subId].owner; if (owner == address(0)) { revert InvalidSubscription(); @@ -309,15 +308,19 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { return 4000000000000000; // 0.004 Ether } - function requestSubscriptionOwnerTransfer(uint64 /*_subId*/, address /*_newOwner*/) external pure override { + function requestSubscriptionOwnerTransfer(uint64, /*_subId*/ address /*_newOwner*/ ) external pure override { revert("not implemented"); } - function acceptSubscriptionOwnerTransfer(uint64 /*_subId*/) external pure override { + function acceptSubscriptionOwnerTransfer( + uint64 /*_subId*/ + ) external pure override { revert("not implemented"); } - function pendingRequestExists(uint64 /*subId*/) public pure override returns (bool) { + function pendingRequestExists( + uint64 /*subId*/ + ) public pure override returns (bool) { revert("not implemented"); } } diff --git a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol index 823cd43dc8..8502a72adf 100644 --- a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol +++ b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol @@ -3,10 +3,11 @@ pragma solidity ^0.8.19; // solhint-disable-next-line no-unused-import -import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../dev/interfaces/IVRFCoordinatorV2Plus.sol"; -import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; + import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; import {VRFConsumerBaseV2Plus} from "../dev/VRFConsumerBaseV2Plus.sol"; +import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../dev/interfaces/IVRFCoordinatorV2Plus.sol"; +import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; contract VRFCoordinatorV2_5Mock is SubscriptionAPI, IVRFCoordinatorV2Plus { uint96 public immutable i_base_fee; @@ -50,6 +51,7 @@ contract VRFCoordinatorV2_5Mock is SubscriptionAPI, IVRFCoordinatorV2Plus { uint32 numWords; bytes extraArgs; } + mapping(uint256 => Request) internal s_requests; /* requestId */ /* request */ constructor(uint96 _baseFee, uint96 _gasPrice, int256 _weiPerUnitLink) SubscriptionAPI() { @@ -130,7 +132,7 @@ contract VRFCoordinatorV2_5Mock is SubscriptionAPI, IVRFCoordinatorV2Plus { bytes memory callReq = abi.encodeWithSelector(v.rawFulfillRandomWords.selector, _requestId, _words); s_config.reentrancyLock = true; // solhint-disable-next-line avoid-low-level-calls, no-unused-vars - (bool success, ) = _consumer.call{gas: req.callbackGasLimit}(callReq); + (bool success,) = _consumer.call{gas: req.callbackGasLimit}(callReq); s_config.reentrancyLock = false; bool nativePayment = uint8(req.extraArgs[req.extraArgs.length - 1]) == 1; @@ -185,7 +187,9 @@ contract VRFCoordinatorV2_5Mock is SubscriptionAPI, IVRFCoordinatorV2Plus { /// @dev Convert the extra args bytes into a struct /// @param extraArgs The extra args bytes /// @return The extra args struct - function _fromBytes(bytes calldata extraArgs) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { + function _fromBytes( + bytes calldata extraArgs + ) internal pure returns (VRFV2PlusClient.ExtraArgsV1 memory) { if (extraArgs.length == 0) { return VRFV2PlusClient.ExtraArgsV1({nativePayment: false}); } @@ -256,14 +260,16 @@ contract VRFCoordinatorV2_5Mock is SubscriptionAPI, IVRFCoordinatorV2Plus { function cancelSubscription(uint256 _subId, address _to) external override onlySubOwner(_subId) nonReentrant { (uint96 balance, uint96 nativeBalance) = _deleteSubscription(_subId); - (bool success, ) = _to.call{value: uint256(nativeBalance)}(""); + (bool success,) = _to.call{value: uint256(nativeBalance)}(""); if (!success) { revert FailedToSendNative(); } emit SubscriptionCanceled(_subId, _to, balance, nativeBalance); } - function pendingRequestExists(uint256 /*subId*/) public pure override returns (bool) { + function pendingRequestExists( + uint256 /*subId*/ + ) public pure override returns (bool) { revert NotImplemented(); } } diff --git a/contracts/src/v0.8/vrf/test/BaseTest.t.sol b/contracts/src/v0.8/vrf/test/BaseTest.t.sol index 1ae2869b24..375f620b81 100644 --- a/contracts/src/v0.8/vrf/test/BaseTest.t.sol +++ b/contracts/src/v0.8/vrf/test/BaseTest.t.sol @@ -15,10 +15,12 @@ contract BaseTest is Test { vm.startPrank(OWNER); } - function getRandomAddresses(uint256 length) internal returns (address[] memory) { + function getRandomAddresses( + uint256 length + ) internal returns (address[] memory) { address[] memory addresses = new address[](length); for (uint256 i = 0; i < length; ++i) { - addresses[i] = address(uint160(uint(keccak256(abi.encodePacked(i))))); + addresses[i] = address(uint160(uint256(keccak256(abi.encodePacked(i))))); } return addresses; } diff --git a/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol b/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol index 4197073aa5..eca494faa4 100644 --- a/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol +++ b/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol @@ -1,13 +1,14 @@ pragma solidity 0.8.19; -import {console} from "forge-std/console.sol"; import {VRF} from "../VRF.sol"; import {VRFTypes} from "../VRFTypes.sol"; import {BatchVRFCoordinatorV2Plus} from "../dev/BatchVRFCoordinatorV2Plus.sol"; -import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; + import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; +import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; import "./BaseTest.t.sol"; import {FixtureVRFCoordinatorV2_5} from "./FixtureVRFCoordinatorV2_5.t.sol"; +import {console} from "forge-std/console.sol"; contract BatchVRFCoordinatorV2PlusTest is FixtureVRFCoordinatorV2_5 { BatchVRFCoordinatorV2Plus private s_batchCoordinator; @@ -105,10 +106,8 @@ contract BatchVRFCoordinatorV2PlusTest is FixtureVRFCoordinatorV2_5 { extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true})) }); - VRFCoordinatorV2_5.Output memory output = s_coordinator.getRandomnessFromProofExternal( - abi.decode(abi.encode(proofs[0]), (VRF.Proof)), - rcs[0] - ); + VRFCoordinatorV2_5.Output memory output = + s_coordinator.getRandomnessFromProofExternal(abi.decode(abi.encode(proofs[0]), (VRF.Proof)), rcs[0]); requestBlock = 20; vm.roll(requestBlock); @@ -178,10 +177,8 @@ contract BatchVRFCoordinatorV2PlusTest is FixtureVRFCoordinatorV2_5 { extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})) }); - VRFCoordinatorV2_5.Output memory output1 = s_coordinator.getRandomnessFromProofExternal( - abi.decode(abi.encode(proofs[1]), (VRF.Proof)), - rcs[1] - ); + VRFCoordinatorV2_5.Output memory output1 = + s_coordinator.getRandomnessFromProofExternal(abi.decode(abi.encode(proofs[1]), (VRF.Proof)), rcs[1]); // The payments are NOT pre-calculated and simply copied from the actual event. // We can assert and ignore the payment field but the code will be considerably longer. diff --git a/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol b/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol index 3e81dd2d3c..a0024ac17c 100644 --- a/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol +++ b/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol @@ -1,11 +1,12 @@ pragma solidity 0.8.6; -import "./BaseTest.t.sol"; import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; +import "./BaseTest.t.sol"; -import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import {OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; contract ChainSpecificUtilTest is BaseTest { // ------------ Start Arbitrum Constants ------------ @@ -59,9 +60,7 @@ contract ChainSpecificUtilTest is BaseTest { bytes32 expectedBlockHash = expectedBlockHashes[i]; uint256 expectedBlockNumber = expectedBlockNumbers[i]; vm.mockCall( - ARBSYS_ADDR, - abi.encodeWithSelector(ArbSys.arbBlockNumber.selector), - abi.encode(expectedBlockNumber + 1) + ARBSYS_ADDR, abi.encodeWithSelector(ArbSys.arbBlockNumber.selector), abi.encode(expectedBlockNumber + 1) ); vm.mockCall( ARBSYS_ADDR, @@ -104,9 +103,7 @@ contract ChainSpecificUtilTest is BaseTest { vm.chainId(chainIds[i]); uint256 expectedGasFee = expectedGasFees[i]; vm.mockCall( - ARBGAS_ADDR, - abi.encodeWithSelector(ArbGasInfo.getCurrentTxL1GasFees.selector), - abi.encode(expectedGasFee) + ARBGAS_ADDR, abi.encodeWithSelector(ArbGasInfo.getCurrentTxL1GasFees.selector), abi.encode(expectedGasFee) ); uint256 actualGasFee = ChainSpecificUtil._getCurrentTxL1GasFees(""); assertEq(expectedGasFee, actualGasFee, "incorrect gas fees"); @@ -115,13 +112,8 @@ contract ChainSpecificUtilTest is BaseTest { function testGetCurrentTxL1GasFeesOptimism() public { // set optimism chain id - uint256[5] memory chainIds = [ - OP_MAINNET_CHAIN_ID, - OP_GOERLI_CHAIN_ID, - OP_SEPOLIA_CHAIN_ID, - BASE_MAINNET_CHAIN_ID, - BASE_GOERLI_CHAIN_ID - ]; + uint256[5] memory chainIds = + [OP_MAINNET_CHAIN_ID, OP_GOERLI_CHAIN_ID, OP_SEPOLIA_CHAIN_ID, BASE_MAINNET_CHAIN_ID, BASE_GOERLI_CHAIN_ID]; uint256[5] memory expectedGasFees = [uint256(10 gwei), 12 gwei, 14 gwei, 16 gwei, 18 gwei]; for (uint256 i = 0; i < chainIds.length; i++) { vm.chainId(chainIds[i]); @@ -142,9 +134,7 @@ contract ChainSpecificUtilTest is BaseTest { for (uint256 i = 0; i < chainIds.length; i++) { vm.chainId(chainIds[i]); vm.mockCall( - ARBGAS_ADDR, - abi.encodeWithSelector(ArbGasInfo.getPricesInWei.selector), - abi.encode(0, 10, 0, 0, 0, 0) + ARBGAS_ADDR, abi.encodeWithSelector(ArbGasInfo.getPricesInWei.selector), abi.encode(0, 10, 0, 0, 0, 0) ); // fee = l1PricePerByte * (calldataSizeBytes + 140) @@ -155,13 +145,8 @@ contract ChainSpecificUtilTest is BaseTest { } function testGetL1CalldataGasCostOptimism() public { - uint256[5] memory chainIds = [ - OP_MAINNET_CHAIN_ID, - OP_GOERLI_CHAIN_ID, - OP_SEPOLIA_CHAIN_ID, - BASE_MAINNET_CHAIN_ID, - BASE_GOERLI_CHAIN_ID - ]; + uint256[5] memory chainIds = + [OP_MAINNET_CHAIN_ID, OP_GOERLI_CHAIN_ID, OP_SEPOLIA_CHAIN_ID, BASE_MAINNET_CHAIN_ID, BASE_GOERLI_CHAIN_ID]; for (uint256 i = 0; i < chainIds.length; i++) { vm.chainId(chainIds[i]); vm.mockCall( diff --git a/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol b/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol index bcbcefdb5c..dbec2296d1 100644 --- a/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol +++ b/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol @@ -1,16 +1,16 @@ pragma solidity ^0.8.19; -import {console} from "forge-std/console.sol"; -import "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; +import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; +import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; import {VRF} from "../VRF.sol"; import {VRFTypes} from "../VRFTypes.sol"; import {BlockhashStore} from "../dev/BlockhashStore.sol"; import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; import {VRFV2PlusConsumerExample} from "../dev/testhelpers/VRFV2PlusConsumerExample.sol"; -import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; -import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; import "./BaseTest.t.sol"; +import "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; +import {console} from "forge-std/console.sol"; contract FixtureVRFCoordinatorV2_5 is BaseTest, VRF { address internal SUBSCRIPTION_OWNER = makeAddr("SUBSCRIPTION_OWNER"); @@ -95,7 +95,9 @@ contract FixtureVRFCoordinatorV2_5 is BaseTest, VRF { // note: Call this function via this.getProvingKeyParts to be able to pass memory as calldata and // index over the byte array. - function _getProvingKeyParts(bytes calldata uncompressedKey) public pure returns (uint256[2] memory) { + function _getProvingKeyParts( + bytes calldata uncompressedKey + ) public pure returns (uint256[2] memory) { uint256 keyPart1 = uint256(bytes32(uncompressedKey[0:32])); uint256 keyPart2 = uint256(bytes32(uncompressedKey[32:64])); return [keyPart1, keyPart2]; diff --git a/contracts/src/v0.8/vrf/test/TrustedBlockhashStore.t.sol b/contracts/src/v0.8/vrf/test/TrustedBlockhashStore.t.sol index ec47f4815d..e95d5c01c7 100644 --- a/contracts/src/v0.8/vrf/test/TrustedBlockhashStore.t.sol +++ b/contracts/src/v0.8/vrf/test/TrustedBlockhashStore.t.sol @@ -1,7 +1,7 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; import {TrustedBlockhashStore} from "../dev/TrustedBlockhashStore.sol"; +import "./BaseTest.t.sol"; import {console} from "forge-std/console.sol"; contract TrustedBlockhashStoreTest is BaseTest { diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol index c0c0a2a2f5..3b08e6c589 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol @@ -1,11 +1,11 @@ pragma solidity 0.8.6; -import "./BaseTest.t.sol"; -import {VRF} from "../VRF.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; +import {VRF} from "../VRF.sol"; import {VRFCoordinatorV2Mock} from "../mocks/VRFCoordinatorV2Mock.sol"; import {VRFConsumerV2} from "../testhelpers/VRFConsumerV2.sol"; +import "./BaseTest.t.sol"; contract VRFCoordinatorV2MockTest is BaseTest { MockLinkToken internal s_linkToken; @@ -82,8 +82,8 @@ contract VRFCoordinatorV2MockTest is BaseTest { uint64 subId = s_vrfCoordinatorV2Mock.createSubscription(); assertEq(subId, 1); - (uint96 balance, uint64 reqCount, address owner, address[] memory consumers) = s_vrfCoordinatorV2Mock - .getSubscription(subId); + (uint96 balance, uint64 reqCount, address owner, address[] memory consumers) = + s_vrfCoordinatorV2Mock.getSubscription(subId); assertEq(balance, 0); assertEq(reqCount, 0); assertEq(owner, s_subOwner); @@ -105,8 +105,8 @@ contract VRFCoordinatorV2MockTest is BaseTest { emit ConsumerAdded(subId, address(s_vrfConsumerV2)); s_vrfCoordinatorV2Mock.addConsumer(subId, address(s_vrfConsumerV2)); - (uint96 balance, uint64 reqCount, address owner, address[] memory consumers) = s_vrfCoordinatorV2Mock - .getSubscription(subId); + (uint96 balance, uint64 reqCount, address owner, address[] memory consumers) = + s_vrfCoordinatorV2Mock.getSubscription(subId); assertEq(balance, 0); assertEq(reqCount, 0); assertEq(owner, s_subOwner); @@ -146,7 +146,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { s_vrfCoordinatorV2Mock.addConsumer(subId, address(s_vrfConsumerV2)); - (, , , address[] memory consumers) = s_vrfCoordinatorV2Mock.getSubscription(subId); + (,,, address[] memory consumers) = s_vrfCoordinatorV2Mock.getSubscription(subId); assertEq(consumers.length, 1); assertEq(consumers[0], address(s_vrfConsumerV2)); @@ -173,7 +173,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { s_vrfCoordinatorV2Mock.addConsumer(subId, address(s_vrfConsumerV2)); - (, , , address[] memory consumers) = s_vrfCoordinatorV2Mock.getSubscription(subId); + (,,, address[] memory consumers) = s_vrfCoordinatorV2Mock.getSubscription(subId); assertEq(consumers.length, 1); assertEq(consumers[0], address(s_vrfConsumerV2)); @@ -197,7 +197,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { emit SubscriptionFunded(subId, 0, oneLink); s_vrfCoordinatorV2Mock.fundSubscription(subId, oneLink); - (uint96 balance, , , address[] memory consumers) = s_vrfCoordinatorV2Mock.getSubscription(subId); + (uint96 balance,,, address[] memory consumers) = s_vrfCoordinatorV2Mock.getSubscription(subId); assertEq(balance, oneLink); assertEq(consumers.length, 0); vm.stopPrank(); @@ -243,11 +243,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { bytes4 reason = bytes4(keccak256("InvalidConsumer()")); vm.expectRevert(toBytes(reason)); s_vrfCoordinatorV2Mock.requestRandomWords( - KEY_HASH, - subId, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_CALLBACK_GAS_LIMIT, - DEFAULT_NUM_WORDS + KEY_HASH, subId, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_CALLBACK_GAS_LIMIT, DEFAULT_NUM_WORDS ); vm.stopPrank(); } @@ -276,11 +272,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { address(s_subOwner) ); uint256 reqId = s_vrfCoordinatorV2Mock.requestRandomWords( - KEY_HASH, - subId, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_CALLBACK_GAS_LIMIT, - DEFAULT_NUM_WORDS + KEY_HASH, subId, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_CALLBACK_GAS_LIMIT, DEFAULT_NUM_WORDS ); bytes4 reason = bytes4(keccak256("InsufficientBalance()")); @@ -312,11 +304,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { address(s_subOwner) ); uint256 reqId = s_vrfConsumerV2.requestRandomness( - KEY_HASH, - subId, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_CALLBACK_GAS_LIMIT, - DEFAULT_NUM_WORDS + KEY_HASH, subId, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_CALLBACK_GAS_LIMIT, DEFAULT_NUM_WORDS ); vm.expectEmit(true, false, false, true); @@ -338,22 +326,10 @@ contract VRFCoordinatorV2MockTest is BaseTest { vm.expectEmit(true, false, false, true); emit RandomWordsRequested( - KEY_HASH, - 1, - 100, - subId, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_CALLBACK_GAS_LIMIT, - 2, - address(s_subOwner) - ); - uint256 reqId = s_vrfConsumerV2.requestRandomness( - KEY_HASH, - subId, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_CALLBACK_GAS_LIMIT, - 2 + KEY_HASH, 1, 100, subId, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_CALLBACK_GAS_LIMIT, 2, address(s_subOwner) ); + uint256 reqId = + s_vrfConsumerV2.requestRandomness(KEY_HASH, subId, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_CALLBACK_GAS_LIMIT, 2); bytes4 reason = bytes4(keccak256("InvalidRandomWords()")); vm.expectRevert(toBytes(reason)); @@ -375,7 +351,9 @@ contract VRFCoordinatorV2MockTest is BaseTest { vm.stopPrank(); } - function toBytes(bytes4 _data) public pure returns (bytes memory) { + function toBytes( + bytes4 _data + ) public pure returns (bytes memory) { return abi.encodePacked(_data); } } diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol index 2d12f5ec82..f7e495e043 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol @@ -1,14 +1,15 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; -import {VRFCoordinatorV2Plus_V2Example} from "../dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol"; -import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; -import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; -import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; -import {VRFV2PlusConsumerExample} from "../dev/testhelpers/VRFV2PlusConsumerExample.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; +import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; +import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; +import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; +import {VRFCoordinatorV2Plus_V2Example} from "../dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol"; + +import {VRFV2PlusConsumerExample} from "../dev/testhelpers/VRFV2PlusConsumerExample.sol"; import {VRFV2PlusMaliciousMigrator} from "../dev/testhelpers/VRFV2PlusMaliciousMigrator.sol"; +import "./BaseTest.t.sol"; contract VRFCoordinatorV2Plus_Migration is BaseTest { uint256 internal constant DEFAULT_LINK_FUNDING = 10 ether; // 10 LINK @@ -157,8 +158,8 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { v1Coordinator.addConsumer(subId, address(testConsumer)); // subscription exists in V1 coordinator before migration - (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers) = v1Coordinator - .getSubscription(subId); + (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers) = + v1Coordinator.getSubscription(subId); assertEq(balance, DEFAULT_LINK_FUNDING); assertEq(nativeBalance, DEFAULT_NATIVE_FUNDING); assertEq(owner, address(OWNER)); @@ -205,11 +206,7 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { // test request still works after migration testConsumer.requestRandomWords( - DEFAULT_CALLBACK_GAS_LIMIT, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_NUM_WORDS, - KEY_HASH, - false + DEFAULT_CALLBACK_GAS_LIMIT, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_NUM_WORDS, KEY_HASH, false ); assertEq(testConsumer.s_recentRequestId(), 1); @@ -225,13 +222,8 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { v1Coordinator_noLink.addConsumer(subId_noLink, address(testConsumer_noLink)); // subscription exists in V1 coordinator before migration - ( - uint96 balance, - uint96 nativeBalance, - uint64 reqCount, - address owner, - address[] memory consumers - ) = v1Coordinator_noLink.getSubscription(subId_noLink); + (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers) = + v1Coordinator_noLink.getSubscription(subId_noLink); assertEq(balance, 0); assertEq(nativeBalance, DEFAULT_NATIVE_FUNDING); assertEq(owner, address(OWNER)); @@ -278,11 +270,7 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { // test request still works after migration testConsumer_noLink.requestRandomWords( - DEFAULT_CALLBACK_GAS_LIMIT, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_NUM_WORDS, - KEY_HASH, - false + DEFAULT_CALLBACK_GAS_LIMIT, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_NUM_WORDS, KEY_HASH, false ); assertEq(testConsumer_noLink.s_recentRequestId(), 1); @@ -312,11 +300,7 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { v1Coordinator.addConsumer(subId, address(testConsumer)); testConsumer.setSubId(subId); testConsumer.requestRandomWords( - DEFAULT_CALLBACK_GAS_LIMIT, - DEFAULT_REQUEST_CONFIRMATIONS, - DEFAULT_NUM_WORDS, - KEY_HASH, - false + DEFAULT_CALLBACK_GAS_LIMIT, DEFAULT_REQUEST_CONFIRMATIONS, DEFAULT_NUM_WORDS, KEY_HASH, false ); vm.expectRevert(SubscriptionAPI.PendingRequestExists.selector); @@ -344,7 +328,9 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { // note: Call this function via this.getProvingKeyParts to be able to pass memory as calldata and // index over the byte array. - function getProvingKeyParts(bytes calldata uncompressedKey) public pure returns (uint256[2] memory) { + function getProvingKeyParts( + bytes calldata uncompressedKey + ) public pure returns (uint256[2] memory) { uint256 keyPart1 = uint256(bytes32(uncompressedKey[0:32])); uint256 keyPart2 = uint256(bytes32(uncompressedKey[32:64])); return [keyPart1, keyPart2]; diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol index d379ab9679..e005babf4e 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol @@ -1,11 +1,11 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; -import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; +import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; +import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; import {VRFCoordinatorV2_5Mock} from "../mocks/VRFCoordinatorV2_5Mock.sol"; import {VRFConsumerV2Plus} from "../testhelpers/VRFConsumerV2Plus.sol"; -import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; +import "./BaseTest.t.sol"; contract VRFCoordinatorV2_5MockTest is BaseTest { MockLinkToken internal s_linkToken; @@ -91,13 +91,8 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { uint256 subId = s_vrfCoordinatorV2_5Mock.createSubscription(); assertEq(subId, expectedSubId); - ( - uint96 balance, - uint96 nativeBalance, - uint64 reqCount, - address owner, - address[] memory consumers - ) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); + (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers) = + s_vrfCoordinatorV2_5Mock.getSubscription(subId); assertEq(balance, 0); assertEq(nativeBalance, 0); assertEq(reqCount, 0); @@ -113,8 +108,8 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { emit SubscriptionConsumerAdded(subId, address(s_vrfConsumerV2Plus)); s_vrfCoordinatorV2_5Mock.addConsumer(subId, address(s_vrfConsumerV2Plus)); - (uint96 balance, , uint64 reqCount, address owner, address[] memory consumers) = s_vrfCoordinatorV2_5Mock - .getSubscription(subId); + (uint96 balance,, uint64 reqCount, address owner, address[] memory consumers) = + s_vrfCoordinatorV2_5Mock.getSubscription(subId); assertEq(balance, 0); assertEq(reqCount, 0); assertEq(owner, s_subOwner); @@ -152,7 +147,7 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { s_vrfCoordinatorV2_5Mock.addConsumer(subId, address(s_vrfConsumerV2Plus)); - (, , , , address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); + (,,,, address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); assertEq(consumers.length, 1); assertEq(consumers[0], address(s_vrfConsumerV2Plus)); @@ -184,7 +179,7 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { s_vrfCoordinatorV2_5Mock.addConsumer(subId, address(s_vrfConsumerV2Plus)); - (, , , , address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); + (,,,, address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); assertEq(consumers.length, 1); assertEq(consumers[0], address(s_vrfConsumerV2Plus)); @@ -209,7 +204,7 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { emit SubscriptionFunded(subId, 0, twoLink); s_vrfCoordinatorV2_5Mock.fundSubscription(subId, twoLink); - (uint96 balance, , , , address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); + (uint96 balance,,,, address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); assertEq(balance, twoLink); assertEq(consumers.length, 0); @@ -219,7 +214,9 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { } // cannot fund a nonexistent subscription - function testFuzz_FundSubscription_RevertIfInvalidSubscription(uint256 subId) public { + function testFuzz_FundSubscription_RevertIfInvalidSubscription( + uint256 subId + ) public { vm.startPrank(s_subOwner); vm.expectRevert(SubscriptionAPI.InvalidSubscription.selector); @@ -237,7 +234,7 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { emit SubscriptionFundedWithNative(subId, 0, oneNative); s_vrfCoordinatorV2_5Mock.fundSubscriptionWithNative{value: oneNative}(subId); - (, uint256 nativeBalance, , , address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); + (, uint256 nativeBalance,,, address[] memory consumers) = s_vrfCoordinatorV2_5Mock.getSubscription(subId); assertEq(nativeBalance, oneNative); assertEq(consumers.length, 0); @@ -247,7 +244,9 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { } // cannot fund a nonexistent subscription - function testFuzz_FundSubscriptionWithNative_RevertIfInvalidSubscription(uint256 subId) public { + function testFuzz_FundSubscriptionWithNative_RevertIfInvalidSubscription( + uint256 subId + ) public { vm.startPrank(s_subOwner); vm.expectRevert(SubscriptionAPI.InvalidSubscription.selector); @@ -309,7 +308,9 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { } // fails to fulfill without being a valid consumer - function testFuzz_RequestRandomWords_RevertIfInvalidConsumer(bool nativePayment) public { + function testFuzz_RequestRandomWords_RevertIfInvalidConsumer( + bool nativePayment + ) public { vm.startPrank(s_subOwner); uint256 subId = s_vrfCoordinatorV2_5Mock.createSubscription(); @@ -329,7 +330,9 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { } // fails to fulfill with insufficient funds - function testFuzz_RequestRandomWords_RevertIfInsufficientFunds(bool nativePayment) public { + function testFuzz_RequestRandomWords_RevertIfInsufficientFunds( + bool nativePayment + ) public { vm.startPrank(s_subOwner); uint256 subId = s_vrfCoordinatorV2_5Mock.createSubscription(); @@ -450,7 +453,9 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { } // Correctly allows for user override of fulfillRandomWords [ @skip-coverage ] - function testFuzz_RequestRandomWordsUserOverride(bool nativePayment) public { + function testFuzz_RequestRandomWordsUserOverride( + bool nativePayment + ) public { vm.startPrank(s_subOwner); uint256 subId = s_vrfCoordinatorV2_5Mock.createSubscription(); diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol index a6c2c88d01..19682e84bb 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol @@ -1,12 +1,14 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; -import {ExposedVRFCoordinatorV2_5_Arbitrum} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol"; -import {BlockhashStore} from "../dev/BlockhashStore.sol"; + import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; +import {BlockhashStore} from "../dev/BlockhashStore.sol"; +import {ExposedVRFCoordinatorV2_5_Arbitrum} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol"; +import "./BaseTest.t.sol"; + import {VmSafe} from "forge-std/Vm.sol"; contract VRFV2CoordinatorV2_5_Arbitrum is BaseTest { @@ -68,13 +70,12 @@ contract VRFV2CoordinatorV2_5_Arbitrum is BaseTest { uint256 weiPerUnitGas, bool onlyPremium ) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - ExposedVRFCoordinatorV2_5_Arbitrum.calculatePaymentAmountNativeExternal.selector, - startGas, - weiPerUnitGas, - onlyPremium - ); + return abi.encodeWithSelector( + ExposedVRFCoordinatorV2_5_Arbitrum.calculatePaymentAmountNativeExternal.selector, + startGas, + weiPerUnitGas, + onlyPremium + ); } function _encodeCalculatePaymentAmountLinkExternal( @@ -82,16 +83,17 @@ contract VRFV2CoordinatorV2_5_Arbitrum is BaseTest { uint256 weiPerUnitGas, bool onlyPremium ) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - ExposedVRFCoordinatorV2_5_Arbitrum.calculatePaymentAmountLinkExternal.selector, - startGas, - weiPerUnitGas, - onlyPremium - ); + return abi.encodeWithSelector( + ExposedVRFCoordinatorV2_5_Arbitrum.calculatePaymentAmountLinkExternal.selector, + startGas, + weiPerUnitGas, + onlyPremium + ); } - function _checkL1GasFeeEmittedLogs(uint256 expectedL1GasFee) internal { + function _checkL1GasFeeEmittedLogs( + uint256 expectedL1GasFee + ) internal { VmSafe.Log[] memory entries = vm.getRecordedLogs(); assertEq(entries.length, 1); assertEq(entries[0].topics.length, 1); diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol index 0ebec3b1c5..813ad55761 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol @@ -1,12 +1,15 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; -import {ExposedVRFCoordinatorV2_5_Optimism} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol"; -import {OptimismL1Fees} from "../dev/OptimismL1Fees.sol"; + +import {GasPriceOracle as OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; import {BlockhashStore} from "../dev/BlockhashStore.sol"; -import {GasPriceOracle as OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; +import {OptimismL1Fees} from "../dev/OptimismL1Fees.sol"; +import {ExposedVRFCoordinatorV2_5_Optimism} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol"; +import "./BaseTest.t.sol"; + import {VmSafe} from "forge-std/Vm.sol"; contract VRFV2CoordinatorV2_5_Optimism is BaseTest { @@ -78,13 +81,12 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { uint256 weiPerUnitGas, bool onlyPremium ) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - ExposedVRFCoordinatorV2_5_Optimism.calculatePaymentAmountNativeExternal.selector, - startGas, - weiPerUnitGas, - onlyPremium - ); + return abi.encodeWithSelector( + ExposedVRFCoordinatorV2_5_Optimism.calculatePaymentAmountNativeExternal.selector, + startGas, + weiPerUnitGas, + onlyPremium + ); } function _encodeCalculatePaymentAmountLinkExternal( @@ -92,13 +94,12 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { uint256 weiPerUnitGas, bool onlyPremium ) internal pure returns (bytes memory) { - return - abi.encodeWithSelector( - ExposedVRFCoordinatorV2_5_Optimism.calculatePaymentAmountLinkExternal.selector, - startGas, - weiPerUnitGas, - onlyPremium - ); + return abi.encodeWithSelector( + ExposedVRFCoordinatorV2_5_Optimism.calculatePaymentAmountLinkExternal.selector, + startGas, + weiPerUnitGas, + onlyPremium + ); } function _mockGasOraclePriceGetL1FeeUpperBoundCall() internal { @@ -114,29 +115,21 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { function _mockGasOraclePriceFeeMethods() internal { // these values are taken from an example transaction on Base Sepolia vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), - abi.encode(64273426165) - ); - vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("baseFeeScalar()"))), - abi.encode(1101) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), abi.encode(64273426165) ); + vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("baseFeeScalar()"))), abi.encode(1101)); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), - abi.encode(659851) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), abi.encode(659851) ); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), - abi.encode(2126959908362) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), abi.encode(2126959908362) ); vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("decimals()"))), abi.encode(6)); } - function _mockGasOraclePriceGetL1FeeCall(bytes memory txMsgData) internal { + function _mockGasOraclePriceGetL1FeeCall( + bytes memory txMsgData + ) internal { vm.mockCall( OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(OVM_GasPriceOracle.getL1Fee.selector, bytes.concat(txMsgData, L1_FEE_DATA_PADDING)), @@ -144,7 +137,9 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { ); } - function _checkL1GasFeeEmittedLogs(uint256 expectedL1GasFee) internal { + function _checkL1GasFeeEmittedLogs( + uint256 expectedL1GasFee + ) internal { VmSafe.Log[] memory entries = vm.getRecordedLogs(); assertEq(entries.length, 1); assertEq(entries[0].topics.length, 1); diff --git a/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol b/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol index 23b434e009..0ca8bca9b2 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol @@ -1,20 +1,23 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; -import {VRF} from "../VRF.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; -import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; -import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; -import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; +import {VRF} from "../VRF.sol"; + +import {VRFTypes} from "../VRFTypes.sol"; import {BlockhashStore} from "../dev/BlockhashStore.sol"; -import {VRFV2PlusConsumerExample} from "../dev/testhelpers/VRFV2PlusConsumerExample.sol"; +import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; +import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; + import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; -import {VRFTypes} from "../VRFTypes.sol"; -import {console} from "forge-std/console.sol"; -import {VmSafe} from "forge-std/Vm.sol"; +import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; +import {VRFV2PlusConsumerExample} from "../dev/testhelpers/VRFV2PlusConsumerExample.sol"; + import {VRFV2PlusLoadTestWithMetrics} from "../dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol"; -import "@openzeppelin/contracts@4.9.6/utils/math/Math.sol"; // for Math.ceilDiv +import "./BaseTest.t.sol"; +import "@openzeppelin/contracts@4.9.6/utils/math/Math.sol"; +import {VmSafe} from "forge-std/Vm.sol"; +import {console} from "forge-std/console.sol"; // for Math.ceilDiv /* * USAGE INSTRUCTIONS: @@ -71,19 +74,18 @@ contract VRFV2Plus is BaseTest { // Use create2 to deploy our consumer, so that its address is always the same // and surrounding changes do not alter our generated proofs. - bytes memory consumerInitCode = bytes.concat( - initializeCode, - abi.encode(address(s_testCoordinator), address(s_linkToken)) - ); + bytes memory consumerInitCode = + bytes.concat(initializeCode, abi.encode(address(s_testCoordinator), address(s_linkToken))); bytes32 abiEncodedOwnerAddress = bytes32(uint256(uint160(LINK_WHALE)) << 96); address consumerCreate2Address; assembly { - consumerCreate2Address := create2( - 0, // value - left at zero here - add(0x20, consumerInitCode), // initialization bytecode (excluding first memory slot which contains its length) - mload(consumerInitCode), // length of initialization bytecode - abiEncodedOwnerAddress // user-defined nonce to ensure unique SCA addresses - ) + consumerCreate2Address := + create2( + 0, // value - left at zero here + add(0x20, consumerInitCode), // initialization bytecode (excluding first memory slot which contains its length) + mload(consumerInitCode), // length of initialization bytecode + abiEncodedOwnerAddress // user-defined nonce to ensure unique SCA addresses + ) } s_testConsumer = VRFV2PlusConsumerExample(consumerCreate2Address); @@ -238,8 +240,8 @@ contract VRFV2Plus is BaseTest { // Should set the proving key successfully. registerProvingKey(); - bytes - memory unregisteredPubKey = hex"6d919e4ed6add6c34b2af77eb6b2d2f5d27db11ba004e70734b23bd4321ea234ff8577a063314bead6d88c1b01849289a5542767a5138924f38fed551a7773db"; + bytes memory unregisteredPubKey = + hex"6d919e4ed6add6c34b2af77eb6b2d2f5d27db11ba004e70734b23bd4321ea234ff8577a063314bead6d88c1b01849289a5542767a5138924f38fed551a7773db"; // Should revert when given pubkey is not registered uint256[2] memory unregisteredKeyParts = this.getProvingKeyParts(unregisteredPubKey); @@ -265,7 +267,9 @@ contract VRFV2Plus is BaseTest { // note: Call this function via this.getProvingKeyParts to be able to pass memory as calldata and // index over the byte array. - function getProvingKeyParts(bytes calldata uncompressedKey) public pure returns (uint256[2] memory) { + function getProvingKeyParts( + bytes calldata uncompressedKey + ) public pure returns (uint256[2] memory) { uint256 keyPart1 = uint256(bytes32(uncompressedKey[0:32])); uint256 keyPart2 = uint256(bytes32(uncompressedKey[32:64])); return [keyPart1, keyPart2]; @@ -289,8 +293,8 @@ contract VRFV2Plus is BaseTest { } function testGetActiveSubscriptionIds() public { - uint numSubs = 40; - for (uint i = 0; i < numSubs; i++) { + uint256 numSubs = 40; + for (uint256 i = 0; i < numSubs; i++) { s_testCoordinator.createSubscription(); } // get all subscriptions, assert length is correct @@ -301,9 +305,9 @@ contract VRFV2Plus is BaseTest { // we should eventually get all the subscriptions this way. uint256[][] memory subIds = paginateSubscriptions(s_testCoordinator, 10); // check that all subscriptions were returned - uint actualNumSubs = 0; - for (uint batchIdx = 0; batchIdx < subIds.length; batchIdx++) { - for (uint subIdx = 0; subIdx < subIds[batchIdx].length; subIdx++) { + uint256 actualNumSubs = 0; + for (uint256 batchIdx = 0; batchIdx < subIds.length; batchIdx++) { + for (uint256 subIdx = 0; subIdx < subIds[batchIdx].length; subIdx++) { s_testCoordinator.getSubscription(subIds[batchIdx][subIdx]); actualNumSubs++; } @@ -312,19 +316,19 @@ contract VRFV2Plus is BaseTest { // cancel a bunch of subscriptions, assert that they are not returned uint256[] memory subsToCancel = new uint256[](3); - for (uint i = 0; i < 3; i++) { + for (uint256 i = 0; i < 3; i++) { subsToCancel[i] = subIds[0][i]; } - for (uint i = 0; i < subsToCancel.length; i++) { + for (uint256 i = 0; i < subsToCancel.length; i++) { s_testCoordinator.cancelSubscription(subsToCancel[i], LINK_WHALE); } uint256[][] memory newSubIds = paginateSubscriptions(s_testCoordinator, 10); // check that all subscriptions were returned // and assert that none of the canceled subscriptions are returned actualNumSubs = 0; - for (uint batchIdx = 0; batchIdx < newSubIds.length; batchIdx++) { - for (uint subIdx = 0; subIdx < newSubIds[batchIdx].length; subIdx++) { - for (uint i = 0; i < subsToCancel.length; i++) { + for (uint256 batchIdx = 0; batchIdx < newSubIds.length; batchIdx++) { + for (uint256 subIdx = 0; subIdx < newSubIds[batchIdx].length; subIdx++) { + for (uint256 i = 0; i < subsToCancel.length; i++) { assertFalse(newSubIds[batchIdx][subIdx] == subsToCancel[i]); } s_testCoordinator.getSubscription(newSubIds[batchIdx][subIdx]); @@ -338,8 +342,8 @@ contract VRFV2Plus is BaseTest { ExposedVRFCoordinatorV2_5 coordinator, uint256 batchSize ) internal view returns (uint256[][] memory) { - uint arrIndex = 0; - uint startIndex = 0; + uint256 arrIndex = 0; + uint256 startIndex = 0; uint256 numSubs = coordinator.getActiveSubscriptionIdsLength(); uint256[][] memory subIds = new uint256[][](Math.ceilDiv(numSubs, batchSize)); while (startIndex < numSubs) { @@ -362,23 +366,14 @@ contract VRFV2Plus is BaseTest { address indexed sender ); event RandomWordsFulfilled( - uint256 indexed requestId, - uint256 outputSeed, - uint256 indexed subID, - uint96 payment, - bytes extraArgs, - bool success + uint256 indexed requestId, uint256 outputSeed, uint256 indexed subID, uint96 payment, bytes extraArgs, bool success ); event FallbackWeiPerUnitLinkUsed(uint256 requestId, int256 fallbackWeiPerUnitLink); function testRequestAndFulfillRandomWordsNative() public { - ( - VRF.Proof memory proof, - VRFTypes.RequestCommitmentV2Plus memory rc, - uint256 subId, - uint256 requestId - ) = setupSubAndRequestRandomnessNativePayment(); - (, uint96 nativeBalanceBefore, , , ) = s_testCoordinator.getSubscription(subId); + (VRF.Proof memory proof, VRFTypes.RequestCommitmentV2Plus memory rc, uint256 subId, uint256 requestId) = + setupSubAndRequestRandomnessNativePayment(); + (, uint96 nativeBalanceBefore,,,) = s_testCoordinator.getSubscription(subId); uint256 outputSeed = s_testCoordinator.getRandomnessFromProofExternal(proof, rc).randomness; vm.recordLogs(); @@ -386,11 +381,11 @@ contract VRFV2Plus is BaseTest { VmSafe.Log[] memory entries = vm.getRecordedLogs(); assertEq(entries[0].topics[1], bytes32(uint256(requestId))); assertEq(entries[0].topics[2], bytes32(uint256(subId))); - (uint256 loggedOutputSeed, , , bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); + (uint256 loggedOutputSeed,,, bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); assertEq(loggedOutputSeed, outputSeed); assertEq(loggedSuccess, true); - (bool fulfilled, , ) = s_testConsumer.s_requests(requestId); + (bool fulfilled,,) = s_testConsumer.s_requests(requestId); assertEq(fulfilled, true); // The cost of fulfillRandomWords is approximately 70_000 gas. @@ -406,7 +401,7 @@ contract VRFV2Plus is BaseTest { // billed_fee = baseFeeWei * (100 + linkPremiumPercentage / 100) + 5e17 // billed_fee = 1.2e16 * 1.15 + 5e17 // billed_fee = 5.138e+17 - (, uint96 nativeBalanceAfter, , , ) = s_testCoordinator.getSubscription(subId); + (, uint96 nativeBalanceAfter,,,) = s_testCoordinator.getSubscription(subId); // 1e15 is less than 1 percent discrepancy assertApproxEqAbs(payment, 5.138 * 1e17, 1e15); assertApproxEqAbs(nativeBalanceAfter, nativeBalanceBefore - 5.138 * 1e17, 1e15); @@ -414,13 +409,9 @@ contract VRFV2Plus is BaseTest { } function testRequestAndFulfillRandomWordsLINK() public { - ( - VRF.Proof memory proof, - VRFTypes.RequestCommitmentV2Plus memory rc, - uint256 subId, - uint256 requestId - ) = setupSubAndRequestRandomnessLINKPayment(); - (uint96 linkBalanceBefore, , , , ) = s_testCoordinator.getSubscription(subId); + (VRF.Proof memory proof, VRFTypes.RequestCommitmentV2Plus memory rc, uint256 subId, uint256 requestId) = + setupSubAndRequestRandomnessLINKPayment(); + (uint96 linkBalanceBefore,,,,) = s_testCoordinator.getSubscription(subId); uint256 outputSeed = s_testCoordinator.getRandomnessFromProofExternal(proof, rc).randomness; vm.recordLogs(); @@ -429,11 +420,11 @@ contract VRFV2Plus is BaseTest { VmSafe.Log[] memory entries = vm.getRecordedLogs(); assertEq(entries[0].topics[1], bytes32(uint256(requestId))); assertEq(entries[0].topics[2], bytes32(uint256(subId))); - (uint256 loggedOutputSeed, , , bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); + (uint256 loggedOutputSeed,,, bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); assertEq(loggedOutputSeed, outputSeed); assertEq(loggedSuccess, true); - (bool fulfilled, , ) = s_testConsumer.s_requests(requestId); + (bool fulfilled,,) = s_testConsumer.s_requests(requestId); assertEq(fulfilled, true); // The cost of fulfillRandomWords is approximately 86_000 gas. @@ -451,7 +442,7 @@ contract VRFV2Plus is BaseTest { // billed_fee = 2.72e16 * 1.1 + 8e17 // billed_fee = 2.992e16 + 8e17 = 8.2992e17 // note: delta is doubled from the native test to account for more variance due to the link/native ratio - (uint96 linkBalanceAfter, , , , ) = s_testCoordinator.getSubscription(subId); + (uint96 linkBalanceAfter,,,,) = s_testCoordinator.getSubscription(subId); // 1e15 is less than 1 percent discrepancy assertApproxEqAbs(payment, 8.2992 * 1e17, 1e15); assertApproxEqAbs(linkBalanceAfter, linkBalanceBefore - 8.2992 * 1e17, 1e15); @@ -459,18 +450,14 @@ contract VRFV2Plus is BaseTest { } function testRequestAndFulfillRandomWordsLINK_FallbackWeiPerUnitLinkUsed() public { - ( - VRF.Proof memory proof, - VRFTypes.RequestCommitmentV2Plus memory rc, - , - uint256 requestId - ) = setupSubAndRequestRandomnessLINKPayment(); - - (, , , uint32 stalenessSeconds, , , , , ) = s_testCoordinator.s_config(); + (VRF.Proof memory proof, VRFTypes.RequestCommitmentV2Plus memory rc,, uint256 requestId) = + setupSubAndRequestRandomnessLINKPayment(); + + (,,, uint32 stalenessSeconds,,,,,) = s_testCoordinator.s_config(); int256 fallbackWeiPerUnitLink = s_testCoordinator.s_fallbackWeiPerUnitLink(); // Set the link feed to be stale. - (uint80 roundId, int256 answer, uint256 startedAt, , ) = s_linkNativeFeed.latestRoundData(); + (uint80 roundId, int256 answer, uint256 startedAt,,) = s_linkNativeFeed.latestRoundData(); uint256 timestamp = block.timestamp - stalenessSeconds - 1; s_linkNativeFeed.updateRoundData(roundId, answer, timestamp, startedAt); @@ -509,7 +496,7 @@ contract VRFV2Plus is BaseTest { address(s_testConsumer) // requester ); s_testConsumer.requestRandomWords(CALLBACK_GAS_LIMIT, MIN_CONFIRMATIONS, NUM_WORDS, vrfKeyHash, false); - (bool fulfilled, , ) = s_testConsumer.s_requests(requestId); + (bool fulfilled,,) = s_testConsumer.s_requests(requestId); assertEq(fulfilled, false); assertTrue(s_testCoordinator.pendingRequestExists(subId)); @@ -605,7 +592,7 @@ contract VRFV2Plus is BaseTest { address(s_testConsumer) // requester ); s_testConsumer.requestRandomWords(CALLBACK_GAS_LIMIT, MIN_CONFIRMATIONS, NUM_WORDS, vrfKeyHash, true); - (bool fulfilled, , ) = s_testConsumer.s_requests(requestId); + (bool fulfilled,,) = s_testConsumer.s_requests(requestId); assertEq(fulfilled, false); assertTrue(s_testCoordinator.pendingRequestExists(subId)); @@ -673,12 +660,7 @@ contract VRFV2Plus is BaseTest { } function testRequestAndFulfillRandomWords_NetworkGasPriceExceedsGasLane() public { - ( - VRF.Proof memory proof, - VRFTypes.RequestCommitmentV2Plus memory rc, - , - - ) = setupSubAndRequestRandomnessNativePayment(); + (VRF.Proof memory proof, VRFTypes.RequestCommitmentV2Plus memory rc,,) = setupSubAndRequestRandomnessNativePayment(); // network gas is higher than gas lane max gas uint256 networkGasPrice = GAS_LANE_MAX_GAS + 1; @@ -690,13 +672,9 @@ contract VRFV2Plus is BaseTest { } function testRequestAndFulfillRandomWords_OnlyPremium_NativePayment() public { - ( - VRF.Proof memory proof, - VRFTypes.RequestCommitmentV2Plus memory rc, - uint256 subId, - uint256 requestId - ) = setupSubAndRequestRandomnessNativePayment(); - (, uint96 nativeBalanceBefore, , , ) = s_testCoordinator.getSubscription(subId); + (VRF.Proof memory proof, VRFTypes.RequestCommitmentV2Plus memory rc, uint256 subId, uint256 requestId) = + setupSubAndRequestRandomnessNativePayment(); + (, uint96 nativeBalanceBefore,,,) = s_testCoordinator.getSubscription(subId); // network gas is twice the gas lane max gas uint256 networkGasPrice = GAS_LANE_MAX_GAS * 2; @@ -704,15 +682,15 @@ contract VRFV2Plus is BaseTest { uint256 outputSeed = s_testCoordinator.getRandomnessFromProofExternal(proof, rc).randomness; vm.recordLogs(); - uint96 payment = s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */); + uint96 payment = s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */ ); VmSafe.Log[] memory entries = vm.getRecordedLogs(); assertEq(entries[0].topics[1], bytes32(uint256(requestId))); assertEq(entries[0].topics[2], bytes32(uint256(subId))); - (uint256 loggedOutputSeed, , , bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); + (uint256 loggedOutputSeed,,, bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); assertEq(loggedOutputSeed, outputSeed); assertEq(loggedSuccess, true); - (bool fulfilled, , ) = s_testConsumer.s_requests(requestId); + (bool fulfilled,,) = s_testConsumer.s_requests(requestId); assertEq(fulfilled, true); // The cost of fulfillRandomWords is approximately 72_100 gas. @@ -729,7 +707,7 @@ contract VRFV2Plus is BaseTest { // billed_fee = baseFeeWei * (linkPremiumPercentage / 100) + 5e17 // billed_fee = 6.11e17 * 0.15 + 5e17 // billed_fee = 5.9157e+17 - (, uint96 nativeBalanceAfter, , , ) = s_testCoordinator.getSubscription(subId); + (, uint96 nativeBalanceAfter,,,) = s_testCoordinator.getSubscription(subId); // 1e15 is less than 1 percent discrepancy assertApproxEqAbs(payment, 5.9157 * 1e17, 1e15); assertApproxEqAbs(nativeBalanceAfter, nativeBalanceBefore - 5.9157 * 1e17, 1e15); @@ -737,13 +715,9 @@ contract VRFV2Plus is BaseTest { } function testRequestAndFulfillRandomWords_OnlyPremium_LinkPayment() public { - ( - VRF.Proof memory proof, - VRFTypes.RequestCommitmentV2Plus memory rc, - uint256 subId, - uint256 requestId - ) = setupSubAndRequestRandomnessLINKPayment(); - (uint96 linkBalanceBefore, , , , ) = s_testCoordinator.getSubscription(subId); + (VRF.Proof memory proof, VRFTypes.RequestCommitmentV2Plus memory rc, uint256 subId, uint256 requestId) = + setupSubAndRequestRandomnessLINKPayment(); + (uint96 linkBalanceBefore,,,,) = s_testCoordinator.getSubscription(subId); // network gas is twice the gas lane max gas uint256 networkGasPrice = GAS_LANE_MAX_GAS * 5; @@ -751,16 +725,16 @@ contract VRFV2Plus is BaseTest { uint256 outputSeed = s_testCoordinator.getRandomnessFromProofExternal(proof, rc).randomness; vm.recordLogs(); - uint96 payment = s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */); + uint96 payment = s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */ ); VmSafe.Log[] memory entries = vm.getRecordedLogs(); assertEq(entries[0].topics[1], bytes32(uint256(requestId))); assertEq(entries[0].topics[2], bytes32(uint256(subId))); - (uint256 loggedOutputSeed, , , bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); + (uint256 loggedOutputSeed,,, bool loggedSuccess) = abi.decode(entries[0].data, (uint256, uint256, bool, bool)); assertEq(loggedOutputSeed, outputSeed); assertEq(loggedSuccess, true); - (bool fulfilled, , ) = s_testConsumer.s_requests(requestId); + (bool fulfilled,,) = s_testConsumer.s_requests(requestId); assertEq(fulfilled, true); // The cost of fulfillRandomWords is approximately 89_100 gas. @@ -779,7 +753,7 @@ contract VRFV2Plus is BaseTest { // billed_fee = 1.391e+18 * 0.1 + 8e17 // billed_fee = 9.391e+17 // note: delta is doubled from the native test to account for more variance due to the link/native ratio - (uint96 linkBalanceAfter, , , , ) = s_testCoordinator.getSubscription(subId); + (uint96 linkBalanceAfter,,,,) = s_testCoordinator.getSubscription(subId); // 1e15 is less than 1 percent discrepancy assertApproxEqAbs(payment, 9.391 * 1e17, 1e15); assertApproxEqAbs(linkBalanceAfter, linkBalanceBefore - 9.391 * 1e17, 1e15); @@ -795,13 +769,7 @@ contract VRFV2Plus is BaseTest { // consumer is not added to the subscription vm.expectRevert(abi.encodeWithSelector(SubscriptionAPI.InvalidConsumer.selector, subId, address(consumer))); consumer.requestRandomWords( - subId, - MIN_CONFIRMATIONS, - vrfKeyHash, - CALLBACK_GAS_LIMIT, - true, - NUM_WORDS, - 1 /* requestCount */ + subId, MIN_CONFIRMATIONS, vrfKeyHash, CALLBACK_GAS_LIMIT, true, NUM_WORDS, 1 /* requestCount */ ); assertFalse(s_testCoordinator.pendingRequestExists(subId)); } @@ -841,7 +809,7 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, vrfKeyHash, CALLBACK_GAS_LIMIT, - true /* nativePayment */, + true, /* nativePayment */ NUM_WORDS, 1 /* requestCount */ ); @@ -906,7 +874,7 @@ contract VRFV2Plus is BaseTest { sender: address(consumer), extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true})) }); - s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */); + s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */ ); assertFalse(s_testCoordinator.pendingRequestExists(subId)); // 4. remove consumer and verify request random words doesn't work @@ -917,7 +885,7 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, vrfKeyHash, CALLBACK_GAS_LIMIT, - false /* nativePayment */, + false, /* nativePayment */ NUM_WORDS, 1 /* requestCount */ ); @@ -944,7 +912,7 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, vrfKeyHash, CALLBACK_GAS_LIMIT, - false /* nativePayment */, + false, /* nativePayment */ NUM_WORDS, 1 /* requestCount */ ); @@ -969,18 +937,10 @@ contract VRFV2Plus is BaseTest { // 2. Request random words. changePrank(subOwner); - (uint256 requestId1, uint256 preSeed1) = s_testCoordinator.computeRequestIdExternal( - vrfKeyHash, - address(consumer1), - subId, - 1 - ); - (uint256 requestId2, uint256 preSeed2) = s_testCoordinator.computeRequestIdExternal( - vrfKeyHash, - address(consumer2), - subId, - 1 - ); + (uint256 requestId1, uint256 preSeed1) = + s_testCoordinator.computeRequestIdExternal(vrfKeyHash, address(consumer1), subId, 1); + (uint256 requestId2, uint256 preSeed2) = + s_testCoordinator.computeRequestIdExternal(vrfKeyHash, address(consumer2), subId, 1); assertNotEq(requestId1, requestId2); assertNotEq(preSeed1, preSeed2); consumer1.requestRandomWords( @@ -988,7 +948,7 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, vrfKeyHash, CALLBACK_GAS_LIMIT, - true /* nativePayment */, + true, /* nativePayment */ NUM_WORDS, 1 /* requestCount */ ); @@ -997,7 +957,7 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, vrfKeyHash, CALLBACK_GAS_LIMIT, - true /* nativePayment */, + true, /* nativePayment */ NUM_WORDS, 1 /* requestCount */ ); @@ -1062,7 +1022,7 @@ contract VRFV2Plus is BaseTest { sender: address(consumer1), extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true})) }); - s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */); + s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */ ); assertTrue(s_testCoordinator.pendingRequestExists(subId)); // 4. Fulfill the 2nd request @@ -1118,11 +1078,13 @@ contract VRFV2Plus is BaseTest { sender: address(consumer2), extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: true})) }); - s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */); + s_testCoordinator.fulfillRandomWords(proof, rc, true /* onlyPremium */ ); assertFalse(s_testCoordinator.pendingRequestExists(subId)); } - function createAndAddLoadTestWithMetricsConsumer(uint256 subId) internal returns (VRFV2PlusLoadTestWithMetrics) { + function createAndAddLoadTestWithMetricsConsumer( + uint256 subId + ) internal returns (VRFV2PlusLoadTestWithMetrics) { VRFV2PlusLoadTestWithMetrics consumer = new VRFV2PlusLoadTestWithMetrics(address(s_testCoordinator)); s_testCoordinator.addConsumer(subId, address(consumer)); return consumer; @@ -1139,21 +1101,21 @@ contract VRFV2Plus is BaseTest { // test remove consumers from multiple positions to have better gas distribution address earlyConsumerAddress = consumers[0]; s_testCoordinator.removeConsumer(subId, earlyConsumerAddress); - (, , , , consumers) = s_testCoordinator.getSubscription(subId); + (,,,, consumers) = s_testCoordinator.getSubscription(subId); assertEq(consumers.length, consumersLength - 1); assertFalse(addressIsIn(earlyConsumerAddress, consumers)); consumersLength = consumers.length; address middleConsumerAddress = consumers[consumersLength / 2]; s_testCoordinator.removeConsumer(subId, middleConsumerAddress); - (, , , , consumers) = s_testCoordinator.getSubscription(subId); + (,,,, consumers) = s_testCoordinator.getSubscription(subId); assertEq(consumers.length, consumersLength - 1); assertFalse(addressIsIn(middleConsumerAddress, consumers)); consumersLength = consumers.length; address lateConsumerAddress = consumers[consumersLength - 1]; s_testCoordinator.removeConsumer(subId, lateConsumerAddress); - (, , , , consumers) = s_testCoordinator.getSubscription(subId); + (,,,, consumers) = s_testCoordinator.getSubscription(subId); assertEq(consumers.length, consumersLength - 1); assertFalse(addressIsIn(lateConsumerAddress, consumers)); } diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusSubscriptionAPI.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusSubscriptionAPI.t.sol index 56c47d547b..1b62df3cce 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusSubscriptionAPI.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusSubscriptionAPI.t.sol @@ -1,11 +1,12 @@ pragma solidity 0.8.19; -import "./BaseTest.t.sol"; -import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; -import {VRFV2PlusLoadTestWithMetrics} from "../dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol"; -import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; +import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; +import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; +import {VRFV2PlusLoadTestWithMetrics} from "../dev/testhelpers/VRFV2PlusLoadTestWithMetrics.sol"; +import "./BaseTest.t.sol"; + import "@openzeppelin/contracts@4.9.6/utils/Strings.sol"; // for Strings.toString import {VmSafe} from "forge-std/Vm.sol"; @@ -97,7 +98,7 @@ contract VRFV2PlusSubscriptionAPITest is BaseTest { // change back to owner and cancel the subscription changePrank(OWNER); vm.expectEmit(true, false, false, true); - emit SubscriptionCanceled(subId, subOwner, 0 /* link balance */, 5 ether /* native balance */); + emit SubscriptionCanceled(subId, subOwner, 0, /* link balance */ 5 ether /* native balance */ ); s_subscriptionAPI.ownerCancelSubscription(subId); // assert that the subscription no longer exists @@ -136,7 +137,7 @@ contract VRFV2PlusSubscriptionAPITest is BaseTest { // change back to owner and cancel the subscription vm.expectEmit(true, false, false, true); - emit SubscriptionCanceled(subId, subOwner, 5 ether /* link balance */, 0 /* native balance */); + emit SubscriptionCanceled(subId, subOwner, 5 ether, /* link balance */ 0 /* native balance */ ); s_subscriptionAPI.ownerCancelSubscription(subId); // assert that the subscription no longer exists @@ -181,7 +182,7 @@ contract VRFV2PlusSubscriptionAPITest is BaseTest { // change back to owner and cancel the subscription changePrank(OWNER); vm.expectEmit(true, false, false, true); - emit SubscriptionCanceled(subId, subOwner, 5 ether /* link balance */, 5 ether /* native balance */); + emit SubscriptionCanceled(subId, subOwner, 5 ether, /* link balance */ 5 ether /* native balance */ ); s_subscriptionAPI.ownerCancelSubscription(subId); // assert that the subscription no longer exists diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol index 45e2131ce7..b2651fdfa2 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol @@ -1,16 +1,18 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; -import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; + import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; -import {VRFV2PlusWrapperConsumerExample} from "../dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol"; -import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; + import {VRFConsumerBaseV2Plus} from "../dev/VRFConsumerBaseV2Plus.sol"; +import {VRFCoordinatorV2_5} from "../dev/VRFCoordinatorV2_5.sol"; import {VRFV2PlusWrapper} from "../dev/VRFV2PlusWrapper.sol"; import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; +import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; +import {VRFV2PlusWrapperConsumerExample} from "../dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract VRFV2PlusWrapperTest is BaseTest { address internal constant LINK_WHALE = 0xD883a6A1C22fC4AbFE938a5aDF9B2Cc31b1BF18B; @@ -47,10 +49,7 @@ contract VRFV2PlusWrapperTest is BaseTest { // Deploy wrapper. s_wrapper = new VRFV2PlusWrapper( - address(s_linkToken), - address(s_linkNativeFeed), - address(s_testCoordinator), - uint256(s_wrapperSubscriptionId) + address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(s_wrapperSubscriptionId) ); assertEq(address(s_linkToken), address(s_wrapper.link())); assertEq(address(s_linkNativeFeed), address(s_wrapper.linkNativeFeed())); @@ -186,10 +185,7 @@ contract VRFV2PlusWrapperTest is BaseTest { function testCreationOfANewVRFV2PlusWrapper() public { // second wrapper contract will simply add itself to the same subscription VRFV2PlusWrapper nextWrapper = new VRFV2PlusWrapper( - address(s_linkToken), - address(s_linkNativeFeed), - address(s_testCoordinator), - s_wrapperSubscriptionId + address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), s_wrapperSubscriptionId ); assertEq(s_wrapperSubscriptionId, nextWrapper.SUBSCRIPTION_ID()); } @@ -238,12 +234,8 @@ contract VRFV2PlusWrapperTest is BaseTest { // Request randomness from wrapper. uint32 callbackGasLimit = 1_000_000; vm.expectEmit(true, true, true, true); - (uint256 requestId, uint256 preSeed) = s_testCoordinator.computeRequestIdExternal( - vrfKeyHash, - address(s_wrapper), - s_wrapper.SUBSCRIPTION_ID(), - 1 - ); + (uint256 requestId, uint256 preSeed) = + s_testCoordinator.computeRequestIdExternal(vrfKeyHash, address(s_wrapper), s_wrapper.SUBSCRIPTION_ID(), 1); uint32 EIP150Overhead = callbackGasLimit / 63 + 1; emit RandomWordsRequested( vrfKeyHash, @@ -269,7 +261,7 @@ contract VRFV2PlusWrapperTest is BaseTest { assertEq(native, true); assertEq(address(s_consumer).balance, 10 ether - expectedPaid); - (, uint256 gasLimit, ) = s_wrapper.s_callbacks(requestId); + (, uint256 gasLimit,) = s_wrapper.s_callbacks(requestId); assertEq(gasLimit, callbackGasLimit); changePrank(address(s_testCoordinator)); @@ -377,12 +369,8 @@ contract VRFV2PlusWrapperTest is BaseTest { // Request randomness from wrapper. uint32 callbackGasLimit = 1_000_000; vm.expectEmit(true, true, true, true); - (uint256 requestId, uint256 preSeed) = s_testCoordinator.computeRequestIdExternal( - vrfKeyHash, - address(s_wrapper), - s_wrapper.SUBSCRIPTION_ID(), - 1 - ); + (uint256 requestId, uint256 preSeed) = + s_testCoordinator.computeRequestIdExternal(vrfKeyHash, address(s_wrapper), s_wrapper.SUBSCRIPTION_ID(), 1); uint32 EIP150Overhead = callbackGasLimit / 63 + 1; emit RandomWordsRequested( vrfKeyHash, @@ -408,7 +396,7 @@ contract VRFV2PlusWrapperTest is BaseTest { assertEq(fulfilled, false); assertEq(native, false); assertEq(s_linkToken.balanceOf(address(s_consumer)), 10 ether - expectedPaid); - (, uint256 gasLimit, ) = s_wrapper.s_callbacks(requestId); + (, uint256 gasLimit,) = s_wrapper.s_callbacks(requestId); assertEq(gasLimit, callbackGasLimit); // Fulfill the request. @@ -436,20 +424,16 @@ contract VRFV2PlusWrapperTest is BaseTest { s_linkToken.transfer(address(s_consumer), 10 ether); // Set the link feed to be stale. - (, , , uint32 stalenessSeconds, , , , , ) = s_testCoordinator.s_config(); + (,,, uint32 stalenessSeconds,,,,,) = s_testCoordinator.s_config(); int256 fallbackWeiPerUnitLink = s_testCoordinator.s_fallbackWeiPerUnitLink(); - (uint80 roundId, int256 answer, uint256 startedAt, , ) = s_linkNativeFeed.latestRoundData(); + (uint80 roundId, int256 answer, uint256 startedAt,,) = s_linkNativeFeed.latestRoundData(); uint256 timestamp = block.timestamp - stalenessSeconds - 1; s_linkNativeFeed.updateRoundData(roundId, answer, timestamp, startedAt); // Request randomness from wrapper. uint32 callbackGasLimit = 1_000_000; - (uint256 requestId, uint256 preSeed) = s_testCoordinator.computeRequestIdExternal( - vrfKeyHash, - address(s_wrapper), - s_wrapper.SUBSCRIPTION_ID(), - 1 - ); + (uint256 requestId, uint256 preSeed) = + s_testCoordinator.computeRequestIdExternal(vrfKeyHash, address(s_wrapper), s_wrapper.SUBSCRIPTION_ID(), 1); uint32 EIP150Overhead = callbackGasLimit / 63 + 1; vm.expectEmit(true, true, true, true); emit FallbackWeiPerUnitLinkUsed(requestId, fallbackWeiPerUnitLink); @@ -469,10 +453,7 @@ contract VRFV2PlusWrapperTest is BaseTest { function testRequestRandomWordsInNativeNotConfigured() public { VRFV2PlusWrapper wrapper = new VRFV2PlusWrapper( - address(s_linkToken), - address(s_linkNativeFeed), - address(s_testCoordinator), - uint256(s_wrapperSubscriptionId) + address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(s_wrapperSubscriptionId) ); vm.expectRevert("wrapper is not configured"); diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol index f88dd15f2d..e81427f0e8 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; -import {ExposedVRFCoordinatorV2_5_Arbitrum} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol"; -import {VRFV2PlusWrapper_Arbitrum} from "../dev/VRFV2PlusWrapper_Arbitrum.sol"; + import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; +import {VRFV2PlusWrapper_Arbitrum} from "../dev/VRFV2PlusWrapper_Arbitrum.sol"; +import {ExposedVRFCoordinatorV2_5_Arbitrum} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Arbitrum.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract VRFV2PlusWrapperArbitrumTest is BaseTest { /// @dev ARBGAS_ADDR is the address of the ArbGasInfo precompile on Arbitrum. @@ -44,10 +45,7 @@ contract VRFV2PlusWrapperArbitrumTest is BaseTest { // Deploy wrapper. s_wrapper = new VRFV2PlusWrapper_Arbitrum( - address(s_linkToken), - address(s_linkNativeFeed), - address(s_testCoordinator), - uint256(s_wrapperSubscriptionId) + address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(s_wrapperSubscriptionId) ); // Configure the wrapper. diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol index 26cc5a213e..24d5385243 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol @@ -1,14 +1,15 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; + +import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; +import {VRFV2PlusWrapper} from "../dev/VRFV2PlusWrapper.sol"; import {ExposedVRFCoordinatorV2_5} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5.sol"; import {VRFCoordinatorV2Plus_V2Example} from "../dev/testhelpers/VRFCoordinatorV2Plus_V2Example.sol"; import {VRFV2PlusWrapperConsumerExample} from "../dev/testhelpers/VRFV2PlusWrapperConsumerExample.sol"; -import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; -import {VRFV2PlusWrapper} from "../dev/VRFV2PlusWrapper.sol"; +import {BaseTest} from "./BaseTest.t.sol"; contract VRFV2PlusWrapper_MigrationTest is BaseTest { address internal constant LINK_WHALE = 0xD883a6A1C22fC4AbFE938a5aDF9B2Cc31b1BF18B; @@ -52,10 +53,7 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { // Deploy wrapper. s_wrapper = new VRFV2PlusWrapper( - address(s_linkToken), - address(s_linkNativeFeed), - address(s_testCoordinator), - uint256(s_wrapperSubscriptionId) + address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(s_wrapperSubscriptionId) ); // Add wrapper as a consumer to the wrapper's subscription. @@ -171,13 +169,8 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { s_testCoordinator.fundSubscriptionWithNative{value: DEFAULT_NATIVE_FUNDING}(s_wrapperSubscriptionId); // subscription exists in V1 coordinator before migration - ( - uint96 balance, - uint96 nativeBalance, - uint64 reqCount, - address owner, - address[] memory consumers - ) = s_testCoordinator.getSubscription(s_wrapperSubscriptionId); + (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers) = + s_testCoordinator.getSubscription(s_wrapperSubscriptionId); assertEq(reqCount, 0); assertEq(balance, DEFAULT_LINK_FUNDING); assertEq(nativeBalance, DEFAULT_NATIVE_FUNDING); @@ -243,7 +236,7 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { assertEq(native, false); assertEq(s_linkToken.balanceOf(address(s_consumer)), DEFAULT_LINK_FUNDING - expectedPaid); - (, uint256 gasLimit, ) = s_wrapper.s_callbacks(requestId); + (, uint256 gasLimit,) = s_wrapper.s_callbacks(requestId); assertEq(gasLimit, callbackGasLimit); vm.stopPrank(); @@ -285,13 +278,8 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { s_testCoordinator.fundSubscriptionWithNative{value: DEFAULT_NATIVE_FUNDING}(s_wrapperSubscriptionId); // subscription exists in V1 coordinator before migration - ( - uint96 balance, - uint96 nativeBalance, - uint64 reqCount, - address owner, - address[] memory consumers - ) = s_testCoordinator.getSubscription(s_wrapperSubscriptionId); + (uint96 balance, uint96 nativeBalance, uint64 reqCount, address owner, address[] memory consumers) = + s_testCoordinator.getSubscription(s_wrapperSubscriptionId); assertEq(reqCount, 0); assertEq(balance, DEFAULT_LINK_FUNDING); assertEq(nativeBalance, DEFAULT_NATIVE_FUNDING); @@ -358,7 +346,7 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { assertEq(native, true); assertEq(address(s_consumer).balance, DEFAULT_NATIVE_FUNDING - expectedPaid); - (, uint256 gasLimit, ) = s_wrapper.s_callbacks(requestId); + (, uint256 gasLimit,) = s_wrapper.s_callbacks(requestId); assertEq(gasLimit, callbackGasLimit); vm.stopPrank(); diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol index de56a9a7e2..00bd76b78b 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol @@ -1,13 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BaseTest} from "./BaseTest.t.sol"; import {MockLinkToken} from "../../functions/tests/v1_X/testhelpers/MockLinkToken.sol"; import {MockV3Aggregator} from "../../shared/mocks/MockV3Aggregator.sol"; -import {ExposedVRFCoordinatorV2_5_Optimism} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol"; -import {VRFV2PlusWrapper_Optimism} from "../dev/VRFV2PlusWrapper_Optimism.sol"; + +import {GasPriceOracle as OVM_GasPriceOracle} from + "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; import {OptimismL1Fees} from "../dev/OptimismL1Fees.sol"; -import {GasPriceOracle as OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts-bedrock/v0.17.3/src/L2/GasPriceOracle.sol"; +import {VRFV2PlusWrapper_Optimism} from "../dev/VRFV2PlusWrapper_Optimism.sol"; +import {ExposedVRFCoordinatorV2_5_Optimism} from "../dev/testhelpers/ExposedVRFCoordinatorV2_5_Optimism.sol"; +import {BaseTest} from "./BaseTest.t.sol"; + import {VmSafe} from "forge-std/Vm.sol"; contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { @@ -57,10 +60,7 @@ contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { // Deploy wrapper. s_wrapper = new VRFV2PlusWrapper_Optimism( - address(s_linkToken), - address(s_linkNativeFeed), - address(s_testCoordinator), - uint256(s_wrapperSubscriptionId) + address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(s_wrapperSubscriptionId) ); // Configure the wrapper. @@ -97,24 +97,14 @@ contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { function _mockGasOraclePriceFeeMethods() internal { // these values are taken from an example transaction on Base Sepolia vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), - abi.encode(64273426165) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), abi.encode(64273426165) ); + vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("baseFeeScalar()"))), abi.encode(1101)); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("baseFeeScalar()"))), - abi.encode(1101) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), abi.encode(659851) ); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), - abi.encode(659851) - ); - vm.mockCall( - OVM_GASPRICEORACLE_ADDR, - abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), - abi.encode(2126959908362) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), abi.encode(2126959908362) ); vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("decimals()"))), abi.encode(6)); } diff --git a/contracts/src/v0.8/vrf/testhelpers/ChainSpecificUtilHelper.sol b/contracts/src/v0.8/vrf/testhelpers/ChainSpecificUtilHelper.sol index 96a088a652..4f5201bdc4 100644 --- a/contracts/src/v0.8/vrf/testhelpers/ChainSpecificUtilHelper.sol +++ b/contracts/src/v0.8/vrf/testhelpers/ChainSpecificUtilHelper.sol @@ -5,7 +5,9 @@ import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; /// @dev A helper contract that exposes ChainSpecificUtil methods for testing contract ChainSpecificUtilHelper { - function getBlockhash(uint64 blockNumber) external view returns (bytes32) { + function getBlockhash( + uint64 blockNumber + ) external view returns (bytes32) { return ChainSpecificUtil._getBlockhash(blockNumber); } @@ -13,11 +15,15 @@ contract ChainSpecificUtilHelper { return ChainSpecificUtil._getBlockNumber(); } - function getCurrentTxL1GasFees(string memory txCallData) external view returns (uint256) { + function getCurrentTxL1GasFees( + string memory txCallData + ) external view returns (uint256) { return ChainSpecificUtil._getCurrentTxL1GasFees(bytes(txCallData)); } - function getL1CalldataGasCost(uint256 calldataSize) external view returns (uint256) { + function getL1CalldataGasCost( + uint256 calldataSize + ) external view returns (uint256) { return ChainSpecificUtil._getL1CalldataGasCost(calldataSize); } } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFConsumer.sol b/contracts/src/v0.8/vrf/testhelpers/VRFConsumer.sol index eaac0be11b..b7e2b7f5ca 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFConsumer.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFConsumer.sol @@ -17,7 +17,7 @@ contract VRFConsumer is VRFConsumerBase { /* empty */ } - function fulfillRandomness(bytes32 /* requestId */, uint256 randomness) internal override { + function fulfillRandomness(bytes32, /* requestId */ uint256 randomness) internal override { randomnessOutput = randomness; requestId = requestId; } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2.sol b/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2.sol index e2502fad3e..b88b010ad8 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; contract VRFConsumerV2 is VRFConsumerBaseV2 { uint256[] public s_randomWords; @@ -25,7 +26,9 @@ contract VRFConsumerV2 is VRFConsumerBaseV2 { s_randomWords = randomWords; } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = COORDINATOR.createSubscription(); COORDINATOR.addConsumer(s_subId, address(this)); @@ -34,13 +37,17 @@ contract VRFConsumerV2 is VRFConsumerBaseV2 { LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { require(s_subId != 0, "sub not set"); // Approve the link transfer. LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { COORDINATOR.addConsumer(s_subId, consumers[i]); diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2Plus.sol b/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2Plus.sol index f0acade0bb..fc32ac8025 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2Plus.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2Plus.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {VRFConsumerBaseV2Plus} from "../dev/VRFConsumerBaseV2Plus.sol"; import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../dev/interfaces/IVRFCoordinatorV2Plus.sol"; import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; -import {VRFConsumerBaseV2Plus} from "../dev/VRFConsumerBaseV2Plus.sol"; -import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; contract VRFConsumerV2Plus is VRFConsumerBaseV2Plus { uint256[] public s_randomWords; @@ -26,7 +26,9 @@ contract VRFConsumerV2Plus is VRFConsumerBaseV2Plus { s_randomWords = randomWords; } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = COORDINATOR.createSubscription(); COORDINATOR.addConsumer(s_subId, address(this)); @@ -35,20 +37,26 @@ contract VRFConsumerV2Plus is VRFConsumerBaseV2Plus { LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { require(s_subId != 0, "sub not set"); // Approve the link transfer. LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { COORDINATOR.addConsumer(s_subId, consumers[i]); } } - function requestRandomness(VRFV2PlusClient.RandomWordsRequest calldata req) external returns (uint256) { + function requestRandomness( + VRFV2PlusClient.RandomWordsRequest calldata req + ) external returns (uint256) { s_requestId = COORDINATOR.requestRandomWords(req); return s_requestId; } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2UpgradeableExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2UpgradeableExample.sol index 930cebf46d..51920f041d 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2UpgradeableExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFConsumerV2UpgradeableExample.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {VRFConsumerBaseV2Upgradeable} from "../dev/VRFConsumerBaseV2Upgradeable.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; contract VRFConsumerV2UpgradeableExample is Initializable, VRFConsumerBaseV2Upgradeable { @@ -27,7 +28,9 @@ contract VRFConsumerV2UpgradeableExample is Initializable, VRFConsumerBaseV2Upgr s_randomWords = randomWords; } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = COORDINATOR.createSubscription(); COORDINATOR.addConsumer(s_subId, address(this)); @@ -36,13 +39,17 @@ contract VRFConsumerV2UpgradeableExample is Initializable, VRFConsumerBaseV2Upgr LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { require(s_subId != 0, "sub not set"); // Approve the link transfer. LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { COORDINATOR.addConsumer(s_subId, consumers[i]); diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol b/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol index 5c42a4070d..5bddbf1932 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol @@ -1,15 +1,16 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {BlockhashStoreInterface} from "../interfaces/BlockhashStoreInterface.sol"; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {AggregatorV3Interface} from "../../shared/interfaces/AggregatorV3Interface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; -import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; +import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; + import {VRF} from "../VRF.sol"; -import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {BlockhashStoreInterface} from "../interfaces/BlockhashStoreInterface.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinatorV2Interface, IERC677Receiver { LinkTokenInterface public immutable LINK; @@ -31,15 +32,18 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi error PendingRequestExists(); error MustBeRequestedOwner(address proposedOwner); error BalanceInvariantViolated(uint256 internalBalance, uint256 externalBalance); // Should never happen + event FundsRecovered(address to, uint256 amount); // We use the subscription struct (1 word) // at fulfillment time. + struct Subscription { // There are only 1e9*1e18 = 1e27 juels in existence, so the balance can fit in uint96 (2^96 ~ 7e28) uint96 balance; // Common link balance used for all consumer requests. uint64 reqCount; // For fee tiers } // We use the config for the mgmt APIs + struct SubscriptionConfig { address owner; // Owner can fund/withdraw/cancel the sub. address requestedOwner; // For safely transferring sub ownership. @@ -52,6 +56,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi address[] consumers; } // Note a nonce of 0 indicates an the consumer is not assigned to that subscription. + mapping(address => mapping(uint64 => uint64)) /* consumer */ /* subId */ /* nonce */ private s_consumers; mapping(uint64 => SubscriptionConfig) /* subId */ /* subscriptionConfig */ private s_subscriptionConfigs; mapping(uint64 => Subscription) /* subId */ /* subscription */ private s_subscriptions; @@ -63,6 +68,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi // A discrepancy with this contract's link balance indicates someone // sent tokens using transfer and so we may need to use recoverFunds. uint96 private s_totalBalance; + event SubscriptionCreated(uint64 indexed subId, address owner); event SubscriptionFunded(uint64 indexed subId, uint256 oldBalance, uint256 newBalance); event SubscriptionConsumerAdded(uint64 indexed subId, address consumer); @@ -78,6 +84,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); error NumWordsTooBig(uint32 have, uint32 want); @@ -98,10 +105,12 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi uint32 numWords; address sender; } + mapping(bytes32 => address) /* keyHash */ /* oracle */ private s_provingKeys; bytes32[] private s_provingKeyHashes; mapping(address => uint96) /* oracle */ /* LINK balance */ private s_withdrawableTokens; mapping(uint256 => bytes32) /* requestID */ /* commitment */ private s_requestCommitments; + event ProvingKeyRegistered(bytes32 keyHash, address indexed oracle); event ProvingKeyDeregistered(bytes32 keyHash, address indexed oracle); event RandomWordsRequested( @@ -128,9 +137,11 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi // We make it configurable in case those operations are repriced. uint32 gasAfterPaymentCalculation; } + int256 private s_fallbackWeiPerUnitLink; Config private s_config; FeeConfig private s_feeConfig; + struct FeeConfig { // Flat fee charged per fulfillment in millionths of link // So fee range is [0, 2^32/10^6]. @@ -144,6 +155,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi uint24 reqsForTier4; uint24 reqsForTier5; } + event ConfigSet( uint16 minimumRequestConfirmations, uint32 maxGasLimit, @@ -178,7 +190,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @notice Deregisters a proving key to an oracle. * @param publicProvingKey key that oracle can use to submit vrf fulfillments */ - function deregisterProvingKey(uint256[2] calldata publicProvingKey) external onlyOwner { + function deregisterProvingKey( + uint256[2] calldata publicProvingKey + ) external onlyOwner { bytes32 kh = hashOfKey(publicProvingKey); address oracle = s_provingKeys[kh]; if (oracle == address(0)) { @@ -200,7 +214,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @notice Returns the proving key hash key associated with this public key * @param publicKey the key to return the hash of */ - function hashOfKey(uint256[2] memory publicKey) public pure returns (bytes32) { + function hashOfKey( + uint256[2] memory publicKey + ) public pure returns (bytes32) { return keccak256(abi.encode(publicKey)); } @@ -223,9 +239,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi ) external onlyOwner { if (minimumRequestConfirmations > MAX_REQUEST_CONFIRMATIONS) { revert InvalidRequestConfirmations( - minimumRequestConfirmations, - minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + minimumRequestConfirmations, minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } if (fallbackWeiPerUnitLink <= 0) { @@ -309,7 +323,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @param subId subscription id * @dev notably can be called even if there are pending requests, outstanding ones may fail onchain */ - function ownerCancelSubscription(uint64 subId) external onlyOwner { + function ownerCancelSubscription( + uint64 subId + ) external onlyOwner { if (s_subscriptionConfigs[subId].owner == address(0)) { revert InvalidSubscription(); } @@ -320,7 +336,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @notice Recover link sent with transfer instead of transferAndCall. * @param to address to send link to */ - function recoverFunds(address to) external onlyOwner { + function recoverFunds( + address to + ) external onlyOwner { uint256 externalBalance = LINK.balanceOf(address(this)); uint256 internalBalance = uint256(s_totalBalance); if (internalBalance > externalBalance) { @@ -363,13 +381,10 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi revert InvalidConsumer(subId, msg.sender); } // Input validation using the config storage word. - if ( - requestConfirmations < s_config.minimumRequestConfirmations || requestConfirmations > MAX_REQUEST_CONFIRMATIONS - ) { + if (requestConfirmations < s_config.minimumRequestConfirmations || requestConfirmations > MAX_REQUEST_CONFIRMATIONS) + { revert InvalidRequestConfirmations( - requestConfirmations, - s_config.minimumRequestConfirmations, - MAX_REQUEST_CONFIRMATIONS + requestConfirmations, s_config.minimumRequestConfirmations, MAX_REQUEST_CONFIRMATIONS ); } // No lower bound on the requested gas limit. A user could request 0 @@ -387,18 +402,10 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi uint64 nonce = currentNonce + 1; (uint256 requestId, uint256 preSeed) = computeRequestId(keyHash, msg.sender, subId, nonce); - s_requestCommitments[requestId] = keccak256( - abi.encode(requestId, block.number, subId, callbackGasLimit, numWords, msg.sender) - ); + s_requestCommitments[requestId] = + keccak256(abi.encode(requestId, block.number, subId, callbackGasLimit, numWords, msg.sender)); emit RandomWordsRequested( - keyHash, - requestId, - preSeed, - subId, - requestConfirmations, - callbackGasLimit, - numWords, - msg.sender + keyHash, requestId, preSeed, subId, requestConfirmations, callbackGasLimit, numWords, msg.sender ); s_consumers[msg.sender][subId] = nonce; @@ -410,7 +417,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @param requestId id of request * @dev used to determine if a request is fulfilled or not */ - function getCommitment(uint256 requestId) external view returns (bytes32) { + function getCommitment( + uint256 requestId + ) external view returns (bytes32) { return s_requestCommitments[requestId]; } @@ -438,19 +447,13 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi // as we do not want to provide them with less, however that check itself costs // gas. GAS_FOR_CALL_EXACT_CHECK ensures we have at least enough gas to be able // to revert if gasAmount > 63//64*gas available. - if lt(g, GAS_FOR_CALL_EXACT_CHECK) { - revert(0, 0) - } + if lt(g, GAS_FOR_CALL_EXACT_CHECK) { revert(0, 0) } g := sub(g, GAS_FOR_CALL_EXACT_CHECK) // if g - g//64 <= gasAmount, revert // (we subtract g//64 because of EIP-150) - if iszero(gt(sub(g, div(g, 64)), gasAmount)) { - revert(0, 0) - } + if iszero(gt(sub(g, div(g, 64)), gasAmount)) { revert(0, 0) } // solidity calls check that a contract actually exists at the destination, so we do the same - if iszero(extcodesize(target)) { - revert(0, 0) - } + if iszero(extcodesize(target)) { revert(0, 0) } // call and return whether we succeeded. ignore return data // call(gas,addr,value,argsOffset,argsLength,retOffset,retLength) success := call(gasAmount, target, 0, add(data, 0x20), mload(data), 0, 0) @@ -497,7 +500,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @param reqCount number of requests * @return feePPM fee in LINK PPM */ - function getFeeTier(uint64 reqCount) public view returns (uint32) { + function getFeeTier( + uint64 reqCount + ) public view returns (uint32) { FeeConfig memory fc = s_feeConfig; if (0 <= reqCount && reqCount <= fc.reqsForTier2) { return fc.fulfillmentFlatFeeLinkPPMTier1; @@ -556,12 +561,8 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi // We also add the flat link fee to the payment amount. // Its specified in millionths of link, if s_config.fulfillmentFlatFeeLinkPPM = 1 // 1 link / 1e6 = 1e18 juels / 1e6 = 1e12 juels. - uint96 payment = calculatePaymentAmount( - startGas, - s_config.gasAfterPaymentCalculation, - getFeeTier(reqCount), - tx.gasprice - ); + uint96 payment = + calculatePaymentAmount(startGas, s_config.gasAfterPaymentCalculation, getFeeTier(reqCount), tx.gasprice); if (s_subscriptions[rc.subId].balance < payment) { revert InsufficientBalance(); } @@ -585,8 +586,8 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi revert InvalidLinkWeiPrice(weiPerUnitLink); } // (1e18 juels/link) (wei/gas * gas) / (wei/link) = juels - uint256 paymentNoFee = (1e18 * weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft())) / - uint256(weiPerUnitLink); + uint256 paymentNoFee = + (1e18 * weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft())) / uint256(weiPerUnitLink); uint256 fee = 1e12 * uint256(fulfillmentFlatFeeLinkPPM); if (paymentNoFee > (1e27 - fee)) { revert PaymentTooLarge(); // Payment + fee cannot be more than all of the link in existence. @@ -599,7 +600,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 weiPerUnitLink; - (, weiPerUnitLink, , timestamp, ) = LINK_ETH_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_ETH_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (staleFallback && stalenessSeconds < block.timestamp - timestamp) { weiPerUnitLink = s_fallbackWeiPerUnitLink; @@ -623,7 +624,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi } } - function onTokenTransfer(address /* sender */, uint256 amount, bytes calldata data) external override nonReentrant { + function onTokenTransfer(address, /* sender */ uint256 amount, bytes calldata data) external override nonReentrant { if (msg.sender != address(LINK)) { revert OnlyCallableFromLink(); } @@ -671,11 +672,8 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi uint64 currentSubId = s_currentSubId; address[] memory consumers = new address[](0); s_subscriptions[currentSubId] = Subscription({balance: 0, reqCount: 0}); - s_subscriptionConfigs[currentSubId] = SubscriptionConfig({ - owner: msg.sender, - requestedOwner: address(0), - consumers: consumers - }); + s_subscriptionConfigs[currentSubId] = + SubscriptionConfig({owner: msg.sender, requestedOwner: address(0), consumers: consumers}); emit SubscriptionCreated(currentSubId, msg.sender); return currentSubId; @@ -698,7 +696,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi /** * @inheritdoc VRFCoordinatorV2Interface */ - function acceptSubscriptionOwnerTransfer(uint64 subId) external override nonReentrant { + function acceptSubscriptionOwnerTransfer( + uint64 subId + ) external override nonReentrant { if (s_subscriptionConfigs[subId].owner == address(0)) { revert InvalidSubscription(); } @@ -788,15 +788,14 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi * @dev Looping is bounded to MAX_CONSUMERS*(number of keyhashes). * @dev Used to disable subscription canceling while outstanding request are present. */ - function pendingRequestExists(uint64 subId) public view override returns (bool) { + function pendingRequestExists( + uint64 subId + ) public view override returns (bool) { SubscriptionConfig memory subConfig = s_subscriptionConfigs[subId]; for (uint256 i = 0; i < subConfig.consumers.length; i++) { for (uint256 j = 0; j < s_provingKeyHashes.length; j++) { - (uint256 reqId, ) = computeRequestId( - s_provingKeyHashes[j], - subConfig.consumers[i], - subId, - s_consumers[subConfig.consumers[i]][subId] + (uint256 reqId,) = computeRequestId( + s_provingKeyHashes[j], subConfig.consumers[i], subId, s_consumers[subConfig.consumers[i]][subId] ); if (s_requestCommitments[reqId] != 0) { return true; @@ -806,7 +805,9 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi return false; } - modifier onlySubOwner(uint64 subId) { + modifier onlySubOwner( + uint64 subId + ) { address owner = s_subscriptionConfigs[subId].owner; if (owner == address(0)) { revert InvalidSubscription(); diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorV2TestHelper.sol b/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorV2TestHelper.sol index c5d1d90c12..d94ffa7ced 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorV2TestHelper.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorV2TestHelper.sol @@ -22,6 +22,7 @@ contract VRFCoordinatorV2TestHelper { // We make it configurable in case those operations are repriced. uint32 gasAfterPaymentCalculation; } + int256 private s_fallbackWeiPerUnitLink; Config private s_config; @@ -36,12 +37,8 @@ contract VRFCoordinatorV2TestHelper { uint32 fulfillmentFlatFeeLinkPPM, uint256 weiPerUnitGas ) external { - s_paymentAmount = calculatePaymentAmount( - gasleft(), - gasAfterPaymentCalculation, - fulfillmentFlatFeeLinkPPM, - weiPerUnitGas - ); + s_paymentAmount = + calculatePaymentAmount(gasleft(), gasAfterPaymentCalculation, fulfillmentFlatFeeLinkPPM, weiPerUnitGas); } error InvalidLinkWeiPrice(int256 linkWei); @@ -52,7 +49,7 @@ contract VRFCoordinatorV2TestHelper { bool staleFallback = stalenessSeconds > 0; uint256 timestamp; int256 weiPerUnitLink; - (, weiPerUnitLink, , timestamp, ) = LINK_ETH_FEED.latestRoundData(); + (, weiPerUnitLink,, timestamp,) = LINK_ETH_FEED.latestRoundData(); // solhint-disable-next-line not-rely-on-time if (staleFallback && stalenessSeconds < block.timestamp - timestamp) { weiPerUnitLink = s_fallbackWeiPerUnitLink; @@ -73,8 +70,8 @@ contract VRFCoordinatorV2TestHelper { revert InvalidLinkWeiPrice(weiPerUnitLink); } // (1e18 juels/link) (wei/gas * gas) / (wei/link) = juels - uint256 paymentNoFee = (1e18 * weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft())) / - uint256(weiPerUnitLink); + uint256 paymentNoFee = + (1e18 * weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft())) / uint256(weiPerUnitLink); uint256 fee = 1e12 * uint256(fulfillmentFlatFeeLinkPPM); if (paymentNoFee > (1e27 - fee)) { revert PaymentTooLarge(); // Payment + fee cannot be more than all of the link in existence. diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFExternalSubOwnerExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFExternalSubOwnerExample.sol index ee2a71df71..2d6c8c1f4e 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFExternalSubOwnerExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFExternalSubOwnerExample.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; contract VRFExternalSubOwnerExample is VRFConsumerBaseV2 { VRFCoordinatorV2Interface internal COORDINATOR; @@ -35,7 +36,9 @@ contract VRFExternalSubOwnerExample is VRFConsumerBaseV2 { s_requestId = COORDINATOR.requestRandomWords(keyHash, subId, requestConfirmations, callbackGasLimit, numWords); } - function transferOwnership(address newOwner) external onlyOwner { + function transferOwnership( + address newOwner + ) external onlyOwner { s_owner = newOwner; } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestExternalSubOwner.sol b/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestExternalSubOwner.sol index 0193e3f67f..8f4beb52d7 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestExternalSubOwner.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestExternalSubOwner.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; +import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; -import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; /** * @title The VRFLoadTestExternalSubOwner contract. diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestOwnerlessConsumer.sol b/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestOwnerlessConsumer.sol index a967c8a565..cb35b00819 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestOwnerlessConsumer.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFLoadTestOwnerlessConsumer.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {VRFConsumerBase} from "../VRFConsumerBase.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {VRFConsumerBase} from "../VRFConsumerBase.sol"; /** * @title The VRFLoadTestOwnerlessConsumer contract. diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol b/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol index be416e9a5c..ab582deef4 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; contract VRFMaliciousConsumerV2 is VRFConsumerBaseV2 { uint256[] public s_randomWords; @@ -27,7 +28,9 @@ contract VRFMaliciousConsumerV2 is VRFConsumerBaseV2 { COORDINATOR.requestRandomWords(s_keyHash, s_subId, 1, 200000, 1); } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = COORDINATOR.createSubscription(); COORDINATOR.addConsumer(s_subId, address(this)); @@ -36,14 +39,18 @@ contract VRFMaliciousConsumerV2 is VRFConsumerBaseV2 { LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { COORDINATOR.addConsumer(s_subId, consumers[i]); } } - function requestRandomness(bytes32 keyHash) external returns (uint256) { + function requestRandomness( + bytes32 keyHash + ) external returns (uint256) { s_keyHash = keyHash; return COORDINATOR.requestRandomWords(keyHash, s_subId, 1, 500000, 1); } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFMockETHLINKAggregator.sol b/contracts/src/v0.8/vrf/testhelpers/VRFMockETHLINKAggregator.sol index 4052c0d0a2..d0a9e902dc 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFMockETHLINKAggregator.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFMockETHLINKAggregator.sol @@ -7,7 +7,9 @@ contract VRFMockETHLINKAggregator is AggregatorV3Interface { int256 public answer; uint256 private blockTimestampDeduction = 0; - constructor(int256 _answer) { + constructor( + int256 _answer + ) { answer = _answer; } @@ -47,7 +49,9 @@ contract VRFMockETHLINKAggregator is AggregatorV3Interface { return block.timestamp - blockTimestampDeduction; } - function setBlockTimestampDeduction(uint256 _blockTimestampDeduction) external { + function setBlockTimestampDeduction( + uint256 _blockTimestampDeduction + ) external { blockTimestampDeduction = _blockTimestampDeduction; } } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFOwnerlessConsumerExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFOwnerlessConsumerExample.sol index a641267597..4425102eb2 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFOwnerlessConsumerExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFOwnerlessConsumerExample.sol @@ -3,8 +3,8 @@ // contract. pragma solidity ^0.8.4; -import {VRFConsumerBase} from "../VRFConsumerBase.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; +import {VRFConsumerBase} from "../VRFConsumerBase.sol"; contract VRFOwnerlessConsumerExample is VRFConsumerBase, IERC677Receiver { uint256 public s_randomnessOutput; @@ -27,7 +27,7 @@ contract VRFOwnerlessConsumerExample is VRFConsumerBase, IERC677Receiver { * @param _amount The amount of LINK transferred to pay for this request. * @param _data The data passed to transferAndCall on LinkToken. Must be an abi-encoded key hash. */ - function onTokenTransfer(address /* sender */, uint256 _amount, bytes calldata _data) external override { + function onTokenTransfer(address, /* sender */ uint256 _amount, bytes calldata _data) external override { if (msg.sender != address(LINK)) { revert OnlyCallableFromLink(); } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFSingleConsumerExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFSingleConsumerExample.sol index 303394ee88..a48e8e4efb 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFSingleConsumerExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFSingleConsumerExample.sol @@ -3,8 +3,9 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; contract VRFSingleConsumerExample is VRFConsumerBaseV2 { VRFCoordinatorV2Interface internal COORDINATOR; @@ -17,6 +18,7 @@ contract VRFSingleConsumerExample is VRFConsumerBaseV2 { uint32 numWords; bytes32 keyHash; } + RequestConfig public s_requestConfig; uint256[] public s_randomWords; uint256 public s_requestId; @@ -52,34 +54,28 @@ contract VRFSingleConsumerExample is VRFConsumerBaseV2 { function requestRandomWords() external onlyOwner { RequestConfig memory rc = s_requestConfig; // Will revert if subscription is not set and funded. - s_requestId = COORDINATOR.requestRandomWords( - rc.keyHash, - rc.subId, - rc.requestConfirmations, - rc.callbackGasLimit, - rc.numWords - ); + s_requestId = + COORDINATOR.requestRandomWords(rc.keyHash, rc.subId, rc.requestConfirmations, rc.callbackGasLimit, rc.numWords); } // Assumes this contract owns link // This method is analogous to VRFv1, except the amount // should be selected based on the keyHash (each keyHash functions like a "gas lane" // with different link costs). - function fundAndRequestRandomWords(uint256 amount) external onlyOwner { + function fundAndRequestRandomWords( + uint256 amount + ) external onlyOwner { RequestConfig memory rc = s_requestConfig; LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_requestConfig.subId)); // Will revert if subscription is not set and funded. - s_requestId = COORDINATOR.requestRandomWords( - rc.keyHash, - rc.subId, - rc.requestConfirmations, - rc.callbackGasLimit, - rc.numWords - ); + s_requestId = + COORDINATOR.requestRandomWords(rc.keyHash, rc.subId, rc.requestConfirmations, rc.callbackGasLimit, rc.numWords); } // Assumes this contract owns link - function topUpSubscription(uint256 amount) external onlyOwner { + function topUpSubscription( + uint256 amount + ) external onlyOwner { LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_requestConfig.subId)); } @@ -87,7 +83,9 @@ contract VRFSingleConsumerExample is VRFConsumerBaseV2 { LINKTOKEN.transfer(to, amount); } - function unsubscribe(address to) external onlyOwner { + function unsubscribe( + address to + ) external onlyOwner { // Returns funds to this address COORDINATOR.cancelSubscription(s_requestConfig.subId, to); s_requestConfig.subId = 0; diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFTestHelper.sol b/contracts/src/v0.8/vrf/testhelpers/VRFTestHelper.sol index 4b794d483e..427b63c3e1 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFTestHelper.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFTestHelper.sol @@ -3,24 +3,31 @@ pragma solidity ^0.8.0; import {VRF} from "../VRF.sol"; -/** *********************************************************************** - @notice Testing harness for VRF.sol, exposing its internal methods. Not to - @notice be used for production. -*/ +/** + * + * @notice Testing harness for VRF.sol, exposing its internal methods. Not to + * @notice be used for production. + */ contract VRFTestHelper is VRF { function bigModExp_(uint256 base, uint256 exponent) public view returns (uint256) { return super._bigModExp(base, exponent); } - function squareRoot_(uint256 x) public view returns (uint256) { + function squareRoot_( + uint256 x + ) public view returns (uint256) { return super._squareRoot(x); } - function ySquared_(uint256 x) public pure returns (uint256) { + function ySquared_( + uint256 x + ) public pure returns (uint256) { return super._ySquared(x); } - function fieldHash_(bytes memory b) public pure returns (uint256) { + function fieldHash_( + bytes memory b + ) public pure returns (uint256) { return super._fieldHash(b); } @@ -80,7 +87,9 @@ contract VRFTestHelper is VRF { return super._scalarFromCurvePoints(hash, pk, gamma, uWitness, v); } - function isOnCurve_(uint256[2] memory p) public pure returns (bool) { + function isOnCurve_( + uint256[2] memory p + ) public pure returns (bool) { return super._isOnCurve(p); } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2LoadTestWithMetrics.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2LoadTestWithMetrics.sol index 3e9e7bfc47..e4f57c2f60 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2LoadTestWithMetrics.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2LoadTestWithMetrics.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; -import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; -import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; +import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; /** * @title The VRFLoadTestExternalSubOwner contract. @@ -26,15 +26,17 @@ contract VRFV2LoadTestWithMetrics is VRFConsumerBaseV2 { struct RequestStatus { bool fulfilled; uint256[] randomWords; - uint requestTimestamp; - uint fulfilmentTimestamp; + uint256 requestTimestamp; + uint256 fulfilmentTimestamp; uint256 requestBlockNumber; uint256 fulfilmentBlockNumber; } mapping(uint256 => RequestStatus) /* requestId */ /* requestStatus */ public s_requests; - constructor(address _vrfCoordinator) VRFConsumerBaseV2(_vrfCoordinator) { + constructor( + address _vrfCoordinator + ) VRFConsumerBaseV2(_vrfCoordinator) { COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator); } @@ -108,8 +110,8 @@ contract VRFV2LoadTestWithMetrics is VRFConsumerBaseV2 { returns ( bool fulfilled, uint256[] memory randomWords, - uint requestTimestamp, - uint fulfilmentTimestamp, + uint256 requestTimestamp, + uint256 fulfilmentTimestamp, uint256 requestBlockNumber, uint256 fulfilmentBlockNumber ) @@ -134,13 +136,8 @@ contract VRFV2LoadTestWithMetrics is VRFConsumerBaseV2 { uint16 _requestCount ) internal { for (uint16 i = 0; i < _requestCount; i++) { - uint256 requestId = COORDINATOR.requestRandomWords( - _keyHash, - _subId, - _requestConfirmations, - _callbackGasLimit, - _numWords - ); + uint256 requestId = + COORDINATOR.requestRandomWords(_keyHash, _subId, _requestConfirmations, _callbackGasLimit, _numWords); s_lastRequestId = requestId; uint256 requestBlockNumber = ChainSpecificUtil._getBlockNumber(); s_requests[requestId] = RequestStatus({ diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2OwnerTestConsumer.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2OwnerTestConsumer.sol index c0c1c659fe..a84080d9b5 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2OwnerTestConsumer.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2OwnerTestConsumer.sol @@ -1,11 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; -import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; -import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; + import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; +import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; +import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; contract VRFV2OwnerTestConsumer is VRFConsumerBaseV2, ConfirmedOwner { VRFCoordinatorV2Interface public COORDINATOR; @@ -24,8 +25,8 @@ contract VRFV2OwnerTestConsumer is VRFConsumerBaseV2, ConfirmedOwner { struct RequestStatus { bool fulfilled; uint256[] randomWords; - uint requestTimestamp; - uint fulfilmentTimestamp; + uint256 requestTimestamp; + uint256 fulfilmentTimestamp; uint256 requestBlockNumber; uint256 fulfilmentBlockNumber; } @@ -74,13 +75,8 @@ contract VRFV2OwnerTestConsumer is VRFConsumerBaseV2, ConfirmedOwner { emit SubscriptionCreatedFundedAndConsumerAdded(subId, address(this), _subTopUpAmount); for (uint16 i = 0; i < _requestCount; i++) { - uint256 requestId = COORDINATOR.requestRandomWords( - _keyHash, - subId, - _requestConfirmations, - _callbackGasLimit, - _numWords - ); + uint256 requestId = + COORDINATOR.requestRandomWords(_keyHash, subId, _requestConfirmations, _callbackGasLimit, _numWords); s_lastRequestId = requestId; uint256 requestBlockNumber = ChainSpecificUtil._getBlockNumber(); s_requests[requestId] = RequestStatus({ @@ -115,8 +111,8 @@ contract VRFV2OwnerTestConsumer is VRFConsumerBaseV2, ConfirmedOwner { returns ( bool fulfilled, uint256[] memory randomWords, - uint requestTimestamp, - uint fulfilmentTimestamp, + uint256 requestTimestamp, + uint256 fulfilmentTimestamp, uint256 requestBlockNumber, uint256 fulfilmentBlockNumber ) @@ -132,7 +128,9 @@ contract VRFV2OwnerTestConsumer is VRFConsumerBaseV2, ConfirmedOwner { ); } - function topUpSubscription(uint256 amount) public onlyOwner { + function topUpSubscription( + uint256 amount + ) public onlyOwner { LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(subId)); } } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2ProxyAdmin.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2ProxyAdmin.sol index c7b7a5f09e..a056ce96bc 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2ProxyAdmin.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2ProxyAdmin.sol @@ -4,5 +4,5 @@ pragma solidity ^0.8.0; import "@openzeppelin/contracts@4.9.6/proxy/transparent/ProxyAdmin.sol"; contract VRFV2ProxyAdmin is ProxyAdmin { - // Nothing here, this is just to generate the gethwrapper for tests. +// Nothing here, this is just to generate the gethwrapper for tests. } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2RevertingExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2RevertingExample.sol index 3d9cf30e34..15cbb84fc1 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2RevertingExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2RevertingExample.sol @@ -2,8 +2,9 @@ pragma solidity ^0.8.0; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; + import {VRFConsumerBaseV2} from "../VRFConsumerBaseV2.sol"; +import {VRFCoordinatorV2Interface} from "../interfaces/VRFCoordinatorV2Interface.sol"; // VRFV2RevertingExample will always revert. Used for testing only, useless in prod. contract VRFV2RevertingExample is VRFConsumerBaseV2 { @@ -24,7 +25,9 @@ contract VRFV2RevertingExample is VRFConsumerBaseV2 { revert(); } - function createSubscriptionAndFund(uint96 amount) external { + function createSubscriptionAndFund( + uint96 amount + ) external { if (s_subId == 0) { s_subId = COORDINATOR.createSubscription(); COORDINATOR.addConsumer(s_subId, address(this)); @@ -33,14 +36,18 @@ contract VRFV2RevertingExample is VRFConsumerBaseV2 { LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function topUpSubscription(uint96 amount) external { + function topUpSubscription( + uint96 amount + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "sub not set"); // Approve the link transfer. LINKTOKEN.transferAndCall(address(COORDINATOR), amount, abi.encode(s_subId)); } - function updateSubscription(address[] memory consumers) external { + function updateSubscription( + address[] memory consumers + ) external { // solhint-disable-next-line gas-custom-errors require(s_subId != 0, "subID not set"); for (uint256 i = 0; i < consumers.length; i++) { diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperConsumerExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperConsumerExample.sol index 924e3e4545..6494ee3ae3 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperConsumerExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperConsumerExample.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; contract VRFV2WrapperConsumerExample is VRFV2WrapperConsumerBase, ConfirmedOwner { event WrappedRequestFulfilled(uint256 requestId, uint256[] randomWords, uint256 payment); @@ -13,6 +13,7 @@ contract VRFV2WrapperConsumerExample is VRFV2WrapperConsumerBase, ConfirmedOwner bool fulfilled; uint256[] randomWords; } + mapping(uint256 => RequestStatus) /* requestId */ /* requestStatus */ public s_requests; constructor( @@ -51,7 +52,9 @@ contract VRFV2WrapperConsumerExample is VRFV2WrapperConsumerBase, ConfirmedOwner /// @notice withdrawLink withdraws the amount specified in amount to the owner /// @param amount the amount to withdraw, in juels - function withdrawLink(uint256 amount) external onlyOwner { + function withdrawLink( + uint256 amount + ) external onlyOwner { LINK.transfer(owner(), amount); } } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperLoadTestConsumer.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperLoadTestConsumer.sol index 9501a74b22..974722d1fe 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperLoadTestConsumer.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperLoadTestConsumer.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {ChainSpecificUtil} from "../ChainSpecificUtil_v0_8_6.sol"; +import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; import {VRFV2WrapperInterface} from "../interfaces/VRFV2WrapperInterface.sol"; contract VRFV2WrapperLoadTestConsumer is VRFV2WrapperConsumerBase, ConfirmedOwner { @@ -121,7 +121,9 @@ contract VRFV2WrapperLoadTestConsumer is VRFV2WrapperConsumerBase, ConfirmedOwne /// @notice withdrawLink withdraws the amount specified in amount to the owner /// @param amount the amount to withdraw, in juels - function withdrawLink(uint256 amount) external onlyOwner { + function withdrawLink( + uint256 amount + ) external onlyOwner { LINK.transfer(owner(), amount); } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperOutOfGasConsumerExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperOutOfGasConsumerExample.sol index 353027d557..190de40ec5 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperOutOfGasConsumerExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperOutOfGasConsumerExample.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; contract VRFV2WrapperOutOfGasConsumerExample is VRFV2WrapperConsumerBase, ConfirmedOwner { constructor( @@ -18,7 +18,7 @@ contract VRFV2WrapperOutOfGasConsumerExample is VRFV2WrapperConsumerBase, Confir return requestRandomness(_callbackGasLimit, _requestConfirmations, _numWords); } - function fulfillRandomWords(uint256 /* _requestId */, uint256[] memory /* _randomWords */) internal view override { + function fulfillRandomWords(uint256, /* _requestId */ uint256[] memory /* _randomWords */ ) internal view override { while (gasleft() > 0) {} } } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperRevertingConsumerExample.sol b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperRevertingConsumerExample.sol index d78992acfd..5183a817e6 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperRevertingConsumerExample.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFV2WrapperRevertingConsumerExample.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; +import {VRFV2WrapperConsumerBase} from "../VRFV2WrapperConsumerBase.sol"; contract VRFV2WrapperRevertingConsumerExample is VRFV2WrapperConsumerBase, ConfirmedOwner { constructor( @@ -18,7 +18,7 @@ contract VRFV2WrapperRevertingConsumerExample is VRFV2WrapperConsumerBase, Confi return requestRandomness(_callbackGasLimit, _requestConfirmations, _numWords); } - function fulfillRandomWords(uint256 /* _requestId */, uint256[] memory /* _randomWords */) internal pure override { + function fulfillRandomWords(uint256, /* _requestId */ uint256[] memory /* _randomWords */ ) internal pure override { revert("reverting example"); } } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFv2Consumer.sol b/contracts/src/v0.8/vrf/testhelpers/VRFv2Consumer.sol index 4ec7ad081b..605630c2f3 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFv2Consumer.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFv2Consumer.sol @@ -2,16 +2,15 @@ // An example of a consumer contract that relies on a subscription for funding. pragma solidity 0.8.6; -import "../interfaces/VRFCoordinatorV2Interface.sol"; -import "../VRFConsumerBaseV2.sol"; import "../../shared/access/ConfirmedOwner.sol"; +import "../VRFConsumerBaseV2.sol"; +import "../interfaces/VRFCoordinatorV2Interface.sol"; /** * THIS IS AN EXAMPLE CONTRACT THAT USES HARDCODED VALUES FOR CLARITY. * THIS IS AN EXAMPLE CONTRACT THAT USES UN-AUDITED CODE. * DO NOT USE THIS CODE IN PRODUCTION. */ - contract VRFv2Consumer is VRFConsumerBaseV2, ConfirmedOwner { event RequestSent(uint256 requestId, uint32 numWords); event RequestFulfilled(uint256 requestId, uint256[] randomWords); @@ -21,6 +20,7 @@ contract VRFv2Consumer is VRFConsumerBaseV2, ConfirmedOwner { bool exists; // whether a requestId exists uint256[] randomWords; } + mapping(uint256 => RequestStatus) public s_requests; /* requestId --> requestStatus */ VRFCoordinatorV2Interface COORDINATOR; @@ -28,7 +28,9 @@ contract VRFv2Consumer is VRFConsumerBaseV2, ConfirmedOwner { uint256[] public requestIds; uint256 public lastRequestId; - constructor(address vrfCoordinator) VRFConsumerBaseV2(vrfCoordinator) ConfirmedOwner(msg.sender) { + constructor( + address vrfCoordinator + ) VRFConsumerBaseV2(vrfCoordinator) ConfirmedOwner(msg.sender) { COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator); } @@ -56,7 +58,9 @@ contract VRFv2Consumer is VRFConsumerBaseV2, ConfirmedOwner { emit RequestFulfilled(_requestId, _randomWords); } - function getRequestStatus(uint256 _requestId) external view returns (bool fulfilled, uint256[] memory randomWords) { + function getRequestStatus( + uint256 _requestId + ) external view returns (bool fulfilled, uint256[] memory randomWords) { require(s_requests[_requestId].exists, "request not found"); RequestStatus memory request = s_requests[_requestId]; return (request.fulfilled, request.randomWords); From f2f578d4ad35b174b7878cdbb165c64c28a70f7c Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 13:20:01 +0200 Subject: [PATCH 02/14] Remove prettier --- .github/workflows/solidity-foundry.yml | 28 +++++++-------- .github/workflows/solidity.yml | 21 ++---------- contracts/.prettierrc | 16 +-------- contracts/.prettierrc.js | 15 -------- contracts/.solhint-test.json | 8 +---- contracts/.solhint.json | 8 +---- contracts/STYLE_GUIDE.md | 2 +- contracts/package.json | 4 --- contracts/pnpm-lock.yaml | 34 ------------------- ...nerate-automation-master-interface-v2_3.ts | 2 +- .../generate-automation-master-interface.ts | 2 +- ...zksync-automation-master-interface-v2_3.ts | 2 +- 12 files changed, 23 insertions(+), 119 deletions(-) diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index 4c83784f8f..9891726f22 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -28,16 +28,16 @@ jobs: run: | cat < matrix.json [ - { "name": "automation", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }}, - { "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false, "run-forge-fmt": false }}, - { "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 65.0, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 29, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }}, - { "name": "workflow", "setup": { "run-coverage": true, "extra-coverage-params": "--ir-minimum --no-match-coverage='(.*v1/test.*)|(.*v2/test.*)'", "min-coverage": 93.0, "run-gas-snapshot": true, "run-forge-fmt": true }}, - { "name": "data-feeds", "setup": { "run-coverage": true, "min-coverage": 98.5, "run-gas-snapshot": true, "extra-coverage-params": "--no-match-coverage='WIP*'", "run-forge-fmt": false }} + { "name": "automation", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false }}, + { "name": "functions", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": true }}, + { "name": "keystone", "setup": { "run-coverage": true, "min-coverage": 72.8, "run-gas-snapshot": false }}, + { "name": "l2ep", "setup": { "run-coverage": true, "min-coverage": 65.0, "run-gas-snapshot": true }}, + { "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true }}, + { "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true }}, + { "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 29, "run-gas-snapshot": true }}, + { "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false }}, + { "name": "workflow", "setup": { "run-coverage": true, "extra-coverage-params": "--ir-minimum --no-match-coverage='(.*v1/test.*)|(.*v2/test.*)'", "min-coverage": 93.0, "run-gas-snapshot": true }}, + { "name": "data-feeds", "setup": { "run-coverage": true, "min-coverage": 98.5, "run-gas-snapshot": true, "extra-coverage-params": "--no-match-coverage='WIP*'" }} ] EOF @@ -596,22 +596,22 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Checkout the repo - if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }} + if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }} uses: actions/checkout@v4 with: persist-credentials: false submodules: recursive - name: Setup NodeJS - if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }} + if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }} uses: ./.github/actions/setup-nodejs - name: Install Foundry - if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }} + if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }} uses: ./.github/actions/install-solidity-foundry - name: Run Forge fmt - if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }} + if: ${{ contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true' }} run: forge fmt --check id: fmt working-directory: contracts diff --git a/.github/workflows/solidity.yml b/.github/workflows/solidity.yml index 2a0e3e0f3d..ed7d014ad8 100644 --- a/.github/workflows/solidity.yml +++ b/.github/workflows/solidity.yml @@ -148,28 +148,11 @@ jobs: - name: Run solhint on tests run: pnpm solhint-test - prettier: - defaults: - run: - working-directory: contracts - needs: [changes] - if: needs.changes.outputs.changes == 'true' - name: Prettier Formatting - runs-on: ubuntu-latest - steps: - - name: Checkout the repo - uses: actions/checkout@v4 - with: - persist-credentials: false - - name: Setup NodeJS - uses: ./.github/actions/setup-nodejs - - name: Run prettier check - run: pnpm prettier:check publish-beta: name: Publish Beta NPM environment: publish-contracts - needs: [tag-check, changes, lint, prettier, native-compile] + needs: [tag-check, changes, lint, native-compile] if: needs.tag-check.outputs.is-pre-release-core == 'true' runs-on: ubuntu-latest steps: @@ -216,7 +199,7 @@ jobs: publish-prod: name: Publish Prod NPM environment: publish-contracts - needs: [tag-check, changes, lint, prettier, native-compile] + needs: [tag-check, changes, lint, native-compile] if: needs.tag-check.outputs.is-release-core == 'true' runs-on: ubuntu-latest permissions: diff --git a/contracts/.prettierrc b/contracts/.prettierrc index 59464a44f2..534cc93807 100644 --- a/contracts/.prettierrc +++ b/contracts/.prettierrc @@ -4,19 +4,5 @@ "printWidth": 80, "endOfLine": "auto", "tabWidth": 2, - "trailingComma": "all", - "plugins": ["prettier-plugin-solidity"], - "overrides": [ - { - "files": "*.sol", - "options": { - "parser": "solidity-parse", - "printWidth": 120, - "tabWidth": 2, - "useTabs": false, - "singleQuote": false, - "bracketSpacing": false - } - } - ] + "trailingComma": "all" } diff --git a/contracts/.prettierrc.js b/contracts/.prettierrc.js index 1766284122..5558ff9d90 100644 --- a/contracts/.prettierrc.js +++ b/contracts/.prettierrc.js @@ -5,19 +5,4 @@ module.exports = { endOfLine: 'auto', tabWidth: 2, trailingComma: 'all', - plugins: ['prettier-plugin-solidity'], - overrides: [ - { - files: '*.sol', - options: { - parser: 'solidity-parse', - printWidth: 120, - tabWidth: 2, - useTabs: false, - singleQuote: false, - bracketSpacing: false, - explicitTypes: 'always', - }, - }, - ], } diff --git a/contracts/.solhint-test.json b/contracts/.solhint-test.json index 67d153efeb..1875b8d41b 100644 --- a/contracts/.solhint-test.json +++ b/contracts/.solhint-test.json @@ -1,6 +1,6 @@ { "extends": "solhint:recommended", - "plugins": ["prettier", "chainlink-solidity"], + "plugins": ["chainlink-solidity"], "rules": { "compiler-version": ["off", "^0.8.0"], "const-name-snakecase": "off", @@ -25,12 +25,6 @@ } ], "not-rely-on-time": "off", - "prettier/prettier": [ - "off", - { - "endOfLine": "auto" - } - ], "no-empty-blocks": "off", "quotes": ["error", "double"], "reason-string": [ diff --git a/contracts/.solhint.json b/contracts/.solhint.json index b4771fc9f8..db597cadfb 100644 --- a/contracts/.solhint.json +++ b/contracts/.solhint.json @@ -1,6 +1,6 @@ { "extends": "solhint:recommended", - "plugins": ["prettier", "chainlink-solidity"], + "plugins": [ "chainlink-solidity"], "rules": { "compiler-version": ["off", "^0.8.0"], "const-name-snakecase": "off", @@ -21,12 +21,6 @@ } ], "not-rely-on-time": "off", - "prettier/prettier": [ - "off", - { - "endOfLine": "auto" - } - ], "no-empty-blocks": "off", "quotes": ["error", "double"], "reason-string": [ diff --git a/contracts/STYLE_GUIDE.md b/contracts/STYLE_GUIDE.md index d58db1c56f..65ff14d545 100644 --- a/contracts/STYLE_GUIDE.md +++ b/contracts/STYLE_GUIDE.md @@ -17,7 +17,7 @@ When making (small) changes in existing files, it is not required to adhere to this guide if it conflicts with other practices in that existing file. Consistency is preferred. -We use `forge fmt` for all new projects, but some older ones still rely on `prettier`. +We use `forge fmt` for all projects. # Guidelines diff --git a/contracts/package.json b/contracts/package.json index e85705d151..bcb48da8dc 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -9,8 +9,6 @@ "scripts": { "test": "hardhat test", "lint": "eslint --ext js,ts .", - "prettier:check": "prettier '**/*' --check --ignore-unknown", - "prettier:write": "prettier '**/*' --write --ignore-unknown", "compile:native": "./scripts/native_solc_compile_all", "publish-beta": "pnpm publish --tag beta", "publish-prod": "pnpm publish --tag latest", @@ -81,10 +79,8 @@ "hardhat": "^3.0.2", "moment": "^2.30.1", "prettier": "^3.6.2", - "prettier-plugin-solidity": "^1.4.3", "solhint": "^5.2.0", "solhint-plugin-chainlink-solidity": "github:smartcontractkit/chainlink-solhint-rules#v1.2.1", - "solhint-plugin-prettier": "^0.1.0", "ts-node": "^10.9.2", "typechain": "^8.3.2", "typescript": "^5.9.2" diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index 8fb663d46b..31474fde02 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -127,18 +127,12 @@ importers: prettier: specifier: ^3.6.2 version: 3.6.2 - prettier-plugin-solidity: - specifier: ^1.4.3 - version: 1.4.3(prettier@3.6.2) solhint: specifier: ^5.2.0 version: 5.2.0(typescript@5.9.2) solhint-plugin-chainlink-solidity: specifier: github:smartcontractkit/chainlink-solhint-rules#v1.2.1 version: '@chainlink/solhint-plugin-chainlink-solidity@https://codeload.github.com/smartcontractkit/chainlink-solhint-rules/tar.gz/1b4c0c2663fcd983589d4f33a2e73908624ed43c' - solhint-plugin-prettier: - specifier: ^0.1.0 - version: 0.1.0(prettier-plugin-solidity@1.4.3(prettier@3.6.2))(prettier@3.6.2) ts-node: specifier: ^10.9.2 version: 10.9.2(@types/node@22.18.0)(typescript@5.9.2) @@ -711,11 +705,6 @@ packages: resolution: {integrity: sha512-c83qWb22rNRuB0UaVCI0uRPNRr8Z0FWnEIvT47jiHAmOIUHbBOg5XvV7pM5x+rKn9HRpjxquDbXYSXr3fAKFcw==} engines: {node: '>=12'} - '@prettier/sync@0.3.0': - resolution: {integrity: sha512-3dcmCyAxIcxy036h1I7MQU/uEEBq8oLwf1CE3xeze+MPlgkdlb/+w6rGR/1dhp6Hqi17fRS6nvwnOzkESxEkOw==} - peerDependencies: - prettier: ^3.0.0 - '@scroll-tech/contracts@2.0.0': resolution: {integrity: sha512-O8sVaA/bVKH/mp+bBfUjZ/vYr5mdBExCpKRLre4r9TbXTtiaY9Uo5xU8dcG3weLxyK0BZqDTP2aCNp4Q0f7SeA==} @@ -2248,12 +2237,6 @@ packages: solady@0.0.182: resolution: {integrity: sha512-FW6xo1akJoYpkXMzu58/56FcNU3HYYNamEbnFO3iSibXk0nSHo0DV2Gu/zI3FPg3So5CCX6IYli1TT1IWATnvg==} - solhint-plugin-prettier@0.1.0: - resolution: {integrity: sha512-SDOTSM6tZxZ6hamrzl3GUgzF77FM6jZplgL2plFBclj/OjKP8Z3eIPojKU73gRr0MvOS8ACZILn8a5g0VTz/Gw==} - peerDependencies: - prettier: ^3.0.0 - prettier-plugin-solidity: ^1.0.0 - solhint@5.2.0: resolution: {integrity: sha512-9NZC1zt+O2K7zEZOhTT9rFeB6GdxC6qTX5pWX70RaQoflR9RejJQUC+/19LNi+e7K9Ptb4k7XAWO9wY5mkprHg==} hasBin: true @@ -3288,10 +3271,6 @@ snapshots: '@pnpm/network.ca-file': 1.0.2 config-chain: 1.1.13 - '@prettier/sync@0.3.0(prettier@3.6.2)': - dependencies: - prettier: 3.6.2 - '@scroll-tech/contracts@2.0.0': {} '@scure/base@1.1.9': {} @@ -4816,12 +4795,6 @@ snapshots: semver: 7.7.2 optional: true - prettier-plugin-solidity@1.4.3(prettier@3.6.2): - dependencies: - '@solidity-parser/parser': 0.20.2 - prettier: 3.6.2 - semver: 7.7.2 - prettier@2.8.8: {} prettier@3.6.2: {} @@ -4982,13 +4955,6 @@ snapshots: solady@0.0.182: {} - solhint-plugin-prettier@0.1.0(prettier-plugin-solidity@1.4.3(prettier@3.6.2))(prettier@3.6.2): - dependencies: - '@prettier/sync': 0.3.0(prettier@3.6.2) - prettier: 3.6.2 - prettier-linter-helpers: 1.0.0 - prettier-plugin-solidity: 1.4.3(prettier@3.6.2) - solhint@5.2.0(typescript@5.9.2): dependencies: '@solidity-parser/parser': 0.20.2 diff --git a/contracts/scripts/generate-automation-master-interface-v2_3.ts b/contracts/scripts/generate-automation-master-interface-v2_3.ts index 1e2d713cab..c2d27eab50 100644 --- a/contracts/scripts/generate-automation-master-interface-v2_3.ts +++ b/contracts/scripts/generate-automation-master-interface-v2_3.ts @@ -48,7 +48,7 @@ fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI)) const cmd = ` cat ${tmpDest} | pnpm abi-to-sol --solidity-version ^0.8.4 --license MIT > ${srcDest} IAutomationRegistryMaster2_3; echo "// abi-checksum: ${checksum}" | cat - ${srcDest} > ${tmpDest} && mv ${tmpDest} ${srcDest}; -pnpm prettier --write ${srcDest}; +export FOUNDRY_PROFILE=automation; forge fmt ${srcDest}; ` exec(cmd) diff --git a/contracts/scripts/generate-automation-master-interface.ts b/contracts/scripts/generate-automation-master-interface.ts index 18866b2e69..990408dfb2 100644 --- a/contracts/scripts/generate-automation-master-interface.ts +++ b/contracts/scripts/generate-automation-master-interface.ts @@ -42,7 +42,7 @@ fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI)) const cmd = ` cat ${tmpDest} | pnpm abi-to-sol --solidity-version ^0.8.4 --license MIT > ${srcDest} IAutomationRegistryMaster; echo "// abi-checksum: ${checksum}" | cat - ${srcDest} > ${tmpDest} && mv ${tmpDest} ${srcDest}; -pnpm prettier --write ${srcDest}; +export FOUNDRY_PROFILE=automation; forge fmt ${srcDest}; ` exec(cmd) diff --git a/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts b/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts index 385d1fb45b..2e267573aa 100644 --- a/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts +++ b/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts @@ -48,7 +48,7 @@ fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI)) const cmd = ` cat ${tmpDest} | pnpm abi-to-sol --solidity-version ^0.8.19 --license MIT > ${srcDest} IZKSyncAutomationRegistryMaster2_3; echo "// solhint-disable \n// abi-checksum: ${checksum}" | cat - ${srcDest} > ${tmpDest} && mv ${tmpDest} ${srcDest}; -pnpm prettier --write ${srcDest}; +export FOUNDRY_PROFILE=automation; forge fmt ${srcDest}; ` exec(cmd) From 652b0c9986b05e92058b0a96a78d821209dc9d2e Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 13:32:10 +0200 Subject: [PATCH 03/14] fix formatting related solhint issues --- contracts/src/v0.8/automation/KeeperBase.sol | 1 - contracts/src/v0.8/automation/KeeperCompatible.sol | 1 - .../v0.8/automation/interfaces/KeeperCompatibleInterface.sol | 1 - .../src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol | 3 +-- contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol | 1 - contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol | 1 - .../dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol | 5 +---- contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol | 3 +-- 8 files changed, 3 insertions(+), 13 deletions(-) diff --git a/contracts/src/v0.8/automation/KeeperBase.sol b/contracts/src/v0.8/automation/KeeperBase.sol index 1507aea7f5..0e050d4aff 100644 --- a/contracts/src/v0.8/automation/KeeperBase.sol +++ b/contracts/src/v0.8/automation/KeeperBase.sol @@ -4,5 +4,4 @@ */ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import - import {AutomationBase as KeeperBase} from "./AutomationBase.sol"; diff --git a/contracts/src/v0.8/automation/KeeperCompatible.sol b/contracts/src/v0.8/automation/KeeperCompatible.sol index 0e724b0b98..2066ecdffa 100644 --- a/contracts/src/v0.8/automation/KeeperCompatible.sol +++ b/contracts/src/v0.8/automation/KeeperCompatible.sol @@ -4,7 +4,6 @@ */ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import - import {AutomationCompatible as KeeperCompatible} from "./AutomationCompatible.sol"; // solhint-disable-next-line no-unused-import import {AutomationBase as KeeperBase} from "./AutomationBase.sol"; diff --git a/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol b/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol index eeb1cd64da..b5ba8196c7 100644 --- a/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol +++ b/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol @@ -4,5 +4,4 @@ */ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import - import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./AutomationCompatibleInterface.sol"; diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol index 31e184ed6d..4ec234407f 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol @@ -3,9 +3,8 @@ pragma solidity ^0.8.0; // solhint-disable-next-line no-unused-import import {ITypeAndVersion} from "../../shared/interfaces/ITypeAndVersion.sol"; -// solhint-disable-next-line no-unused-import - import {IDelegateForwarder} from "../interfaces/IDelegateForwarder.sol"; +// solhint-disable-next-line no-unused-import import {IForwarder} from "../interfaces/IForwarder.sol"; import {ArbitrumCrossDomainForwarder} from "./ArbitrumCrossDomainForwarder.sol"; diff --git a/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol b/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol index 559ca004e2..9b6ef4f4d2 100644 --- a/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol +++ b/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol @@ -98,7 +98,6 @@ pragma solidity ^0.8.4; abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i - address private immutable vrfCoordinator; /** diff --git a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol index 0de66bd3ad..27a0eba6bd 100644 --- a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol +++ b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol @@ -107,7 +107,6 @@ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Ini abstract contract VRFConsumerBaseV2Upgradeable is Initializable { error OnlyCoordinatorCanFulfill(address have, address want); // solhint-disable-next-line chainlink-solidity/prefix-storage-variables-with-s-underscore - address private vrfCoordinator; // See https://github.com/OpenZeppelin/openzeppelin-sdk/issues/37. diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol index 645765426a..aca18500a0 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol @@ -2,15 +2,13 @@ pragma solidity 0.8.19; import {BlockhashStoreInterface} from "../../interfaces/BlockhashStoreInterface.sol"; -// solhint-disable-next-line no-unused-import - import {ChainSpecificUtil} from "../../../shared/util/ChainSpecificUtil.sol"; import {VRF} from "../../../vrf/VRF.sol"; import {VRFTypes} from "../../VRFTypes.sol"; import {SubscriptionAPI} from "../SubscriptionAPI.sol"; import {IVRFMigratableConsumerV2Plus, VRFConsumerBaseV2Plus} from "../VRFConsumerBaseV2Plus.sol"; +// solhint-disable-next-line no-unused-import import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../interfaces/IVRFCoordinatorV2Plus.sol"; - import {IVRFCoordinatorV2PlusMigration} from "../interfaces/IVRFCoordinatorV2PlusMigration.sol"; import {VRFV2PlusClient} from "../libraries/VRFV2PlusClient.sol"; import {EnumerableSet} from "@openzeppelin/contracts@4.9.6/utils/structs/EnumerableSet.sol"; @@ -24,7 +22,6 @@ contract VRFCoordinatorV2PlusUpgradedVersion is using EnumerableSet for EnumerableSet.UintSet; /// @dev should always be available // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i - BlockhashStoreInterface public immutable BLOCKHASH_STORE; // Set this maximum to 200 to give us a 56 block window to fulfill diff --git a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol index 8502a72adf..a138bb4605 100644 --- a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol +++ b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol @@ -2,10 +2,9 @@ // A mock for testing code that relies on VRFCoordinatorV2_5. pragma solidity ^0.8.19; -// solhint-disable-next-line no-unused-import - import {SubscriptionAPI} from "../dev/SubscriptionAPI.sol"; import {VRFConsumerBaseV2Plus} from "../dev/VRFConsumerBaseV2Plus.sol"; +// solhint-disable-next-line no-unused-import import {IVRFCoordinatorV2Plus, IVRFSubscriptionV2Plus} from "../dev/interfaces/IVRFCoordinatorV2Plus.sol"; import {VRFV2PlusClient} from "../dev/libraries/VRFV2PlusClient.sol"; From 7750a96a724cb6afa73bb93cd13e5217ac71546a Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 13:37:12 +0200 Subject: [PATCH 04/14] rm eslint-config-prettier Since eslint-config-prettier only turns off rules and removing it doesn't trigger issues, it was not doing anything for us --- contracts/.prettierignore | 8 +------- contracts/eslint.config.cjs | 7 ------- contracts/package.json | 1 - contracts/pnpm-lock.yaml | 4 +--- 4 files changed, 2 insertions(+), 18 deletions(-) diff --git a/contracts/.prettierignore b/contracts/.prettierignore index 8b55187d99..55ce519771 100644 --- a/contracts/.prettierignore +++ b/contracts/.prettierignore @@ -1,13 +1,9 @@ **/node_modules/** **/generated/** -core/ **/dist/** **/artifacts/** **/public/** **/build/** -truffle-config.js -truffle.js -gethload.js pnpm-lock.yaml coverage @@ -20,9 +16,7 @@ node_modules solc LinkToken.json typechain -**/vendor -src/v0.8/workflow/** -src/v0.8/data-feeds/** +src # Ignore TS definition and map files **/**.d.ts diff --git a/contracts/eslint.config.cjs b/contracts/eslint.config.cjs index 13568073e2..73676ae4d0 100644 --- a/contracts/eslint.config.cjs +++ b/contracts/eslint.config.cjs @@ -75,19 +75,12 @@ module.exports = defineConfig([ globalIgnores([ '**/node_modules/**/*', '**/generated/**/*', - '**/core/', '**/dist/**/*', '**/artifacts/**/*', '**/public/**/*', '**/build/**/*', '**/fixtures/**/*', '**/lib/**/*', - '**/truffle-config.js', - '**/truffle.js', - '**/gethload.js', '**/craco.config.js', - 'integration/apocalypse/**/*', - '**/contracts/', - 'tools/ci-ts/tests/ethers/**/*', ]), ]) diff --git a/contracts/package.json b/contracts/package.json index bcb48da8dc..538906ce8a 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -73,7 +73,6 @@ "debug": "^4.4.1", "deep-equal-in-any-order": "^2.0.6", "eslint": "^9.34.0", - "eslint-config-prettier": "^10.1.8", "eslint-plugin-prettier": "^5.5.4", "globals": "^16.3.0", "hardhat": "^3.0.2", diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index 31474fde02..27bda82f6b 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -109,9 +109,6 @@ importers: eslint: specifier: ^9.34.0 version: 9.34.0 - eslint-config-prettier: - specifier: ^10.1.8 - version: 10.1.8(eslint@9.34.0) eslint-plugin-prettier: specifier: ^5.5.4 version: 5.5.4(eslint-config-prettier@10.1.8(eslint@9.34.0))(eslint@9.34.0)(prettier@3.6.2) @@ -3944,6 +3941,7 @@ snapshots: eslint-config-prettier@10.1.8(eslint@9.34.0): dependencies: eslint: 9.34.0 + optional: true eslint-plugin-prettier@5.5.4(eslint-config-prettier@10.1.8(eslint@9.34.0))(eslint@9.34.0)(prettier@3.6.2): dependencies: From 7ed4a5bd91eda9a85c08a5788fa0d8691b4cb355 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 13:53:12 +0200 Subject: [PATCH 05/14] cleanup CI --- .github/workflows/solidity-foundry.yml | 3 - .github/workflows/solidity-wrappers.yml | 87 ------------------------- 2 files changed, 90 deletions(-) delete mode 100644 .github/workflows/solidity-wrappers.yml diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index 9891726f22..da3d199bf6 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -100,9 +100,6 @@ jobs: - 'contracts/src/v0.8/vrf/**/*.sol' shared: - 'contracts/src/v0.8/shared/**/*.sol' - - 'contracts/src/v0.8/*.sol' - - 'contracts/src/v0.8/mocks/**/*.sol' - - 'contracts/src/v0.8/tests/**/*.sol' - 'contracts/src/v0.8/vendor/**/*.sol' workflow: - 'contracts/src/v0.8/workflow/**/*.sol' diff --git a/.github/workflows/solidity-wrappers.yml b/.github/workflows/solidity-wrappers.yml deleted file mode 100644 index feff75a873..0000000000 --- a/.github/workflows/solidity-wrappers.yml +++ /dev/null @@ -1,87 +0,0 @@ -# This workflow is not active and will be removed on July 1st, 2025 -# If you still need it, please add the necessary GH secrets and update it. - -#name: Solidity Wrappers -## This is its own workflow file rather than being merged into "solidity.yml" to avoid over complicating the conditionals -## used for job execution. The jobs in "solidity.yml" are configured around push events, whereas -## we only want to generate gethwrappers during pull requests. -#on: -# pull_request: -# types: -# - opened -# - synchronize -# - reopened -# -#concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true -# -#jobs: -# changes: -# # We don't directly merge dependabot PRs, so let's not waste the resources -# if: ${{ github.actor != 'dependabot[bot]' }} -# name: Detect changes -# runs-on: ubuntu-latest -# outputs: -# changes: ${{ steps.ch.outputs.changes }} -# steps: -# - name: Checkout the repo -# uses: actions/checkout@v4 -# with: -# persist-credentials: false -# - name: Detect changes -# id: ch -# uses: ./.github/actions/detect-solidity-file-changes -# -# # On a pull request event, make updates to gethwrappers if there are changes. -# update-wrappers: -# needs: [changes] -# if: needs.changes.outputs.changes == 'true' -# name: Update Wrappers -# permissions: -# actions: read -# id-token: write -# contents: read -# runs-on: ubuntu22.04-8cores-32GB -# steps: -# - name: Checkout the repo -# uses: actions/checkout@v4 -# with: -# persist-credentials: false -# -# - name: Setup Go -# uses: ./.github/actions/setup-go -# -# - name: Setup NodeJS -# uses: ./.github/actions/setup-nodejs -# with: -# prod: "true" -# -# - name: Install Foundry -# uses: ./.github/actions/install-solidity-foundry -# -# - name: Run native compile and generate wrappers -# run: make wrappers-all -# working-directory: ./contracts -# -# - name: Run zksync compile and generate wrappers -# run: make wrappers-zksync -# working-directory: ./contracts -# -# - name: Assume role capable of dispatching action -# uses: smartcontractkit/.github/actions/setup-github-token@ef78fa97bf3c77de6563db1175422703e9e6674f # setup-github-token@0.2.1 -# id: get-gh-token -# with: -# aws-role-arn: ${{ secrets.AWS_OIDC_CHAINLINK_CI_AUTO_PR_TOKEN_ISSUER_ROLE_ARN }} -# aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} -# aws-region: ${{ secrets.AWS_REGION }} -# -# - name: Commit any wrapper changes -# uses: planetscale/ghcommit-action@21a8cda29f55e5cc2cdae0cdbdd08e38dd148c25 # v0.1.37 -# with: -# commit_message: "Update gethwrappers" -# repo: ${{ github.repository }} -# branch: ${{ github.head_ref }} -# file_pattern: "core/gethwrappers/**/generated/*.go core/gethwrappers/**/generated-wrapper-dependency-versions-do-not-edit.txt" -# env: -# GITHUB_TOKEN: ${{ steps.get-gh-token.outputs.access-token }} From 659421005570c96996b32d5abcdd2e3d2d9a017d Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 14:18:03 +0200 Subject: [PATCH 06/14] cleanup npm packages --- .github/workflows/solidity-foundry.yml | 1 - contracts/package.json | 1 - contracts/pnpm-lock.yaml | 15 --------------- 3 files changed, 17 deletions(-) diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index da3d199bf6..94d0eaea6e 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -75,7 +75,6 @@ jobs: non_src: - '.github/workflows/solidity-foundry.yml' - 'contracts/foundry.toml' - - 'contracts/gas-snapshots/*.gas-snapshot' - 'contracts/package.json' - 'contracts/GNUmakefile' sol: diff --git a/contracts/package.json b/contracts/package.json index 538906ce8a..f9457dec04 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -58,7 +58,6 @@ }, "devDependencies": { "@eslint/js": "^9.34.0", - "@ethereum-waffle/mock-contract": "^3.4.4", "@types/cbor": "~5.0.1", "@types/chai": "^4.3.20", "@types/debug": "^4.1.12", diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index 27bda82f6b..952bd83013 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -64,9 +64,6 @@ importers: '@eslint/js': specifier: ^9.34.0 version: 9.34.0 - '@ethereum-waffle/mock-contract': - specifier: ^3.4.4 - version: 3.4.4 '@types/cbor': specifier: ~5.0.1 version: 5.0.1 @@ -425,10 +422,6 @@ packages: '@eth-optimism/core-utils@0.12.0': resolution: {integrity: sha512-qW+7LZYCz7i8dRa7SRlUKIo1VBU8lvN0HeXCxJR+z+xtMzMQpPds20XJNCMclszxYQHkXY00fOT6GvFw9ZL6nw==} - '@ethereum-waffle/mock-contract@3.4.4': - resolution: {integrity: sha512-Mp0iB2YNWYGUV+VMl5tjPsaXKbKo8MDH9wSJ702l9EBjdxFf/vBvnMBAC1Fub1lLtmD0JHtp1pq+mWzg/xlLnA==} - engines: {node: '>=10.0'} - '@ethersproject/abi@5.8.0': resolution: {integrity: sha512-b9YS/43ObplgyV6SlyQsG53/vkSal0MNA1fskSC4mbnCMi8R+NkcH8K9FPYNESf6jUefBUniE4SOKms0E/KK1Q==} @@ -2820,14 +2813,6 @@ snapshots: - bufferutil - utf-8-validate - '@ethereum-waffle/mock-contract@3.4.4': - dependencies: - '@ethersproject/abi': 5.8.0 - ethers: 5.8.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - '@ethersproject/abi@5.8.0': dependencies: '@ethersproject/address': 5.8.0 From 35db28a654a2b6d3b031045f7a70df0bd411b679 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 14:20:34 +0200 Subject: [PATCH 07/14] rm unused packages --- contracts/package.json | 11 +-- contracts/pnpm-lock.yaml | 196 +++++++++++++-------------------------- 2 files changed, 69 insertions(+), 138 deletions(-) diff --git a/contracts/package.json b/contracts/package.json index f9457dec04..6ade5b0cf0 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -58,23 +58,16 @@ }, "devDependencies": { "@eslint/js": "^9.34.0", - "@types/cbor": "~5.0.1", - "@types/chai": "^4.3.20", - "@types/debug": "^4.1.12", "@types/deep-equal-in-any-order": "^1.0.4", - "@types/mocha": "^10.0.10", "@types/node": "^22.18.0", "@typescript-eslint/eslint-plugin": "^8.41.0", "@typescript-eslint/parser": "^8.41.0", "abi-to-sol": "^0.6.6", - "cbor": "^5.2.0", - "chai": "^4.5.0", - "debug": "^4.4.1", "deep-equal-in-any-order": "^2.0.6", "eslint": "^9.34.0", "eslint-plugin-prettier": "^5.5.4", "globals": "^16.3.0", - "hardhat": "^3.0.2", + "hardhat": "^3.0.3", "moment": "^2.30.1", "prettier": "^3.6.2", "solhint": "^5.2.0", @@ -85,7 +78,7 @@ }, "dependencies": { "@arbitrum/nitro-contracts": "3.0.0", - "@changesets/cli": "^2.29.5", + "@changesets/cli": "^2.29.6", "@changesets/get-github-info": "^0.6.0", "@eslint/eslintrc": "^3.3.1", "@eth-optimism/contracts": "0.6.0", diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index 952bd83013..d0b4b8742c 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -22,8 +22,8 @@ importers: specifier: 3.0.0 version: 3.0.0 '@changesets/cli': - specifier: ^2.29.5 - version: 2.29.5 + specifier: ^2.29.6 + version: 2.29.6(@types/node@22.18.0) '@changesets/get-github-info': specifier: ^0.6.0 version: 0.6.0 @@ -64,21 +64,9 @@ importers: '@eslint/js': specifier: ^9.34.0 version: 9.34.0 - '@types/cbor': - specifier: ~5.0.1 - version: 5.0.1 - '@types/chai': - specifier: ^4.3.20 - version: 4.3.20 - '@types/debug': - specifier: ^4.1.12 - version: 4.1.12 '@types/deep-equal-in-any-order': specifier: ^1.0.4 version: 1.0.4 - '@types/mocha': - specifier: ^10.0.10 - version: 10.0.10 '@types/node': specifier: ^22.18.0 version: 22.18.0 @@ -91,15 +79,6 @@ importers: abi-to-sol: specifier: ^0.6.6 version: 0.6.6 - cbor: - specifier: ^5.2.0 - version: 5.2.0 - chai: - specifier: ^4.5.0 - version: 4.5.0 - debug: - specifier: ^4.4.1 - version: 4.4.1 deep-equal-in-any-order: specifier: ^2.0.6 version: 2.0.6 @@ -113,8 +92,8 @@ importers: specifier: ^16.3.0 version: 16.3.0 hardhat: - specifier: ^3.0.2 - version: 3.0.2 + specifier: ^3.0.3 + version: 3.0.3 moment: specifier: ^2.30.1 version: 2.30.1 @@ -167,8 +146,8 @@ packages: '@changesets/changelog-git@0.2.1': resolution: {integrity: sha512-x/xEleCFLH28c3bQeQIyeZf8lFXyDFVn1SgcBiR2Tw/r4IAWlk1fzxCEZ6NxQAjF2Nwtczoen3OA2qR+UawQ8Q==} - '@changesets/cli@2.29.5': - resolution: {integrity: sha512-0j0cPq3fgxt2dPdFsg4XvO+6L66RC0pZybT9F4dG5TBrLA3jA/1pNkdTXH9IBBVHkgsKrNKenI3n1mPyPlIydg==} + '@changesets/cli@2.29.6': + resolution: {integrity: sha512-6qCcVsIG1KQLhpQ5zE8N0PckIx4+9QlHK3z6/lwKnw7Tir71Bjw8BeOZaxA/4Jt00pcgCnCSWZnyuZf5Il05QQ==} hasBin: true '@changesets/config@3.1.1': @@ -536,6 +515,15 @@ packages: resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} engines: {node: '>=18.18'} + '@inquirer/external-editor@1.0.1': + resolution: {integrity: sha512-Oau4yL24d2B5IL4ma4UpbQigkVhzPDXLoqy1ggK4gnHg/stmkffJE4oOXHXF3uz0UEpywG68KcyXsyYpA1Re/Q==} + engines: {node: '>=18'} + peerDependencies: + '@types/node': '>=18' + peerDependenciesMeta: + '@types/node': + optional: true + '@jridgewell/resolve-uri@3.1.2': resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} @@ -583,36 +571,36 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@nomicfoundation/edr-darwin-arm64@0.12.0-next.4': - resolution: {integrity: sha512-BJKRXjqqerACk92inxu7haweb3KFk4VJ2qemIjMT7xf4k0RyOO6lzmv+pToD5MMDGEpqhLcI61ALY9oyNKirtQ==} + '@nomicfoundation/edr-darwin-arm64@0.12.0-next.5': + resolution: {integrity: sha512-LfDxE/Q+wsToSL17Rf6HNaqfp3v4G9AGwjzfCa3momYw9QhMiELfB4nPm93qt3pwwuiCCqqpdURFdC8oYmVHfg==} engines: {node: '>= 18'} - '@nomicfoundation/edr-darwin-x64@0.12.0-next.4': - resolution: {integrity: sha512-MMN3VaoPhbepI4Z0anZB0jPorpRik7XwWbTqGyuZZcmNld9ZGKXE5ZQux31eKqSzPfcukHkNilFFZhCN/ck3TA==} + '@nomicfoundation/edr-darwin-x64@0.12.0-next.5': + resolution: {integrity: sha512-jKTBN90XOTFkeg0BgxmXemvUUuC0fr2vwekMcxLhW2zb0E6oO/DM5ApSz4KoQhefVZCOFFvmj0Za5Cgr27accg==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-arm64-gnu@0.12.0-next.4': - resolution: {integrity: sha512-SYwe1duRkr5i8KnBe3Hw1X25cy/XNVpy5dj/1KbCh8fh1bvv5/gCw+MZW2N2+XzXOwTkP3aMwI2jDGCw4yB0xQ==} + '@nomicfoundation/edr-linux-arm64-gnu@0.12.0-next.5': + resolution: {integrity: sha512-aBe22ybgRdgSCVBtw5x8w25wwHhQa1B1mrcmHeFadW5lBM4thOwpq4xeNcdRhID7ZSkJvRTCe9KA1yCn2EYdbw==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-arm64-musl@0.12.0-next.4': - resolution: {integrity: sha512-FT37tuqYnjLhvlZQey5b7HMhvVVuk5vdVH58cmG6LP3y1R+G/eJJYp8ZEasm67eWgUANp/LwZ2Os0mdkkv2k3g==} + '@nomicfoundation/edr-linux-arm64-musl@0.12.0-next.5': + resolution: {integrity: sha512-168VcV9HcUY6rRmZNb2wHWWQJ82BZmu4if17MnQSeqT/u77hObjx4P7rfFpcOxfnuEbP2NEgAZsA7uU2bMcRMQ==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-x64-gnu@0.12.0-next.4': - resolution: {integrity: sha512-omW2AyLa2WqD7MD5tI8d4Lu4hC0fFei708pM1CWCM0C45DJJxg32e3iNoQzyPgpoVq24ck7GO1fEOWhtt0r5eQ==} + '@nomicfoundation/edr-linux-x64-gnu@0.12.0-next.5': + resolution: {integrity: sha512-C0N9zBEMGwYO5Is9dYuvM2Bl/0y1ornF6xRmnaaMOEf9y6grjC84Ip33fnySNG4nGcjHMYrS2RBC/Lm+rg4BcA==} engines: {node: '>= 18'} - '@nomicfoundation/edr-linux-x64-musl@0.12.0-next.4': - resolution: {integrity: sha512-lOy2UZWwLnsbLz5NnewhmkM9PtVjzIBzajXX5zcQUdjJmN3daj5wsrR/b0hC8BPqwfGlrLCBr8CJtepKNrEI6A==} + '@nomicfoundation/edr-linux-x64-musl@0.12.0-next.5': + resolution: {integrity: sha512-BqCg+I4/r833BH4bVA/0oAYTvfg7GHpUq0DTRqaAwTD1bWTD48rIEtKBYZ6KEDQNB3NQEi5CMz50G9ziteaq0A==} engines: {node: '>= 18'} - '@nomicfoundation/edr-win32-x64-msvc@0.12.0-next.4': - resolution: {integrity: sha512-OPpVYE7F4FuTKPdt8z0nrx/KZd7vHeNAjd4KAlzi+/X6imVHFX3sArVd0cdbw/oijINrvxgL/S6SrgbvSgASTA==} + '@nomicfoundation/edr-win32-x64-msvc@0.12.0-next.5': + resolution: {integrity: sha512-5bp+w+dVxe5vxzQY0N+R1wuk6heCgSKqPLz5mjiU5SP/LtynF7mV2siXXCi+NGOM3sV04oUzLfR8K+c83Za5sw==} engines: {node: '>= 18'} - '@nomicfoundation/edr@0.12.0-next.4': - resolution: {integrity: sha512-yXMIpISsZcrlCziY5fwd9s8iJ7Rs9AD+UyHKKzSazKevMvJRlLbdCVqoEld9QZRwWo9Pc8AyAUmS9Xix+ZQiRQ==} + '@nomicfoundation/edr@0.12.0-next.5': + resolution: {integrity: sha512-VhjH0OyKGtWqGeOMGICGsj2l0+7SyQWXp00wuY0hkG+vt1XH2G404L0CK9+qWEPcoZu9/LFcVGVs+Bb1XWvDPA==} engines: {node: '>= 20'} '@nomicfoundation/hardhat-errors@3.0.0': @@ -755,15 +743,6 @@ packages: '@types/bn.js@5.2.0': resolution: {integrity: sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q==} - '@types/cbor@5.0.1': - resolution: {integrity: sha512-zVqJy2KzusZPLOgyGJDnOIbu3DxIGGqxYbEwtEEe4Z+la8jwIhOyb+GMrlHafs5tvKruwf8f8qOYP6zTvse/pw==} - - '@types/chai@4.3.20': - resolution: {integrity: sha512-/pC9HAB5I/xMlc5FP77qjCnI16ChlJfW0tGa0IUcFn38VJrTV6DeZ60NU5KZBtaOZqjdpwTWohz5HU1RrhiYxQ==} - - '@types/debug@4.1.12': - resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} - '@types/deep-equal-in-any-order@1.0.4': resolution: {integrity: sha512-nkgl+KTkRWeybgMSBCrWrc1YHFrLADVxZ6Kllj40p9U499NGsCrFUjzgHgQY+Upsa/VWOc3YlsFEvhg+drUmkA==} @@ -776,12 +755,6 @@ packages: '@types/json-schema@7.0.15': resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} - '@types/mocha@10.0.10': - resolution: {integrity: sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==} - - '@types/ms@2.1.0': - resolution: {integrity: sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==} - '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} @@ -982,9 +955,6 @@ packages: resolution: {integrity: sha512-pbnl5XzGBdrFU/wT4jqmJVPn2B6UHPBOhzMQkY/SPUPB6QtUXtmBHBIwCbXJol93mOpGMnQyP/+BB19q04xj7g==} engines: {node: '>=4'} - bignumber.js@9.3.1: - resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==} - blakejs@1.2.1: resolution: {integrity: sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==} @@ -1056,10 +1026,6 @@ packages: camel-case@3.0.0: resolution: {integrity: sha512-+MbKztAYHXPr1jNTSKQF52VpcFjwY5RkR7fxksV8Doo4KAYc5Fl4UJRgthBbTmEx8C54DqahhbLJkDwjI3PI/w==} - cbor@5.2.0: - resolution: {integrity: sha512-5IMhi9e1QU76ppa5/ajP1BmMWZ2FHkhAhjeVKQ/EFCgYSEaeVaoGtL7cxJskf9oCCk+XjzaIdc3IuU/dbA/o2A==} - engines: {node: '>=6.0.0'} - chai@4.5.0: resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} engines: {node: '>=4'} @@ -1079,8 +1045,8 @@ packages: change-case@3.0.2: resolution: {integrity: sha512-Mww+SLF6MZ0U6kdg11algyKd5BARbyM4TbFBepwowYSR5ClfQGCGtxNXgykpN0uF/bstWeaGDT4JWaDh8zWAHA==} - chardet@0.7.0: - resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + chardet@2.1.0: + resolution: {integrity: sha512-bNFETTG/pM5ryzQ9Ad0lJOTa6HWD/YsScAR3EnCPZRPlQh77JocYktSHOUHelyhm8IARL+o4c4F1bP5KVOjiRA==} check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} @@ -1362,10 +1328,6 @@ packages: extendable-error@0.1.7: resolution: {integrity: sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==} - external-editor@3.1.0: - resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} - engines: {node: '>=4'} - fast-check@3.1.1: resolution: {integrity: sha512-3vtXinVyuUKCKFKYcwXhGE6NtGWkqF8Yh3rvMZNzmwz8EPrgoc/v4pDdLHyLnCyCI5MZpZZkDEwFyXyEONOxpA==} engines: {node: '>=8.0.0'} @@ -1532,8 +1494,8 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - hardhat@3.0.2: - resolution: {integrity: sha512-BXQwItt/2R+grUWY/srJCfjX3i9yiPtlyZV2rU+938baRrXYqzBkLv5DBo3OlLdiXf32NkNf5Xjv182Cks80Rw==} + hardhat@3.0.3: + resolution: {integrity: sha512-QQwkjc0xO+sXygcjAiwwBQAqXdhU5/FBPlXtb/DB5CuQQ60fHHbLwBK2axrwwoJcmDSEoifyXi9S+46Nw14hDg==} hasBin: true has-flag@3.0.0: @@ -1586,8 +1548,8 @@ packages: resolution: {integrity: sha512-3gKm/gCSUipeLsRYZbbdA1BD83lBoWUkZ7G9VFrhWPAU76KwYo5KR8V28bpoPm/ygy0x5/GCbpRQdY7VLYCoIg==} hasBin: true - iconv-lite@0.4.24: - resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} engines: {node: '>=0.10.0'} ignore@5.3.2: @@ -1889,10 +1851,6 @@ packages: resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} hasBin: true - nofilter@1.0.4: - resolution: {integrity: sha512-N8lidFp+fCz+TD51+haYdbDGrcBWwuHX40F5+z0qkUjMJ5Tp+rdSuAkMJ9N9eoolDlEVTf6u5icM+cNKkKW2mA==} - engines: {node: '>=8'} - normalize-url@8.0.2: resolution: {integrity: sha512-Ee/R3SyN4BuynXcnTaekmaVdbDAEiNrHqjQIA37mHU8G9pf7aaAD4ZX3XjBLo6rsdcxA/gtkcNYZLt30ACgynw==} engines: {node: '>=14.16'} @@ -2535,7 +2493,7 @@ snapshots: dependencies: '@changesets/types': 6.1.0 - '@changesets/cli@2.29.5': + '@changesets/cli@2.29.6(@types/node@22.18.0)': dependencies: '@changesets/apply-release-plan': 7.0.12 '@changesets/assemble-release-plan': 6.0.9 @@ -2551,11 +2509,11 @@ snapshots: '@changesets/should-skip-package': 0.1.2 '@changesets/types': 6.1.0 '@changesets/write': 0.4.0 + '@inquirer/external-editor': 1.0.1(@types/node@22.18.0) '@manypkg/get-packages': 1.1.3 ansi-colors: 4.1.3 ci-info: 3.9.0 enquirer: 2.4.1 - external-editor: 3.1.0 fs-extra: 7.0.1 mri: 1.2.0 p-limit: 2.3.0 @@ -2565,6 +2523,8 @@ snapshots: semver: 7.7.2 spawndamnit: 3.0.1 term-size: 2.2.1 + transitivePeerDependencies: + - '@types/node' '@changesets/config@3.1.1': dependencies: @@ -3083,6 +3043,13 @@ snapshots: '@humanwhocodes/retry@0.4.3': {} + '@inquirer/external-editor@1.0.1(@types/node@22.18.0)': + dependencies: + chardet: 2.1.0 + iconv-lite: 0.6.3 + optionalDependencies: + '@types/node': 22.18.0 + '@jridgewell/resolve-uri@3.1.2': {} '@jridgewell/sourcemap-codec@1.5.4': {} @@ -3134,36 +3101,36 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.19.1 - '@nomicfoundation/edr-darwin-arm64@0.12.0-next.4': + '@nomicfoundation/edr-darwin-arm64@0.12.0-next.5': optional: true - '@nomicfoundation/edr-darwin-x64@0.12.0-next.4': + '@nomicfoundation/edr-darwin-x64@0.12.0-next.5': optional: true - '@nomicfoundation/edr-linux-arm64-gnu@0.12.0-next.4': + '@nomicfoundation/edr-linux-arm64-gnu@0.12.0-next.5': optional: true - '@nomicfoundation/edr-linux-arm64-musl@0.12.0-next.4': + '@nomicfoundation/edr-linux-arm64-musl@0.12.0-next.5': optional: true - '@nomicfoundation/edr-linux-x64-gnu@0.12.0-next.4': + '@nomicfoundation/edr-linux-x64-gnu@0.12.0-next.5': optional: true - '@nomicfoundation/edr-linux-x64-musl@0.12.0-next.4': + '@nomicfoundation/edr-linux-x64-musl@0.12.0-next.5': optional: true - '@nomicfoundation/edr-win32-x64-msvc@0.12.0-next.4': + '@nomicfoundation/edr-win32-x64-msvc@0.12.0-next.5': optional: true - '@nomicfoundation/edr@0.12.0-next.4': + '@nomicfoundation/edr@0.12.0-next.5': optionalDependencies: - '@nomicfoundation/edr-darwin-arm64': 0.12.0-next.4 - '@nomicfoundation/edr-darwin-x64': 0.12.0-next.4 - '@nomicfoundation/edr-linux-arm64-gnu': 0.12.0-next.4 - '@nomicfoundation/edr-linux-arm64-musl': 0.12.0-next.4 - '@nomicfoundation/edr-linux-x64-gnu': 0.12.0-next.4 - '@nomicfoundation/edr-linux-x64-musl': 0.12.0-next.4 - '@nomicfoundation/edr-win32-x64-msvc': 0.12.0-next.4 + '@nomicfoundation/edr-darwin-arm64': 0.12.0-next.5 + '@nomicfoundation/edr-darwin-x64': 0.12.0-next.5 + '@nomicfoundation/edr-linux-arm64-gnu': 0.12.0-next.5 + '@nomicfoundation/edr-linux-arm64-musl': 0.12.0-next.5 + '@nomicfoundation/edr-linux-x64-gnu': 0.12.0-next.5 + '@nomicfoundation/edr-linux-x64-musl': 0.12.0-next.5 + '@nomicfoundation/edr-win32-x64-msvc': 0.12.0-next.5 '@nomicfoundation/hardhat-errors@3.0.0': dependencies: @@ -3311,16 +3278,6 @@ snapshots: dependencies: '@types/node': 22.18.0 - '@types/cbor@5.0.1': - dependencies: - '@types/node': 22.18.0 - - '@types/chai@4.3.20': {} - - '@types/debug@4.1.12': - dependencies: - '@types/ms': 2.1.0 - '@types/deep-equal-in-any-order@1.0.4': {} '@types/estree@1.0.8': {} @@ -3329,10 +3286,6 @@ snapshots: '@types/json-schema@7.0.15': {} - '@types/mocha@10.0.10': {} - - '@types/ms@2.1.0': {} - '@types/node@12.20.55': {} '@types/node@22.18.0': @@ -3565,8 +3518,6 @@ snapshots: dependencies: is-windows: 1.0.2 - bignumber.js@9.3.1: {} - blakejs@1.2.1: {} bn.js@4.11.6: {} @@ -3651,11 +3602,6 @@ snapshots: no-case: 2.3.2 upper-case: 1.1.3 - cbor@5.2.0: - dependencies: - bignumber.js: 9.3.1 - nofilter: 1.0.4 - chai@4.5.0: dependencies: assertion-error: 1.1.0 @@ -3700,7 +3646,7 @@ snapshots: upper-case: 1.1.3 upper-case-first: 1.1.2 - chardet@0.7.0: {} + chardet@2.1.0: {} check-error@1.0.3: dependencies: @@ -4091,12 +4037,6 @@ snapshots: extendable-error@0.1.7: {} - external-editor@3.1.0: - dependencies: - chardet: 0.7.0 - iconv-lite: 0.4.24 - tmp: 0.0.33 - fast-check@3.1.1: dependencies: pure-rand: 5.0.5 @@ -4293,9 +4233,9 @@ snapshots: graphemer@1.4.0: {} - hardhat@3.0.2: + hardhat@3.0.3: dependencies: - '@nomicfoundation/edr': 0.12.0-next.4 + '@nomicfoundation/edr': 0.12.0-next.5 '@nomicfoundation/hardhat-errors': 3.0.0 '@nomicfoundation/hardhat-utils': 3.0.0 '@nomicfoundation/hardhat-zod-utils': 3.0.0(zod@3.25.76) @@ -4371,7 +4311,7 @@ snapshots: human-id@4.1.1: {} - iconv-lite@0.4.24: + iconv-lite@0.6.3: dependencies: safer-buffer: 2.1.2 @@ -4623,8 +4563,6 @@ snapshots: node-gyp-build@4.8.4: {} - nofilter@1.0.4: {} - normalize-url@8.0.2: {} number-to-bn@1.7.0: From 71ea016cb658029aa84b1476ab6222476d7b20e7 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 14:53:48 +0200 Subject: [PATCH 08/14] replace ts-node with tsx, fix automation interface gen --- contracts/hardhat.config.ts | 2 +- contracts/package.json | 6 +- contracts/pnpm-lock.yaml | 146 ++---------------- ...nerate-automation-master-interface-v2_3.ts | 18 ++- .../generate-automation-master-interface.ts | 15 +- ...zksync-automation-master-interface-v2_3.ts | 17 +- .../v2_2/IAutomationRegistryMaster.sol | 8 +- .../v2_3/IAutomationRegistryMaster2_3.sol | 4 +- .../IZKSyncAutomationRegistryMaster2_3.sol | 4 +- 9 files changed, 53 insertions(+), 167 deletions(-) diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 88a407e6c8..9a0fc0ee3a 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -14,7 +14,7 @@ const config: HardhatUserConfig = { paths: { artifacts: './artifacts', cache: './cache', - sources: './src/v0.8/operatorforwarder', + sources: './src/v0.8/automation', tests: './test', }, solidity: { diff --git a/contracts/package.json b/contracts/package.json index 6ade5b0cf0..eda02a4171 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -62,7 +62,7 @@ "@types/node": "^22.18.0", "@typescript-eslint/eslint-plugin": "^8.41.0", "@typescript-eslint/parser": "^8.41.0", - "abi-to-sol": "^0.6.6", + "abi-to-sol": "^0.8.0", "deep-equal-in-any-order": "^2.0.6", "eslint": "^9.34.0", "eslint-plugin-prettier": "^5.5.4", @@ -72,7 +72,7 @@ "prettier": "^3.6.2", "solhint": "^5.2.0", "solhint-plugin-chainlink-solidity": "github:smartcontractkit/chainlink-solhint-rules#v1.2.1", - "ts-node": "^10.9.2", + "tsx": "^4.20.5", "typechain": "^8.3.2", "typescript": "^5.9.2" }, @@ -82,12 +82,12 @@ "@changesets/get-github-info": "^0.6.0", "@eslint/eslintrc": "^3.3.1", "@eth-optimism/contracts": "0.6.0", - "@openzeppelin/contracts-upgradeable": "4.9.6", "@openzeppelin/contracts-4.7.3/": "npm:@openzeppelin/contracts@4.7.3", "@openzeppelin/contracts-4.8.3/": "npm:@openzeppelin/contracts@4.8.3", "@openzeppelin/contracts-4.9.6/": "npm:@openzeppelin/contracts@4.9.6", "@openzeppelin/contracts-5.0.2/": "npm:@openzeppelin/contracts@5.0.2", "@openzeppelin/contracts-5.1.0/": "npm:@openzeppelin/contracts@5.1.0", + "@openzeppelin/contracts-upgradeable": "4.9.6", "@scroll-tech/contracts": "2.0.0", "@zksync/contracts": "github:matter-labs/era-contracts#446d391d34bdb48255d5f8fef8a8248925fc98b9", "semver": "^7.7.2" diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index d0b4b8742c..c040d276ef 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -77,8 +77,8 @@ importers: specifier: ^8.41.0 version: 8.41.0(eslint@9.34.0)(typescript@5.9.2) abi-to-sol: - specifier: ^0.6.6 - version: 0.6.6 + specifier: ^0.8.0 + version: 0.8.0 deep-equal-in-any-order: specifier: ^2.0.6 version: 2.0.6 @@ -106,9 +106,9 @@ importers: solhint-plugin-chainlink-solidity: specifier: github:smartcontractkit/chainlink-solhint-rules#v1.2.1 version: '@chainlink/solhint-plugin-chainlink-solidity@https://codeload.github.com/smartcontractkit/chainlink-solhint-rules/tar.gz/1b4c0c2663fcd983589d4f33a2e73908624ed43c' - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@22.18.0)(typescript@5.9.2) + tsx: + specifier: ^4.20.5 + version: 4.20.5 typechain: specifier: ^8.3.2 version: 8.3.2(typescript@5.9.2) @@ -195,10 +195,6 @@ packages: '@changesets/write@0.4.0': resolution: {integrity: sha512-CdTLvIOPiCNuH71pyDu3rA+Q0n65cmAbXnwWH84rKGiFumFzkmHNT8KHTMEchcxN+Kl8I54xGUhJ7l3E7X396Q==} - '@cspotcode/source-map-support@0.8.1': - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - '@esbuild/aix-ppc64@0.25.9': resolution: {integrity: sha512-OaGtL73Jck6pBKjNIe24BnFE6agGl+6KxDtTfHhy1HmhthfKouEcOhqpSL64K4/0WCtbKFLOdzD/44cJ4k9opA==} engines: {node: '>=18'} @@ -524,16 +520,6 @@ packages: '@types/node': optional: true - '@jridgewell/resolve-uri@3.1.2': - resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} - engines: {node: '>=6.0.0'} - - '@jridgewell/sourcemap-codec@1.5.4': - resolution: {integrity: sha512-VT2+G1VQs/9oz078bLrYbecdZKs912zQlkelYpuf+SXF+QvZDYJlbx/LSx+meSAwdDFnF8FVXW92AVjjkVmgFw==} - - '@jridgewell/trace-mapping@0.3.9': - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@manypkg/find-root@1.1.0': resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -719,8 +705,9 @@ packages: resolution: {integrity: sha512-+PmQX0PiAYPMeVYe237LJAYvOMYW1j2rH5YROyS3b4CTVJum34HfRvKvAzozHAQG0TnHNdUfY9nCeUyRAs//cw==} engines: {node: '>=14.16'} - '@truffle/abi-utils@0.3.10': - resolution: {integrity: sha512-Q3TXsF0NIct3KFLL2giF/alfSoKf5axyw+4wQdDRlihFrG1nbTBzWq+Q0ya6oHffZDida0NSpnJIf5IhFMV+JQ==} + '@truffle/abi-utils@1.0.3': + resolution: {integrity: sha512-AWhs01HCShaVKjml7Z4AbVREr/u4oiWxCcoR7Cktm0mEvtT04pvnxW5xB/cI4znRkrbPdFQlFt67kgrAjesYkw==} + engines: {node: ^16.20 || ^18.16 || >=20} deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. '@truffle/contract-schema@3.4.16': @@ -728,18 +715,6 @@ packages: engines: {node: ^16.20 || ^18.16 || >=20} deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info. - '@tsconfig/node10@1.0.11': - resolution: {integrity: sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==} - - '@tsconfig/node12@1.0.11': - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - - '@tsconfig/node14@1.0.3': - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - - '@tsconfig/node16@1.0.4': - resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} - '@types/bn.js@5.2.0': resolution: {integrity: sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q==} @@ -832,8 +807,8 @@ packages: '@yarnpkg/lockfile@1.1.0': resolution: {integrity: sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==} - abi-to-sol@0.6.6: - resolution: {integrity: sha512-PRn81rSpv6NXFPYQSw7ujruqIP6UkwZ/XoFldtiqCX8+2kHVc73xVaUVvdbro06vvBVZiwnxhEIGdI4BRMwGHw==} + abi-to-sol@0.8.0: + resolution: {integrity: sha512-hCGE+K1YiepxpWik0yPCN3Dfi+GY0kg2RNy29Mdjho2cXnhauvmsuvYjNDV8TFOhBq3a95KZUIfPUIkqqjHPYg==} hasBin: true acorn-jsx@5.3.2: @@ -841,10 +816,6 @@ packages: peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn-walk@8.3.4: - resolution: {integrity: sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==} - engines: {node: '>=0.4.0'} - acorn@8.15.0: resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==} engines: {node: '>=0.4.0'} @@ -892,9 +863,6 @@ packages: resolution: {integrity: sha512-QiVbZhyy4xAZ17UPEuG3YTOt8ZaoeOR1CvEAqrEsDBsOqINslaB147i9xqljZqoyf5S+EUlGStaj+t22LT9MOg==} engines: {node: '>=16'} - arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} @@ -1121,9 +1089,6 @@ packages: create-hmac@1.1.7: resolution: {integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==} - create-require@1.1.1: - resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - cross-spawn@6.0.6: resolution: {integrity: sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==} engines: {node: '>=4.8'} @@ -1174,10 +1139,6 @@ packages: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} - diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -1753,9 +1714,6 @@ packages: resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} @@ -2298,20 +2256,6 @@ packages: peerDependencies: typescript: '>=3.7.0' - ts-node@10.9.2: - resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - tsx@4.20.5: resolution: {integrity: sha512-+wKjMNU9w/EaQayHXb7WA7ZaHY6hN8WgfvHNQ3t1PnU91/7O8TcTnIhCDYTZwnt8JsO9IBqZ30Ln1r7pPF52Aw==} engines: {node: '>=18.0.0'} @@ -2378,9 +2322,6 @@ packages: util-deprecate@1.0.2: resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} - v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - web3-utils@1.10.0: resolution: {integrity: sha512-kSaCM0uMcZTNUSmn5vMEhlo02RObGNRRCkdX0V9UTAU0+lrvn0HSaudyCo6CQzuXUsnuY2ERJGCGPfeWmv19Rg==} engines: {node: '>=8.0.0'} @@ -2431,10 +2372,6 @@ packages: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} - yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} @@ -2615,10 +2552,6 @@ snapshots: human-id: 4.1.1 prettier: 2.8.8 - '@cspotcode/source-map-support@0.8.1': - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - '@esbuild/aix-ppc64@0.25.9': optional: true @@ -3050,15 +2983,6 @@ snapshots: optionalDependencies: '@types/node': 22.18.0 - '@jridgewell/resolve-uri@3.1.2': {} - - '@jridgewell/sourcemap-codec@1.5.4': {} - - '@jridgewell/trace-mapping@0.3.9': - dependencies: - '@jridgewell/resolve-uri': 3.1.2 - '@jridgewell/sourcemap-codec': 1.5.4 - '@manypkg/find-root@1.1.0': dependencies: '@babel/runtime': 7.28.2 @@ -3253,7 +3177,7 @@ snapshots: dependencies: defer-to-connect: 2.0.1 - '@truffle/abi-utils@0.3.10': + '@truffle/abi-utils@1.0.3': dependencies: change-case: 3.0.2 fast-check: 3.1.1 @@ -3266,14 +3190,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@tsconfig/node10@1.0.11': {} - - '@tsconfig/node12@1.0.11': {} - - '@tsconfig/node14@1.0.3': {} - - '@tsconfig/node16@1.0.4': {} - '@types/bn.js@5.2.0': dependencies: '@types/node': 22.18.0 @@ -3397,9 +3313,9 @@ snapshots: '@yarnpkg/lockfile@1.1.0': {} - abi-to-sol@0.6.6: + abi-to-sol@0.8.0: dependencies: - '@truffle/abi-utils': 0.3.10 + '@truffle/abi-utils': 1.0.3 '@truffle/contract-schema': 3.4.16 ajv: 6.12.6 better-ajv-errors: 0.8.2(ajv@6.12.6) @@ -3416,10 +3332,6 @@ snapshots: dependencies: acorn: 8.15.0 - acorn-walk@8.3.4: - dependencies: - acorn: 8.15.0 - acorn@8.15.0: {} adm-zip@0.4.16: {} @@ -3460,8 +3372,6 @@ snapshots: antlr4@4.13.2: {} - arg@4.1.3: {} - argparse@1.0.10: dependencies: sprintf-js: 1.0.3 @@ -3718,7 +3628,7 @@ snapshots: dependencies: cipher-base: 1.0.6 inherits: 2.0.4 - ripemd160: 2.0.1 + ripemd160: 2.0.2 sha.js: 2.4.12 create-hash@1.2.0: @@ -3738,8 +3648,6 @@ snapshots: safe-buffer: 5.2.1 sha.js: 2.4.12 - create-require@1.1.1: {} - cross-spawn@6.0.6: dependencies: nice-try: 1.0.5 @@ -3787,8 +3695,6 @@ snapshots: detect-indent@6.1.0: {} - diff@4.0.2: {} - dir-glob@3.0.1: dependencies: path-type: 4.0.0 @@ -4484,8 +4390,6 @@ snapshots: lowercase-keys@3.0.0: {} - make-error@1.3.6: {} - math-intrinsics@1.1.0: {} md5.js@1.3.5: @@ -5020,24 +4924,6 @@ snapshots: dependencies: typescript: 5.9.2 - ts-node@10.9.2(@types/node@22.18.0)(typescript@5.9.2): - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.11 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.4 - '@types/node': 22.18.0 - acorn: 8.15.0 - acorn-walk: 8.3.4 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.9.2 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - tsx@4.20.5: dependencies: esbuild: 0.25.9 @@ -5101,8 +4987,6 @@ snapshots: util-deprecate@1.0.2: {} - v8-compile-cache-lib@3.0.1: {} - web3-utils@1.10.0: dependencies: bn.js: 5.2.2 @@ -5151,8 +5035,6 @@ snapshots: yaml@1.10.2: {} - yn@3.1.1: {} - yocto-queue@0.1.0: {} zod@3.25.76: {} diff --git a/contracts/scripts/generate-automation-master-interface-v2_3.ts b/contracts/scripts/generate-automation-master-interface-v2_3.ts index c2d27eab50..b1f1ab9164 100644 --- a/contracts/scripts/generate-automation-master-interface-v2_3.ts +++ b/contracts/scripts/generate-automation-master-interface-v2_3.ts @@ -1,19 +1,21 @@ /** * @description this script generates a master interface for interacting with the automation registry - * @notice run this script with pnpm ts-node ./scripts/generate-automation-master-interface-v2_3.ts + * @notice run this script with pnpm tsx ./scripts/generate-automation-master-interface-v2_3.ts */ -import { AutomationRegistry2_3__factory as Registry } from '../typechain/factories/AutomationRegistry2_3__factory' -import { AutomationRegistryLogicA2_3__factory as RegistryLogicA } from '../typechain/factories/AutomationRegistryLogicA2_3__factory' -import { AutomationRegistryLogicB2_3__factory as RegistryLogicB } from '../typechain/factories/AutomationRegistryLogicB2_3__factory' -import { AutomationRegistryLogicC2_3__factory as RegistryLogicC } from '../typechain/factories/AutomationRegistryLogicC2_3__factory' -import { utils } from 'ethers' +import Registry from '../artifacts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol/AutomationRegistry2_3.json' +import RegistryLogicA from '../artifacts/src/v0.8/automation/v2_3/AutomationRegistryLogicA2_3.sol/AutomationRegistryLogicA2_3.json' +import RegistryLogicB from '../artifacts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol/AutomationRegistryLogicB2_3.json' +import RegistryLogicC from '../artifacts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol/AutomationRegistryLogicC2_3.json' + import fs from 'fs' import { exec } from 'child_process' +import { createHash } from 'crypto' const dest = 'src/v0.8/automation/interfaces/v2_3' const srcDest = `${dest}/IAutomationRegistryMaster2_3.sol` const tmpDest = `${dest}/tmp.txt` + const combinedABI = [] const abiSet = new Set() const abis = [ @@ -25,7 +27,7 @@ const abis = [ for (const abi of abis) { for (const entry of abi) { - const id = utils.id(JSON.stringify(entry)) + const id = createHash('sha256').update(JSON.stringify(entry)).digest('hex') if (!abiSet.has(id)) { abiSet.add(id) if ( @@ -41,7 +43,7 @@ for (const abi of abis) { } } -const checksum = utils.id(abis.join('')) +const checksum = createHash('sha256').update(JSON.stringify(abis)).digest('hex') fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI)) diff --git a/contracts/scripts/generate-automation-master-interface.ts b/contracts/scripts/generate-automation-master-interface.ts index 990408dfb2..788277837d 100644 --- a/contracts/scripts/generate-automation-master-interface.ts +++ b/contracts/scripts/generate-automation-master-interface.ts @@ -1,13 +1,14 @@ /** * @description this script generates a master interface for interacting with the automation registry - * @notice run this script with pnpm ts-node ./scripts/generate-automation-master-interface.ts + * @notice run this script with pnpm tsx ./scripts/generate-automation-master-interface.ts */ -import { AutomationRegistry2_2__factory as Registry } from '../typechain/factories/AutomationRegistry2_2__factory' -import { AutomationRegistryLogicA2_2__factory as RegistryLogicA } from '../typechain/factories/AutomationRegistryLogicA2_2__factory' -import { AutomationRegistryLogicB2_2__factory as RegistryLogicB } from '../typechain/factories/AutomationRegistryLogicB2_2__factory' -import { utils } from 'ethers' +import Registry from '../artifacts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol/AutomationRegistry2_2.json' +import RegistryLogicA from '../artifacts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol/AutomationRegistryLogicA2_2.json' +import RegistryLogicB from '../artifacts/src/v0.8/automation/v2_2/AutomationRegistryLogicB2_2.sol/AutomationRegistryLogicB2_2.json' + import fs from 'fs' import { exec } from 'child_process' +import { createHash } from 'crypto' const dest = 'src/v0.8/automation/interfaces/v2_2' const srcDest = `${dest}/IAutomationRegistryMaster.sol` @@ -19,7 +20,7 @@ const abis = [Registry.abi, RegistryLogicA.abi, RegistryLogicB.abi] for (const abi of abis) { for (const entry of abi) { - const id = utils.id(JSON.stringify(entry)) + const id = createHash('sha256').update(JSON.stringify(entry)).digest('hex') if (!abiSet.has(id)) { abiSet.add(id) if ( @@ -35,7 +36,7 @@ for (const abi of abis) { } } -const checksum = utils.id(abis.join('')) +const checksum = createHash('sha256').update(JSON.stringify(abis)).digest('hex') fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI)) diff --git a/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts b/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts index 2e267573aa..da9f3b03b5 100644 --- a/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts +++ b/contracts/scripts/generate-zksync-automation-master-interface-v2_3.ts @@ -1,14 +1,15 @@ /** * @description this script generates a master interface for interacting with the automation registry - * @notice run this script with pnpm ts-node ./scripts/generate-zksync-automation-master-interface-v2_3.ts + * @notice run this script with pnpm tsx ./scripts/generate-zksync-automation-master-interface-v2_3.ts */ -import { ZKSyncAutomationRegistry2_3__factory as Registry } from '../typechain/factories/ZKSyncAutomationRegistry2_3__factory' -import { ZKSyncAutomationRegistryLogicA2_3__factory as RegistryLogicA } from '../typechain/factories/ZKSyncAutomationRegistryLogicA2_3__factory' -import { ZKSyncAutomationRegistryLogicB2_3__factory as RegistryLogicB } from '../typechain/factories/ZKSyncAutomationRegistryLogicB2_3__factory' -import { ZKSyncAutomationRegistryLogicC2_3__factory as RegistryLogicC } from '../typechain/factories/ZKSyncAutomationRegistryLogicC2_3__factory' -import { utils } from 'ethers' +import Registry from '../artifacts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol/ZKSyncAutomationRegistry2_3.json' +import RegistryLogicA from '../artifacts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicA2_3.sol/ZKSyncAutomationRegistryLogicA2_3.json' +import RegistryLogicB from '../artifacts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol/ZKSyncAutomationRegistryLogicB2_3.json' +import RegistryLogicC from '../artifacts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol/ZKSyncAutomationRegistryLogicC2_3.json' + import fs from 'fs' import { exec } from 'child_process' +import { createHash } from 'crypto' const dest = 'src/v0.8/automation/interfaces/zksync' const srcDest = `${dest}/IZKSyncAutomationRegistryMaster2_3.sol` @@ -25,7 +26,7 @@ const abis = [ for (const abi of abis) { for (const entry of abi) { - const id = utils.id(JSON.stringify(entry)) + const id = createHash('sha256').update(JSON.stringify(entry)).digest('hex') if (!abiSet.has(id)) { abiSet.add(id) if ( @@ -41,7 +42,7 @@ for (const abi of abis) { } } -const checksum = utils.id(abis.join('')) +const checksum = createHash('sha256').update(JSON.stringify(abis)).digest('hex') fs.writeFileSync(`${tmpDest}`, JSON.stringify(combinedABI)) diff --git a/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol index 9d6e2c72c5..558b428f13 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol @@ -1,6 +1,6 @@ -// abi-checksum: 0xfc319f2ddde95d2e0226c913b9e417495effc4c8c847d01fe07e3de68ea8839c +// abi-checksum: e6814d884d91e02be00b3ec7134d6b61a80a3f5a8b3ce0dbbf209f34dd58355c // SPDX-License-Identifier: MIT -// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.6. SEE SOURCE BELOW. !! +// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.8.0. SEE SOURCE BELOW. !! pragma solidity ^0.8.4; interface IAutomationRegistryMaster { @@ -103,7 +103,7 @@ interface IAutomationRegistryMaster { event UpkeepTriggerConfigSet(uint256 indexed id, bytes triggerConfig); event UpkeepUnpaused(uint256 indexed id); - fallback() external; + fallback() external payable; function acceptOwnership() external; function fallbackTo() external view returns (address); function latestConfigDetails() external view returns (uint32 configCount, uint32 blockNumber, bytes32 configDigest); @@ -374,5 +374,5 @@ interface IAutomationV21PlusCommon { // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* -[{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_2","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MaxCheckDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MaxPerformDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"PaymentGreaterThanAllLINK","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"OwnerFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"internalType":"struct AutomationRegistryBase2_2.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_2","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkNativeFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkNativeFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum AutomationRegistryBase2_2.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmitCalldataFixedBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransmitCalldataPerSignerBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum AutomationRegistryBase2_2.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepTranscoderVersion","outputs":[{"internalType":"enum UpkeepFormat","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOwnerFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] +[{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_2","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MaxCheckDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MaxPerformDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"PaymentGreaterThanAllLINK","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"OwnerFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"internalType":"struct AutomationRegistryBase2_2.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_2","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkNativeFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkNativeFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum AutomationRegistryBase2_2.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmitCalldataFixedBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransmitCalldataPerSignerBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum AutomationRegistryBase2_2.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepTranscoderVersion","outputs":[{"internalType":"enum UpkeepFormat","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOwnerFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] */ diff --git a/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol b/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol index 0332378584..4d7be31526 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol @@ -1,6 +1,6 @@ -// abi-checksum: 0xacb9d0daec3e3bed110c8cf95bdbe7280a21ce61519d4cd496f802884bf05524 +// abi-checksum: 9abe5ae170fbe32b3ecc5a8b1a0a4676364953c6780d053f5087aa1b86be42f4 // SPDX-License-Identifier: MIT -// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.6. SEE SOURCE BELOW. !! +// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.8.0. SEE SOURCE BELOW. !! pragma solidity ^0.8.4; interface IAutomationRegistryMaster2_3 { diff --git a/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol b/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol index db56d251c6..0d7938d6e8 100644 --- a/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol +++ b/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol @@ -1,7 +1,7 @@ // solhint-disable -// abi-checksum: 0x5857a77a981fcb60dbdac0700e68420cbe544249b20d9326d51c5ef8584c5dd7 +// abi-checksum: 24611050742b2673899f5f68ef240432ff61569918a6002b4a483910e4e8695f // SPDX-License-Identifier: MIT -// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.6.6. SEE SOURCE BELOW. !! +// !! THIS FILE WAS AUTOGENERATED BY abi-to-sol v0.8.0. SEE SOURCE BELOW. !! pragma solidity ^0.8.19; interface IZKSyncAutomationRegistryMaster2_3 { From fe7fe56aee393fe8f20c64d254edae412a06e6ec Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 15:29:27 +0200 Subject: [PATCH 09/14] rm typechain --- contracts/package.json | 1 - contracts/pnpm-lock.yaml | 160 --------------------------------------- 2 files changed, 161 deletions(-) diff --git a/contracts/package.json b/contracts/package.json index eda02a4171..8869dc8dab 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -73,7 +73,6 @@ "solhint": "^5.2.0", "solhint-plugin-chainlink-solidity": "github:smartcontractkit/chainlink-solhint-rules#v1.2.1", "tsx": "^4.20.5", - "typechain": "^8.3.2", "typescript": "^5.9.2" }, "dependencies": { diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index c040d276ef..bd643f73c5 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -109,9 +109,6 @@ importers: tsx: specifier: ^4.20.5 version: 4.20.5 - typechain: - specifier: ^8.3.2 - version: 8.3.2(typescript@5.9.2) typescript: specifier: ^5.9.2 version: 5.9.2 @@ -739,9 +736,6 @@ packages: '@types/pbkdf2@3.1.2': resolution: {integrity: sha512-uRwJqmiXmh9++aSu1VNEn3iIxWOhd8AHXNSdlaLfdAAdSTY9jYVeGWnzejM3dvrkbqE3/hyQkQQ29IFATEGlew==} - '@types/prettier@2.7.3': - resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==} - '@types/secp256k1@4.0.6': resolution: {integrity: sha512-hHxJU6PAEUn0TP4S/ZOzuTUvJWuZ6eIKeNKb5RBpODvSl6hp1Wrw4s7ATY50rklRCScUDpHzVA/DQdSjJ3UoYQ==} @@ -869,14 +863,6 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - array-back@3.1.0: - resolution: {integrity: sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==} - engines: {node: '>=6'} - - array-back@4.0.2: - resolution: {integrity: sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg==} - engines: {node: '>=8'} - array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} @@ -1047,14 +1033,6 @@ packages: color-name@1.1.4: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} - command-line-args@5.2.1: - resolution: {integrity: sha512-H4UfQhZyakIjC74I9d34fGYDwk3XpSr17QhEd0Q3I9Xq1CETHo4Hcuo87WyWHpAF1aSLjLRf5lD9ZGX2qStUvg==} - engines: {node: '>=4.0.0'} - - command-line-usage@6.1.3: - resolution: {integrity: sha512-sH5ZSPr+7UStsloltmDh7Ce5fb8XPlHyoPzTpyyMuYCtervL65+ubVZ6Q61cFtFl62UyJlc8/JwERRbAFPUqgw==} - engines: {node: '>=8.0.0'} - commander@10.0.1: resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} engines: {node: '>=14'} @@ -1327,10 +1305,6 @@ packages: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} - find-replace@3.0.0: - resolution: {integrity: sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==} - engines: {node: '>=4.0.0'} - find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -1410,10 +1384,6 @@ packages: resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} engines: {node: '>=10.13.0'} - glob@7.1.7: - resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==} - deprecated: Glob versions prior to v9 are no longer supported - glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} deprecated: Glob versions prior to v9 are no longer supported @@ -1683,9 +1653,6 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} - lodash.camelcase@4.3.0: - resolution: {integrity: sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==} - lodash.mapvalues@4.6.0: resolution: {integrity: sha512-JPFqXFeZQ7BfS00H58kClY7SPVeHertPE0lNuCyZ26/XlN8TvakYD7b9bGyNmXbT/D3BbtPAAmq90gPWqLkxlQ==} @@ -1763,11 +1730,6 @@ packages: minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - mkdirp@1.0.4: - resolution: {integrity: sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==} - engines: {node: '>=10'} - hasBin: true - moment@2.30.1: resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} @@ -2005,10 +1967,6 @@ packages: resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} engines: {node: '>= 6'} - reduce-flatten@2.0.0: - resolution: {integrity: sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==} - engines: {node: '>=6'} - registry-auth-token@5.1.0: resolution: {integrity: sha512-GdekYuwLXLxMuFTwAPg5UKGLW/UXzQrZvH/Zj791BQif5T05T0RsaLfHc9q3ZOKi7n+BoprPD9mJ0O0k4xzUlw==} engines: {node: '>=14'} @@ -2163,9 +2121,6 @@ packages: sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} - string-format@2.0.0: - resolution: {integrity: sha512-bbEs3scLeYNXLecRRuk6uJxdXUSj6le/8rNPHChIJTn2V79aXVTR1EH2OH5zLKKoz0V02fOUKZZcw01pLUShZA==} - string-width@4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -2208,10 +2163,6 @@ packages: resolution: {integrity: sha512-MeQTA1r0litLUf0Rp/iisCaL8761lKAZHaimlbGK4j0HysC4PLfqygQj9srcs0m2RdtDYnF8UuYyKpbjHYp7Jw==} engines: {node: ^14.18.0 || >=16.0.0} - table-layout@1.0.2: - resolution: {integrity: sha512-qd/R7n5rQTRFi+Zf2sk5XVVd9UQl6ZkduPFC3S7WEGJAmetDTjY3qPN50eSKzwuzEyQKy5TN2TiZdkIjos2L6A==} - engines: {node: '>=8.0.0'} - table@6.9.0: resolution: {integrity: sha512-9kY+CygyYM6j02t5YFHbNz2FN5QmYGv9zAjVp4lCDjlCw7amdckXlEt/bjMhUIfj4ThGRE4gCUH5+yGnNuPo5A==} engines: {node: '>=10.0.0'} @@ -2247,15 +2198,6 @@ packages: peerDependencies: typescript: '>=4.8.4' - ts-command-line-args@2.5.1: - resolution: {integrity: sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw==} - hasBin: true - - ts-essentials@7.0.3: - resolution: {integrity: sha512-8+gr5+lqO3G84KdiTSMRLtuyJ+nTBVRKuCrK4lidMPdVeEp0uqC875uE5NMcaA7YYMN7XsNiFQuMvasF8HT/xQ==} - peerDependencies: - typescript: '>=3.7.0' - tsx@4.20.5: resolution: {integrity: sha512-+wKjMNU9w/EaQayHXb7WA7ZaHY6hN8WgfvHNQ3t1PnU91/7O8TcTnIhCDYTZwnt8JsO9IBqZ30Ln1r7pPF52Aw==} engines: {node: '>=18.0.0'} @@ -2269,12 +2211,6 @@ packages: resolution: {integrity: sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==} engines: {node: '>=4'} - typechain@8.3.2: - resolution: {integrity: sha512-x/sQYr5w9K7yv3es7jo4KTX05CLxOf7TRWwoHlrjRh8H82G64g+k7VuWPJlgMo6qrjfCulOdfBjiaDtmhFYD/Q==} - hasBin: true - peerDependencies: - typescript: '>=4.3.0' - typed-array-buffer@1.0.3: resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} engines: {node: '>= 0.4'} @@ -2284,14 +2220,6 @@ packages: engines: {node: '>=14.17'} hasBin: true - typical@4.0.0: - resolution: {integrity: sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==} - engines: {node: '>=8'} - - typical@5.2.0: - resolution: {integrity: sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg==} - engines: {node: '>=8'} - undici-types@6.21.0: resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} @@ -2349,10 +2277,6 @@ packages: resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} engines: {node: '>=0.10.0'} - wordwrapjs@4.0.1: - resolution: {integrity: sha512-kKlNACbvHrkpIw6oPeYDSmdCTu2hdMHoyXLTcUKala++lx5Y+wjJ/e474Jqv5abnVmwxw08DiTuHmw69lJGksA==} - engines: {node: '>=8.0.0'} - wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} @@ -3212,8 +3136,6 @@ snapshots: dependencies: '@types/node': 22.18.0 - '@types/prettier@2.7.3': {} - '@types/secp256k1@4.0.6': dependencies: '@types/node': 22.18.0 @@ -3378,10 +3300,6 @@ snapshots: argparse@2.0.1: {} - array-back@3.1.0: {} - - array-back@4.0.2: {} - array-union@2.1.0: {} assertion-error@1.1.0: {} @@ -3585,20 +3503,6 @@ snapshots: color-name@1.1.4: {} - command-line-args@5.2.1: - dependencies: - array-back: 3.1.0 - find-replace: 3.0.0 - lodash.camelcase: 4.3.0 - typical: 4.0.0 - - command-line-usage@6.1.3: - dependencies: - array-back: 4.0.2 - chalk: 2.4.2 - table-layout: 1.0.2 - typical: 5.2.0 - commander@10.0.1: {} concat-map@0.0.1: {} @@ -3979,10 +3883,6 @@ snapshots: dependencies: to-regex-range: 5.0.1 - find-replace@3.0.0: - dependencies: - array-back: 3.1.0 - find-up@4.1.0: dependencies: locate-path: 5.0.0 @@ -4076,15 +3976,6 @@ snapshots: dependencies: is-glob: 4.0.3 - glob@7.1.7: - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 3.1.2 - once: 1.4.0 - path-is-absolute: 1.0.1 - glob@7.2.3: dependencies: fs.realpath: 1.0.0 @@ -4366,8 +4257,6 @@ snapshots: dependencies: p-locate: 5.0.0 - lodash.camelcase@4.3.0: {} - lodash.mapvalues@4.6.0: {} lodash.merge@4.6.2: {} @@ -4437,8 +4326,6 @@ snapshots: minimist@1.2.8: {} - mkdirp@1.0.4: {} - moment@2.30.1: {} mri@1.2.0: {} @@ -4660,8 +4547,6 @@ snapshots: string_decoder: 1.3.0 util-deprecate: 1.0.2 - reduce-flatten@2.0.0: {} - registry-auth-token@5.1.0: dependencies: '@pnpm/npm-conf': 2.3.1 @@ -4826,8 +4711,6 @@ snapshots: sprintf-js@1.0.3: {} - string-format@2.0.0: {} - string-width@4.2.3: dependencies: emoji-regex: 8.0.0 @@ -4869,13 +4752,6 @@ snapshots: dependencies: '@pkgr/core': 0.2.9 - table-layout@1.0.2: - dependencies: - array-back: 4.0.2 - deep-extend: 0.6.0 - typical: 5.2.0 - wordwrapjs: 4.0.1 - table@6.9.0: dependencies: ajv: 8.17.1 @@ -4913,17 +4789,6 @@ snapshots: dependencies: typescript: 5.9.2 - ts-command-line-args@2.5.1: - dependencies: - chalk: 4.1.2 - command-line-args: 5.2.1 - command-line-usage: 6.1.3 - string-format: 2.0.0 - - ts-essentials@7.0.3(typescript@5.9.2): - dependencies: - typescript: 5.9.2 - tsx@4.20.5: dependencies: esbuild: 0.25.9 @@ -4937,22 +4802,6 @@ snapshots: type-detect@4.1.0: {} - typechain@8.3.2(typescript@5.9.2): - dependencies: - '@types/prettier': 2.7.3 - debug: 4.4.1 - fs-extra: 7.0.1 - glob: 7.1.7 - js-sha3: 0.8.0 - lodash: 4.17.21 - mkdirp: 1.0.4 - prettier: 2.8.8 - ts-command-line-args: 2.5.1 - ts-essentials: 7.0.3(typescript@5.9.2) - typescript: 5.9.2 - transitivePeerDependencies: - - supports-color - typed-array-buffer@1.0.3: dependencies: call-bound: 1.0.4 @@ -4961,10 +4810,6 @@ snapshots: typescript@5.9.2: {} - typical@4.0.0: {} - - typical@5.2.0: {} - undici-types@6.21.0: {} undici@6.21.3: {} @@ -5024,11 +4869,6 @@ snapshots: word-wrap@1.2.5: {} - wordwrapjs@4.0.1: - dependencies: - reduce-flatten: 2.0.0 - typical: 5.2.0 - wrappy@1.0.2: {} ws@8.18.0: {} From fceca335fe898e43e2e8d911f0c6bfc04f24649a Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sat, 30 Aug 2025 15:31:36 +0200 Subject: [PATCH 10/14] rm old overrides & deep-equal-in-any-order --- contracts/.tool-versions | 2 +- contracts/package.json | 8 +- contracts/pnpm-lock.yaml | 89 ++++++------------- ...nerate-automation-master-interface-v2_3.ts | 1 - ..._automation_registry_master_wrapper_2_2.go | 2 +- ...rapper-dependency-versions-do-not-edit.txt | 2 +- 6 files changed, 32 insertions(+), 72 deletions(-) diff --git a/contracts/.tool-versions b/contracts/.tool-versions index 9684ba663a..77cd4d76b5 100644 --- a/contracts/.tool-versions +++ b/contracts/.tool-versions @@ -1,2 +1,2 @@ -nodejs 20.13.1 +nodejs 22.18.0 pnpm 10.6.5 diff --git a/contracts/package.json b/contracts/package.json index 8869dc8dab..c925a1c1f3 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -30,11 +30,7 @@ ".solhintignore-test" ], "pnpm": { - "_comment": "See https://github.com/ethers-io/ethers.js/discussions/2849#discussioncomment-2696454", - "_comment2_logger": "See https://github.com/ethers-io/ethers.js/issues/379 we pin this version since that's what was used in the old yarn lockfile", "overrides": { - "@ethersproject/logger": "5.0.6", - "@ethersproject/providers@5.7.2>ws": "7.5.10", "@openzeppelin/contracts-upgradeable": "4.9.6", "@openzeppelin/contracts": "4.9.6", "cookie": "^0.7.0", @@ -53,17 +49,15 @@ ] }, "engines": { - "node": ">=18", + "node": ">=22", "pnpm": ">=10" }, "devDependencies": { "@eslint/js": "^9.34.0", - "@types/deep-equal-in-any-order": "^1.0.4", "@types/node": "^22.18.0", "@typescript-eslint/eslint-plugin": "^8.41.0", "@typescript-eslint/parser": "^8.41.0", "abi-to-sol": "^0.8.0", - "deep-equal-in-any-order": "^2.0.6", "eslint": "^9.34.0", "eslint-plugin-prettier": "^5.5.4", "globals": "^16.3.0", diff --git a/contracts/pnpm-lock.yaml b/contracts/pnpm-lock.yaml index bd643f73c5..4c0391f144 100644 --- a/contracts/pnpm-lock.yaml +++ b/contracts/pnpm-lock.yaml @@ -5,8 +5,6 @@ settings: excludeLinksFromLockfile: false overrides: - '@ethersproject/logger': 5.0.6 - '@ethersproject/providers@5.7.2>ws': 7.5.10 '@openzeppelin/contracts-upgradeable': 4.9.6 '@openzeppelin/contracts': 4.9.6 cookie: ^0.7.0 @@ -64,9 +62,6 @@ importers: '@eslint/js': specifier: ^9.34.0 version: 9.34.0 - '@types/deep-equal-in-any-order': - specifier: ^1.0.4 - version: 1.0.4 '@types/node': specifier: ^22.18.0 version: 22.18.0 @@ -79,9 +74,6 @@ importers: abi-to-sol: specifier: ^0.8.0 version: 0.8.0 - deep-equal-in-any-order: - specifier: ^2.0.6 - version: 2.0.6 eslint: specifier: ^9.34.0 version: 9.34.0 @@ -436,8 +428,8 @@ packages: '@ethersproject/keccak256@5.8.0': resolution: {integrity: sha512-A1pkKLZSz8pDaQ1ftutZoaN46I6+jvuqugx5KYNeQOPqq+JZ0Txm7dlWesCHB5cndJSu5vP2VKptKf7cksERng==} - '@ethersproject/logger@5.0.6': - resolution: {integrity: sha512-FrX0Vnb3JZ1md/7GIZfmJ06XOAA8r3q9Uqt9O5orr4ZiksnbpXKlyDzQtlZ5Yv18RS8CAUbiKH9vwidJg1BPmQ==} + '@ethersproject/logger@5.8.0': + resolution: {integrity: sha512-Qe6knGmY+zPPWTC+wQrpitodgBfH7XoceCGL5bJVejmH+yCS3R8jJm8iiWuvWbG76RUmyEG53oqv6GMVWqunjA==} '@ethersproject/networks@5.8.0': resolution: {integrity: sha512-egPJh3aPVAzbHwq8DD7Po53J4OUSsA1MjQp8Vf/OZPav5rlmWUaFLiq8cvQiGK0Z5K6LYzm29+VA/p4RL1FzNg==} @@ -715,9 +707,6 @@ packages: '@types/bn.js@5.2.0': resolution: {integrity: sha512-DLbJ1BPqxvQhIGbeu8VbUC1DiAiahHtAYvA0ZEAa4P31F7IaArc8z3C3BRQdWX4mtLQuABG4yzp76ZrS02Ui1Q==} - '@types/deep-equal-in-any-order@1.0.4': - resolution: {integrity: sha512-nkgl+KTkRWeybgMSBCrWrc1YHFrLADVxZ6Kllj40p9U499NGsCrFUjzgHgQY+Upsa/VWOc3YlsFEvhg+drUmkA==} - '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} @@ -1095,9 +1084,6 @@ packages: resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} engines: {node: '>=6'} - deep-equal-in-any-order@2.0.6: - resolution: {integrity: sha512-RfnWHQzph10YrUjvWwhd15Dne8ciSJcZ3U6OD7owPwiVwsdE5IFSoZGg8rlwJD11ES+9H5y8j3fCofviRHOqLQ==} - deep-extend@0.6.0: resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} engines: {node: '>=4.0.0'} @@ -1653,9 +1639,6 @@ packages: resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} engines: {node: '>=10'} - lodash.mapvalues@4.6.0: - resolution: {integrity: sha512-JPFqXFeZQ7BfS00H58kClY7SPVeHertPE0lNuCyZ26/XlN8TvakYD7b9bGyNmXbT/D3BbtPAAmq90gPWqLkxlQ==} - lodash.merge@4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} @@ -2105,9 +2088,6 @@ packages: resolution: {integrity: sha512-9NZC1zt+O2K7zEZOhTT9rFeB6GdxC6qTX5pWX70RaQoflR9RejJQUC+/19LNi+e7K9Ptb4k7XAWO9wY5mkprHg==} hasBin: true - sort-any@2.0.0: - resolution: {integrity: sha512-T9JoiDewQEmWcnmPn/s9h/PH9t3d/LSWi0RgVmXSuDYeZXTZOZ1/wrK2PHaptuR1VXe3clLLt0pD6sgVOwjNEA==} - source-map-support@0.5.21: resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} @@ -2638,7 +2618,7 @@ snapshots: '@ethersproject/constants': 5.8.0 '@ethersproject/hash': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/strings': 5.8.0 @@ -2646,7 +2626,7 @@ snapshots: dependencies: '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/networks': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/transactions': 5.8.0 @@ -2657,7 +2637,7 @@ snapshots: '@ethersproject/abstract-provider': 5.8.0 '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/address@5.8.0': @@ -2665,7 +2645,7 @@ snapshots: '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/rlp': 5.8.0 '@ethersproject/base64@5.8.0': @@ -2680,12 +2660,12 @@ snapshots: '@ethersproject/bignumber@5.8.0': dependencies: '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 bn.js: 5.2.2 '@ethersproject/bytes@5.8.0': dependencies: - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/constants@5.8.0': dependencies: @@ -2700,7 +2680,7 @@ snapshots: '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 '@ethersproject/constants': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/transactions': 5.8.0 @@ -2712,7 +2692,7 @@ snapshots: '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/strings': 5.8.0 @@ -2722,7 +2702,7 @@ snapshots: '@ethersproject/basex': 5.8.0 '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/pbkdf2': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/sha2': 5.8.0 @@ -2738,7 +2718,7 @@ snapshots: '@ethersproject/bytes': 5.8.0 '@ethersproject/hdnode': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/pbkdf2': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/random': 5.8.0 @@ -2752,11 +2732,11 @@ snapshots: '@ethersproject/bytes': 5.8.0 js-sha3: 0.8.0 - '@ethersproject/logger@5.0.6': {} + '@ethersproject/logger@5.8.0': {} '@ethersproject/networks@5.8.0': dependencies: - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/pbkdf2@5.8.0': dependencies: @@ -2765,7 +2745,7 @@ snapshots: '@ethersproject/properties@5.8.0': dependencies: - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/providers@5.8.0': dependencies: @@ -2778,7 +2758,7 @@ snapshots: '@ethersproject/bytes': 5.8.0 '@ethersproject/constants': 5.8.0 '@ethersproject/hash': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/networks': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/random': 5.8.0 @@ -2796,23 +2776,23 @@ snapshots: '@ethersproject/random@5.8.0': dependencies: '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/rlp@5.8.0': dependencies: '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/sha2@5.8.0': dependencies: '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 hash.js: 1.1.7 '@ethersproject/signing-key@5.8.0': dependencies: '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 bn.js: 5.2.2 elliptic: 6.6.1 @@ -2823,7 +2803,7 @@ snapshots: '@ethersproject/bignumber': 5.8.0 '@ethersproject/bytes': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/sha2': 5.8.0 '@ethersproject/strings': 5.8.0 @@ -2831,7 +2811,7 @@ snapshots: dependencies: '@ethersproject/bytes': 5.8.0 '@ethersproject/constants': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/transactions@5.8.0': dependencies: @@ -2840,7 +2820,7 @@ snapshots: '@ethersproject/bytes': 5.8.0 '@ethersproject/constants': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/rlp': 5.8.0 '@ethersproject/signing-key': 5.8.0 @@ -2849,7 +2829,7 @@ snapshots: dependencies: '@ethersproject/bignumber': 5.8.0 '@ethersproject/constants': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/wallet@5.8.0': dependencies: @@ -2862,7 +2842,7 @@ snapshots: '@ethersproject/hdnode': 5.8.0 '@ethersproject/json-wallets': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/random': 5.8.0 '@ethersproject/signing-key': 5.8.0 @@ -2873,7 +2853,7 @@ snapshots: dependencies: '@ethersproject/base64': 5.8.0 '@ethersproject/bytes': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/strings': 5.8.0 @@ -2881,7 +2861,7 @@ snapshots: dependencies: '@ethersproject/bytes': 5.8.0 '@ethersproject/hash': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/properties': 5.8.0 '@ethersproject/strings': 5.8.0 @@ -3118,8 +3098,6 @@ snapshots: dependencies: '@types/node': 22.18.0 - '@types/deep-equal-in-any-order@1.0.4': {} - '@types/estree@1.0.8': {} '@types/http-cache-semantics@4.0.4': {} @@ -3580,11 +3558,6 @@ snapshots: dependencies: type-detect: 4.1.0 - deep-equal-in-any-order@2.0.6: - dependencies: - lodash.mapvalues: 4.6.0 - sort-any: 2.0.0 - deep-extend@0.6.0: {} deep-is@0.1.4: {} @@ -3815,7 +3788,7 @@ snapshots: '@ethersproject/hdnode': 5.8.0 '@ethersproject/json-wallets': 5.8.0 '@ethersproject/keccak256': 5.8.0 - '@ethersproject/logger': 5.0.6 + '@ethersproject/logger': 5.8.0 '@ethersproject/networks': 5.8.0 '@ethersproject/pbkdf2': 5.8.0 '@ethersproject/properties': 5.8.0 @@ -4257,8 +4230,6 @@ snapshots: dependencies: p-locate: 5.0.0 - lodash.mapvalues@4.6.0: {} - lodash.merge@4.6.2: {} lodash.startcase@4.4.0: {} @@ -4693,10 +4664,6 @@ snapshots: transitivePeerDependencies: - typescript - sort-any@2.0.0: - dependencies: - lodash: 4.17.21 - source-map-support@0.5.21: dependencies: buffer-from: 1.1.2 diff --git a/contracts/scripts/generate-automation-master-interface-v2_3.ts b/contracts/scripts/generate-automation-master-interface-v2_3.ts index b1f1ab9164..6e1e62083c 100644 --- a/contracts/scripts/generate-automation-master-interface-v2_3.ts +++ b/contracts/scripts/generate-automation-master-interface-v2_3.ts @@ -15,7 +15,6 @@ const dest = 'src/v0.8/automation/interfaces/v2_3' const srcDest = `${dest}/IAutomationRegistryMaster2_3.sol` const tmpDest = `${dest}/tmp.txt` - const combinedABI = [] const abiSet = new Set() const abis = [ diff --git a/gethwrappers/generated/i_automation_registry_master_wrapper_2_2/i_automation_registry_master_wrapper_2_2.go b/gethwrappers/generated/i_automation_registry_master_wrapper_2_2/i_automation_registry_master_wrapper_2_2.go index 63d3c4b5b1..8d7f8906a5 100644 --- a/gethwrappers/generated/i_automation_registry_master_wrapper_2_2/i_automation_registry_master_wrapper_2_2.go +++ b/gethwrappers/generated/i_automation_registry_master_wrapper_2_2/i_automation_registry_master_wrapper_2_2.go @@ -95,7 +95,7 @@ type IAutomationV21PlusCommonUpkeepInfoLegacy struct { } var IAutomationRegistryMasterMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"fallback\",\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"acceptPayeeship\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"acceptUpkeepAdmin\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addFunds\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"cancelUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"checkCallback\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"values\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"checkUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"triggerData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fastGasWei\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"linkNative\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"checkUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fastGasWei\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"linkNative\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"executeCallback\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"payload\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"fallbackTo\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getActiveUpkeepIDs\",\"inputs\":[{\"name\":\"startIndex\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"maxCount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAdminPrivilegeConfig\",\"inputs\":[{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAllowedReadOnlyAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAutomationForwarderLogic\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBalance\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"balance\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCancellationDelay\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getChainModule\",\"inputs\":[],\"outputs\":[{\"name\":\"chainModule\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConditionalGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getFastGasFeedAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getForwarder\",\"inputs\":[{\"name\":\"upkeepID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLinkAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLinkNativeFeedAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLogGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getMaxPaymentForGas\",\"inputs\":[{\"name\":\"triggerType\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[{\"name\":\"maxPayment\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMinBalance\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMinBalanceForUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"minBalance\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPeerRegistryMigrationPermission\",\"inputs\":[{\"name\":\"peer\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPerPerformByteGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getPerSignerGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getReorgProtectionEnabled\",\"inputs\":[],\"outputs\":[{\"name\":\"reorgProtectionEnabled\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getSignerInfo\",\"inputs\":[{\"name\":\"query\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"active\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"index\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getState\",\"inputs\":[],\"outputs\":[{\"name\":\"state\",\"type\":\"tuple\",\"internalType\":\"structIAutomationV21PlusCommon.StateLegacy\",\"components\":[{\"name\":\"nonce\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"ownerLinkBalance\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"expectedLinkBalance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"totalPremium\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"numUpkeeps\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"configCount\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"latestConfigBlockNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"latestConfigDigest\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"latestEpoch\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"paused\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"config\",\"type\":\"tuple\",\"internalType\":\"structIAutomationV21PlusCommon.OnchainConfigLegacy\",\"components\":[{\"name\":\"paymentPremiumPPB\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"flatFeeMicroLink\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"checkGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"stalenessSeconds\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"gasCeilingMultiplier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"minUpkeepSpend\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"maxPerformGas\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxCheckDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxPerformDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxRevertDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"fallbackGasPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fallbackLinkPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"transcoder\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"registrars\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"upkeepPrivilegeManager\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"signers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransmitCalldataFixedBytesOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTransmitCalldataPerSignerBytesOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTransmitterInfo\",\"inputs\":[{\"name\":\"query\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"active\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"index\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"balance\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"lastCollected\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"payee\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTriggerType\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"upkeepInfo\",\"type\":\"tuple\",\"internalType\":\"structIAutomationV21PlusCommon.UpkeepInfoLegacy\",\"components\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"performGas\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"checkData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"balance\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"maxValidBlocknumber\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastPerformedBlockNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"amountSpent\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"paused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getUpkeepPrivilegeConfig\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getUpkeepTriggerConfig\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"hasDedupKey\",\"inputs\":[{\"name\":\"dedupKey\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"latestConfigDetails\",\"inputs\":[],\"outputs\":[{\"name\":\"configCount\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blockNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"configDigest\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"latestConfigDigestAndEpoch\",\"inputs\":[],\"outputs\":[{\"name\":\"scanLogs\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"configDigest\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"migrateUpkeeps\",\"inputs\":[{\"name\":\"ids\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"destination\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onTokenTransfer\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"pauseUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"receiveUpkeeps\",\"inputs\":[{\"name\":\"encodedUpkeeps\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"recoverFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerUpkeep\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"triggerType\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"checkData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"triggerConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerUpkeep\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"checkData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setAdminPrivilegeConfig\",\"inputs\":[{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"newPrivilegeConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setConfig\",\"inputs\":[{\"name\":\"signers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"onchainConfigBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"offchainConfigVersion\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setConfigTypeSafe\",\"inputs\":[{\"name\":\"signers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"onchainConfig\",\"type\":\"tuple\",\"internalType\":\"structAutomationRegistryBase2_2.OnchainConfig\",\"components\":[{\"name\":\"paymentPremiumPPB\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"flatFeeMicroLink\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"checkGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"stalenessSeconds\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"gasCeilingMultiplier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"minUpkeepSpend\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"maxPerformGas\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxCheckDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxPerformDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxRevertDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"fallbackGasPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fallbackLinkPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"transcoder\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"registrars\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"upkeepPrivilegeManager\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"chainModule\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"reorgProtectionEnabled\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"offchainConfigVersion\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayees\",\"inputs\":[{\"name\":\"payees\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPeerRegistryMigrationPermission\",\"inputs\":[{\"name\":\"peer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"permission\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepCheckData\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"newCheckData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepGasLimit\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepOffchainConfig\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"config\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepPrivilegeConfig\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"newPrivilegeConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepTriggerConfig\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"triggerConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"simulatePerformUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"success\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferPayeeship\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"proposed\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferUpkeepAdmin\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"proposed\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transmit\",\"inputs\":[{\"name\":\"reportContext\",\"type\":\"bytes32[3]\",\"internalType\":\"bytes32[3]\"},{\"name\":\"rawReport\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"rs\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"ss\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"rawVs\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"typeAndVersion\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpauseUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upkeepTranscoderVersion\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"upkeepVersion\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"withdrawFunds\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawOwnerFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawPayment\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminPrivilegeConfigSet\",\"inputs\":[{\"name\":\"admin\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"privilegeConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CancelledUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ChainSpecificModuleUpdated\",\"inputs\":[{\"name\":\"newModule\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfigSet\",\"inputs\":[{\"name\":\"previousConfigBlockNumber\",\"type\":\"uint32\",\"indexed\":false,\"internalType\":\"uint32\"},{\"name\":\"configDigest\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"configCount\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"signers\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"},{\"name\":\"onchainConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"offchainConfigVersion\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"DedupKeyAdded\",\"inputs\":[{\"name\":\"dedupKey\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FundsAdded\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FundsWithdrawn\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InsufficientFundsUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnerFundsWithdrawn\",\"inputs\":[{\"name\":\"amount\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferRequested\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PayeesUpdated\",\"inputs\":[{\"name\":\"transmitters\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"},{\"name\":\"payees\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PayeeshipTransferRequested\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PayeeshipTransferred\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PaymentWithdrawn\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"payee\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ReorgedUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StaleUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transmitted\",\"inputs\":[{\"name\":\"configDigest\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint32\",\"indexed\":false,\"internalType\":\"uint32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepAdminTransferRequested\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepAdminTransferred\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepCanceled\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"atBlockHeight\",\"type\":\"uint64\",\"indexed\":true,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepCheckDataSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"newCheckData\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepGasLimitSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepMigrated\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"remainingBalance\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"destination\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepOffchainConfigSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepPaused\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepPerformed\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"success\",\"type\":\"bool\",\"indexed\":true,\"internalType\":\"bool\"},{\"name\":\"totalPayment\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"gasOverhead\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepPrivilegeConfigSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"privilegeConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepReceived\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"startingBalance\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"importedFrom\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepRegistered\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"performGas\",\"type\":\"uint32\",\"indexed\":false,\"internalType\":\"uint32\"},{\"name\":\"admin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepTriggerConfigSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"triggerConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepUnpaused\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ArrayHasNoEntries\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"CannotCancel\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"CheckDataExceedsLimit\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ConfigDigestMismatch\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"DuplicateEntry\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"DuplicateSigners\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"GasLimitCanOnlyIncrease\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"GasLimitOutsideRange\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IncorrectNumberOfFaultyOracles\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IncorrectNumberOfSignatures\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IncorrectNumberOfSigners\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IndexOutOfRange\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidDataLength\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidPayee\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidRecipient\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidReport\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidSigner\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTransmitter\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTrigger\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTriggerType\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MaxCheckDataSizeCanOnlyIncrease\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MaxPerformDataSizeCanOnlyIncrease\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MigrationNotPermitted\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotAContract\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyActiveSigners\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyActiveTransmitters\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByAdmin\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByLINKToken\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByOwnerOrAdmin\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByOwnerOrRegistrar\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByPayee\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByProposedAdmin\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByProposedPayee\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByUpkeepPrivilegeManager\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyPausedUpkeep\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlySimulatedBackend\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyUnpausedUpkeep\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ParameterLengthError\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PaymentGreaterThanAllLINK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ReentrantCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RegistryPaused\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RepeatedSigner\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RepeatedTransmitter\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"TargetCheckReverted\",\"inputs\":[{\"name\":\"reason\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"TooManyOracles\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"TranscoderNotSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepAlreadyExists\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepCancelled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepNotCanceled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepNotNeeded\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ValueNotChanged\",\"inputs\":[]}]", + ABI: "[{\"type\":\"fallback\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"acceptPayeeship\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"acceptUpkeepAdmin\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addFunds\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"cancelUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"checkCallback\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"values\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"extraData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"checkUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"triggerData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fastGasWei\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"linkNative\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"checkUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fastGasWei\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"linkNative\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"executeCallback\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"payload\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"upkeepNeeded\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"upkeepFailureReason\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"fallbackTo\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getActiveUpkeepIDs\",\"inputs\":[{\"name\":\"startIndex\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"maxCount\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAdminPrivilegeConfig\",\"inputs\":[{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAllowedReadOnlyAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAutomationForwarderLogic\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBalance\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"balance\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getCancellationDelay\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getChainModule\",\"inputs\":[],\"outputs\":[{\"name\":\"chainModule\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getConditionalGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getFastGasFeedAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getForwarder\",\"inputs\":[{\"name\":\"upkeepID\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLinkAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLinkNativeFeedAddress\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getLogGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getMaxPaymentForGas\",\"inputs\":[{\"name\":\"triggerType\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[{\"name\":\"maxPayment\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMinBalance\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getMinBalanceForUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"minBalance\",\"type\":\"uint96\",\"internalType\":\"uint96\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPeerRegistryMigrationPermission\",\"inputs\":[{\"name\":\"peer\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getPerPerformByteGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getPerSignerGasOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getReorgProtectionEnabled\",\"inputs\":[],\"outputs\":[{\"name\":\"reorgProtectionEnabled\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getSignerInfo\",\"inputs\":[{\"name\":\"query\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"active\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"index\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getState\",\"inputs\":[],\"outputs\":[{\"name\":\"state\",\"type\":\"tuple\",\"internalType\":\"structIAutomationV21PlusCommon.StateLegacy\",\"components\":[{\"name\":\"nonce\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"ownerLinkBalance\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"expectedLinkBalance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"totalPremium\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"numUpkeeps\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"configCount\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"latestConfigBlockNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"latestConfigDigest\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"latestEpoch\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"paused\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"config\",\"type\":\"tuple\",\"internalType\":\"structIAutomationV21PlusCommon.OnchainConfigLegacy\",\"components\":[{\"name\":\"paymentPremiumPPB\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"flatFeeMicroLink\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"checkGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"stalenessSeconds\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"gasCeilingMultiplier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"minUpkeepSpend\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"maxPerformGas\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxCheckDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxPerformDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxRevertDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"fallbackGasPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fallbackLinkPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"transcoder\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"registrars\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"upkeepPrivilegeManager\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"name\":\"signers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTransmitCalldataFixedBytesOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTransmitCalldataPerSignerBytesOverhead\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getTransmitterInfo\",\"inputs\":[{\"name\":\"query\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"active\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"index\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"balance\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"lastCollected\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"payee\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getTriggerType\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"getUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"upkeepInfo\",\"type\":\"tuple\",\"internalType\":\"structIAutomationV21PlusCommon.UpkeepInfoLegacy\",\"components\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"performGas\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"checkData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"balance\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"maxValidBlocknumber\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"lastPerformedBlockNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"amountSpent\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"paused\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getUpkeepPrivilegeConfig\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getUpkeepTriggerConfig\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"hasDedupKey\",\"inputs\":[{\"name\":\"dedupKey\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"latestConfigDetails\",\"inputs\":[],\"outputs\":[{\"name\":\"configCount\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"blockNumber\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"configDigest\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"latestConfigDigestAndEpoch\",\"inputs\":[],\"outputs\":[{\"name\":\"scanLogs\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"configDigest\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"migrateUpkeeps\",\"inputs\":[{\"name\":\"ids\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"},{\"name\":\"destination\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"onTokenTransfer\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"pauseUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"receiveUpkeeps\",\"inputs\":[{\"name\":\"encodedUpkeeps\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"recoverFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerUpkeep\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"triggerType\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"checkData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"triggerConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"registerUpkeep\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"checkData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setAdminPrivilegeConfig\",\"inputs\":[{\"name\":\"admin\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"newPrivilegeConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setConfig\",\"inputs\":[{\"name\":\"signers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"onchainConfigBytes\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"offchainConfigVersion\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setConfigTypeSafe\",\"inputs\":[{\"name\":\"signers\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"internalType\":\"uint8\"},{\"name\":\"onchainConfig\",\"type\":\"tuple\",\"internalType\":\"structAutomationRegistryBase2_2.OnchainConfig\",\"components\":[{\"name\":\"paymentPremiumPPB\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"flatFeeMicroLink\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"checkGasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"stalenessSeconds\",\"type\":\"uint24\",\"internalType\":\"uint24\"},{\"name\":\"gasCeilingMultiplier\",\"type\":\"uint16\",\"internalType\":\"uint16\"},{\"name\":\"minUpkeepSpend\",\"type\":\"uint96\",\"internalType\":\"uint96\"},{\"name\":\"maxPerformGas\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxCheckDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxPerformDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"maxRevertDataSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"fallbackGasPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"fallbackLinkPrice\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"transcoder\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"registrars\",\"type\":\"address[]\",\"internalType\":\"address[]\"},{\"name\":\"upkeepPrivilegeManager\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"chainModule\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"reorgProtectionEnabled\",\"type\":\"bool\",\"internalType\":\"bool\"}]},{\"name\":\"offchainConfigVersion\",\"type\":\"uint64\",\"internalType\":\"uint64\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPayees\",\"inputs\":[{\"name\":\"payees\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setPeerRegistryMigrationPermission\",\"inputs\":[{\"name\":\"peer\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"permission\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepCheckData\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"newCheckData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepGasLimit\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepOffchainConfig\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"config\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepPrivilegeConfig\",\"inputs\":[{\"name\":\"upkeepId\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"newPrivilegeConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUpkeepTriggerConfig\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"triggerConfig\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"simulatePerformUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"performData\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"success\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferPayeeship\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"proposed\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferUpkeepAdmin\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"proposed\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transmit\",\"inputs\":[{\"name\":\"reportContext\",\"type\":\"bytes32[3]\",\"internalType\":\"bytes32[3]\"},{\"name\":\"rawReport\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"rs\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"ss\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"rawVs\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"typeAndVersion\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpauseUpkeep\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"upkeepTranscoderVersion\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"upkeepVersion\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"pure\"},{\"type\":\"function\",\"name\":\"withdrawFunds\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawOwnerFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdrawPayment\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"AdminPrivilegeConfigSet\",\"inputs\":[{\"name\":\"admin\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"privilegeConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"CancelledUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ChainSpecificModuleUpdated\",\"inputs\":[{\"name\":\"newModule\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ConfigSet\",\"inputs\":[{\"name\":\"previousConfigBlockNumber\",\"type\":\"uint32\",\"indexed\":false,\"internalType\":\"uint32\"},{\"name\":\"configDigest\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"configCount\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"signers\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"},{\"name\":\"transmitters\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"},{\"name\":\"f\",\"type\":\"uint8\",\"indexed\":false,\"internalType\":\"uint8\"},{\"name\":\"onchainConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"offchainConfigVersion\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"DedupKeyAdded\",\"inputs\":[{\"name\":\"dedupKey\",\"type\":\"bytes32\",\"indexed\":true,\"internalType\":\"bytes32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FundsAdded\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"FundsWithdrawn\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"InsufficientFundsUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnerFundsWithdrawn\",\"inputs\":[{\"name\":\"amount\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferRequested\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PayeesUpdated\",\"inputs\":[{\"name\":\"transmitters\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"},{\"name\":\"payees\",\"type\":\"address[]\",\"indexed\":false,\"internalType\":\"address[]\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PayeeshipTransferRequested\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PayeeshipTransferred\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"PaymentWithdrawn\",\"inputs\":[{\"name\":\"transmitter\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"payee\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"ReorgedUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StaleUpkeepReport\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transmitted\",\"inputs\":[{\"name\":\"configDigest\",\"type\":\"bytes32\",\"indexed\":false,\"internalType\":\"bytes32\"},{\"name\":\"epoch\",\"type\":\"uint32\",\"indexed\":false,\"internalType\":\"uint32\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepAdminTransferRequested\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepAdminTransferred\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"from\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"to\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepCanceled\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"atBlockHeight\",\"type\":\"uint64\",\"indexed\":true,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepCheckDataSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"newCheckData\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepGasLimitSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"gasLimit\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepMigrated\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"remainingBalance\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"destination\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepOffchainConfigSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"offchainConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepPaused\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepPerformed\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"success\",\"type\":\"bool\",\"indexed\":true,\"internalType\":\"bool\"},{\"name\":\"totalPayment\",\"type\":\"uint96\",\"indexed\":false,\"internalType\":\"uint96\"},{\"name\":\"gasUsed\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"gasOverhead\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"trigger\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepPrivilegeConfigSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"privilegeConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepReceived\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"startingBalance\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"importedFrom\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepRegistered\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"performGas\",\"type\":\"uint32\",\"indexed\":false,\"internalType\":\"uint32\"},{\"name\":\"admin\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepTriggerConfigSet\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"},{\"name\":\"triggerConfig\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UpkeepUnpaused\",\"inputs\":[{\"name\":\"id\",\"type\":\"uint256\",\"indexed\":true,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"ArrayHasNoEntries\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"CannotCancel\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"CheckDataExceedsLimit\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ConfigDigestMismatch\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"DuplicateEntry\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"DuplicateSigners\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"GasLimitCanOnlyIncrease\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"GasLimitOutsideRange\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IncorrectNumberOfFaultyOracles\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IncorrectNumberOfSignatures\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IncorrectNumberOfSigners\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"IndexOutOfRange\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidDataLength\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidPayee\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidRecipient\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidReport\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidSigner\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTransmitter\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTrigger\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidTriggerType\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MaxCheckDataSizeCanOnlyIncrease\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MaxPerformDataSizeCanOnlyIncrease\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MigrationNotPermitted\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotAContract\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyActiveSigners\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyActiveTransmitters\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByAdmin\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByLINKToken\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByOwnerOrAdmin\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByOwnerOrRegistrar\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByPayee\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByProposedAdmin\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByProposedPayee\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyCallableByUpkeepPrivilegeManager\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyPausedUpkeep\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlySimulatedBackend\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OnlyUnpausedUpkeep\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ParameterLengthError\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PaymentGreaterThanAllLINK\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ReentrantCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RegistryPaused\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RepeatedSigner\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"RepeatedTransmitter\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"TargetCheckReverted\",\"inputs\":[{\"name\":\"reason\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"TooManyOracles\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"TranscoderNotSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepAlreadyExists\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepCancelled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepNotCanceled\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UpkeepNotNeeded\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ValueNotChanged\",\"inputs\":[]}]", } var IAutomationRegistryMasterABI = IAutomationRegistryMasterMetaData.ABI diff --git a/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 5f6cbf3323..e3195f594e 100644 --- a/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/gethwrappers/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -20,7 +20,7 @@ chain_module_base: ../contracts/solc/automation/ChainModuleBase/ChainModuleBase. chain_specific_util_helper: ../contracts/solc/vrf/ChainSpecificUtilHelper/ChainSpecificUtilHelper.sol/ChainSpecificUtilHelper.abi.json ../contracts/solc/vrf/ChainSpecificUtilHelper/ChainSpecificUtilHelper.sol/ChainSpecificUtilHelper.bin b95cd35610e932cc6a104cfa661b010bb58ad34621ad3cb7a4ebb0d5c9023f2d counter: ../contracts/solc/vrf/Counter/Counter.sol/Counter.abi.json ../contracts/solc/vrf/Counter/Counter.sol/Counter.bin 7dea2e58598a5973f8280f3465654254b5fc790598e45be18455e5219f57cc13 dummy_protocol_wrapper: ../contracts/solc/automation/DummyProtocol/DummyProtocol.sol/DummyProtocol.abi.json ../contracts/solc/automation/DummyProtocol/DummyProtocol.sol/DummyProtocol.bin 2bf4a48b67a87f50636dd0a65316860907159e8ca366a633aaa63812f2c9b0b4 -i_automation_registry_master_wrapper_2_2: ../contracts/solc/automation/IAutomationRegistryMaster/IAutomationRegistryMaster.sol/IAutomationRegistryMaster.abi.json ../contracts/solc/automation/IAutomationRegistryMaster/IAutomationRegistryMaster.sol/IAutomationRegistryMaster.bin 56718030427cc0e9bf0cafeb0a20b1f1e19745d7289956099481b3c6cd8091b6 +i_automation_registry_master_wrapper_2_2: ../contracts/solc/automation/IAutomationRegistryMaster/IAutomationRegistryMaster.sol/IAutomationRegistryMaster.abi.json ../contracts/solc/automation/IAutomationRegistryMaster/IAutomationRegistryMaster.sol/IAutomationRegistryMaster.bin d30a8773b6b88f2281673f34aa1adc29ad7cb9b52e0450b52d222dbf2f8867fc i_automation_registry_master_wrapper_2_3: ../contracts/solc/automation/IAutomationRegistryMaster2_3/IAutomationRegistryMaster2_3.sol/IAutomationRegistryMaster2_3.abi.json ../contracts/solc/automation/IAutomationRegistryMaster2_3/IAutomationRegistryMaster2_3.sol/IAutomationRegistryMaster2_3.bin 2a99f71d3e04b4eb09a7b678e033f122a2e5748b9f2d7de5fdc7a3e227d20e5f i_automation_v21_plus_common: ../contracts/solc/automation/IAutomationV21PlusCommon/IAutomationV21PlusCommon.sol/IAutomationV21PlusCommon.abi.json ../contracts/solc/automation/IAutomationV21PlusCommon/IAutomationV21PlusCommon.sol/IAutomationV21PlusCommon.bin 802c8a8c754685a113ac4613fc8effe38a040b289bd983a3377b9fdaa02652c2 i_chain_module: ../contracts/solc/automation/IChainModule/IChainModule.sol/IChainModule.abi.json ../contracts/solc/automation/IChainModule/IChainModule.sol/IChainModule.bin e748933893e2c139709e6d127207e703fd5effb99d1f971c2129caddb7925a70 From 669318593b2e3415af6e665551502b9a92c353a1 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sun, 31 Aug 2025 19:10:25 +0200 Subject: [PATCH 11/14] fix fmt --- contracts/foundry.toml | 1 + contracts/src/v0.8/automation/KeeperBase.sol | 1 + contracts/src/v0.8/automation/KeeperCompatible.sol | 1 + .../v0.8/automation/interfaces/KeeperCompatibleInterface.sol | 1 + contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol | 1 + contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol | 1 + .../dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol | 3 ++- 7 files changed, 8 insertions(+), 1 deletion(-) diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 06e942be47..29dc10d075 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -21,6 +21,7 @@ tab_width = 2 multiline_func_header = "params_first" sort_imports = true single_line_statement_blocks = "preserve" +ignore = ["src/v0.8/vendor/**/*.sol"] [profile.functions] optimizer_runs = 1_000_000 diff --git a/contracts/src/v0.8/automation/KeeperBase.sol b/contracts/src/v0.8/automation/KeeperBase.sol index 0e050d4aff..3e9881ab63 100644 --- a/contracts/src/v0.8/automation/KeeperBase.sol +++ b/contracts/src/v0.8/automation/KeeperBase.sol @@ -3,5 +3,6 @@ * @notice This is a deprecated interface. Please use AutomationBase directly. */ pragma solidity ^0.8.0; + // solhint-disable-next-line no-unused-import import {AutomationBase as KeeperBase} from "./AutomationBase.sol"; diff --git a/contracts/src/v0.8/automation/KeeperCompatible.sol b/contracts/src/v0.8/automation/KeeperCompatible.sol index 2066ecdffa..4c5e6a2605 100644 --- a/contracts/src/v0.8/automation/KeeperCompatible.sol +++ b/contracts/src/v0.8/automation/KeeperCompatible.sol @@ -3,6 +3,7 @@ * @notice This is a deprecated interface. Please use AutomationCompatible directly. */ pragma solidity ^0.8.0; + // solhint-disable-next-line no-unused-import import {AutomationCompatible as KeeperCompatible} from "./AutomationCompatible.sol"; // solhint-disable-next-line no-unused-import diff --git a/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol b/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol index b5ba8196c7..5465666981 100644 --- a/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol +++ b/contracts/src/v0.8/automation/interfaces/KeeperCompatibleInterface.sol @@ -3,5 +3,6 @@ * @notice This is a deprecated interface. Please use AutomationCompatibleInterface directly. */ pragma solidity ^0.8.0; + // solhint-disable-next-line no-unused-import import {AutomationCompatibleInterface as KeeperCompatibleInterface} from "./AutomationCompatibleInterface.sol"; diff --git a/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol b/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol index 9b6ef4f4d2..a0c09c4422 100644 --- a/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol +++ b/contracts/src/v0.8/vrf/VRFConsumerBaseV2.sol @@ -97,6 +97,7 @@ pragma solidity ^0.8.4; */ abstract contract VRFConsumerBaseV2 { error OnlyCoordinatorCanFulfill(address have, address want); + // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i address private immutable vrfCoordinator; diff --git a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol index 27a0eba6bd..3c18083513 100644 --- a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol +++ b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol @@ -106,6 +106,7 @@ import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Ini */ abstract contract VRFConsumerBaseV2Upgradeable is Initializable { error OnlyCoordinatorCanFulfill(address have, address want); + // solhint-disable-next-line chainlink-solidity/prefix-storage-variables-with-s-underscore address private vrfCoordinator; diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol index aca18500a0..a4f8d018dc 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.19; -import {BlockhashStoreInterface} from "../../interfaces/BlockhashStoreInterface.sol"; import {ChainSpecificUtil} from "../../../shared/util/ChainSpecificUtil.sol"; import {VRF} from "../../../vrf/VRF.sol"; import {VRFTypes} from "../../VRFTypes.sol"; +import {BlockhashStoreInterface} from "../../interfaces/BlockhashStoreInterface.sol"; import {SubscriptionAPI} from "../SubscriptionAPI.sol"; import {IVRFMigratableConsumerV2Plus, VRFConsumerBaseV2Plus} from "../VRFConsumerBaseV2Plus.sol"; // solhint-disable-next-line no-unused-import @@ -21,6 +21,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is { using EnumerableSet for EnumerableSet.UintSet; /// @dev should always be available + // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i BlockhashStoreInterface public immutable BLOCKHASH_STORE; From bec66fad827a98465b5aec015303e04b858a8297 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sun, 31 Aug 2025 19:21:13 +0200 Subject: [PATCH 12/14] number_underscore = "thousands" --- contracts/foundry.toml | 2 + .../v0.8/automation/AutomationForwarder.sol | 2 +- .../v0.8/automation/mocks/MockArbGasInfo.sol | 2 +- .../automation/mocks/MockGasBoundCaller.sol | 2 +- .../mocks/MockZKSyncSystemContext.sol | 2 +- .../automation/test/AutomationForwarder.t.sol | 8 +- .../test/AutomationRegistry2_2.t.sol | 6 +- .../automation/test/MercuryRegistry.t.sol | 50 +++---- .../test/v2_3/AutomationRegistry2_3.t.sol | 86 ++++++------ .../v0.8/automation/test/v2_3/BaseTest.t.sol | 12 +- .../test/v2_3_zksync/BaseTest.t.sol | 18 +-- .../ZKSyncAutomationRegistry2_3.t.sol | 86 ++++++------ .../testhelpers/MockOVMGasPriceOracle.sol | 4 +- .../testhelpers/UpkeepCounterNew.sol | 6 +- .../testhelpers/VerifiableLoadBase.sol | 4 +- .../VerifiableLoadLogTriggerUpkeep.sol | 2 +- .../VerifiableLoadStreamsLookupUpkeep.sol | 2 +- .../testhelpers/VerifiableLoadUpkeep.sol | 2 +- .../upkeeps/LinkAvailableBalanceMonitor.sol | 4 +- .../automation/v2_1/KeeperRegistryBase2_1.sol | 10 +- .../v2_2/AutomationRegistryBase2_2.sol | 8 +- .../v2_3/AutomationRegistryBase2_3.sol | 6 +- .../ZKSyncAutomationRegistryBase2_3.sol | 4 +- .../src/v0.8/data-feeds/test/BaseTest.t.sol | 2 +- .../v0.8/data-feeds/test/DataFeedsCache.t.sol | 82 +++++------ .../data-feeds/test/DataFeedsCacheGas.t.sol | 26 ++-- .../data-feeds/test/DataFeedsSetupGas.t.sol | 8 +- .../dev/v1_X/libraries/ChainSpecificUtil.sol | 12 +- .../v0.8/functions/tests/v1_X/BaseTest.t.sol | 2 +- .../tests/v1_X/ChainSpecificUtil.t.sol | 16 +-- .../tests/v1_X/FunctionsBilling.t.sol | 16 +-- .../tests/v1_X/FunctionsCoordinator.t.sol | 6 +- .../tests/v1_X/FunctionsRouter.t.sol | 18 +-- .../tests/v1_X/FunctionsSubscriptions.t.sol | 18 +-- .../src/v0.8/functions/tests/v1_X/Gas.t.sol | 4 +- .../src/v0.8/functions/tests/v1_X/Setup.t.sol | 6 +- .../tests/v1_X/ZKSyncFunctionsRouter.t.sol | 2 +- .../v1_1_0/libraries/ChainSpecificUtil.sol | 12 +- .../src/v0.8/keystone/KeystoneForwarder.sol | 2 +- .../CapabilitiesRegistry_AddNodesTest.t.sol | 2 +- ...tiesRegistry_UpdateNodeOperatorsTest.t.sol | 4 +- .../l2ep/test/mocks/MockAggregatorV2V3.sol | 2 +- .../ArbitrumSequencerUptimeFeed.t.sol | 2 +- .../v1_0_0/arbitrum/ArbitrumValidator.t.sol | 8 +- .../v1_0_0/optimism/OptimismValidator.t.sol | 4 +- .../test/v1_0_0/scroll/ScrollValidator.t.sol | 4 +- .../shared/BaseSequencerUptimeFeed.t.sol | 2 +- .../test/v1_0_0/shared/BaseValidator.t.sol | 2 +- .../test/v1_0_0/zksync/ZKSyncValidator.t.sol | 6 +- .../v0.3.0/test/gas/Gas_VerifierTest.t.sol | 2 +- .../test/verifier/BaseVerifierTest.t.sol | 2 +- .../VerifierSetConfigFromSourceTest.t.sol | 20 +-- .../BaseDestinationVerifierTest.t.sol | 2 +- .../v0.5.0/test/gas/Gas_VerifierTest.t.sol | 2 +- .../test/verifier/BaseVerifierTest.t.sol | 2 +- .../src/v0.8/operatorforwarder/Operator.sol | 2 +- .../test/testhelpers/MaliciousChainlinked.sol | 2 +- contracts/src/v0.8/shared/test/BaseTest.t.sol | 2 +- .../test/call/CallWithExactGasZKSync.t.sol | 4 +- .../shared/test/mocks/MockSystemContext.sol | 4 +- .../test/token/ERC677/BurnMintERC677.t.sol | 2 +- .../v0.8/shared/util/ChainSpecificUtil.sol | 12 +- .../src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol | 12 +- contracts/src/v0.8/vrf/KeepersVRFConsumer.sol | 4 +- contracts/src/v0.8/vrf/VRFCoordinatorV2.sol | 2 +- contracts/src/v0.8/vrf/VRFV2Wrapper.sol | 2 +- .../src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol | 2 +- .../src/v0.8/vrf/dev/VRFV2PlusWrapper.sol | 2 +- .../testhelpers/VRFCoordinatorTestV2_5.sol | 2 +- .../VRFCoordinatorV2PlusUpgradedVersion.sol | 2 +- .../VRFMaliciousConsumerV2Plus.sol | 4 +- .../src/v0.8/vrf/mocks/VRFCoordinatorMock.sol | 2 +- .../v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol | 16 +-- .../vrf/test/BatchVRFCoordinatorV2Plus.t.sol | 54 ++++---- .../src/v0.8/vrf/test/ChainSpecificUtil.t.sol | 10 +- .../vrf/test/FixtureVRFCoordinatorV2_5.t.sol | 4 +- .../v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol | 6 +- .../test/VRFCoordinatorV2Plus_Migration.t.sol | 2 +- .../vrf/test/VRFCoordinatorV2_5Mock.t.sol | 8 +- .../test/VRFCoordinatorV2_5_Arbitrum.t.sol | 18 +-- .../test/VRFCoordinatorV2_5_Optimism.t.sol | 10 +- contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol | 128 +++++++++--------- .../src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol | 18 +-- .../vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol | 4 +- .../vrf/test/VRFV2PlusWrapper_Migration.t.sol | 6 +- .../vrf/test/VRFV2PlusWrapper_Optimism.t.sol | 10 +- .../vrf/testhelpers/VRFCoordinatorTestV2.sol | 2 +- .../testhelpers/VRFMaliciousConsumerV2.sol | 4 +- .../v0.8/workflow/dev/v2/WorkflowRegistry.sol | 2 +- .../CapabilitiesRegistry_AddNodesTest.t.sol | 2 +- ...tiesRegistry_UpdateNodeOperatorsTest.t.sol | 4 +- ...flowRegistry.getCapabilitiesRegistry.t.sol | 2 +- ...flowRegistry.setCapabilitiesRegistry.t.sol | 10 +- 93 files changed, 507 insertions(+), 501 deletions(-) diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 29dc10d075..8613eaaac1 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -22,6 +22,8 @@ multiline_func_header = "params_first" sort_imports = true single_line_statement_blocks = "preserve" ignore = ["src/v0.8/vendor/**/*.sol"] +override_spacing = false +number_underscore = "thousands" [profile.functions] optimizer_runs = 1_000_000 diff --git a/contracts/src/v0.8/automation/AutomationForwarder.sol b/contracts/src/v0.8/automation/AutomationForwarder.sol index 184ab23a55..9cdda73d9c 100644 --- a/contracts/src/v0.8/automation/AutomationForwarder.sol +++ b/contracts/src/v0.8/automation/AutomationForwarder.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.16; import {IAutomationRegistryConsumer} from "./interfaces/IAutomationRegistryConsumer.sol"; -uint256 constant PERFORM_GAS_CUSHION = 5_000; +uint256 constant PERFORM_GAS_CUSHION = 5000; /** * @title AutomationForwarder is a relayer that sits between the registry and the customer's target contract diff --git a/contracts/src/v0.8/automation/mocks/MockArbGasInfo.sol b/contracts/src/v0.8/automation/mocks/MockArbGasInfo.sol index 687428a25b..4999904b9b 100644 --- a/contracts/src/v0.8/automation/mocks/MockArbGasInfo.sol +++ b/contracts/src/v0.8/automation/mocks/MockArbGasInfo.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.6; contract MockArbGasInfo { function getCurrentTxL1GasFees() external view returns (uint256) { - return 1000000; + return 1_000_000; } function getPricesInWei() external view returns (uint256, uint256, uint256, uint256, uint256, uint256) { diff --git a/contracts/src/v0.8/automation/mocks/MockGasBoundCaller.sol b/contracts/src/v0.8/automation/mocks/MockGasBoundCaller.sol index 3184f9dba3..295fb97fc9 100644 --- a/contracts/src/v0.8/automation/mocks/MockGasBoundCaller.sol +++ b/contracts/src/v0.8/automation/mocks/MockGasBoundCaller.sol @@ -15,7 +15,7 @@ contract MockGasBoundCaller { revert TransactionFailed(target); } - uint256 pubdataGas = 500000; + uint256 pubdataGas = 500_000; bytes memory returnData = abi.encode(address(0), pubdataGas); uint256 paddedReturndataLen = returnData.length + 96; diff --git a/contracts/src/v0.8/automation/mocks/MockZKSyncSystemContext.sol b/contracts/src/v0.8/automation/mocks/MockZKSyncSystemContext.sol index 265d4b678a..d697e5627d 100644 --- a/contracts/src/v0.8/automation/mocks/MockZKSyncSystemContext.sol +++ b/contracts/src/v0.8/automation/mocks/MockZKSyncSystemContext.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.19; contract MockZKSyncSystemContext { function gasPrice() external pure returns (uint256) { - return 250000000; // 0.25 gwei + return 250_000_000; // 0.25 gwei } function gasPerPubdataByte() external pure returns (uint256) { diff --git a/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol b/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol index 939476cee8..c983daf6b1 100644 --- a/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol +++ b/contracts/src/v0.8/automation/test/AutomationForwarder.t.sol @@ -45,18 +45,18 @@ contract AutomationForwarderTest_constructor is AutomationForwarderTestSetUp { contract AutomationForwarderTest_forward is AutomationForwarderTestSetUp { function testOnlyCallableByTheRegistry() external { vm.prank(REGISTRY); - forwarder.forward(100000, abi.encodeWithSelector(Target.handler.selector)); + forwarder.forward(100_000, abi.encodeWithSelector(Target.handler.selector)); vm.prank(STRANGER); vm.expectRevert(); - forwarder.forward(100000, abi.encodeWithSelector(Target.handler.selector)); + forwarder.forward(100_000, abi.encodeWithSelector(Target.handler.selector)); } function testReturnsSuccessValueAndGasUsed() external { vm.startPrank(REGISTRY); - (bool success, uint256 gasUsed) = forwarder.forward(100000, abi.encodeWithSelector(Target.handler.selector)); + (bool success, uint256 gasUsed) = forwarder.forward(100_000, abi.encodeWithSelector(Target.handler.selector)); assertTrue(success); assertGt(gasUsed, 0); - (success, gasUsed) = forwarder.forward(100000, abi.encodeWithSelector(Target.handlerRevert.selector)); + (success, gasUsed) = forwarder.forward(100_000, abi.encodeWithSelector(Target.handlerRevert.selector)); assertFalse(success); assertGt(gasUsed, 0); } diff --git a/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol b/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol index c538daa9b1..5d4a9aa464 100644 --- a/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol +++ b/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol @@ -103,9 +103,9 @@ contract AutomationRegistry2_2_SetConfig is AutomationRegistry2_2_SetUp { gasCeilingMultiplier: 0, minUpkeepSpend: 0, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 200_000_000_000, transcoder: 0xB1e66855FD67f6e85F0f0fA38cd6fBABdf00923c, diff --git a/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol b/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol index e970cd5ac6..53ad266289 100644 --- a/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol +++ b/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol @@ -56,7 +56,7 @@ contract MercuryRegistryTest is Test { } catch { s_verifier = address(new MockVerifierProxy()); } - vm.chainId(31337); // restore chain Id + vm.chainId(31_337); // restore chain Id // Use a BTC feed and ETH feed. feedIds = new string[](2); @@ -133,10 +133,10 @@ contract MercuryRegistryTest is Test { int192 deviationPercentagePPM, uint32 stalenessSeconds ) = s_testRegistry.s_feedMapping(s_BTCUSDFeedId); - assertEq(observationsTimestamp, 1692732568); // Tuesday, August 22, 2023 7:29:28 PM - assertEq(bid, 2585674416498); // $25,856.74416498 - assertEq(price, 2585711126720); // $25,857.11126720 - assertEq(ask, 2585747836943); // $25,857.47836943 + assertEq(observationsTimestamp, 1_692_732_568); // Tuesday, August 22, 2023 7:29:28 PM + assertEq(bid, 2_585_674_416_498); // $25,856.74416498 + assertEq(price, 2_585_711_126_720); // $25,857.11126720 + assertEq(ask, 2_585_747_836_943); // $25,857.47836943 assertEq(feedName, "BTC/USD"); assertEq(localFeedId, s_BTCUSDFeedId); assertEq(active, true); @@ -163,18 +163,18 @@ contract MercuryRegistryTest is Test { MercuryRegistry.Feed[] memory feeds = s_testRegistry.getLatestFeedData(feedIds); // Check state of BTC/USD feed to ensure update was propagated. - assertEq(feeds[0].observationsTimestamp, 1692820502); // Wednesday, August 23, 2023 7:55:02 PM - assertEq(feeds[0].bid, 2672027981674); // $26,720.27981674 - assertEq(feeds[0].price, 2672037346975); // $26,720.37346975 - assertEq(feeds[0].ask, 2672046712275); // $26,720.46712275 + assertEq(feeds[0].observationsTimestamp, 1_692_820_502); // Wednesday, August 23, 2023 7:55:02 PM + assertEq(feeds[0].bid, 2_672_027_981_674); // $26,720.27981674 + assertEq(feeds[0].price, 2_672_037_346_975); // $26,720.37346975 + assertEq(feeds[0].ask, 2_672_046_712_275); // $26,720.46712275 assertEq(feeds[0].feedName, "BTC/USD"); assertEq(feeds[0].feedId, s_BTCUSDFeedId); // Check state of ETH/USD feed to ensure update was propagated. - assertEq(feeds[1].observationsTimestamp, 1692820501); // Wednesday, August 23, 2023 7:55:01 PM - assertEq(feeds[1].bid, 169056689850); // $1,690.56689850 - assertEq(feeds[1].price, 169076482169); // $1,690.76482169 - assertEq(feeds[1].ask, 169086456584); // $16,90.86456584 + assertEq(feeds[1].observationsTimestamp, 1_692_820_501); // Wednesday, August 23, 2023 7:55:01 PM + assertEq(feeds[1].bid, 169_056_689_850); // $1,690.56689850 + assertEq(feeds[1].price, 169_076_482_169); // $1,690.76482169 + assertEq(feeds[1].ask, 169_086_456_584); // $16,90.86456584 assertEq(feeds[1].feedName, "ETH/USD"); assertEq(feeds[1].feedId, s_ETHUSDFeedId); assertEq(feeds[1].active, true); @@ -258,10 +258,10 @@ contract MercuryRegistryTest is Test { int192 deviationPercentagePPM, uint32 stalenessSeconds ) = s_testRegistry.s_feedMapping(s_BTCUSDFeedId); - assertEq(observationsTimestamp, 1692732568); // Tuesday, August 22, 2023 7:29:28 PM - assertEq(bid, 2585674416498); // $25,856.74416498 - assertEq(price, 2585711126720); // $25,857.11126720 - assertEq(ask, 2585747836943); // $25,857.47836943 + assertEq(observationsTimestamp, 1_692_732_568); // Tuesday, August 22, 2023 7:29:28 PM + assertEq(bid, 2_585_674_416_498); // $25,856.74416498 + assertEq(price, 2_585_711_126_720); // $25,857.11126720 + assertEq(ask, 2_585_747_836_943); // $25,857.47836943 assertEq(feedName, "BTC/USD"); assertEq(localFeedId, s_BTCUSDFeedId); assertEq(active, true); @@ -284,10 +284,10 @@ contract MercuryRegistryTest is Test { MercuryRegistry.Feed[] memory feeds = s_testRegistry.getLatestFeedData(feedIds); // Check state of BTC/USD feed to ensure update was propagated. - assertEq(feeds[0].observationsTimestamp, 1692820502); // Wednesday, August 23, 2023 7:55:02 PM - assertEq(feeds[0].bid, 2672027981674); // $26,720.27981674 - assertEq(feeds[0].price, 2672037346975); // $26,720.37346975 - assertEq(feeds[0].ask, 2672046712275); // $26,720.46712275 + assertEq(feeds[0].observationsTimestamp, 1_692_820_502); // Wednesday, August 23, 2023 7:55:02 PM + assertEq(feeds[0].bid, 2_672_027_981_674); // $26,720.27981674 + assertEq(feeds[0].price, 2_672_037_346_975); // $26,720.37346975 + assertEq(feeds[0].ask, 2_672_046_712_275); // $26,720.46712275 assertEq(feeds[0].feedName, "BTC/USD"); assertEq(feeds[0].feedId, s_BTCUSDFeedId); @@ -307,10 +307,10 @@ contract MercuryRegistryTest is Test { feeds = s_testRegistry.getLatestFeedData(feedIds); // Check state of ETH/USD feed to ensure update was propagated. - assertEq(feeds[1].observationsTimestamp, 1692820501); // Wednesday, August 23, 2023 7:55:01 PM - assertEq(feeds[1].bid, 169056689850); // $1,690.56689850 - assertEq(feeds[1].price, 169076482169); // $1,690.76482169 - assertEq(feeds[1].ask, 169086456584); // $16,90.86456584 + assertEq(feeds[1].observationsTimestamp, 1_692_820_501); // Wednesday, August 23, 2023 7:55:01 PM + assertEq(feeds[1].bid, 169_056_689_850); // $1,690.56689850 + assertEq(feeds[1].price, 169_076_482_169); // $1,690.76482169 + assertEq(feeds[1].ask, 169_086_456_584); // $16,90.86456584 assertEq(feeds[1].feedName, "ETH/USD"); assertEq(feeds[1].feedId, s_ETHUSDFeedId); diff --git a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol index 58fcef7c05..48eb40e18f 100644 --- a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol @@ -338,7 +338,7 @@ contract Withdraw is SetUp { (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -396,9 +396,9 @@ contract SetConfig is SetUp { stalenessSeconds: 90_000, gasCeilingMultiplier: 0, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -420,7 +420,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -467,7 +467,7 @@ contract SetConfig is SetUp { assertEq(f, F); AutomationRegistryBase2_3.BillingConfig memory config = registry.getBillingTokenConfig(billingTokenAddress); - assertEq(config.gasFeePPB, 5_000); + assertEq(config.gasFeePPB, 5000); assertEq(config.flatFeeMilliCents, 20_000); assertEq(config.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config.minSpend, 100_000); @@ -488,7 +488,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](2); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_001, + gasFeePPB: 5001, flatFeeMilliCents: 20_001, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 100, @@ -496,7 +496,7 @@ contract SetConfig is SetUp { decimals: 18 }); billingConfigs[1] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_002, + gasFeePPB: 5002, flatFeeMilliCents: 20_002, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 200, @@ -517,14 +517,14 @@ contract SetConfig is SetUp { assertEq(f, F); AutomationRegistryBase2_3.BillingConfig memory config1 = registry.getBillingTokenConfig(billingTokenAddress1); - assertEq(config1.gasFeePPB, 5_001); + assertEq(config1.gasFeePPB, 5001); assertEq(config1.flatFeeMilliCents, 20_001); assertEq(config1.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config1.fallbackPrice, 100); assertEq(config1.minSpend, 100); AutomationRegistryBase2_3.BillingConfig memory config2 = registry.getBillingTokenConfig(billingTokenAddress2); - assertEq(config2.gasFeePPB, 5_002); + assertEq(config2.gasFeePPB, 5002); assertEq(config2.flatFeeMilliCents, 20_002); assertEq(config2.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config2.fallbackPrice, 200); @@ -545,7 +545,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs1 = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs1[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_001, + gasFeePPB: 5001, flatFeeMilliCents: 20_001, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 100, @@ -571,7 +571,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs2 = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs2[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_002, + gasFeePPB: 5002, flatFeeMilliCents: 20_002, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 200, @@ -590,9 +590,9 @@ contract SetConfig is SetUp { stalenessSeconds: 90_000, gasCeilingMultiplier: 0, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -629,7 +629,7 @@ contract SetConfig is SetUp { assertEq(f, F); AutomationRegistryBase2_3.BillingConfig memory config2 = registry.getBillingTokenConfig(billingTokenAddress2); - assertEq(config2.gasFeePPB, 5_002); + assertEq(config2.gasFeePPB, 5002); assertEq(config2.flatFeeMilliCents, 20_002); assertEq(config2.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config2.fallbackPrice, 200); @@ -651,7 +651,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](2); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_001, + gasFeePPB: 5001, flatFeeMilliCents: 20_001, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 100, @@ -659,7 +659,7 @@ contract SetConfig is SetUp { decimals: 18 }); billingConfigs[1] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_002, + gasFeePPB: 5002, flatFeeMilliCents: 20_002, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 200, @@ -682,7 +682,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -705,7 +705,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -748,7 +748,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -911,7 +911,7 @@ contract NOPsSettlement is SetUp { registry.setPayees(PAYEES); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -991,7 +991,7 @@ contract NOPsSettlement is SetUp { (Registry registry, Registrar registrar) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1105,7 +1105,7 @@ contract NOPsSettlement is SetUp { registry.setPayees(PAYEES); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1144,7 +1144,7 @@ contract NOPsSettlement is SetUp { registry.setPayees(PAYEES); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1202,7 +1202,7 @@ contract NOPsSettlement is SetUp { new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); billingTokenConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ gasFeePPB: 10_000_000, // 15% - flatFeeMilliCents: 2_000, // 2 cents + flatFeeMilliCents: 2000, // 2 cents priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 1e8, // $1 minSpend: 1e18, // 1 USD @@ -1217,9 +1217,9 @@ contract NOPsSettlement is SetUp { stalenessSeconds: 90_000, gasCeilingMultiplier: 2, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -1424,7 +1424,7 @@ contract BillingOverrides is SetUp { function test_RevertsWhen_NotPrivilegeManager() public { AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = - AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5000, flatFeeMilliCents: 20_000}); vm.expectRevert(Registry.OnlyCallableByUpkeepPrivilegeManager.selector); registry.setBillingOverrides(linkUpkeepID, billingOverrides); @@ -1432,7 +1432,7 @@ contract BillingOverrides is SetUp { function test_RevertsWhen_UpkeepCancelled() public { AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = - AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5000, flatFeeMilliCents: 20_000}); registry.cancelUpkeep(linkUpkeepID); @@ -1443,7 +1443,7 @@ contract BillingOverrides is SetUp { function test_Happy_SetBillingOverrides() public { AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = - AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5000, flatFeeMilliCents: 20_000}); vm.startPrank(PRIVILEGE_MANAGER); @@ -1701,7 +1701,7 @@ contract Transmit is SetUp { // register an upkeep and add funds uint256 upkeepID = - registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1741,7 +1741,7 @@ contract Transmit is SetUp { // register an upkeep and add funds uint256 upkeepID = - registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken6), "", "", ""); + registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken6), "", "", ""); vm.prank(OWNER); usdToken6.mint(UPKEEP_ADMIN, 1e20); @@ -1999,13 +1999,13 @@ contract CancelUpkeep is SetUp { function test_RevertsWhen_IdIsInvalid_CalledByAdmin() external { vm.startPrank(UPKEEP_ADMIN); vm.expectRevert(Registry.CannotCancel.selector); - registry.cancelUpkeep(1111111); + registry.cancelUpkeep(1_111_111); } function test_RevertsWhen_IdIsInvalid_CalledByOwner() external { vm.startPrank(registry.owner()); vm.expectRevert(Registry.CannotCancel.selector); - registry.cancelUpkeep(1111111); + registry.cancelUpkeep(1_111_111); } function test_RevertsWhen_NotCalledByOwnerOrAdmin() external { @@ -2435,7 +2435,7 @@ contract SetUpkeepGasLimit is SetUp { vm.startPrank(UPKEEP_ADMIN); vm.expectRevert(Registry.OnlyCallableByAdmin.selector); - registry.setUpkeepGasLimit(linkUpkeepID + 1, 1230000); + registry.setUpkeepGasLimit(linkUpkeepID + 1, 1_230_000); } function test_RevertsWhen_UpkeepAlreadyCanceled() external { @@ -2443,7 +2443,7 @@ contract SetUpkeepGasLimit is SetUp { registry.cancelUpkeep(linkUpkeepID); vm.expectRevert(Registry.UpkeepCancelled.selector); - registry.setUpkeepGasLimit(linkUpkeepID, 1230000); + registry.setUpkeepGasLimit(linkUpkeepID, 1_230_000); } function test_RevertsWhen_NewGasLimitOutOfRange() external { @@ -2453,24 +2453,24 @@ contract SetUpkeepGasLimit is SetUp { registry.setUpkeepGasLimit(linkUpkeepID, 300); vm.expectRevert(Registry.GasLimitOutsideRange.selector); - registry.setUpkeepGasLimit(linkUpkeepID, 3000000000); + registry.setUpkeepGasLimit(linkUpkeepID, 3_000_000_000); } function test_RevertsWhen_NotCalledByAdmin() external { vm.startPrank(STRANGER); vm.expectRevert(Registry.OnlyCallableByAdmin.selector); - registry.setUpkeepGasLimit(linkUpkeepID, 1230000); + registry.setUpkeepGasLimit(linkUpkeepID, 1_230_000); } function test_UpdateGasLimit_CalledByAdmin() external { vm.startPrank(UPKEEP_ADMIN); vm.expectEmit(); - emit UpkeepGasLimitSet(linkUpkeepID, 1230000); - registry.setUpkeepGasLimit(linkUpkeepID, 1230000); + emit UpkeepGasLimitSet(linkUpkeepID, 1_230_000); + registry.setUpkeepGasLimit(linkUpkeepID, 1_230_000); - assertEq(registry.getUpkeep(linkUpkeepID).performGas, 1230000); + assertEq(registry.getUpkeep(linkUpkeepID).performGas, 1_230_000); } } diff --git a/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol b/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol index 88f09d9b42..6c1dc4350c 100644 --- a/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol @@ -39,7 +39,7 @@ contract BaseTest is Test { // constants address internal constant ZERO_ADDRESS = address(0); uint32 internal constant DEFAULT_GAS_FEE_PPB = 10_000_000; - uint24 internal constant DEFAULT_FLAT_FEE_MILLI_CENTS = 2_000; + uint24 internal constant DEFAULT_FLAT_FEE_MILLI_CENTS = 2000; // config uint8 internal constant F = 1; // number of faulty nodes @@ -262,9 +262,9 @@ contract BaseTest is Test { stalenessSeconds: 90_000, gasCeilingMultiplier: 2, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -375,7 +375,7 @@ contract BaseTest is Test { } AutoBase.Report memory report = - AutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); + AutoBase.Report(uint256(1_000_000_000), uint256(2_000_000_000), upkeepIds, gasLimits, triggers, performDatas); reportBytes = _encodeReport(report); } @@ -421,7 +421,7 @@ contract BaseTest is Test { } AutoBase.Report memory report = - AutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); + AutoBase.Report(uint256(1_000_000_000), uint256(2_000_000_000), upkeepIds, gasLimits, triggers, performDatas); reportBytes = _encodeReport(report); } diff --git a/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol b/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol index 2d55e97c89..3b698cdceb 100644 --- a/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol @@ -39,7 +39,7 @@ contract BaseTest is Test { // constants address internal constant ZERO_ADDRESS = address(0); uint32 internal constant DEFAULT_GAS_FEE_PPB = 10_000_000; - uint24 internal constant DEFAULT_FLAT_FEE_MILLI_CENTS = 2_000; + uint24 internal constant DEFAULT_FLAT_FEE_MILLI_CENTS = 2000; // config uint8 internal constant F = 1; // number of faulty nodes @@ -272,9 +272,9 @@ contract BaseTest is Test { stalenessSeconds: 90_000, gasCeilingMultiplier: 2, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -373,8 +373,9 @@ contract BaseTest is Test { revert("not implemented"); } } - ZKSyncAutoBase.Report memory report = - ZKSyncAutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); + ZKSyncAutoBase.Report memory report = ZKSyncAutoBase.Report( + uint256(1_000_000_000), uint256(2_000_000_000), upkeepIds, gasLimits, triggers, performDatas + ); reportBytes = _encodeReport(report); } @@ -418,8 +419,9 @@ contract BaseTest is Test { } } - ZKSyncAutoBase.Report memory report = - ZKSyncAutoBase.Report(uint256(1000000000), uint256(2000000000), upkeepIds, gasLimits, triggers, performDatas); + ZKSyncAutoBase.Report memory report = ZKSyncAutoBase.Report( + uint256(1_000_000_000), uint256(2_000_000_000), upkeepIds, gasLimits, triggers, performDatas + ); reportBytes = _encodeReport(report); } diff --git a/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol index cf950da11b..10164c5e8b 100644 --- a/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol @@ -338,7 +338,7 @@ contract Withdraw is SetUp { (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -396,9 +396,9 @@ contract SetConfig is SetUp { stalenessSeconds: 90_000, gasCeilingMultiplier: 0, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -420,7 +420,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -467,7 +467,7 @@ contract SetConfig is SetUp { assertEq(f, F); AutomationRegistryBase2_3.BillingConfig memory config = registry.getBillingTokenConfig(billingTokenAddress); - assertEq(config.gasFeePPB, 5_000); + assertEq(config.gasFeePPB, 5000); assertEq(config.flatFeeMilliCents, 20_000); assertEq(config.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config.minSpend, 100_000); @@ -488,7 +488,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](2); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_001, + gasFeePPB: 5001, flatFeeMilliCents: 20_001, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 100, @@ -496,7 +496,7 @@ contract SetConfig is SetUp { decimals: 18 }); billingConfigs[1] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_002, + gasFeePPB: 5002, flatFeeMilliCents: 20_002, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 200, @@ -517,14 +517,14 @@ contract SetConfig is SetUp { assertEq(f, F); AutomationRegistryBase2_3.BillingConfig memory config1 = registry.getBillingTokenConfig(billingTokenAddress1); - assertEq(config1.gasFeePPB, 5_001); + assertEq(config1.gasFeePPB, 5001); assertEq(config1.flatFeeMilliCents, 20_001); assertEq(config1.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config1.fallbackPrice, 100); assertEq(config1.minSpend, 100); AutomationRegistryBase2_3.BillingConfig memory config2 = registry.getBillingTokenConfig(billingTokenAddress2); - assertEq(config2.gasFeePPB, 5_002); + assertEq(config2.gasFeePPB, 5002); assertEq(config2.flatFeeMilliCents, 20_002); assertEq(config2.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config2.fallbackPrice, 200); @@ -545,7 +545,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs1 = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs1[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_001, + gasFeePPB: 5001, flatFeeMilliCents: 20_001, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 100, @@ -571,7 +571,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs2 = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs2[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_002, + gasFeePPB: 5002, flatFeeMilliCents: 20_002, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 200, @@ -590,9 +590,9 @@ contract SetConfig is SetUp { stalenessSeconds: 90_000, gasCeilingMultiplier: 0, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -629,7 +629,7 @@ contract SetConfig is SetUp { assertEq(f, F); AutomationRegistryBase2_3.BillingConfig memory config2 = registry.getBillingTokenConfig(billingTokenAddress2); - assertEq(config2.gasFeePPB, 5_002); + assertEq(config2.gasFeePPB, 5002); assertEq(config2.flatFeeMilliCents, 20_002); assertEq(config2.priceFeed, address(USDTOKEN_USD_FEED)); assertEq(config2.fallbackPrice, 200); @@ -651,7 +651,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](2); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_001, + gasFeePPB: 5001, flatFeeMilliCents: 20_001, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 100, @@ -659,7 +659,7 @@ contract SetConfig is SetUp { decimals: 18 }); billingConfigs[1] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_002, + gasFeePPB: 5002, flatFeeMilliCents: 20_002, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 200, @@ -682,7 +682,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -705,7 +705,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -748,7 +748,7 @@ contract SetConfig is SetUp { AutomationRegistryBase2_3.BillingConfig[] memory billingConfigs = new AutomationRegistryBase2_3.BillingConfig[](1); billingConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ - gasFeePPB: 5_000, + gasFeePPB: 5000, flatFeeMilliCents: 20_000, priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 2_000_000_000, // $20 @@ -911,7 +911,7 @@ contract NOPsSettlement is SetUp { registry.setPayees(PAYEES); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -992,7 +992,7 @@ contract NOPsSettlement is SetUp { deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1106,7 +1106,7 @@ contract NOPsSettlement is SetUp { registry.setPayees(PAYEES); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1145,7 +1145,7 @@ contract NOPsSettlement is SetUp { registry.setPayees(PAYEES); // register an upkeep and add funds - uint256 id = registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + uint256 id = registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1203,7 +1203,7 @@ contract NOPsSettlement is SetUp { new AutomationRegistryBase2_3.BillingConfig[](billingTokens.length); billingTokenConfigs[0] = AutomationRegistryBase2_3.BillingConfig({ gasFeePPB: 10_000_000, // 15% - flatFeeMilliCents: 2_000, // 2 cents + flatFeeMilliCents: 2000, // 2 cents priceFeed: address(USDTOKEN_USD_FEED), fallbackPrice: 1e8, // $1 minSpend: 1e18, // 1 USD @@ -1218,9 +1218,9 @@ contract NOPsSettlement is SetUp { stalenessSeconds: 90_000, gasCeilingMultiplier: 2, maxPerformGas: 10_000_000, - maxCheckDataSize: 5_000, - maxPerformDataSize: 5_000, - maxRevertDataSize: 5_000, + maxCheckDataSize: 5000, + maxPerformDataSize: 5000, + maxRevertDataSize: 5000, fallbackGasPrice: 20_000_000_000, fallbackLinkPrice: 2_000_000_000, // $20 fallbackNativePrice: 400_000_000_000, // $4,000 @@ -1425,7 +1425,7 @@ contract BillingOverrides is SetUp { function test_RevertsWhen_NotPrivilegeManager() public { AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = - AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5000, flatFeeMilliCents: 20_000}); vm.expectRevert(Registry.OnlyCallableByUpkeepPrivilegeManager.selector); registry.setBillingOverrides(linkUpkeepID, billingOverrides); @@ -1433,7 +1433,7 @@ contract BillingOverrides is SetUp { function test_RevertsWhen_UpkeepCancelled() public { AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = - AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5000, flatFeeMilliCents: 20_000}); registry.cancelUpkeep(linkUpkeepID); @@ -1444,7 +1444,7 @@ contract BillingOverrides is SetUp { function test_Happy_SetBillingOverrides() public { AutomationRegistryBase2_3.BillingOverrides memory billingOverrides = - AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5_000, flatFeeMilliCents: 20_000}); + AutomationRegistryBase2_3.BillingOverrides({gasFeePPB: 5000, flatFeeMilliCents: 20_000}); vm.startPrank(PRIVILEGE_MANAGER); @@ -1702,7 +1702,7 @@ contract Transmit is SetUp { // register an upkeep and add funds uint256 upkeepID = - registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); + registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken18), "", "", ""); _mintERC20_18Decimals(UPKEEP_ADMIN, 1e20); vm.startPrank(UPKEEP_ADMIN); usdToken18.approve(address(registry), 1e20); @@ -1742,7 +1742,7 @@ contract Transmit is SetUp { // register an upkeep and add funds uint256 upkeepID = - registry.registerUpkeep(address(TARGET1), 1000000, UPKEEP_ADMIN, 0, address(usdToken6), "", "", ""); + registry.registerUpkeep(address(TARGET1), 1_000_000, UPKEEP_ADMIN, 0, address(usdToken6), "", "", ""); vm.prank(OWNER); usdToken6.mint(UPKEEP_ADMIN, 1e20); @@ -2010,13 +2010,13 @@ contract CancelUpkeep is SetUp { function test_RevertsWhen_IdIsInvalid_CalledByAdmin() external { vm.startPrank(UPKEEP_ADMIN); vm.expectRevert(Registry.CannotCancel.selector); - registry.cancelUpkeep(1111111); + registry.cancelUpkeep(1_111_111); } function test_RevertsWhen_IdIsInvalid_CalledByOwner() external { vm.startPrank(registry.owner()); vm.expectRevert(Registry.CannotCancel.selector); - registry.cancelUpkeep(1111111); + registry.cancelUpkeep(1_111_111); } function test_RevertsWhen_NotCalledByOwnerOrAdmin() external { @@ -2442,7 +2442,7 @@ contract SetUpkeepGasLimit is SetUp { vm.startPrank(UPKEEP_ADMIN); vm.expectRevert(Registry.OnlyCallableByAdmin.selector); - registry.setUpkeepGasLimit(linkUpkeepID + 1, 1230000); + registry.setUpkeepGasLimit(linkUpkeepID + 1, 1_230_000); } function test_RevertsWhen_UpkeepAlreadyCanceled() external { @@ -2450,7 +2450,7 @@ contract SetUpkeepGasLimit is SetUp { registry.cancelUpkeep(linkUpkeepID); vm.expectRevert(Registry.UpkeepCancelled.selector); - registry.setUpkeepGasLimit(linkUpkeepID, 1230000); + registry.setUpkeepGasLimit(linkUpkeepID, 1_230_000); } function test_RevertsWhen_NewGasLimitOutOfRange() external { @@ -2460,24 +2460,24 @@ contract SetUpkeepGasLimit is SetUp { registry.setUpkeepGasLimit(linkUpkeepID, 300); vm.expectRevert(Registry.GasLimitOutsideRange.selector); - registry.setUpkeepGasLimit(linkUpkeepID, 3000000000); + registry.setUpkeepGasLimit(linkUpkeepID, 3_000_000_000); } function test_RevertsWhen_NotCalledByAdmin() external { vm.startPrank(STRANGER); vm.expectRevert(Registry.OnlyCallableByAdmin.selector); - registry.setUpkeepGasLimit(linkUpkeepID, 1230000); + registry.setUpkeepGasLimit(linkUpkeepID, 1_230_000); } function test_UpdateGasLimit_CalledByAdmin() external { vm.startPrank(UPKEEP_ADMIN); vm.expectEmit(); - emit UpkeepGasLimitSet(linkUpkeepID, 1230000); - registry.setUpkeepGasLimit(linkUpkeepID, 1230000); + emit UpkeepGasLimitSet(linkUpkeepID, 1_230_000); + registry.setUpkeepGasLimit(linkUpkeepID, 1_230_000); - assertEq(registry.getUpkeep(linkUpkeepID).performGas, 1230000); + assertEq(registry.getUpkeep(linkUpkeepID).performGas, 1_230_000); } } diff --git a/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol b/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol index fda40e941b..f206621662 100644 --- a/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol +++ b/contracts/src/v0.8/automation/testhelpers/MockOVMGasPriceOracle.sol @@ -5,12 +5,12 @@ contract MockOVMGasPriceOracle { function getL1Fee( bytes memory ) public pure returns (uint256) { - return 2000000; + return 2_000_000; } function getL1FeeUpperBound( uint256 ) public pure returns (uint256) { - return 2000000; + return 2_000_000; } } diff --git a/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol b/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol index 10a049dc78..3d456f990e 100644 --- a/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol +++ b/contracts/src/v0.8/automation/testhelpers/UpkeepCounterNew.sol @@ -25,7 +25,7 @@ contract UpkeepCounterNew { address public forwarder; constructor() { - testRange = 1000000; + testRange = 1_000_000; interval = 40; previousPerformBlock = 0; lastTimestamp = block.timestamp; @@ -34,8 +34,8 @@ contract UpkeepCounterNew { useMoreCheckGas = false; useMorePerformData = false; useMorePerformGas = false; - checkGasToBurn = 9700000; - performGasToBurn = 7700000; + checkGasToBurn = 9_700_000; + performGasToBurn = 7_700_000; } function setPerformGasToBurn( diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol index ca89f5e800..24ab11eaa5 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol @@ -43,7 +43,7 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { // check if an upkeep is eligible for adding funds at this interval uint256 public upkeepTopUpCheckInterval = 5; // an upkeep will get this amount of LINK for every top up - uint96 public addLinkAmount = 200000000000000000; // 0.2 LINK + uint96 public addLinkAmount = 200_000_000_000_000_000; // 0.2 LINK // if an upkeep's balance is less than this threshold * min balance, this upkeep is eligible for adding funds uint8 public minBalanceThresholdMultiplier = 20; // if this contract is using arbitrum block number @@ -329,7 +329,7 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { function burnPerformGas(uint256 upkeepId, uint256 startGas, uint256 blockNum) public { uint256 performGasToBurn = performGasToBurns[upkeepId]; - while (startGas - gasleft() + 10000 < performGasToBurn) { + while (startGas - gasleft() + 10_000 < performGasToBurn) { dummyMap[blockhash(blockNum)] = false; } } diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol index c8a79a0ac5..e6b2928315 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadLogTriggerUpkeep.sol @@ -52,7 +52,7 @@ contract VerifiableLoadLogTriggerUpkeep is VerifiableLoadBase, StreamsLookupComp address addr = abi.decode(t3, (address)); uint256 checkGasToBurn = checkGasToBurns[upkeepId]; - while (startGas - gasleft() + 15000 < checkGasToBurn) { + while (startGas - gasleft() + 15_000 < checkGasToBurn) { dummyMap[blockhash(blockNum)] = false; } diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol index 122b9c1801..d59e13fddd 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadStreamsLookupUpkeep.sol @@ -35,7 +35,7 @@ contract VerifiableLoadStreamsLookupUpkeep is VerifiableLoadBase, StreamsLookupC bytes memory pData = abi.encode(upkeepId, new bytes(performDataSize)); uint256 blockNum = getBlockNumber(); bool needed = eligible(upkeepId); - while (startGas - gasleft() + 10000 < checkGasToBurn) { + while (startGas - gasleft() + 10_000 < checkGasToBurn) { // 10K margin over gas to burn // Hard coded check gas to burn dummyMap[blockhash(blockNum)] = false; // arbitrary storage writes diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol index d75234b190..edf7aa1fed 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadUpkeep.sol @@ -17,7 +17,7 @@ contract VerifiableLoadUpkeep is VerifiableLoadBase { bytes memory pData = abi.encode(upkeepId, new bytes(performDataSize)); uint256 blockNum = getBlockNumber(); bool needed = eligible(upkeepId); - while (startGas - gasleft() + 10000 < checkGasToBurn) { + while (startGas - gasleft() + 10_000 < checkGasToBurn) { dummyMap[blockhash(blockNum)] = false; blockNum--; } diff --git a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol index 334981ecd2..0f5dff93a5 100644 --- a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol @@ -73,8 +73,8 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter bytes32 private constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); bytes32 private constant EXECUTOR_ROLE = keccak256("EXECUTOR_ROLE"); - uint96 private constant DEFAULT_TOP_UP_AMOUNT_JUELS = 3000000000000000000; - uint96 private constant DEFAULT_MIN_BALANCE_JUELS = 1000000000000000000; + uint96 private constant DEFAULT_TOP_UP_AMOUNT_JUELS = 3_000_000_000_000_000_000; + uint96 private constant DEFAULT_MIN_BALANCE_JUELS = 1_000_000_000_000_000_000; IERC20 private immutable i_linkToken; uint256 private s_minWaitPeriodSeconds; diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol index 008d32fc92..04b90a432f 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol @@ -35,9 +35,9 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { bytes4 internal constant PERFORM_SELECTOR = KeeperCompatibleInterface.performUpkeep.selector; bytes4 internal constant CHECK_CALLBACK_SELECTOR = StreamsLookupCompatibleInterface.checkCallback.selector; bytes4 internal constant CHECK_LOG_SELECTOR = ILogAutomation.checkLog.selector; - uint256 internal constant PERFORM_GAS_MIN = 2_300; + uint256 internal constant PERFORM_GAS_MIN = 2300; uint256 internal constant CANCELLATION_DELAY = 50; - uint256 internal constant PERFORM_GAS_CUSHION = 5_000; + uint256 internal constant PERFORM_GAS_CUSHION = 5000; uint256 internal constant PPB_BASE = 1_000_000_000; uint32 internal constant UINT32_MAX = type(uint32).max; uint96 internal constant LINK_TOTAL_SUPPLY = 1e27; @@ -57,11 +57,11 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { uint256 internal constant REGISTRY_CONDITIONAL_OVERHEAD = 90_000; // Used in maxPayment estimation, and in capping overheads during actual payment uint256 internal constant REGISTRY_LOG_OVERHEAD = 110_000; // Used only in maxPayment estimation, and in capping overheads during actual payment. uint256 internal constant REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD = 20; // Used only in maxPayment estimation, and in capping overheads during actual payment. Value scales with performData length. - uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 7_500; // Used only in maxPayment estimation, and in capping overheads during actual payment. Value scales with f. + uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 7500; // Used only in maxPayment estimation, and in capping overheads during actual payment. Value scales with f. uint256 internal constant ACCOUNTING_FIXED_GAS_OVERHEAD = 27_500; // Used in actual payment. Fixed overhead per tx - uint256 internal constant ACCOUNTING_PER_SIGNER_GAS_OVERHEAD = 1_100; // Used in actual payment. overhead per signer - uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7_000; // Used in actual payment. overhead per upkeep performed + uint256 internal constant ACCOUNTING_PER_SIGNER_GAS_OVERHEAD = 1100; // Used in actual payment. overhead per signer + uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7000; // Used in actual payment. overhead per upkeep performed OVM_GasPriceOracle internal constant OPTIMISM_ORACLE = OVM_GasPriceOracle(0x420000000000000000000000000000000000000F); ArbGasInfo internal constant ARB_NITRO_ORACLE = ArbGasInfo(0x000000000000000000000000000000000000006C); diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol index f237992c0b..86a71a109c 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol @@ -31,9 +31,9 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { bytes4 internal constant PERFORM_SELECTOR = KeeperCompatibleInterface.performUpkeep.selector; bytes4 internal constant CHECK_CALLBACK_SELECTOR = StreamsLookupCompatibleInterface.checkCallback.selector; bytes4 internal constant CHECK_LOG_SELECTOR = ILogAutomation.checkLog.selector; - uint256 internal constant PERFORM_GAS_MIN = 2_300; + uint256 internal constant PERFORM_GAS_MIN = 2300; uint256 internal constant CANCELLATION_DELAY = 50; - uint256 internal constant PERFORM_GAS_CUSHION = 5_000; + uint256 internal constant PERFORM_GAS_CUSHION = 5000; uint256 internal constant PPB_BASE = 1_000_000_000; uint32 internal constant UINT32_MAX = type(uint32).max; uint96 internal constant LINK_TOTAL_SUPPLY = 1e27; @@ -52,7 +52,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { // the variables result in accurate estimation uint256 internal constant REGISTRY_CONDITIONAL_OVERHEAD = 60_000; // Fixed gas overhead for conditional upkeeps uint256 internal constant REGISTRY_LOG_OVERHEAD = 85_000; // Fixed gas overhead for log upkeeps - uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5_600; // Value scales with f + uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5600; // Value scales with f uint256 internal constant REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD = 24; // Per perform data byte overhead // The overhead (in bytes) in addition to perform data for upkeep sent in calldata @@ -66,7 +66,7 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates various cases and verifies that // the variables result in accurate estimation uint256 internal constant ACCOUNTING_FIXED_GAS_OVERHEAD = 22_000; // Fixed overhead per tx - uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7_000; // Overhead per upkeep performed in batch + uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7000; // Overhead per upkeep performed in batch LinkTokenInterface internal immutable i_link; AggregatorV3Interface internal immutable i_linkNativeFeed; diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol index e406bf059e..deaa9894e4 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol @@ -34,9 +34,9 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { bytes4 internal constant PERFORM_SELECTOR = KeeperCompatibleInterface.performUpkeep.selector; bytes4 internal constant CHECK_CALLBACK_SELECTOR = StreamsLookupCompatibleInterface.checkCallback.selector; bytes4 internal constant CHECK_LOG_SELECTOR = ILogAutomation.checkLog.selector; - uint256 internal constant PERFORM_GAS_MIN = 2_300; + uint256 internal constant PERFORM_GAS_MIN = 2300; uint256 internal constant CANCELLATION_DELAY = 50; - uint256 internal constant PERFORM_GAS_CUSHION = 5_000; + uint256 internal constant PERFORM_GAS_CUSHION = 5000; uint256 internal constant PPB_BASE = 1_000_000_000; uint32 internal constant UINT32_MAX = type(uint32).max; // The first byte of the mask can be 0, because we only ever have 31 oracles @@ -48,7 +48,7 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { // the variables result in accurate estimation uint256 internal constant REGISTRY_CONDITIONAL_OVERHEAD = 98_200; // Fixed gas overhead for conditional upkeeps uint256 internal constant REGISTRY_LOG_OVERHEAD = 123_500; // Fixed gas overhead for log upkeeps - uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5_600; // Value scales with f + uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5600; // Value scales with f uint256 internal constant REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD = 24; // Per perform data byte overhead // The overhead (in bytes) in addition to perform data for upkeep sent in calldata diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol index 768c184ba7..1c2a2acd59 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol @@ -34,7 +34,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { bytes4 internal constant PERFORM_SELECTOR = KeeperCompatibleInterface.performUpkeep.selector; bytes4 internal constant CHECK_CALLBACK_SELECTOR = StreamsLookupCompatibleInterface.checkCallback.selector; bytes4 internal constant CHECK_LOG_SELECTOR = ILogAutomation.checkLog.selector; - uint256 internal constant PERFORM_GAS_MIN = 2_300; + uint256 internal constant PERFORM_GAS_MIN = 2300; uint256 internal constant CANCELLATION_DELAY = 50; uint32 internal constant UINT32_MAX = type(uint32).max; // The first byte of the mask can be 0, because we only ever have 31 oracles @@ -46,7 +46,7 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { // the variables result in accurate estimation uint256 internal constant REGISTRY_CONDITIONAL_OVERHEAD = 98_200; // Fixed gas overhead for conditional upkeeps uint256 internal constant REGISTRY_LOG_OVERHEAD = 122_500; // Fixed gas overhead for log upkeeps - uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5_600; // Value scales with f + uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5600; // Value scales with f // Next block of constants are used in actual payment calculation. We calculate the exact gas used within the // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed constants diff --git a/contracts/src/v0.8/data-feeds/test/BaseTest.t.sol b/contracts/src/v0.8/data-feeds/test/BaseTest.t.sol index c92986b272..b8c985e0a2 100644 --- a/contracts/src/v0.8/data-feeds/test/BaseTest.t.sol +++ b/contracts/src/v0.8/data-feeds/test/BaseTest.t.sol @@ -9,7 +9,7 @@ contract BaseTest is Test { address internal constant STRANGER = 0x02e7d5DD1F4dDbC9f512FfA01d30aa190Ae3edBb; // Fri May 26 2023 13:49:53 GMT+0000 - uint256 internal constant BLOCK_TIME = 1685108993; + uint256 internal constant BLOCK_TIME = 1_685_108_993; function setUp() public virtual { // BaseTest.setUp is often called multiple times from tests' setUp due to inheritance. diff --git a/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol b/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol index 07076337fc..76437fba0f 100644 --- a/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol +++ b/contracts/src/v0.8/data-feeds/test/DataFeedsCache.t.sol @@ -15,14 +15,14 @@ contract DataFeedsCacheTest is BaseTest { BundleAggregatorProxy internal s_dataFeedsAggregatorProxy; DataFeedsCacheHarness internal s_dataFeedsCache; - address internal constant ILLEGAL_CALLER = address(11111); // address used as incorrect caller in tests - address internal constant REPORT_SENDER = address(12222); // mocks keystone forwarder address + address internal constant ILLEGAL_CALLER = address(11_111); // address used as incorrect caller in tests + address internal constant REPORT_SENDER = address(12_222); // mocks keystone forwarder address ERC20Mock internal s_link = new ERC20Mock(18); bytes32 internal constant WORKFLOWID = hex"6d795f6964000000000000000000000000000000000000000000000000000000"; bytes10 internal constant WORKFLOWNAME = bytes10("abc"); - address internal constant WORKFLOWOWNER = address(10004); + address internal constant WORKFLOWOWNER = address(10_004); bytes2 internal constant REPORTID = hex"0001"; string[] internal s_descriptions = ["description"]; @@ -33,7 +33,7 @@ contract DataFeedsCacheTest is BaseTest { bytes internal constant METADATA = abi.encodePacked(WORKFLOWID, WORKFLOWNAME, WORKFLOWOWNER, REPORTID); address[] internal s_allowedSendersList = [REPORT_SENDER, REPORT_SENDER]; - address[] internal s_allowedWorkflowOwnersList = [address(10004), address(10005)]; + address[] internal s_allowedWorkflowOwnersList = [address(10_004), address(10_005)]; bytes10[] internal s_allowedWorkflowNamesList = [bytes10("abc"), bytes10("xyz")]; address[] internal s_singleProxyList = new address[](1); @@ -77,12 +77,12 @@ contract DataFeedsCacheTest is BaseTest { bytes16 internal constant DATA_ID_3 = bytes16(keccak256("45678")); bytes16 internal constant DATA_ID_4 = bytes16(keccak256("56789")); bytes16 internal constant DATA_ID_5 = bytes16(keccak256("67890")); - uint256 internal constant PRICE1 = 123456; - uint256 internal constant PRICE2 = 456789; - uint256 internal constant PRICE3 = 789456; - uint256 internal constant PRICE4 = 890123; - uint256 internal constant PRICE5 = 654321; - uint256 internal constant PRICE6 = 987654; + uint256 internal constant PRICE1 = 123_456; + uint256 internal constant PRICE2 = 456_789; + uint256 internal constant PRICE3 = 789_456; + uint256 internal constant PRICE4 = 890_123; + uint256 internal constant PRICE5 = 654_321; + uint256 internal constant PRICE6 = 987_654; uint32 internal constant TIMESTAMP1 = 100; uint32 internal constant TIMESTAMP2 = 200; @@ -189,21 +189,21 @@ contract DataFeedsCacheTest is BaseTest { s_workflowMetadata.push(s_workflowMetadata1); s_workflowMetadata.push(s_workflowMetadata2); - s_singleProxyList[0] = address(10002); + s_singleProxyList[0] = address(10_002); s_proxyList[0] = address(s_dataFeedsAggregatorProxy); - s_proxyList[1] = address(10002); - s_proxyList[2] = address(10004); - s_proxyList[3] = address(10005); - s_proxyList[4] = address(10006); + s_proxyList[1] = address(10_002); + s_proxyList[2] = address(10_004); + s_proxyList[3] = address(10_005); + s_proxyList[4] = address(10_006); - s_newSingleProxyList[0] = address(10007); + s_newSingleProxyList[0] = address(10_007); - s_newProxyList[0] = address(10002); - s_newProxyList[1] = address(10003); - s_newProxyList[2] = address(10004); - s_newProxyList[3] = address(10005); - s_newProxyList[4] = address(10006); + s_newProxyList[0] = address(10_002); + s_newProxyList[1] = address(10_003); + s_newProxyList[2] = address(10_004); + s_newProxyList[3] = address(10_005); + s_newProxyList[4] = address(10_006); s_singleValueId = new bytes16[](1); s_singleValueId[0] = bytes16(DATAID1); @@ -238,7 +238,7 @@ contract DataFeedsCacheTest is BaseTest { function test_updateDataIdMappingsForProxiesRevertInvalidLengths() public { address[] memory s_proxyList = new address[](1); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); bytes16[] memory dataIdList = new bytes16[](2); dataIdList[0] = bytes16(keccak256("12345")); @@ -251,7 +251,7 @@ contract DataFeedsCacheTest is BaseTest { function test_updateDataIdMappingsForProxiesRevertUnauthorizedOwner() public { address[] memory s_proxyList = new address[](1); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); bytes16[] memory dataIdList = new bytes16[](1); dataIdList[0] = bytes16(keccak256("12345")); @@ -268,7 +268,7 @@ contract DataFeedsCacheTest is BaseTest { function test_updateDataIdMappingsForProxiesSuccess() public { address[] memory s_proxyList = new address[](1); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); bytes16[] memory dataIdList = new bytes16[](1); dataIdList[0] = bytes16(keccak256("12345")); @@ -327,7 +327,7 @@ contract DataFeedsCacheTest is BaseTest { function test_updateDataIdMappingsForProxies_and_RevertOnWrongCaller() public { address[] memory s_proxyList = new address[](1); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); bytes16[] memory dataIdList = new bytes16[](1); dataIdList[0] = bytes16(keccak256("12345")); @@ -348,7 +348,7 @@ contract DataFeedsCacheTest is BaseTest { function test_removeDataIdMappingsForProxiesSuccess() public { address[] memory s_proxyList = new address[](1); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); bytes16[] memory dataIdList = new bytes16[](1); dataIdList[0] = bytes16(keccak256("12345")); @@ -366,7 +366,7 @@ contract DataFeedsCacheTest is BaseTest { function test_removeDataIdMappingsForProxiesSuccess_and_call_decimals() public { address[] memory s_proxyList = new address[](1); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); bytes16[] memory dataIdList = new bytes16[](1); dataIdList[0] = bytes16(keccak256("12345")); @@ -915,14 +915,14 @@ contract DataFeedsCacheTest is BaseTest { function test_isFeedAdmin() public view { assertEq(s_dataFeedsCache.isFeedAdmin(OWNER), true); - assertEq(s_dataFeedsCache.isFeedAdmin(address(10002)), false); + assertEq(s_dataFeedsCache.isFeedAdmin(address(10_002)), false); } function test_removeFeedAdminSuccess() public { - s_dataFeedsCache.setFeedAdmin(address(10003), true); + s_dataFeedsCache.setFeedAdmin(address(10_003), true); vm.expectEmit(); - emit DataFeedsCache.FeedAdminSet(address(10003), false); - s_dataFeedsCache.setFeedAdmin(address(10003), false); + emit DataFeedsCache.FeedAdminSet(address(10_003), false); + s_dataFeedsCache.setFeedAdmin(address(10_003), false); } function testFuzz_checkFeedPermissionFalse( @@ -1144,7 +1144,7 @@ contract DataFeedsCacheTest is BaseTest { s_dataFeedsCache.setDecimalFeedConfigs(dataIds, s_descriptions, s_workflowMetadata); // workFlowOwner in report is address(10004); - address invalidWorkflowOwner = address(10005); + address invalidWorkflowOwner = address(10_005); bytes memory thisMetadata = abi.encodePacked(WORKFLOWID, WORKFLOWNAME, invalidWorkflowOwner, REPORTID); vm.startPrank(REPORT_SENDER); @@ -1591,12 +1591,12 @@ contract DataFeedsCacheTest is BaseTest { vm.startPrank(ILLEGAL_CALLER); vm.expectRevert("Only callable by owner"); - s_dataFeedsCache.recoverTokens(IERC20(address(s_link)), address(10008), 1 ether); + s_dataFeedsCache.recoverTokens(IERC20(address(s_link)), address(10_008), 1 ether); } function test_recoverTokensERC20RevertNoBalance() public { vm.expectRevert(abi.encodeWithSelector(DataFeedsCache.InsufficientBalance.selector, 0, 1)); - s_dataFeedsCache.recoverTokens(IERC20(address(s_link)), address(10007), 1); + s_dataFeedsCache.recoverTokens(IERC20(address(s_link)), address(10_007), 1); } function testFuzzy_recoverTokensERC20Success( @@ -1606,15 +1606,15 @@ contract DataFeedsCacheTest is BaseTest { s_link.mint(address(s_dataFeedsCache), amount); vm.expectEmit(); - emit DataFeedsCache.TokenRecovered(address(s_link), address(10008), amount); - s_dataFeedsCache.recoverTokens(IERC20(address(s_link)), address(10008), amount); - assertEq(s_link.balanceOf(address(10008)), amount); + emit DataFeedsCache.TokenRecovered(address(s_link), address(10_008), amount); + s_dataFeedsCache.recoverTokens(IERC20(address(s_link)), address(10_008), amount); + assertEq(s_link.balanceOf(address(10_008)), amount); assertEq(s_link.balanceOf(address(s_dataFeedsCache)), 0); } function test_recoverTokensNativeRevertNoBalance() public { vm.expectRevert(abi.encodeWithSelector(DataFeedsCache.InsufficientBalance.selector, 0, 1 ether)); - s_dataFeedsCache.recoverTokens(IERC20(address(0)), address(10007), 1 ether); + s_dataFeedsCache.recoverTokens(IERC20(address(0)), address(10_007), 1 ether); } function testFuzzy_recoverTokensNativeSuccess( @@ -1625,10 +1625,10 @@ contract DataFeedsCacheTest is BaseTest { assertEq(address(s_dataFeedsCache).balance, amount); vm.expectEmit(); - emit DataFeedsCache.TokenRecovered(address(0), address(10007), amount); - s_dataFeedsCache.recoverTokens(IERC20(address(0)), address(10007), amount); + emit DataFeedsCache.TokenRecovered(address(0), address(10_007), amount); + s_dataFeedsCache.recoverTokens(IERC20(address(0)), address(10_007), amount); assertEq(address(s_dataFeedsCache).balance, 0); - assertEq(address(10007).balance, amount); + assertEq(address(10_007).balance, amount); } function test_getLatestByFeedId() public { diff --git a/contracts/src/v0.8/data-feeds/test/DataFeedsCacheGas.t.sol b/contracts/src/v0.8/data-feeds/test/DataFeedsCacheGas.t.sol index 0b906c75a6..95f51f6caf 100644 --- a/contracts/src/v0.8/data-feeds/test/DataFeedsCacheGas.t.sol +++ b/contracts/src/v0.8/data-feeds/test/DataFeedsCacheGas.t.sol @@ -39,21 +39,21 @@ contract DataFeedsCacheGasTest is DataFeedsSetupGas { function setUp() public virtual override { DataFeedsSetupGas.setUp(); - s_singleProxyList[0] = address(10002); + s_singleProxyList[0] = address(10_002); - s_proxyList[0] = address(10002); + s_proxyList[0] = address(10_002); s_proxyList[1] = address(s_dataFeedsLegacyAggregatorProxy); s_proxyList[2] = address(s_dataFeedsAggregatorProxy); - s_proxyList[3] = address(10005); - s_proxyList[4] = address(10006); + s_proxyList[3] = address(10_005); + s_proxyList[4] = address(10_006); - s_newSingleProxyList[0] = address(10007); + s_newSingleProxyList[0] = address(10_007); - s_newProxyList[0] = address(10002); - s_newProxyList[1] = address(10003); - s_newProxyList[2] = address(10004); - s_newProxyList[3] = address(10005); - s_newProxyList[4] = address(10006); + s_newProxyList[0] = address(10_002); + s_newProxyList[1] = address(10_003); + s_newProxyList[2] = address(10_004); + s_newProxyList[3] = address(10_005); + s_newProxyList[4] = address(10_006); vm.startPrank(OWNER); s_dataFeedsCache.updateDataIdMappingsForProxies(s_proxyList, s_batchValueIds); @@ -179,13 +179,13 @@ contract DataFeedsCacheGasTest is DataFeedsSetupGas { function test_getAnswer_proxy_gas() public { vm.startSnapshotGas("test_getAnswer_proxy_gas"); - s_dataFeedsLegacyAggregatorProxy.getAnswer(18446744073709551617); + s_dataFeedsLegacyAggregatorProxy.getAnswer(18_446_744_073_709_551_617); vm.stopSnapshotGas("test_getAnswer_proxy_gas"); } function test_getTimestamp_proxy_gas() public { vm.startSnapshotGas("test_getTimestamp_proxy_gas"); - s_dataFeedsLegacyAggregatorProxy.getTimestamp(18446744073709551617); + s_dataFeedsLegacyAggregatorProxy.getTimestamp(18_446_744_073_709_551_617); vm.stopSnapshotGas("test_getTimestamp_proxy_gas"); } @@ -205,7 +205,7 @@ contract DataFeedsCacheGasTest is DataFeedsSetupGas { function test_getRoundData_proxy_gas() public { vm.startSnapshotGas("test_getRoundData_proxy_gas"); - s_dataFeedsLegacyAggregatorProxy.getRoundData(uint80(18446744073709551617)); + s_dataFeedsLegacyAggregatorProxy.getRoundData(uint80(18_446_744_073_709_551_617)); vm.stopSnapshotGas("test_getRoundData_proxy_gas"); } diff --git a/contracts/src/v0.8/data-feeds/test/DataFeedsSetupGas.t.sol b/contracts/src/v0.8/data-feeds/test/DataFeedsSetupGas.t.sol index fc8322e8ec..2f4e753d90 100644 --- a/contracts/src/v0.8/data-feeds/test/DataFeedsSetupGas.t.sol +++ b/contracts/src/v0.8/data-feeds/test/DataFeedsSetupGas.t.sol @@ -35,18 +35,18 @@ contract DataFeedsSetupGas is BaseTest { bytes16[] internal s_batchValueIds = new bytes16[](5); bytes32[] internal s_paddedDataIds = new bytes32[](5); - uint256 internal s_price1 = 123456; - uint256 internal s_price2 = 456789; + uint256 internal s_price1 = 123_456; + uint256 internal s_price2 = 456_789; uint32 internal s_timestamp1 = 0; uint32 internal s_timestamp2 = 0; uint32 internal s_timestamp3 = 0; - address internal s_reportSender = address(10002); + address internal s_reportSender = address(10_002); string internal s_description = "description"; bytes32 internal s_workflowId = hex"6d795f6964000000000000000000000000000000000000000000000000000000"; bytes2 internal s_reportId = hex"0001"; address[] internal s_senders = [s_reportSender, s_reportSender]; - address[] internal s_workflowOwners = [address(10004), address(10005)]; + address[] internal s_workflowOwners = [address(10_004), address(10_005)]; bytes10[] internal s_workflowNames = [bytes10("abc"), bytes10("xyz")]; DataFeedsCache.WorkflowMetadata internal s_workflowMetadata1 = DataFeedsCache.WorkflowMetadata({ diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol index e9bc6b97d9..530e9c6120 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol @@ -16,9 +16,9 @@ library ChainSpecificUtil { /// @dev reference: https://docs.arbitrum.io/build-decentralized-apps/how-to-estimate-gas#where-do-we-get-all-this-information-from uint256 private constant ARB_DATA_PADDING_SIZE = 140; - uint256 private constant ARB_MAINNET_CHAIN_ID = 42161; - uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421613; - uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421614; + uint256 private constant ARB_MAINNET_CHAIN_ID = 42_161; + uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421_613; + uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421_614; // ------------ End Arbitrum Constants ------------ @@ -29,12 +29,12 @@ library ChainSpecificUtil { uint256 private constant OP_MAINNET_CHAIN_ID = 10; uint256 private constant OP_GOERLI_CHAIN_ID = 420; - uint256 private constant OP_SEPOLIA_CHAIN_ID = 11155420; + uint256 private constant OP_SEPOLIA_CHAIN_ID = 11_155_420; /// @dev Base is a OP stack based rollup and follows the same L1 pricing logic as Optimism. uint256 private constant BASE_MAINNET_CHAIN_ID = 8453; - uint256 private constant BASE_GOERLI_CHAIN_ID = 84531; - uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84532; + uint256 private constant BASE_GOERLI_CHAIN_ID = 84_531; + uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84_532; // ------------ End Optimism Constants ------------ diff --git a/contracts/src/v0.8/functions/tests/v1_X/BaseTest.t.sol b/contracts/src/v0.8/functions/tests/v1_X/BaseTest.t.sol index ffa684e84c..fcd4ffeaff 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/BaseTest.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/BaseTest.t.sol @@ -11,7 +11,7 @@ contract BaseTest is Test { uint256 internal STRANGER_PRIVATE_KEY = 0x2; address internal STRANGER_ADDRESS = vm.addr(STRANGER_PRIVATE_KEY); - uint256 TX_GASPRICE_START = 3000000000; // 3 gwei + uint256 TX_GASPRICE_START = 3_000_000_000; // 3 gwei uint72 constant JUELS_PER_LINK = 1e18; diff --git a/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol b/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol index 9b31834adf..8bb967771b 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol @@ -37,7 +37,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS function test__getL1FeeUpperLimit_SuccessWhenArbitrumMainnet() public { // Set the chainID - vm.chainId(42161); + vm.chainId(42_161); // Setup sends and fulfills request #1 FunctionsFulfillmentSetup.setUp(); @@ -58,7 +58,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS function test__getL1FeeUpperLimit_SuccessWhenArbitrumGoerli() public { // Set the chainID - vm.chainId(421613); + vm.chainId(421_613); // Setup sends and fulfills request #1 FunctionsFulfillmentSetup.setUp(); @@ -79,7 +79,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS function test__getL1FeeUpperLimit_SuccessWhenArbitrumSepolia() public { // Set the chainID - vm.chainId(421614); + vm.chainId(421_614); // Setup sends and fulfills request #1 FunctionsFulfillmentSetup.setUp(); @@ -109,7 +109,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentS GasPriceOracle private constant GAS_PRICE_ORACLE = GasPriceOracle(GAS_PRICE_ORACLE_ADDR); uint256 private constant L1_FEE_WEI = 1_648_118_885_618; - uint256 private constant L1_FEE_ESTIMATE_WITH_OVERESTIMATION_WEI = (L1_FEE_WEI * (10_000 + 5_000)) / 10_000; + uint256 private constant L1_FEE_ESTIMATE_WITH_OVERESTIMATION_WEI = (L1_FEE_WEI * (10_000 + 5000)) / 10_000; uint96 l1FeeEstimateJuels = uint96((1e18 * L1_FEE_ESTIMATE_WITH_OVERESTIMATION_WEI) / uint256(LINK_ETH_RATE)); uint96 l1FeeJuels = uint96((1e18 * L1_FEE_WEI) / uint256(LINK_ETH_RATE)); @@ -166,7 +166,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentS function test__getL1FeeUpperLimit_SuccessWhenOptimismSepolia() public { // Set the chainID - vm.chainId(11155420); + vm.chainId(11_155_420); // Setup sends and fulfills request #1 FunctionsFulfillmentSetup.setUp(); @@ -193,7 +193,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup GasPriceOracle private constant GAS_PRICE_ORACLE = GasPriceOracle(GAS_PRICE_ORACLE_ADDR); uint256 private constant L1_FEE_WEI = 1_648_118_885_618; - uint256 private constant L1_FEE_ESTIMATE_WITH_OVERESTIMATION_WEI = (L1_FEE_WEI * (10_000 + 5_000)) / 10_000; + uint256 private constant L1_FEE_ESTIMATE_WITH_OVERESTIMATION_WEI = (L1_FEE_WEI * (10_000 + 5000)) / 10_000; uint96 l1FeeEstimateJuels = uint96((1e18 * L1_FEE_ESTIMATE_WITH_OVERESTIMATION_WEI) / uint256(LINK_ETH_RATE)); uint96 l1FeeJuels = uint96((1e18 * L1_FEE_WEI) / uint256(LINK_ETH_RATE)); @@ -229,7 +229,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup function test__getL1FeeUpperLimit_SuccessWhenBaseGoerli() public { // Set the chainID - vm.chainId(84531); + vm.chainId(84_531); // Setup sends and fulfills request #1 FunctionsFulfillmentSetup.setUp(); @@ -250,7 +250,7 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup function test__getL1FeeUpperLimit_SuccessWhenBaseSepolia() public { // Set the chainID - vm.chainId(84532); + vm.chainId(84_532); // Setup sends and fulfills request #1 FunctionsFulfillmentSetup.setUp(); diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol index 00f0fb7111..e608d137ac 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol @@ -181,7 +181,7 @@ contract FunctionsBilling_EstimateCost is FunctionsSubscriptionSetup { ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); - uint32 callbackGasLimit = 5_500; + uint32 callbackGasLimit = 5500; uint256 gasPriceWei = REASONABLE_GAS_PRICE_CEILING + 1; vm.expectRevert(FunctionsBilling.InvalidCalldata.selector); @@ -198,13 +198,13 @@ contract FunctionsBilling_EstimateCost is FunctionsSubscriptionSetup { ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); - uint32 callbackGasLimit = 5_500; + uint32 callbackGasLimit = 5500; uint256 gasPriceWei = 1; uint96 costEstimate = s_functionsCoordinator.estimateCost(s_subscriptionId, requestData, callbackGasLimit, gasPriceWei); - uint96 expectedCostEstimate = 51110500000000000 + s_adminFee + s_functionsCoordinator.getDONFeeJuels(requestData) - + s_functionsCoordinator.getOperationFeeJuels(); + uint96 expectedCostEstimate = 51_110_500_000_000_000 + s_adminFee + + s_functionsCoordinator.getDONFeeJuels(requestData) + s_functionsCoordinator.getOperationFeeJuels(); assertEq(costEstimate, expectedCostEstimate); } @@ -217,13 +217,13 @@ contract FunctionsBilling_EstimateCost is FunctionsSubscriptionSetup { ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); - uint32 callbackGasLimit = 5_500; - uint256 gasPriceWei = 5000000000; // 5 gwei + uint32 callbackGasLimit = 5500; + uint256 gasPriceWei = 5_000_000_000; // 5 gwei uint96 costEstimate = s_functionsCoordinator.estimateCost(s_subscriptionId, requestData, callbackGasLimit, gasPriceWei); - uint96 expectedCostEstimate = 255552500000000000 + s_adminFee + s_functionsCoordinator.getDONFeeJuels(requestData) - + s_functionsCoordinator.getOperationFeeJuels(); + uint96 expectedCostEstimate = 255_552_500_000_000_000 + s_adminFee + + s_functionsCoordinator.getDONFeeJuels(requestData) + s_functionsCoordinator.getOperationFeeJuels(); assertEq(costEstimate, expectedCostEstimate); } } diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol index 64c9e11476..4d3b3722ed 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsCoordinator.t.sol @@ -137,7 +137,7 @@ contract FunctionsCoordinator_StartRequest is FunctionsSubscriptionSetup { subscriptionId: s_subscriptionId, dataVersion: FunctionsRequest.REQUEST_DATA_VERSION, flags: bytes32(0), - callbackGasLimit: 5_500, + callbackGasLimit: 5500, adminFee: s_adminFee, initiatedRequests: 0, completedRequests: 0, @@ -167,7 +167,7 @@ contract FunctionsCoordinator_StartRequest is FunctionsSubscriptionSetup { (,, address txOrigin) = vm.readCallers(); bytes memory _requestData = new bytes(0); - uint32 _callbackGasLimit = 5_500; + uint32 _callbackGasLimit = 5500; uint96 costEstimate = s_functionsCoordinator.estimateCost(s_subscriptionId, _requestData, _callbackGasLimit, tx.gasprice); uint32 timeoutTimestamp = uint32(block.timestamp + getCoordinatorConfig().requestTimeoutSeconds); @@ -223,7 +223,7 @@ contract FunctionsCoordinator_StartRequest is FunctionsSubscriptionSetup { subscriptionId: s_subscriptionId, dataVersion: FunctionsRequest.REQUEST_DATA_VERSION, flags: bytes32(0), - callbackGasLimit: 5_500, + callbackGasLimit: 5500, adminFee: s_adminFee, initiatedRequests: 0, completedRequests: 0, diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol index 6f23a80ab4..1a322ba804 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol @@ -222,7 +222,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.RouteNotFound.selector, invalidDonId)); s_functionsRouter.sendRequest( - s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, invalidDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, invalidDonId ); } @@ -240,7 +240,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { // Low level revert from incorrect call vm.expectRevert(); s_functionsRouter.sendRequest( - s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, incorrectDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, incorrectDonId ); } @@ -268,7 +268,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); s_functionsRouter.sendRequest( @@ -321,7 +321,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsRouter.EmptyRequestData.selector); s_functionsRouter.sendRequest( - s_subscriptionId, emptyRequestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, s_donId + s_subscriptionId, emptyRequestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, s_donId ); } @@ -353,7 +353,7 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { FunctionsRequest._initializeRequest( request, FunctionsRequest.Location.Inline, FunctionsRequest.CodeLanguage.JavaScript, sourceCode ); - uint32 callbackGasLimit = 5_000; + uint32 callbackGasLimit = 5000; bytes memory requestData = FunctionsRequest._encodeCBOR(request); // Send a first request that will remain pending @@ -481,7 +481,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(abi.encodeWithSelector(FunctionsRouter.RouteNotFound.selector, invalidDonId)); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, invalidDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, invalidDonId ); } @@ -499,7 +499,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { // Low level revert from incorrect call vm.expectRevert(); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, incorrectDonId + s_subscriptionId, requestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, incorrectDonId ); } @@ -529,7 +529,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { ); bytes memory requestData = FunctionsRequest._encodeCBOR(request); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); s_functionsRouter.sendRequestToProposed( @@ -584,7 +584,7 @@ contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { vm.expectRevert(FunctionsRouter.EmptyRequestData.selector); s_functionsRouter.sendRequestToProposed( - s_subscriptionId, emptyRequestData, FunctionsRequest.REQUEST_DATA_VERSION, 5_000, s_donId + s_subscriptionId, emptyRequestData, FunctionsRequest.REQUEST_DATA_VERSION, 5000, s_donId ); } diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol index 9fb38b013f..002dfed988 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol @@ -86,7 +86,7 @@ contract FunctionsSubscriptions_OwnerCancelSubscription is FunctionsSubscription function test_OwnerCancelSubscription_RevertIfNoSubscription() public { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; s_functionsRouter.ownerCancelSubscription(invalidSubscriptionId); } @@ -351,7 +351,7 @@ contract FunctionsSubscriptions_OnTokenTransfer is FunctionsClientSetup { // Funding amount must be less than or equal to LINK total supply uint256 totalSupplyJuels = 1_000_000_000 * 1e18; vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; s_linkToken.transferAndCall(address(s_functionsRouter), totalSupplyJuels, abi.encode(invalidSubscriptionId)); } @@ -646,7 +646,7 @@ contract FunctionsSubscriptions_ProposeSubscriptionOwnerTransfer is FunctionsSub function test_ProposeSubscriptionOwnerTransfer_RevertIfNoSubscription() public { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; s_functionsRouter.proposeSubscriptionOwnerTransfer(invalidSubscriptionId, NEW_OWNER_ADDRESS_WITH_TOS); } @@ -833,7 +833,7 @@ contract FunctionsSubscriptions_RemoveConsumer is FunctionsSubscriptionSetup { function test_RemoveConsumer_RevertIfNoSubscription() public { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; s_functionsRouter.removeConsumer(invalidSubscriptionId, address(s_functionsClient)); } @@ -913,7 +913,7 @@ contract FunctionsSubscriptions_AddConsumer is FunctionsSubscriptionSetup { function test_AddConsumer_RevertIfNoSubscription() public { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; s_functionsRouter.addConsumer(invalidSubscriptionId, address(1)); } @@ -1002,7 +1002,7 @@ contract FunctionsSubscriptions_CancelSubscription is FunctionsSubscriptionSetup function test_CancelSubscription_RevertIfNoSubscription() public { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; s_functionsRouter.cancelSubscription(invalidSubscriptionId, OWNER_ADDRESS); } @@ -1186,7 +1186,7 @@ contract FunctionsSubscriptions_SetFlags is FunctionsSubscriptionSetup { function test_SetFlags_RevertIfNoSubscription() public { vm.expectRevert(FunctionsSubscriptions.InvalidSubscription.selector); - uint64 invalidSubscriptionId = 123456789; + uint64 invalidSubscriptionId = 123_456_789; bytes32 flagsToSet = bytes32("1"); s_functionsRouter.setFlags(invalidSubscriptionId, flagsToSet); } @@ -1206,7 +1206,7 @@ contract FunctionsSubscriptions_GetFlags is FunctionsSubscriptionSetup { vm.stopPrank(); vm.startPrank(STRANGER_ADDRESS); - uint64 invalidSubscriptionId = 999999; + uint64 invalidSubscriptionId = 999_999; bytes32 flags = s_functionsRouter.getFlags(invalidSubscriptionId); assertEq(flags, bytes32(0)); @@ -1239,7 +1239,7 @@ contract FunctionsSubscriptions_TimeoutRequests is FunctionsClientRequestSetup { function test_TimeoutRequests_RevertInvalidRequest() public { // Modify the commitment so that it doesn't match - s_requests[1].commitmentOnchain.donFee = 123456789; + s_requests[1].commitmentOnchain.donFee = 123_456_789; FunctionsResponse.Commitment[] memory commitments = new FunctionsResponse.Commitment[](1); commitments[0] = s_requests[1].commitmentOnchain; vm.expectRevert(FunctionsSubscriptions.InvalidCalldata.selector); diff --git a/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol b/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol index 860119b3ba..d6e9bc3375 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol @@ -145,7 +145,7 @@ contract Gas_SendRequest is FunctionsSubscriptionSetup { // Pull storage variables into memory bytes memory minimalRequestData = s_minimalRequestData; uint64 subscriptionId = s_subscriptionId; - uint32 callbackGasLimit = 5_500; + uint32 callbackGasLimit = 5500; bytes32 donId = s_donId; vm.resumeGasMetering(); @@ -233,7 +233,7 @@ contract Gas_FulfillRequest_Setup is FunctionsClientRequestSetup { bytes memory secrets = new bytes(0); string[] memory args = new string[](0); bytes[] memory bytesArgs = new bytes[](0); - uint32 callbackGasLimit = 5_500; + uint32 callbackGasLimit = 5500; for (uint256 i = 0; i < requestsToSend; ++i) { _sendAndStoreRequest(i + requestNumberOffset, sourceCode, secrets, args, bytesArgs, callbackGasLimit); diff --git a/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol b/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol index 4940b4fa9a..2d80887d34 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol @@ -89,10 +89,10 @@ contract FunctionsRouterSetup is BaseTest { operationFeeCentsUsd: s_operationFee, maxSupportedRequestDataVersion: 1, fulfillmentGasPriceOverEstimationBP: 5000, - fallbackNativePerUnitLink: 5000000000000000, - fallbackUsdPerUnitLink: 1400000000, + fallbackNativePerUnitLink: 5_000_000_000_000_000, + fallbackUsdPerUnitLink: 1_400_000_000, fallbackUsdPerUnitLinkDecimals: 8, - minimumEstimateGasPriceWei: 1000000000, // 1 gwei + minimumEstimateGasPriceWei: 1_000_000_000, // 1 gwei transmitTxSizeBytes: 1764 }); } diff --git a/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol b/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol index 1fda5121a6..a48cc43ad3 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/ZKSyncFunctionsRouter.t.sol @@ -36,7 +36,7 @@ contract ZKSyncFunctionsRouter__Callback is ZKSyncFunctionsRouterSetup { bytes memory err = bytes("errData"); uint32 totalGas = 5_000_000; uint32 callbackGasLimit = 4_000_000; - address noCodeAddress = address(12345); + address noCodeAddress = address(12_345); ZKSyncFunctionsRouter.CallbackResult memory result = _callback(reqId, resp, err, totalGas, callbackGasLimit, noCodeAddress); diff --git a/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol b/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol index 192917dc39..31f9db19d6 100644 --- a/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/functions/v1_1_0/libraries/ChainSpecificUtil.sol @@ -14,9 +14,9 @@ library ChainSpecificUtil { address private constant ARBGAS_ADDR = address(0x000000000000000000000000000000000000006C); ArbGasInfo private constant ARBGAS = ArbGasInfo(ARBGAS_ADDR); - uint256 private constant ARB_MAINNET_CHAIN_ID = 42161; - uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421613; - uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421614; + uint256 private constant ARB_MAINNET_CHAIN_ID = 42_161; + uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421_613; + uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421_614; // ------------ End Arbitrum Constants ------------ @@ -31,12 +31,12 @@ library ChainSpecificUtil { uint256 private constant OP_MAINNET_CHAIN_ID = 10; uint256 private constant OP_GOERLI_CHAIN_ID = 420; - uint256 private constant OP_SEPOLIA_CHAIN_ID = 11155420; + uint256 private constant OP_SEPOLIA_CHAIN_ID = 11_155_420; /// @dev Base is a OP stack based rollup and follows the same L1 pricing logic as Optimism. uint256 private constant BASE_MAINNET_CHAIN_ID = 8453; - uint256 private constant BASE_GOERLI_CHAIN_ID = 84531; - uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84532; + uint256 private constant BASE_GOERLI_CHAIN_ID = 84_531; + uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84_532; // ------------ End Optimism Constants ------------ diff --git a/contracts/src/v0.8/keystone/KeystoneForwarder.sol b/contracts/src/v0.8/keystone/KeystoneForwarder.sol index 820fd62daa..4f372bcf9d 100644 --- a/contracts/src/v0.8/keystone/KeystoneForwarder.sol +++ b/contracts/src/v0.8/keystone/KeystoneForwarder.sol @@ -97,7 +97,7 @@ contract KeystoneForwarder is OwnerIsCreator, ITypeAndVersion, IRouter { /// @dev This is the gas required to store `success` after the report is processed. /// It is a warm storage write because of the packed struct. In practice it will cost less. - uint256 internal constant INTERNAL_GAS_REQUIREMENTS_AFTER_REPORT = 5_000; + uint256 internal constant INTERNAL_GAS_REQUIREMENTS_AFTER_REPORT = 5000; /// @dev This is the gas required to store the transmission struct and perform other checks. uint256 internal constant INTERNAL_GAS_REQUIREMENTS = 25_000 + INTERNAL_GAS_REQUIREMENTS_AFTER_REPORT; /// @dev This is the minimum gas required to route a report. This includes internal gas requirements diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol index 9bed5144a3..a97abc01e6 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_AddNodesTest.t.sol @@ -42,7 +42,7 @@ contract CapabilitiesRegistry_AddNodesTest is BaseTest { bytes32[] memory hashedCapabilityIds = new bytes32[](1); hashedCapabilityIds[0] = s_basicHashedCapabilityId; - uint32 invalidNodeOperatorId = 10000; + uint32 invalidNodeOperatorId = 10_000; nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: invalidNodeOperatorId, // Invalid NOP diff --git a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol index d40d4c0240..218a898ce8 100644 --- a/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/keystone/test/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol @@ -45,7 +45,7 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - uint32 invalidNodeOperatorId = 10000; + uint32 invalidNodeOperatorId = 10_000; uint32[] memory nodeOperatorIds = new uint32[](2); nodeOperatorIds[0] = invalidNodeOperatorId; vm.expectRevert( @@ -59,7 +59,7 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - uint32 invalidNodeOperatorId = 10000; + uint32 invalidNodeOperatorId = 10_000; uint32[] memory nodeOperatorIds = new uint32[](1); nodeOperatorIds[0] = invalidNodeOperatorId; vm.expectRevert( diff --git a/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol b/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol index 3c69e62e9b..999274d5a7 100644 --- a/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol +++ b/contracts/src/v0.8/l2ep/test/mocks/MockAggregatorV2V3.sol @@ -51,6 +51,6 @@ contract MockAggregatorV2V3 is AggregatorV2V3Interface { pure returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) { - return (73786976294838220258, 96800000000, 163826896, 1638268960, 73786976294838220258); + return (73_786_976_294_838_220_258, 96_800_000_000, 163_826_896, 1_638_268_960, 73_786_976_294_838_220_258); } } diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol index 05fbe52894..c6a4f87992 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumSequencerUptimeFeed.t.sol @@ -119,7 +119,7 @@ contract ArbitrumSequencerUptimeFeed_UpdateStatus is ArbitrumSequencerUptimeFeed vm.startPrank(s_l2MessengerAddr, s_l2MessengerAddr); // Submits a status update - uint256 timestamp = s_arbitrumSequencerUptimeFeed.latestTimestamp() + 10000; + uint256 timestamp = s_arbitrumSequencerUptimeFeed.latestTimestamp() + 10_000; vm.expectEmit(); emit AnswerUpdated(1, 2, timestamp); s_arbitrumSequencerUptimeFeed.updateStatus(true, uint64(timestamp)); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol index 6a5cea3418..fbb6e17c47 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/arbitrum/ArbitrumValidator.t.sol @@ -15,9 +15,9 @@ import {L2EPTest} from "../L2EPTest.t.sol"; contract ArbitrumValidatorTest is L2EPTest { /// Helper constants address internal constant L2_SEQ_STATUS_RECORDER_ADDRESS = 0x491B1dDA0A8fa069bbC1125133A975BF4e85a91b; - uint256 internal constant GAS_PRICE_BID = 1000000; - uint256 internal constant BASE_FEE = 14000000000; - uint256 internal constant MAX_GAS = 1000000; + uint256 internal constant GAS_PRICE_BID = 1_000_000; + uint256 internal constant BASE_FEE = 14_000_000_000; + uint256 internal constant MAX_GAS = 1_000_000; /// L2EP contracts AccessControllerInterface internal s_accessController; @@ -75,7 +75,7 @@ contract ArbitrumValidator_Validate is ArbitrumValidatorTest { emit RetryableTicketNoRefundAliasRewriteCreated( L2_SEQ_STATUS_RECORDER_ADDRESS, // destAddr 0, // arbTxCallValue - 25312000000000, // maxSubmissionCost + 25_312_000_000_000, // maxSubmissionCost arbitrumValidatorL2Addr, // submissionRefundAddress arbitrumValidatorL2Addr, // valueRefundAddress MAX_GAS, // maxGas diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol index 4bff7c1b2b..5aa70f960c 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/optimism/OptimismValidator.t.sol @@ -13,7 +13,7 @@ import {L2EPTest} from "../L2EPTest.t.sol"; contract OptimismValidator_Setup is L2EPTest { /// Helper constants address internal constant L2_SEQ_STATUS_RECORDER_ADDRESS = 0x491B1dDA0A8fa069bbC1125133A975BF4e85a91b; - uint32 internal constant INIT_GAS_LIMIT = 1900000; + uint32 internal constant INIT_GAS_LIMIT = 1_900_000; /// L2EP contracts MockOptimismL1CrossDomainMessenger internal s_mockOptimismL1CrossDomainMessenger; @@ -86,7 +86,7 @@ contract OptimismValidator_Validate is OptimismValidator_Setup { uint256 currentRoundId = 1; int256 currentAnswer = 1; // Sets block.timestamp to a later date - uint256 futureTimestampInSeconds = block.timestamp + 10000; + uint256 futureTimestampInSeconds = block.timestamp + 10_000; vm.startPrank(s_eoaValidator); vm.warp(futureTimestampInSeconds); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol index 76c9a4c962..1d31287ede 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/scroll/ScrollValidator.t.sol @@ -15,7 +15,7 @@ import {L2EPTest} from "../L2EPTest.t.sol"; contract ScrollValidator_Setup is L2EPTest { /// Helper constants address internal immutable L2_SEQ_STATUS_RECORDER_ADDRESS = makeAddr("L2_SEQ_STATUS_RECORDER_ADDRESS"); - uint32 internal constant INIT_GAS_LIMIT = 1900000; + uint32 internal constant INIT_GAS_LIMIT = 1_900_000; /// L2EP contracts MockScrollL1CrossDomainMessenger internal s_mockScrollL1CrossDomainMessenger; @@ -108,7 +108,7 @@ contract ScrollValidator_Validate is ScrollValidator_Setup { uint256 currentRoundId = 1; int256 currentAnswer = 1; // Sets block.timestamp to a later date - uint256 futureTimestampInSeconds = block.timestamp + 10000; + uint256 futureTimestampInSeconds = block.timestamp + 10_000; vm.startPrank(s_eoaValidator); vm.warp(futureTimestampInSeconds); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol index df49b682a4..48b3fb9c7e 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseSequencerUptimeFeed.t.sol @@ -202,7 +202,7 @@ contract BaseSequencerUptimeFeed_UpdateStatus is BaseSequencerUptimeFeed_Setup { vm.startPrank(s_aliasedL1OwnerAddress, s_aliasedL1OwnerAddress); // Submits a status update - uint256 timestamp = s_sequencerUptimeFeed.latestTimestamp() + 10000; + uint256 timestamp = s_sequencerUptimeFeed.latestTimestamp() + 10_000; vm.expectEmit(); emit AnswerUpdated(1, 2, timestamp); s_sequencerUptimeFeed.updateStatus(true, uint64(timestamp)); diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol index a0c1737b61..94b241bc57 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/shared/BaseValidator.t.sol @@ -11,7 +11,7 @@ contract BaseValidator_Setup is L2EPTest { address internal immutable L2_SEQ_STATUS_RECORDER_ADDRESS = makeAddr("L2_SEQ_STATUS_RECORDER_ADDRESS"); address internal immutable DUMMY_L1_XDOMAIN_MSNGR_ADDR = makeAddr("DUMMY_L1_XDOMAIN_MSNGR_ADDR"); address internal immutable DUMMY_L2_UPTIME_FEED_ADDR = makeAddr("DUMMY_L2_UPTIME_FEED_ADDR"); - uint32 internal constant INIT_GAS_LIMIT = 1900000; + uint32 internal constant INIT_GAS_LIMIT = 1_900_000; BaseValidator internal s_baseValidator; diff --git a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol index 63e1ed1db4..85c868e95d 100644 --- a/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol +++ b/contracts/src/v0.8/l2ep/test/v1_0_0/zksync/ZKSyncValidator.t.sol @@ -13,7 +13,7 @@ contract ZKSyncValidator_Setup is L2EPTest { address internal immutable DUMMY_L1_XDOMAIN_MSNGR_ADDR = makeAddr("DUMMY_L1_XDOMAIN_MSNGR_ADDR"); address internal immutable DUMMY_L2_UPTIME_FEED_ADDR = makeAddr("DUMMY_L2_UPTIME_FEED_ADDR"); uint32 internal constant INIT_GAS_PER_PUBDATA_BYTE_LIMIT = 800; - uint32 internal constant INIT_GAS_LIMIT = 1900000; + uint32 internal constant INIT_GAS_LIMIT = 1_900_000; uint32 internal constant MAIN_NET_CHAIN_ID = 300; uint32 internal constant BAD_CHAIN_ID = 0; @@ -74,7 +74,7 @@ contract ZKSyncValidator_GetSetL2GasPerPubdataByteLimit is ZKSyncValidator_Setup function test_GetSetL2GasPerPubdataByteLimit_CorrectlyHandlesGasPerPubdataByteLimit() public { assertEq(s_zksyncValidator.getL2GasPerPubdataByteLimit(), INIT_GAS_PER_PUBDATA_BYTE_LIMIT); - uint32 newGasPerPubDataByteLimit = 2000000; + uint32 newGasPerPubDataByteLimit = 2_000_000; s_zksyncValidator.setL2GasPerPubdataByteLimit(newGasPerPubDataByteLimit); assertEq(s_zksyncValidator.getL2GasPerPubdataByteLimit(), newGasPerPubDataByteLimit); } @@ -133,7 +133,7 @@ contract ZKSyncValidator_Validate is ZKSyncValidator_Setup { uint256 currentRoundId = 1; int256 currentAnswer = 1; // Sets block.timestamp to a later date - uint256 futureTimestampInSeconds = block.timestamp + 10000; + uint256 futureTimestampInSeconds = block.timestamp + 10_000; vm.startPrank(s_eoaValidator); vm.warp(futureTimestampInSeconds); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol index 72de313d24..9d602f0038 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/gas/Gas_VerifierTest.t.sol @@ -190,7 +190,7 @@ contract Verifier_accessControlledVerify is BaseTestWithConfiguredVerifierAndFee SimpleWriteAccessController s_accessController; address internal constant CLIENT = address(9000); - address internal constant ACCESS_CONTROLLER_ADDR = address(10000); + address internal constant ACCESS_CONTROLLER_ADDR = address(10_000); function setUp() public override { BaseTestWithConfiguredVerifierAndFeeManager.setUp(); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol index db40e64f0b..93e527abc3 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/BaseVerifierTest.t.sol @@ -44,7 +44,7 @@ contract BaseTest is Test { uint64 internal constant BLOCKNUMBER_LOWER_BOUND = 1000; uint64 internal constant BLOCKNUMBER_UPPER_BOUND = BLOCKNUMBER_LOWER_BOUND + 5; int192 internal constant MEDIAN = 1 ether; - int192 internal constant BID = 500000000 gwei; + int192 internal constant BID = 500_000_000 gwei; int192 internal constant ASK = 2 ether; bytes32 internal constant EMPTY_BYTES = bytes32(""); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol index f850407727..e06d3ab240 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/verifier/VerifierSetConfigFromSourceTest.t.sol @@ -16,8 +16,8 @@ contract VerifierSetConfigFromSourceTest is BaseTest { changePrank(USER); s_verifier.setConfigFromSource( FEED_ID, - 12345, - address(12345), + 12_345, + address(12_345), 0, _getSignerAddresses(signers), s_offchaintransmitters, @@ -36,8 +36,8 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC s_verifier.setConfigFromSource( FEED_ID, - 12345, - address(12345), + 12_345, + address(12_345), 0, _getSignerAddresses(newSigners), s_offchaintransmitters, @@ -58,8 +58,8 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC s_verifier.setConfigFromSource( FEED_ID_2, - 12345, - address(12345), + 12_345, + address(12_345), 0, _getSignerAddresses(newSigners), s_offchaintransmitters, @@ -76,8 +76,8 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC s_verifier_2.setConfigFromSource( FEED_ID_3, - 12345, - address(12345), + 12_345, + address(12_345), 0, _getSignerAddresses(newSigners), s_offchaintransmitters, @@ -100,7 +100,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC s_verifier.setConfigFromSource( FEED_ID, - 12345, + 12_345, address(s_verifier), 0, _getSignerAddresses(newSigners), @@ -114,7 +114,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC bytes32 expectedConfigDigest = _configDigestFromConfigData( FEED_ID, - 12345, + 12_345, address(s_verifier), s_numConfigsSet + 1, _getSignerAddresses(newSigners), diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol index eb645f5e4a..f877c43a6a 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/BaseDestinationVerifierTest.t.sol @@ -84,7 +84,7 @@ contract BaseTest is Test { uint64 internal constant BLOCKNUMBER_LOWER_BOUND = 1000; uint64 internal constant BLOCKNUMBER_UPPER_BOUND = BLOCKNUMBER_LOWER_BOUND + 5; int192 internal constant MEDIAN = 1 ether; - int192 internal constant BID = 500000000 gwei; + int192 internal constant BID = 500_000_000 gwei; int192 internal constant ASK = 2 ether; //version 0 feeds diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol index 985729a706..4c966b8025 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/gas/Gas_VerifierTest.t.sol @@ -194,7 +194,7 @@ contract Verifier_accessControlledVerifyV05 is BaseTestWithConfiguredVerifierAnd SimpleWriteAccessController s_accessController; address internal constant CLIENT = address(9000); - address internal constant ACCESS_CONTROLLER_ADDR = address(10000); + address internal constant ACCESS_CONTROLLER_ADDR = address(10_000); function setUp() public override { BaseTestWithConfiguredVerifierAndFeeManager.setUp(); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol index 249410351c..b87310eb4c 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/verifier/BaseVerifierTest.t.sol @@ -47,7 +47,7 @@ contract BaseTest is Test { uint64 internal constant BLOCKNUMBER_LOWER_BOUND = 1000; uint64 internal constant BLOCKNUMBER_UPPER_BOUND = BLOCKNUMBER_LOWER_BOUND + 5; int192 internal constant MEDIAN = 1 ether; - int192 internal constant BID = 500000000 gwei; + int192 internal constant BID = 500_000_000 gwei; int192 internal constant ASK = 2 ether; bytes32 internal constant EMPTY_BYTES = bytes32(""); diff --git a/contracts/src/v0.8/operatorforwarder/Operator.sol b/contracts/src/v0.8/operatorforwarder/Operator.sol index b7a86d36cf..f55e732b09 100644 --- a/contracts/src/v0.8/operatorforwarder/Operator.sol +++ b/contracts/src/v0.8/operatorforwarder/Operator.sol @@ -24,7 +24,7 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper uint256 public constant EXPIRYTIME = 5 minutes; uint256 private constant MAXIMUM_DATA_VERSION = 256; - uint256 private constant MINIMUM_CONSUMER_GAS_LIMIT = 400000; + uint256 private constant MINIMUM_CONSUMER_GAS_LIMIT = 400_000; uint256 private constant SELECTOR_LENGTH = 4; uint256 private constant EXPECTED_REQUEST_WORDS = 2; uint256 private constant MINIMUM_REQUEST_LENGTH = SELECTOR_LENGTH + (32 * EXPECTED_REQUEST_WORDS); diff --git a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol index 3be8b7f21f..734656a4d4 100644 --- a/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol +++ b/contracts/src/v0.8/operatorforwarder/test/testhelpers/MaliciousChainlinked.sol @@ -104,7 +104,7 @@ contract MaliciousChainlinked is Chainlinked { return abi.encodeWithSelector( bytes4(keccak256("oracleRequest(address,uint256,bytes32,address,bytes4,uint256,uint256,bytes)")), 0, // overridden by onTokenTransfer - 2000000000000000000, // overridden by onTokenTransfer + 2_000_000_000_000_000_000, // overridden by onTokenTransfer _req.id, _req.callbackAddress, _req.callbackFunctionId, diff --git a/contracts/src/v0.8/shared/test/BaseTest.t.sol b/contracts/src/v0.8/shared/test/BaseTest.t.sol index d48df81083..287cf945cb 100644 --- a/contracts/src/v0.8/shared/test/BaseTest.t.sol +++ b/contracts/src/v0.8/shared/test/BaseTest.t.sol @@ -9,7 +9,7 @@ contract BaseTest is Test { address internal constant STRANGER = 0x02e7d5DD1F4dDbC9f512FfA01d30aa190Ae3edBb; // Fri May 26 2023 13:49:53 GMT+0000 - uint256 internal constant BLOCK_TIME = 1685108993; + uint256 internal constant BLOCK_TIME = 1_685_108_993; function setUp() public virtual { // BaseTest.setUp is often called multiple times from tests' setUp due to inheritance. diff --git a/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol b/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol index 92b2af4625..7bc394b452 100644 --- a/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol +++ b/contracts/src/v0.8/shared/test/call/CallWithExactGasZKSync.t.sol @@ -59,7 +59,7 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact function test__callWithExactGasSafeReturnData_RevertWhen_NoContract() public { (bool successCall, bytes memory retData) = _limitedGasCallWithExactGas( 2_000_000, - address(12345), // no code + address(12_345), // no code 1_000_000, abi.encodeWithSelector(TestTarget.returnData.selector), 100 @@ -121,7 +121,7 @@ contract CallWithExactGasZKSync__callWithExactGasSafeReturnData is CallWithExact /// @notice Succeeds under normal conditions, returning data. function test__callWithExactGasSafeReturnData_Success() public { (bool successCall, bytes memory retData) = _limitedGasCallWithExactGas( - 5_000_000, address(s_target), 4_000_000, abi.encodeWithSelector(TestTarget.returnData.selector), 10000 + 5_000_000, address(s_target), 4_000_000, abi.encodeWithSelector(TestTarget.returnData.selector), 10_000 ); assertTrue(successCall, "Subcall itself must not revert"); (bool success, bytes memory returnedData, uint256 pubdata) = _decodeResult(retData); diff --git a/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol b/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol index bf496a996d..754ffc67b5 100644 --- a/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol +++ b/contracts/src/v0.8/shared/test/mocks/MockSystemContext.sol @@ -16,7 +16,7 @@ contract MockSystemContext is ISystemContext { // Example placeholders for block number & timestamp uint128 private s_mockBlockNumber = 1000; - uint128 private s_mockBlockTimestamp = 123456789; + uint128 private s_mockBlockTimestamp = 123_456_789; // --------------------------------------- // Functions required by ISystemContext @@ -35,7 +35,7 @@ contract MockSystemContext is ISystemContext { function gasPrice() external pure override returns (uint256) { // Return a dummy gas price - return 1000000000; // 1 gwei, for example + return 1_000_000_000; // 1 gwei, for example } function blockGasLimit() external pure override returns (uint256) { diff --git a/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol b/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol index 1e22c14fd1..60f4ab88d4 100644 --- a/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC677/BurnMintERC677.t.sol @@ -19,7 +19,7 @@ contract BurnMintERC677Setup is BaseTest { BurnMintERC677 internal s_burnMintERC677; - address internal s_mockPool = address(6243783892); + address internal s_mockPool = address(6_243_783_892); uint256 internal s_amount = 1e18; function setUp() public virtual override { diff --git a/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol b/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol index a326efb0da..238058762b 100644 --- a/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/shared/util/ChainSpecificUtil.sol @@ -22,9 +22,9 @@ library ChainSpecificUtil { address private constant ARBGAS_ADDR = address(0x000000000000000000000000000000000000006C); ArbGasInfo private constant ARBGAS = ArbGasInfo(ARBGAS_ADDR); - uint256 private constant ARB_MAINNET_CHAIN_ID = 42161; - uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421613; - uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421614; + uint256 private constant ARB_MAINNET_CHAIN_ID = 42_161; + uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421_613; + uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421_614; // ------------ End Arbitrum Constants ------------ @@ -39,12 +39,12 @@ library ChainSpecificUtil { uint256 private constant OP_MAINNET_CHAIN_ID = 10; uint256 private constant OP_GOERLI_CHAIN_ID = 420; - uint256 private constant OP_SEPOLIA_CHAIN_ID = 11155420; + uint256 private constant OP_SEPOLIA_CHAIN_ID = 11_155_420; /// @dev Base is a OP stack based rollup and follows the same L1 pricing logic as Optimism. uint256 private constant BASE_MAINNET_CHAIN_ID = 8453; - uint256 private constant BASE_GOERLI_CHAIN_ID = 84531; - uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84532; + uint256 private constant BASE_GOERLI_CHAIN_ID = 84_531; + uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84_532; // ------------ End Optimism Constants ------------ diff --git a/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol b/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol index 4f53916fab..646d45a186 100644 --- a/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol +++ b/contracts/src/v0.8/vrf/ChainSpecificUtil_v0_8_6.sol @@ -22,9 +22,9 @@ library ChainSpecificUtil { address private constant ARBGAS_ADDR = address(0x000000000000000000000000000000000000006C); ArbGasInfo private constant ARBGAS = ArbGasInfo(ARBGAS_ADDR); - uint256 private constant ARB_MAINNET_CHAIN_ID = 42161; - uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421613; - uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421614; + uint256 private constant ARB_MAINNET_CHAIN_ID = 42_161; + uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421_613; + uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421_614; // ------------ End Arbitrum Constants ------------ @@ -39,12 +39,12 @@ library ChainSpecificUtil { uint256 private constant OP_MAINNET_CHAIN_ID = 10; uint256 private constant OP_GOERLI_CHAIN_ID = 420; - uint256 private constant OP_SEPOLIA_CHAIN_ID = 11155420; + uint256 private constant OP_SEPOLIA_CHAIN_ID = 11_155_420; /// @dev Base is a OP stack based rollup and follows the same L1 pricing logic as Optimism. uint256 private constant BASE_MAINNET_CHAIN_ID = 8453; - uint256 private constant BASE_GOERLI_CHAIN_ID = 84531; - uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84532; + uint256 private constant BASE_GOERLI_CHAIN_ID = 84_531; + uint256 private constant BASE_SEPOLIA_CHAIN_ID = 84_532; // ------------ End Optimism Constants ------------ diff --git a/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol b/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol index 32576eee5a..dbda4cf1f7 100644 --- a/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol +++ b/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol @@ -109,11 +109,11 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 { KEY_HASH, SUBSCRIPTION_ID, REQUEST_CONFIRMATIONS, - 150000, // callback gas limit + 150_000, // callback gas limit 1 // num words ); s_requests[requestId] = - RequestRecord({requestId: requestId, fulfilled: false, callbackGasLimit: 150000, randomness: 0}); + RequestRecord({requestId: requestId, fulfilled: false, callbackGasLimit: 150_000, randomness: 0}); s_vrfRequestCounter++; } } diff --git a/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol b/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol index c1eb8b6500..258d36fb30 100644 --- a/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol +++ b/contracts/src/v0.8/vrf/VRFCoordinatorV2.sol @@ -87,7 +87,7 @@ contract VRFCoordinatorV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordinato uint32 public constant MAX_NUM_WORDS = 500; // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); diff --git a/contracts/src/v0.8/vrf/VRFV2Wrapper.sol b/contracts/src/v0.8/vrf/VRFV2Wrapper.sol index dbc311a1e7..e20f91302d 100644 --- a/contracts/src/v0.8/vrf/VRFV2Wrapper.sol +++ b/contracts/src/v0.8/vrf/VRFV2Wrapper.sol @@ -39,7 +39,7 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; // lastRequestId is the request ID of the most recent VRF V2 request made by this wrapper. This // should only be relied on within the same transaction the request was made. diff --git a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol index 8f6ad07446..1fe5b5f2fb 100644 --- a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol @@ -24,7 +24,7 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { uint32 public constant MAX_NUM_WORDS = 500; // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; // upper bound limit for premium percentages to make sure fee calculations don't overflow uint8 private constant PREMIUM_PERCENTAGE_MAX = 155; diff --git a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol index 57236f9408..1e02c0987f 100644 --- a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol +++ b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol @@ -25,7 +25,7 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; uint16 private constant EXPECTED_MIN_LENGTH = 36; // solhint-disable-next-line chainlink-solidity/prefix-immutable-variables-with-i diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol index 939b1d334a..0cfc6307d8 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol @@ -25,7 +25,7 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu uint32 public constant MAX_NUM_WORDS = 500; // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; // upper bound limit for premium percentages to make sure fee calculations don't overflow uint8 private constant PREMIUM_PERCENTAGE_MAX = 155; diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol index a4f8d018dc..1d1c2d41a0 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol @@ -31,7 +31,7 @@ contract VRFCoordinatorV2PlusUpgradedVersion is uint32 public constant MAX_NUM_WORDS = 500; // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; // upper bound limit for premium percentages to make sure fee calculations don't overflow uint8 private constant PREMIUM_PERCENTAGE_MAX = 155; diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol index c243f05d8f..aaae7ec352 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFMaliciousConsumerV2Plus.sol @@ -27,7 +27,7 @@ contract VRFMaliciousConsumerV2Plus is VRFConsumerBaseV2Plus { keyHash: s_keyHash, subId: s_subId, requestConfirmations: 1, - callbackGasLimit: 200000, + callbackGasLimit: 200_000, numWords: 1, extraArgs: "" // empty extraArgs defaults to link payment }); @@ -64,7 +64,7 @@ contract VRFMaliciousConsumerV2Plus is VRFConsumerBaseV2Plus { keyHash: keyHash, subId: s_subId, requestConfirmations: 1, - callbackGasLimit: 500000, + callbackGasLimit: 500_000, numWords: 1, extraArgs: "" // empty extraArgs defaults to link payment }); diff --git a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol index e3a2267952..e489cb3865 100644 --- a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol +++ b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorMock.sol @@ -25,7 +25,7 @@ contract VRFCoordinatorMock { function callBackWithRandomness(bytes32 requestId, uint256 randomness, address consumerContract) public { VRFConsumerBase v; bytes memory resp = abi.encodeWithSelector(v.rawFulfillRandomness.selector, requestId, randomness); - uint256 b = 206000; + uint256 b = 206_000; require(gasleft() >= b, "not enough gas for consumer"); // solhint-disable-next-line avoid-low-level-calls, no-unused-vars (bool success,) = consumerContract.call(resp); diff --git a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol index f244296901..dd55b5e9bc 100644 --- a/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol +++ b/contracts/src/v0.8/vrf/mocks/VRFCoordinatorV2Mock.sol @@ -223,7 +223,7 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { } function getRequestConfig() external pure override returns (uint16, uint32, bytes32[] memory) { - return (3, 2000000, new bytes32[](0)); + return (3, 2_000_000, new bytes32[](0)); } function addConsumer(uint64 _subId, address _consumer) external override onlySubOwner(_subId) { @@ -266,7 +266,7 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { uint32 gasAfterPaymentCalculation ) { - return (4, 2_500_000, 2_700, 33285); + return (4, 2_500_000, 2700, 33_285); } function getFeeConfig() @@ -285,11 +285,11 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { ) { return ( - 100000, // 0.1 LINK - 100000, // 0.1 LINK - 100000, // 0.1 LINK - 100000, // 0.1 LINK - 100000, // 0.1 LINK + 100_000, // 0.1 LINK + 100_000, // 0.1 LINK + 100_000, // 0.1 LINK + 100_000, // 0.1 LINK + 100_000, // 0.1 LINK 0, 0, 0, @@ -305,7 +305,7 @@ contract VRFCoordinatorV2Mock is VRFCoordinatorV2Interface, ConfirmedOwner { } function getFallbackWeiPerUnitLink() external pure returns (int256) { - return 4000000000000000; // 0.004 Ether + return 4_000_000_000_000_000; // 0.004 Ether } function requestSubscriptionOwnerTransfer(uint64, /*_subId*/ address /*_newOwner*/ ) external pure override { diff --git a/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol b/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol index eca494faa4..8a8be17567 100644 --- a/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol +++ b/contracts/src/v0.8/vrf/test/BatchVRFCoordinatorV2Plus.t.sol @@ -76,26 +76,26 @@ contract BatchVRFCoordinatorV2PlusTest is FixtureVRFCoordinatorV2_5 { */ proofs[0] = VRFTypes.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 26762213923453052192184693334574145607290366984305044804336172347176490943606, - 70503534560525619072578237689732581746976650376431765635714023643649039207077 + 26_762_213_923_453_052_192_184_693_334_574_145_607_290_366_984_305_044_804_336_172_347_176_490_943_606, + 70_503_534_560_525_619_072_578_237_689_732_581_746_976_650_376_431_765_635_714_023_643_649_039_207_077 ], - c: 10992233996918874905152274435276937088064589467016709044984819613170049539489, - s: 79662863379962724455809192044326025082567113176696761949197261107120333769102, - seed: 4430852740828987645228960511496023658059009607317025880962658187812299131155, + c: 10_992_233_996_918_874_905_152_274_435_276_937_088_064_589_467_016_709_044_984_819_613_170_049_539_489, + s: 79_662_863_379_962_724_455_809_192_044_326_025_082_567_113_176_696_761_949_197_261_107_120_333_769_102, + seed: 4_430_852_740_828_987_645_228_960_511_496_023_658_059_009_607_317_025_880_962_658_187_812_299_131_155, uWitness: 0x421A52Fb797d76Fb610aA1a0c020346fC1Ee2DeB, cGammaWitness: [ - 50748523246052507241857300891945475679319243536065937584940024494820365165901, - 85746856994474260612851047426766648416105284284185975301552792881940939754570 + 50_748_523_246_052_507_241_857_300_891_945_475_679_319_243_536_065_937_584_940_024_494_820_365_165_901, + 85_746_856_994_474_260_612_851_047_426_766_648_416_105_284_284_185_975_301_552_792_881_940_939_754_570 ], sHashWitness: [ - 78637275871978664522379716948105702461748200460627087255706483027519919611423, - 82219236913923465822780520561305604064850823877720616893986252854976640396959 + 78_637_275_871_978_664_522_379_716_948_105_702_461_748_200_460_627_087_255_706_483_027_519_919_611_423, + 82_219_236_913_923_465_822_780_520_561_305_604_064_850_823_877_720_616_893_986_252_854_976_640_396_959 ], - zInv: 60547558497534848069125896511700272238016171243048151035528198622956754542730 + zInv: 60_547_558_497_534_848_069_125_896_511_700_272_238_016_171_243_048_151_035_528_198_622_956_754_542_730 }); rcs[0] = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, @@ -147,26 +147,26 @@ contract BatchVRFCoordinatorV2PlusTest is FixtureVRFCoordinatorV2_5 { */ proofs[1] = VRFTypes.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 97658842840420719674383370910135023062422561858595941631054490821636116883585, - 44255438468488339528368406358785988551798314198954634050943346751039644360856 + 97_658_842_840_420_719_674_383_370_910_135_023_062_422_561_858_595_941_631_054_490_821_636_116_883_585, + 44_255_438_468_488_339_528_368_406_358_785_988_551_798_314_198_954_634_050_943_346_751_039_644_360_856 ], - c: 5233652943248967403606766735502925802264855214922758107203237169366748118852, - s: 87931642435666855739510477620068257005869145374865238974094299759068218698655, - seed: 14541556911652758131165474365357244907354309169650401973525070879190071151266, + c: 5_233_652_943_248_967_403_606_766_735_502_925_802_264_855_214_922_758_107_203_237_169_366_748_118_852, + s: 87_931_642_435_666_855_739_510_477_620_068_257_005_869_145_374_865_238_974_094_299_759_068_218_698_655, + seed: 14_541_556_911_652_758_131_165_474_365_357_244_907_354_309_169_650_401_973_525_070_879_190_071_151_266, uWitness: 0x0A87a9CB71983cE0F2C4bA41D0c1A6Fb1785c46A, cGammaWitness: [ - 54062743217909816783918413821204010151082432359411822104552882037459289383418, - 67491004534731980264926765871774299056809003077448271411776926359153820235981 + 54_062_743_217_909_816_783_918_413_821_204_010_151_082_432_359_411_822_104_552_882_037_459_289_383_418, + 67_491_004_534_731_980_264_926_765_871_774_299_056_809_003_077_448_271_411_776_926_359_153_820_235_981 ], sHashWitness: [ - 7745933951617569731026754652291310837540252155195826133994719499558406927394, - 58405861596456412358325504621101233475720292237067230796670629212111423924259 + 7_745_933_951_617_569_731_026_754_652_291_310_837_540_252_155_195_826_133_994_719_499_558_406_927_394, + 58_405_861_596_456_412_358_325_504_621_101_233_475_720_292_237_067_230_796_670_629_212_111_423_924_259 ], - zInv: 44253513765558903217330502897662324213800000485156126961643960636269885275795 + zInv: 44_253_513_765_558_903_217_330_502_897_662_324_213_800_000_485_156_126_961_643_960_636_269_885_275_795 }); rcs[1] = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, @@ -183,9 +183,11 @@ contract BatchVRFCoordinatorV2PlusTest is FixtureVRFCoordinatorV2_5 { // The payments are NOT pre-calculated and simply copied from the actual event. // We can assert and ignore the payment field but the code will be considerably longer. vm.expectEmit(true, true, false, true, address(s_coordinator)); - emit RandomWordsFulfilled(output.requestId, output.randomness, s_subId, 500000000000143261, true, true, false); + emit RandomWordsFulfilled(output.requestId, output.randomness, s_subId, 500_000_000_000_143_261, true, true, false); vm.expectEmit(true, true, false, true, address(s_coordinator)); - emit RandomWordsFulfilled(output1.requestId, output1.randomness, s_subId, 800000000000312358, false, true, false); + emit RandomWordsFulfilled( + output1.requestId, output1.randomness, s_subId, 800_000_000_000_312_358, false, true, false + ); // Fulfill the requests. s_batchCoordinator.fulfillRandomWords(proofs, rcs); diff --git a/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol b/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol index a0024ac17c..4e4928321d 100644 --- a/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol +++ b/contracts/src/v0.8/vrf/test/ChainSpecificUtil.t.sol @@ -21,9 +21,9 @@ contract ChainSpecificUtilTest is BaseTest { address private constant ARBGAS_ADDR = address(0x000000000000000000000000000000000000006C); ArbGasInfo private constant ARBGAS = ArbGasInfo(ARBGAS_ADDR); - uint256 private constant ARB_MAINNET_CHAIN_ID = 42161; - uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421613; - uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421614; + uint256 private constant ARB_MAINNET_CHAIN_ID = 42_161; + uint256 private constant ARB_GOERLI_TESTNET_CHAIN_ID = 421_613; + uint256 private constant ARB_SEPOLIA_TESTNET_CHAIN_ID = 421_614; // ------------ End Arbitrum Constants ------------ @@ -38,11 +38,11 @@ contract ChainSpecificUtilTest is BaseTest { uint256 private constant OP_MAINNET_CHAIN_ID = 10; uint256 private constant OP_GOERLI_CHAIN_ID = 420; - uint256 private constant OP_SEPOLIA_CHAIN_ID = 11155420; + uint256 private constant OP_SEPOLIA_CHAIN_ID = 11_155_420; /// @dev Base is a OP stack based rollup and follows the same L1 pricing logic as Optimism. uint256 private constant BASE_MAINNET_CHAIN_ID = 8453; - uint256 private constant BASE_GOERLI_CHAIN_ID = 84531; + uint256 private constant BASE_GOERLI_CHAIN_ID = 84_531; // ------------ End Optimism Constants ------------ diff --git a/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol b/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol index dbec2296d1..931347bd54 100644 --- a/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol +++ b/contracts/src/v0.8/vrf/test/FixtureVRFCoordinatorV2_5.t.sol @@ -49,7 +49,7 @@ contract FixtureVRFCoordinatorV2_5 is BaseTest, VRF { // Deploy coordinator. s_coordinator = new ExposedVRFCoordinatorV2_5(address(s_bhs)); s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Configure the coordinator. s_coordinator.setLINKAndLINKNativeFeed(address(s_linkToken), address(s_linkNativeFeed)); @@ -69,7 +69,7 @@ contract FixtureVRFCoordinatorV2_5 is BaseTest, VRF { 2_500_000, // maxGasLimit 1, // stalenessSeconds 50_000, // gasAfterPaymentCalculation - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000, // fulfillmentFlatFeeLinkDiscountPPM 15, // nativePremiumPercentage diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol index 3b08e6c589..f4b831a97d 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Mock.t.sol @@ -57,7 +57,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { // Deploy link token and link/eth feed. s_linkToken = new MockLinkToken(); - s_linkEthFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkEthFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Deploy coordinator and consumer. s_vrfCoordinatorV2Mock = new VRFCoordinatorV2Mock( @@ -308,7 +308,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { ); vm.expectEmit(true, false, false, true); - emit RandomWordsFulfilled(reqId, 1, 100090236000000000, true); + emit RandomWordsFulfilled(reqId, 1, 100_090_236_000_000_000, true); s_vrfCoordinatorV2Mock.fulfillRandomWords(reqId, consumerAddr); vm.stopPrank(); @@ -345,7 +345,7 @@ contract VRFCoordinatorV2MockTest is BaseTest { uint256[] memory words2 = new uint256[](2); words1[0] = 2533; words1[1] = 1768; - emit RandomWordsFulfilled(reqId, 1, 100072314000000000, true); + emit RandomWordsFulfilled(reqId, 1, 100_072_314_000_000_000, true); s_vrfCoordinatorV2Mock.fulfillRandomWordsWithOverride(reqId, consumerAddr, words2); vm.stopPrank(); diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol index f7e495e043..9f773c0c49 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2Plus_Migration.t.sol @@ -55,7 +55,7 @@ contract VRFCoordinatorV2Plus_Migration is BaseTest { subId = v1Coordinator.createSubscription(); subId_noLink = v1Coordinator_noLink.createSubscription(); linkToken = new MockLinkToken(); - linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) v1Coordinator.setLINKAndLINKNativeFeed(address(linkToken), address(linkNativeFeed)); linkTokenAddr = address(linkToken); v2Coordinator = new VRFCoordinatorV2Plus_V2Example(address(linkToken), address(v1Coordinator)); diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol index e005babf4e..a132973413 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5Mock.t.sol @@ -406,7 +406,7 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { uint256 reqId = s_vrfConsumerV2Plus.requestRandomness(req); vm.expectEmit(true, false, false, true); - emit RandomWordsFulfilled(reqId, 1, subId, 1432960000000000000, false, true, false); + emit RandomWordsFulfilled(reqId, 1, subId, 1_432_960_000_000_000_000, false, true, false); s_vrfCoordinatorV2_5Mock.fulfillRandomWords(reqId, consumerAddr); vm.stopPrank(); @@ -446,7 +446,7 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { uint256 reqId = s_vrfConsumerV2Plus.requestRandomness(req); vm.expectEmit(true, false, false, true); - emit RandomWordsFulfilled(reqId, 1, subId, 5731840000000000, true, true, false); + emit RandomWordsFulfilled(reqId, 1, subId, 5_731_840_000_000_000, true, true, false); s_vrfCoordinatorV2_5Mock.fulfillRandomWords(reqId, consumerAddr); vm.stopPrank(); @@ -461,10 +461,10 @@ contract VRFCoordinatorV2_5MockTest is BaseTest { uint96 expectedPayment; if (nativePayment) { - expectedPayment = 5011440000000000; + expectedPayment = 5_011_440_000_000_000; s_vrfCoordinatorV2_5Mock.fundSubscriptionWithNative{value: oneNative}(subId); } else { - expectedPayment = 1252860000000000000; + expectedPayment = 1_252_860_000_000_000_000; s_vrfCoordinatorV2_5Mock.fundSubscription(subId, twoLink); } diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol index 19682e84bb..5835482b99 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Arbitrum.t.sol @@ -48,7 +48,7 @@ contract VRFV2CoordinatorV2_5_Arbitrum is BaseTest { // Deploy coordinator, LINK token and LINK/Native feed. s_testCoordinator = new ExposedVRFCoordinatorV2_5_Arbitrum(address(s_bhs)); s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Configure the coordinator. s_testCoordinator.setLINKAndLINKNativeFeed(address(s_linkToken), address(s_linkNativeFeed)); @@ -57,7 +57,7 @@ contract VRFV2CoordinatorV2_5_Arbitrum is BaseTest { 2_500_000, // maxGasLimit 1, // stalenessSeconds 50_000, // gasAfterPaymentCalculation - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000, // fulfillmentFlatFeeLinkDiscountPPM 15, // nativePremiumPercentage @@ -105,20 +105,20 @@ contract VRFV2CoordinatorV2_5_Arbitrum is BaseTest { function test_getBlockNumber() public { // sanity check that Arbitrum will use ArbSys to get the block number - vm.mockCall(ARBSYS_ADDR, abi.encodeWithSelector(ARBSYS.arbBlockNumber.selector), abi.encode(33691)); - assertEq(33691, s_testCoordinator.getBlockNumberExternal()); + vm.mockCall(ARBSYS_ADDR, abi.encodeWithSelector(ARBSYS.arbBlockNumber.selector), abi.encode(33_691)); + assertEq(33_691, s_testCoordinator.getBlockNumberExternal()); } function test_getBlockhash() public { // for blocks within 256 blocks from the current block return the blockhash using ArbSys bytes32 testBlockHash = bytes32(keccak256("testBlock")); - vm.mockCall(ARBSYS_ADDR, abi.encodeWithSelector(ARBSYS.arbBlockNumber.selector), abi.encode(45830)); - vm.mockCall(ARBSYS_ADDR, abi.encodeWithSelector(ARBSYS.arbBlockHash.selector, 45825), abi.encode(testBlockHash)); - assertEq(testBlockHash, s_testCoordinator.getBlockhashExternal(45825)); + vm.mockCall(ARBSYS_ADDR, abi.encodeWithSelector(ARBSYS.arbBlockNumber.selector), abi.encode(45_830)); + vm.mockCall(ARBSYS_ADDR, abi.encodeWithSelector(ARBSYS.arbBlockHash.selector, 45_825), abi.encode(testBlockHash)); + assertEq(testBlockHash, s_testCoordinator.getBlockhashExternal(45_825)); // for blocks outside 256 blocks from the current block return nothing - assertEq("", s_testCoordinator.getBlockhashExternal(33830)); + assertEq("", s_testCoordinator.getBlockhashExternal(33_830)); // for blocks greater than the current block return nothing - assertEq("", s_testCoordinator.getBlockhashExternal(50550)); + assertEq("", s_testCoordinator.getBlockhashExternal(50_550)); } function test_calculatePaymentAmountNative() public { diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol index 813ad55761..38ef557ac4 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol @@ -59,7 +59,7 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { // Deploy coordinator, LINK token and LINK/Native feed. s_testCoordinator = new ExposedVRFCoordinatorV2_5_Optimism(address(s_bhs)); s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Configure the coordinator. s_testCoordinator.setLINKAndLINKNativeFeed(address(s_linkToken), address(s_linkNativeFeed)); @@ -68,7 +68,7 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { 2_500_000, // maxGasLimit 1, // stalenessSeconds 50_000, // gasAfterPaymentCalculation - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000, // fulfillmentFlatFeeLinkDiscountPPM 15, // nativePremiumPercentage @@ -115,14 +115,14 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { function _mockGasOraclePriceFeeMethods() internal { // these values are taken from an example transaction on Base Sepolia vm.mockCall( - OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), abi.encode(64273426165) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), abi.encode(64_273_426_165) ); vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("baseFeeScalar()"))), abi.encode(1101)); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), abi.encode(659851) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), abi.encode(659_851) ); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), abi.encode(2126959908362) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), abi.encode(2_126_959_908_362) ); vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("decimals()"))), abi.encode(6)); } diff --git a/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol b/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol index 0ca8bca9b2..f83ab70a30 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol @@ -70,7 +70,7 @@ contract VRFV2Plus is BaseTest { // Note: adding contract deployments to this section will require the VRF proofs be regenerated. s_testCoordinator = new ExposedVRFCoordinatorV2_5(address(s_bhs)); s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Use create2 to deploy our consumer, so that its address is always the same // and surrounding changes do not alter our generated proofs. @@ -101,7 +101,7 @@ contract VRFV2Plus is BaseTest { 2_500_000, // maxGasLimit 1, // stalenessSeconds 50_000, // gasAfterPaymentCalculation - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000, // fulfillmentFlatFeeLinkDiscountPPM 15, // nativePremiumPercentage @@ -120,7 +120,7 @@ contract VRFV2Plus is BaseTest { 2_500_000, 1, 50_000, - 50000000000000000, + 50_000_000_000_000_000, 500_000, // fulfillmentFlatFeeNativePPM 100_000, // fulfillmentFlatFeeLinkDiscountPPM 15, // nativePremiumPercentage @@ -530,31 +530,31 @@ contract VRFV2Plus is BaseTest { */ proof = VRF.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 103927982338770370318312316555080928288985522873495041111817988974598585393796, - 56789421278806198480964888112155620425048056183534931202752833185923411715624 + 103_927_982_338_770_370_318_312_316_555_080_928_288_985_522_873_495_041_111_817_988_974_598_585_393_796, + 56_789_421_278_806_198_480_964_888_112_155_620_425_048_056_183_534_931_202_752_833_185_923_411_715_624 ], - c: 23645475075665525321781505993434124657388421977074956645288621921391376468128, - s: 106817081950846808215350231311242951539230271757396902089035477907017240898689, - seed: 77134414723242246520332717536018735794426514244521954002798799849127623496871, + c: 23_645_475_075_665_525_321_781_505_993_434_124_657_388_421_977_074_956_645_288_621_921_391_376_468_128, + s: 106_817_081_950_846_808_215_350_231_311_242_951_539_230_271_757_396_902_089_035_477_907_017_240_898_689, + seed: 77_134_414_723_242_246_520_332_717_536_018_735_794_426_514_244_521_954_002_798_799_849_127_623_496_871, uWitness: 0xD6899602060d574DE03FE1cf76fDf66afE12d549, cGammaWitness: [ - 9892458071712426452033749279561067220589549155902380165087951541202159693388, - 61235995320721681444549354910430438435754757626312862714628885100042911955139 + 9_892_458_071_712_426_452_033_749_279_561_067_220_589_549_155_902_380_165_087_951_541_202_159_693_388, + 61_235_995_320_721_681_444_549_354_910_430_438_435_754_757_626_312_862_714_628_885_100_042_911_955_139 ], sHashWitness: [ - 101478618362722903511580105256015180591690884037598276249676652094434483808775, - 82512235485399822034680598942438982472006937353405384896956013889074719896188 + 101_478_618_362_722_903_511_580_105_256_015_180_591_690_884_037_598_276_249_676_652_094_434_483_808_775, + 82_512_235_485_399_822_034_680_598_942_438_982_472_006_937_353_405_384_896_956_013_889_074_719_896_188 ], - zInv: 82281039329215616805111360985152709712368762415186906218863971780664103705723 + zInv: 82_281_039_329_215_616_805_111_360_985_152_709_712_368_762_415_186_906_218_863_971_780_664_103_705_723 }); rc = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, subId: subId, - callbackGasLimit: 1000000, + callbackGasLimit: 1_000_000, numWords: 1, sender: address(s_testConsumer), extraArgs: VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})) @@ -626,26 +626,26 @@ contract VRFV2Plus is BaseTest { */ proof = VRF.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 102142782721757938350759722545721736888276217484353597703162772276193136052353, - 87167280284008869627768921028415708350806510214000539818296353518495698939660 + 102_142_782_721_757_938_350_759_722_545_721_736_888_276_217_484_353_597_703_162_772_276_193_136_052_353, + 87_167_280_284_008_869_627_768_921_028_415_708_350_806_510_214_000_539_818_296_353_518_495_698_939_660 ], - c: 78738462581063211677832865654743924688552792392007862664964608134754001810280, - s: 97066881804257970453329086439696419448135613089654606517271688187030953014593, - seed: 88177119495082281213609405072572269421661478022189589823108119237563684383163, + c: 78_738_462_581_063_211_677_832_865_654_743_924_688_552_792_392_007_862_664_964_608_134_754_001_810_280, + s: 97_066_881_804_257_970_453_329_086_439_696_419_448_135_613_089_654_606_517_271_688_187_030_953_014_593, + seed: 88_177_119_495_082_281_213_609_405_072_572_269_421_661_478_022_189_589_823_108_119_237_563_684_383_163, uWitness: 0xa335ea8dF652d5331a276B60b16c9733435D4f73, cGammaWitness: [ - 114435126227922602743444254494036972095649501991695809092954325430947992864624, - 63032211040463927862594425238691911311087931119674607521158894139074063158678 + 114_435_126_227_922_602_743_444_254_494_036_972_095_649_501_991_695_809_092_954_325_430_947_992_864_624, + 63_032_211_040_463_927_862_594_425_238_691_911_311_087_931_119_674_607_521_158_894_139_074_063_158_678 ], sHashWitness: [ - 105043781471073183057173130563345930784924139079040814418442661347864735908726, - 68696469914696211053833437482938344908217760552761185546164836556562945431554 + 105_043_781_471_073_183_057_173_130_563_345_930_784_924_139_079_040_814_418_442_661_347_864_735_908_726, + 68_696_469_914_696_211_053_833_437_482_938_344_908_217_760_552_761_185_546_164_836_556_562_945_431_554 ], - zInv: 73325637847357165955904789471972164751975373195750497508525598331798833112175 + zInv: 73_325_637_847_357_165_955_904_789_471_972_164_751_975_373_195_750_497_508_525_598_331_798_833_112_175 }); rc = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, @@ -845,26 +845,26 @@ contract VRFV2Plus is BaseTest { */ VRF.Proof memory proof = VRF.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 65913937398148449626792563067325648649534055460473988721938103219381973178278, - 63156327344180203180831822252171874192175272818200597638000091892096122362120 + 65_913_937_398_148_449_626_792_563_067_325_648_649_534_055_460_473_988_721_938_103_219_381_973_178_278, + 63_156_327_344_180_203_180_831_822_252_171_874_192_175_272_818_200_597_638_000_091_892_096_122_362_120 ], - c: 96524997218413735279221574381819903278651909890109201564980667824986706861580, - s: 32941032142956097592442894642111025677491308239274769364799856748447418202313, - seed: 78857362017365444144484359594634073685493503942324326290718892836953423263381, + c: 96_524_997_218_413_735_279_221_574_381_819_903_278_651_909_890_109_201_564_980_667_824_986_706_861_580, + s: 32_941_032_142_956_097_592_442_894_642_111_025_677_491_308_239_274_769_364_799_856_748_447_418_202_313, + seed: 78_857_362_017_365_444_144_484_359_594_634_073_685_493_503_942_324_326_290_718_892_836_953_423_263_381, uWitness: 0xda613621Dc2347d9A6670a1cBA812d52A7ec3A3A, cGammaWitness: [ - 6776842114900054689355891239487365968068230823400902903493665825747641410781, - 753482930067864853610521010650481816782338376846697006021590704037205560592 + 6_776_842_114_900_054_689_355_891_239_487_365_968_068_230_823_400_902_903_493_665_825_747_641_410_781, + 753_482_930_067_864_853_610_521_010_650_481_816_782_338_376_846_697_006_021_590_704_037_205_560_592 ], sHashWitness: [ - 76619528582417858778905184311764104068650968652636772643050945629834129417915, - 27947566794040118487986033070014357750801611688958204148187927873566412002355 + 76_619_528_582_417_858_778_905_184_311_764_104_068_650_968_652_636_772_643_050_945_629_834_129_417_915, + 27_947_566_794_040_118_487_986_033_070_014_357_750_801_611_688_958_204_148_187_927_873_566_412_002_355 ], - zInv: 77351076831418813780936064446565588198113457019145030499544500588309236458362 + zInv: 77_351_076_831_418_813_780_936_064_446_565_588_198_113_457_019_145_030_499_544_500_588_309_236_458_362 }); VRFTypes.RequestCommitmentV2Plus memory rc = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, @@ -993,26 +993,26 @@ contract VRFV2Plus is BaseTest { */ VRF.Proof memory proof = VRF.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 65913937398148449626792563067325648649534055460473988721938103219381973178278, - 63156327344180203180831822252171874192175272818200597638000091892096122362120 + 65_913_937_398_148_449_626_792_563_067_325_648_649_534_055_460_473_988_721_938_103_219_381_973_178_278, + 63_156_327_344_180_203_180_831_822_252_171_874_192_175_272_818_200_597_638_000_091_892_096_122_362_120 ], - c: 103296526941774692908067234360350834482645116475454593803823148315342533216203, - s: 50291245814080656739779812653411869801334231723444391096753849942661931376590, - seed: 78857362017365444144484359594634073685493503942324326290718892836953423263381, + c: 103_296_526_941_774_692_908_067_234_360_350_834_482_645_116_475_454_593_803_823_148_315_342_533_216_203, + s: 50_291_245_814_080_656_739_779_812_653_411_869_801_334_231_723_444_391_096_753_849_942_661_931_376_590, + seed: 78_857_362_017_365_444_144_484_359_594_634_073_685_493_503_942_324_326_290_718_892_836_953_423_263_381, uWitness: 0x38500711AdcB471ac1A566c4b915759eb9cBCE2F, cGammaWitness: [ - 56476970720509547210740928951846471668018949971632948991136782499758110143588, - 44326075300781389077656415325167171692706436527877070415603658305817367373598 + 56_476_970_720_509_547_210_740_928_951_846_471_668_018_949_971_632_948_991_136_782_499_758_110_143_588, + 44_326_075_300_781_389_077_656_415_325_167_171_692_706_436_527_877_070_415_603_658_305_817_367_373_598 ], sHashWitness: [ - 109524696164787283409393383708118913934136014139634321235031691839206768278439, - 52690039857779635909051684567562068782378693408005554345469129234366171822741 + 109_524_696_164_787_283_409_393_383_708_118_913_934_136_014_139_634_321_235_031_691_839_206_768_278_439, + 52_690_039_857_779_635_909_051_684_567_562_068_782_378_693_408_005_554_345_469_129_234_366_171_822_741 ], - zInv: 108537983043800425266290112227943788107669768716438017124275578856644517258573 + zInv: 108_537_983_043_800_425_266_290_112_227_943_788_107_669_768_716_438_017_124_275_578_856_644_517_258_573 }); VRFTypes.RequestCommitmentV2Plus memory rc = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, @@ -1049,26 +1049,26 @@ contract VRFV2Plus is BaseTest { */ proof = VRF.Proof({ pk: [ - 72488970228380509287422715226575535698893157273063074627791787432852706183111, - 62070622898698443831883535403436258712770888294397026493185421712108624767191 + 72_488_970_228_380_509_287_422_715_226_575_535_698_893_157_273_063_074_627_791_787_432_852_706_183_111, + 62_070_622_898_698_443_831_883_535_403_436_258_712_770_888_294_397_026_493_185_421_712_108_624_767_191 ], gamma: [ - 7260273098301741284457725182313945178888499328441106869722941415453613782770, - 91648498042618923465107471165504200585847250228048015102713552756245653299952 + 7_260_273_098_301_741_284_457_725_182_313_945_178_888_499_328_441_106_869_722_941_415_453_613_782_770, + 91_648_498_042_618_923_465_107_471_165_504_200_585_847_250_228_048_015_102_713_552_756_245_653_299_952 ], - c: 64987886290696558870328339791409334400119338012796549091587853494368167422332, - s: 69469162696695326295567645789624554797683340898724555794078876350372084267572, - seed: 53330100288105770463016865504321558518073051667771993294213115153676065708950, + c: 64_987_886_290_696_558_870_328_339_791_409_334_400_119_338_012_796_549_091_587_853_494_368_167_422_332, + s: 69_469_162_696_695_326_295_567_645_789_624_554_797_683_340_898_724_555_794_078_876_350_372_084_267_572, + seed: 53_330_100_288_105_770_463_016_865_504_321_558_518_073_051_667_771_993_294_213_115_153_676_065_708_950, uWitness: 0xa6ce21aD47eC5E90Ac7a2c6152D9710234Afe8ab, cGammaWitness: [ - 57318358662553647785891634403735348577492991113152343207139729697842283565417, - 57942043484796308689103390068712967247519265087617809262260051163954389512396 + 57_318_358_662_553_647_785_891_634_403_735_348_577_492_991_113_152_343_207_139_729_697_842_283_565_417, + 57_942_043_484_796_308_689_103_390_068_712_967_247_519_265_087_617_809_262_260_051_163_954_389_512_396 ], sHashWitness: [ - 113345999157319332195230171660555736547709417795439282230372737104445523493539, - 113358219039155973560933190466797830695088313506343976960055230355894888727567 + 113_345_999_157_319_332_195_230_171_660_555_736_547_709_417_795_439_282_230_372_737_104_445_523_493_539, + 113_358_219_039_155_973_560_933_190_466_797_830_695_088_313_506_343_976_960_055_230_355_894_888_727_567 ], - zInv: 68349552569605209428774574139615352877146713490794995768725549089572297658255 + zInv: 68_349_552_569_605_209_428_774_574_139_615_352_877_146_713_490_794_995_768_725_549_089_572_297_658_255 }); rc = VRFTypes.RequestCommitmentV2Plus({ blockNum: requestBlock, diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol index b2651fdfa2..95f2ed24b0 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper.t.sol @@ -39,7 +39,7 @@ contract VRFV2PlusWrapperTest is BaseTest { // Deploy link token and link/native feed. s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Deploy coordinator. s_testCoordinator = new ExposedVRFCoordinatorV2_5(address(0)); @@ -74,7 +74,7 @@ contract VRFV2PlusWrapperTest is BaseTest { 2_500_000, // maxGasLimit 1, // stalenessSeconds 50_000, // gasAfterPaymentCalculation - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 0, // fulfillmentFlatFeeNativePPM 0, // fulfillmentFlatFeeLinkDiscountPPM 0, // nativePremiumPercentage @@ -94,7 +94,7 @@ contract VRFV2PlusWrapperTest is BaseTest { vrfKeyHash, 10, 1, - 50000000000000000, + 50_000_000_000_000_000, 0, 0 ); @@ -108,7 +108,7 @@ contract VRFV2PlusWrapperTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 0, // fulfillmentFlatFeeNativePPM 0 // fulfillmentFlatFeeLinkDiscountPPM ); @@ -197,7 +197,7 @@ contract VRFV2PlusWrapperTest is BaseTest { function testVRFV2PlusWrapperWithInvalidSubscriptionId() public { vm.expectRevert(SubscriptionAPI.InvalidSubscription.selector); - new VRFV2PlusWrapper(address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(123456)); + new VRFV2PlusWrapper(address(s_linkToken), address(s_linkNativeFeed), address(s_testCoordinator), uint256(123_456)); } function testSetFulfillmentTxSize() public { @@ -295,7 +295,7 @@ contract VRFV2PlusWrapperTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500, // fulfillmentFlatFeeNativePPM 501 // fulfillmentFlatFeeLinkDiscountPPM ); @@ -313,7 +313,7 @@ contract VRFV2PlusWrapperTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 450, // fulfillmentFlatFeeNativePPM 450 // fulfillmentFlatFeeLinkDiscountPPM ); @@ -334,7 +334,7 @@ contract VRFV2PlusWrapperTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 0, // fulfillmentFlatFeeNativePPM 0 // fulfillmentFlatFeeLinkDiscountPPM ); @@ -355,7 +355,7 @@ contract VRFV2PlusWrapperTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 0, // fulfillmentFlatFeeNativePPM 0 // fulfillmentFlatFeeLinkDiscountPPM ); diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol index e81427f0e8..b3238eba9d 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Arbitrum.t.sol @@ -35,7 +35,7 @@ contract VRFV2PlusWrapperArbitrumTest is BaseTest { // Deploy link token and link/native feed. s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Deploy coordinator. s_testCoordinator = new ExposedVRFCoordinatorV2_5_Arbitrum(address(0)); @@ -59,7 +59,7 @@ contract VRFV2PlusWrapperArbitrumTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000 // fulfillmentFlatFeeLinkDiscountPPM ); diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol index 24d5385243..8e24d81437 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Migration.t.sol @@ -43,7 +43,7 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { // Deploy link token and link/native feed. s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Deploy coordinator. s_testCoordinator = new ExposedVRFCoordinatorV2_5(address(0)); @@ -89,7 +89,7 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { 2_500_000, // maxGasLimit 1, // stalenessSeconds 50_000, // gasAfterPaymentCalculation - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000, // fulfillmentFlatFeeLinkDiscountPPM 15, // nativePremiumPercentage @@ -108,7 +108,7 @@ contract VRFV2PlusWrapper_MigrationTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 0, // fulfillmentFlatFeeNativePPM 0 // fulfillmentFlatFeeLinkDiscountPPM ); diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol index 00bd76b78b..cf7de04b0b 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol @@ -50,7 +50,7 @@ contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { // Deploy link token and link/native feed. s_linkToken = new MockLinkToken(); - s_linkNativeFeed = new MockV3Aggregator(18, 500000000000000000); // .5 ETH (good for testing) + s_linkNativeFeed = new MockV3Aggregator(18, 500_000_000_000_000_000); // .5 ETH (good for testing) // Deploy coordinator. s_testCoordinator = new ExposedVRFCoordinatorV2_5_Optimism(address(0)); @@ -74,7 +74,7 @@ contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { vrfKeyHash, // keyHash 10, // max number of words, 1, // stalenessSeconds - 50000000000000000, // fallbackWeiPerUnitLink + 50_000_000_000_000_000, // fallbackWeiPerUnitLink 500_000, // fulfillmentFlatFeeNativePPM 100_000 // fulfillmentFlatFeeLinkDiscountPPM ); @@ -97,14 +97,14 @@ contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { function _mockGasOraclePriceFeeMethods() internal { // these values are taken from an example transaction on Base Sepolia vm.mockCall( - OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), abi.encode(64273426165) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("l1BaseFee()"))), abi.encode(64_273_426_165) ); vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("baseFeeScalar()"))), abi.encode(1101)); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), abi.encode(659851) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFeeScalar()"))), abi.encode(659_851) ); vm.mockCall( - OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), abi.encode(2126959908362) + OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("blobBaseFee()"))), abi.encode(2_126_959_908_362) ); vm.mockCall(OVM_GASPRICEORACLE_ADDR, abi.encodeWithSelector(bytes4(keccak256("decimals()"))), abi.encode(6)); } diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol b/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol index 5bddbf1932..8e9296b504 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFCoordinatorTestV2.sol @@ -83,7 +83,7 @@ contract VRFCoordinatorTestV2 is VRF, ConfirmedOwner, ITypeAndVersion, VRFCoordi uint32 public constant MAX_NUM_WORDS = 500; // 5k is plenty for an EXTCODESIZE call (2600) + warm CALL (100) // and some arithmetic operations. - uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5_000; + uint256 private constant GAS_FOR_CALL_EXACT_CHECK = 5000; error InvalidRequestConfirmations(uint16 have, uint16 min, uint16 max); error GasLimitTooBig(uint32 have, uint32 want); diff --git a/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol b/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol index ab582deef4..770a55a3b6 100644 --- a/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol +++ b/contracts/src/v0.8/vrf/testhelpers/VRFMaliciousConsumerV2.sol @@ -25,7 +25,7 @@ contract VRFMaliciousConsumerV2 is VRFConsumerBaseV2 { s_randomWords = randomWords; s_requestId = requestId; // Should revert - COORDINATOR.requestRandomWords(s_keyHash, s_subId, 1, 200000, 1); + COORDINATOR.requestRandomWords(s_keyHash, s_subId, 1, 200_000, 1); } function createSubscriptionAndFund( @@ -52,6 +52,6 @@ contract VRFMaliciousConsumerV2 is VRFConsumerBaseV2 { bytes32 keyHash ) external returns (uint256) { s_keyHash = keyHash; - return COORDINATOR.requestRandomWords(keyHash, s_subId, 1, 500000, 1); + return COORDINATOR.requestRandomWords(keyHash, s_subId, 1, 500_000, 1); } } diff --git a/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol b/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol index fb8acbfa68..c4e5ccb2db 100644 --- a/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol +++ b/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol @@ -22,7 +22,7 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { uint8 private constant DEFAULT_MAX_TAG_LEN = 32; uint8 private constant DEFAULT_MAX_URL_LEN = 200; uint16 private constant DEFAULT_MAX_ATTR_LEN = 1024; - uint32 private constant DEFAULT_MAX_EXPIRY = 604800; // one week + uint32 private constant DEFAULT_MAX_EXPIRY = 604_800; // one week /// @dev Configuration struct that keeps config parameters for this contract. Config private s_config = Config({ diff --git a/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_AddNodesTest.t.sol b/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_AddNodesTest.t.sol index d52d6d975b..e29e6cba0f 100644 --- a/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_AddNodesTest.t.sol +++ b/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_AddNodesTest.t.sol @@ -43,7 +43,7 @@ contract CapabilitiesRegistry_AddNodesTest is BaseTest { string[] memory capabilityIds = new string[](1); capabilityIds[0] = s_basicCapabilityId; - uint32 invalidNodeOperatorId = 10000; + uint32 invalidNodeOperatorId = 10_000; nodes[0] = CapabilitiesRegistry.NodeParams({ nodeOperatorId: invalidNodeOperatorId, // Invalid NOP diff --git a/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol b/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol index 0b35d3d407..40248e6d57 100644 --- a/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol +++ b/contracts/src/v0.8/workflow/dev/v2/test/CapabilitiesRegistry/CapabilitiesRegistry_UpdateNodeOperatorsTest.t.sol @@ -45,7 +45,7 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - uint32 invalidNodeOperatorId = 10000; + uint32 invalidNodeOperatorId = 10_000; uint32[] memory nodeOperatorIds = new uint32[](2); nodeOperatorIds[0] = invalidNodeOperatorId; vm.expectRevert( @@ -59,7 +59,7 @@ contract CapabilitiesRegistry_UpdateNodeOperatorTest is BaseTest { CapabilitiesRegistry.NodeOperator[] memory nodeOperators = new CapabilitiesRegistry.NodeOperator[](1); nodeOperators[0] = CapabilitiesRegistry.NodeOperator({admin: NEW_NODE_OPERATOR_ADMIN, name: NEW_NODE_OPERATOR_NAME}); - uint32 invalidNodeOperatorId = 10000; + uint32 invalidNodeOperatorId = 10_000; uint32[] memory nodeOperatorIds = new uint32[](1); nodeOperatorIds[0] = invalidNodeOperatorId; vm.expectRevert( diff --git a/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.getCapabilitiesRegistry.t.sol b/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.getCapabilitiesRegistry.t.sol index 07cb45372d..209901df84 100644 --- a/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.getCapabilitiesRegistry.t.sol +++ b/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.getCapabilitiesRegistry.t.sol @@ -18,7 +18,7 @@ contract WorkflowRegistry_getCapabilitiesRegistry is WorkflowRegistrySetup { // set the Capabilities Registry vm.prank(s_owner); address capRegAddr = makeAddr("cap-registry-address"); - uint64 chainSel = 123456; + uint64 chainSel = 123_456; s_registry.setCapabilitiesRegistry(capRegAddr, chainSel); (address capRegValue, uint64 chainSelValue) = s_registry.getCapabilitiesRegistry(); diff --git a/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.setCapabilitiesRegistry.t.sol b/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.setCapabilitiesRegistry.t.sol index dacc8de745..cc4c1fc95f 100644 --- a/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.setCapabilitiesRegistry.t.sol +++ b/contracts/src/v0.8/workflow/dev/v2/test/WorkflowRegistry/WorkflowRegistry.setCapabilitiesRegistry.t.sol @@ -13,7 +13,7 @@ contract WorkflowRegistry_setCapabilitiesRegistry is WorkflowRegistrySetup { vm.prank(s_stranger); address capReg = makeAddr("cap-registry-address"); vm.expectRevert(abi.encodeWithSelector(Ownable2Step.OnlyCallableByOwner.selector, s_stranger)); - s_registry.setCapabilitiesRegistry(capReg, 123456); + s_registry.setCapabilitiesRegistry(capReg, 123_456); } // whenTheCallerISTheContractOwner @@ -21,7 +21,7 @@ contract WorkflowRegistry_setCapabilitiesRegistry is WorkflowRegistrySetup { // It should write to s_capabilitiesRegistry with the pair and emit CapabilitiesRegistryUpdated vm.prank(s_owner); address capReg = makeAddr("cap-registry-address"); - uint64 chainSel = 123456; + uint64 chainSel = 123_456; vm.expectEmit(true, true, true, false); emit WorkflowRegistry.CapabilitiesRegistryUpdated(address(0), capReg, uint64(0), chainSel); @@ -39,13 +39,13 @@ contract WorkflowRegistry_setCapabilitiesRegistry is WorkflowRegistrySetup { vm.startPrank(s_owner); // set the capabilities registry address capReg = makeAddr("cap-registry-address"); - uint64 chainSel = 123456; + uint64 chainSel = 123_456; s_registry.setCapabilitiesRegistry(capReg, chainSel); // set it with different values address newCapReg = makeAddr("cap-registry-address-2"); - uint64 newChainSel = 678910; + uint64 newChainSel = 678_910; s_registry.setCapabilitiesRegistry(newCapReg, newChainSel); @@ -62,7 +62,7 @@ contract WorkflowRegistry_setCapabilitiesRegistry is WorkflowRegistrySetup { vm.startPrank(s_owner); // set the capabilities registry address capReg = makeAddr("cap-registry-address"); - uint64 chainSel = 123456; + uint64 chainSel = 123_456; s_registry.setCapabilitiesRegistry(capReg, chainSel); // set the same registry again From 3924385d2a8d7da7f3e1d519fc5400ec991f8087 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sun, 31 Aug 2025 19:22:53 +0200 Subject: [PATCH 13/14] wrap_comments = true --- contracts/foundry.toml | 2 +- .../v0.8/automation/chains/ScrollModule.sol | 3 +- .../v0.8/automation/dev/MercuryRegistry.sol | 3 +- .../automation/interfaces/IChainModule.sol | 2 +- .../interfaces/v2_1/IKeeperRegistryMaster.sol | 22 ++- .../v2_2/IAutomationRegistryMaster.sol | 22 ++- .../v2_3/IAutomationRegistryMaster2_3.sol | 55 ++++++- .../IZKSyncAutomationRegistryMaster2_3.sol | 55 ++++++- .../automation/test/MercuryRegistry.t.sol | 3 +- .../test/v2_3/AutomationRegistry2_3.t.sol | 6 +- .../v0.8/automation/test/v2_3/BaseTest.t.sol | 3 +- .../test/v2_3_zksync/BaseTest.t.sol | 3 +- .../ZKSyncAutomationRegistry2_3.t.sol | 9 +- .../automation/testhelpers/DummyProtocol.sol | 12 +- .../testhelpers/LogTriggeredStreamsLookup.sol | 3 +- .../testhelpers/VerifiableLoadBase.sol | 12 +- .../upkeeps/ERC20BalanceMonitor.sol | 3 +- .../upkeeps/LinkAvailableBalanceMonitor.sol | 3 +- .../upkeeps/UpkeepBalanceMonitor.sol | 3 +- .../v2_1/AutomationRegistrar2_1.sol | 9 +- .../automation/v2_1/KeeperRegistryBase2_1.sol | 24 ++- .../v2_1/KeeperRegistryLogicA2_1.sol | 3 +- .../automation/v2_2/AutomationRegistry2_2.sol | 3 +- .../v2_2/AutomationRegistryBase2_2.sol | 15 +- .../v2_2/AutomationRegistryLogicA2_2.sol | 3 +- .../v2_3/AutomationRegistrar2_3.sol | 21 ++- .../automation/v2_3/AutomationRegistry2_3.sol | 12 +- .../v2_3/AutomationRegistryBase2_3.sol | 42 +++-- .../v2_3/AutomationRegistryLogicB2_3.sol | 3 +- .../v2_3/AutomationRegistryLogicC2_3.sol | 9 +- .../automation/v2_3/AutomationUtils2_3.sol | 3 +- .../automation/v2_3/UpkeepTranscoder5_0.sol | 3 +- .../ZKSyncAutomationRegistry2_3.sol | 12 +- .../ZKSyncAutomationRegistryBase2_3.sol | 42 +++-- .../ZKSyncAutomationRegistryLogicB2_3.sol | 3 +- .../ZKSyncAutomationRegistryLogicC2_3.sol | 9 +- .../src/v0.8/data-feeds/DataFeedsCache.sol | 6 +- .../functions/dev/v1_X/FunctionsBilling.sol | 15 +- .../functions/dev/v1_X/FunctionsRouter.sol | 25 ++- .../accessControl/TermsOfServiceAllowList.sol | 3 +- .../interfaces/ITermsOfServiceAllowList.sol | 9 +- .../dev/v1_X/interfaces/IFunctionsBilling.sol | 46 ++++-- .../interfaces/IFunctionsSubscriptions.sol | 3 +- .../dev/v1_X/libraries/ChainSpecificUtil.sol | 6 +- .../dev/v1_X/libraries/FunctionsRequest.sol | 14 +- .../dev/v1_X/libraries/FunctionsResponse.sol | 18 ++- .../v0.8/functions/dev/v1_X/ocr/OCR2Base.sol | 9 +- .../tests/v1_X/ChainSpecificUtil.t.sol | 6 +- .../tests/v1_X/FunctionsBilling.t.sol | 9 +- .../tests/v1_X/FunctionsClient.t.sol | 3 +- .../tests/v1_X/FunctionsRouter.t.sol | 48 ++++-- .../tests/v1_X/FunctionsSubscriptions.t.sol | 45 ++++-- .../FunctionsTermsOfServiceAllowList.t.sol | 15 +- .../src/v0.8/functions/tests/v1_X/Gas.t.sol | 6 +- .../src/v0.8/functions/tests/v1_X/Setup.t.sol | 152 ++++++++++++------ .../functions/v1_0_0/FunctionsBilling.sol | 27 ++-- .../v0.8/functions/v1_0_0/FunctionsRouter.sol | 22 ++- .../accessControl/TermsOfServiceAllowList.sol | 3 +- .../interfaces/ITermsOfServiceAllowList.sol | 3 +- .../v1_0_0/interfaces/IFunctionsBilling.sol | 6 +- .../interfaces/IFunctionsSubscriptions.sol | 3 +- .../v1_0_0/libraries/FunctionsRequest.sol | 14 +- .../v1_0_0/libraries/FunctionsResponse.sol | 18 ++- .../v0.8/functions/v1_0_0/ocr/OCR2Base.sol | 3 +- .../functions/v1_1_0/FunctionsBilling.sol | 30 ++-- .../v0.8/functions/v1_1_0/ocr/OCR2Base.sol | 9 +- .../functions/v1_3_0/FunctionsBilling.sol | 15 +- .../accessControl/TermsOfServiceAllowList.sol | 3 +- .../interfaces/ITermsOfServiceAllowList.sol | 6 +- .../v1_3_0/interfaces/IFunctionsBilling.sol | 43 +++-- .../v0.8/functions/v1_3_0/ocr/OCR2Base.sol | 9 +- .../v1_3_0_zksync/FunctionsBilling.sol | 15 +- .../KeystoneFeedsPermissionHandler.sol | 3 +- .../interfaces/ICapabilityConfiguration.sol | 3 +- .../test/KeystoneForwarder_ReportTest.t.sol | 3 +- .../l2ep/CrossDomainDelegateForwarder.sol | 3 +- .../src/v0.8/l2ep/CrossDomainForwarder.sol | 3 +- .../arbitrum/ArbitrumCrossDomainForwarder.sol | 3 +- .../arbitrum/ArbitrumCrossDomainGovernor.sol | 3 +- .../v0.8/l2ep/arbitrum/ArbitrumValidator.sol | 18 ++- .../optimism/OptimismCrossDomainForwarder.sol | 3 +- .../optimism/OptimismCrossDomainGovernor.sol | 3 +- .../scroll/ScrollCrossDomainForwarder.sol | 3 +- .../l2ep/scroll/ScrollCrossDomainGovernor.sol | 3 +- .../libraries/test/ByteUtilTest.t.sol | 9 +- .../src/v0.8/llo-feeds/v0.3.0/FeeManager.sol | 6 +- .../v0.8/llo-feeds/v0.3.0/RewardManager.sol | 25 ++- .../src/v0.8/llo-feeds/v0.3.0/Verifier.sol | 18 ++- .../v0.3.0/interfaces/IFeeManager.sol | 3 +- .../v0.3.0/interfaces/IRewardManager.sol | 6 +- .../test/fee-manager/BaseFeeManager.t.sol | 3 +- .../fee-manager/FeeManager.processFee.t.sol | 6 +- .../FeeManager.processFeeBulk.t.sol | 3 +- .../reward-manager/BaseRewardManager.t.sol | 6 +- .../reward-manager/RewardManager.claim.t.sol | 18 ++- .../v0.4.0/DestinationFeeManager.sol | 6 +- .../v0.4.0/DestinationRewardManager.sol | 25 ++- .../llo-feeds/v0.4.0/DestinationVerifier.sol | 25 ++- .../v0.4.0/DestinationVerifierProxy.sol | 4 +- .../interfaces/IDestinationFeeManager.sol | 3 +- .../interfaces/IDestinationRewardManager.sol | 6 +- .../IDestinationVerifierProxyVerifier.sol | 3 +- .../BaseDestinationFeeManager.t.sol | 3 +- .../DestinationFeeManager.processFee.t.sol | 6 +- ...DestinationFeeManager.processFeeBulk.t.sol | 3 +- .../BaseDestinationRewardManager.t.sol | 6 +- .../DestinationRewardManager.claim.t.sol | 18 ++- .../DestinationVerifierInterfacesTest.t.sol | 6 +- .../DestinationVerifierSetConfigTest.t.sol | 3 +- .../DestinationVerifierTestRewards.t.sol | 2 +- ...erTestRewardsMultiVefifierFeeManager.t.sol | 2 +- .../DestinationVerifierVerifyTest.t.sol | 7 +- .../src/v0.8/llo-feeds/v0.5.0/FeeManager.sol | 6 +- .../v0.8/llo-feeds/v0.5.0/RewardManager.sol | 25 ++- .../src/v0.8/llo-feeds/v0.5.0/Verifier.sol | 6 +- .../v0.5.0/configuration/Configurator.sol | 21 ++- .../interfaces/IConfigurator.sol | 6 +- .../ConfiguratorSetProductionConfigTest.t.sol | 3 +- .../ConfiguratorSetStagingConfigTest.t.sol | 6 +- .../v0.5.0/interfaces/IFeeManager.sol | 3 +- .../v0.5.0/interfaces/IRewardManager.sol | 6 +- .../test/fee-manager/BaseFeeManager.t.sol | 3 +- .../fee-manager/FeeManager.processFee.t.sol | 6 +- .../FeeManager.processFeeBulk.t.sol | 3 +- .../v0.5.0/test/mocks/MockFeeManager.sol | 6 +- .../reward-manager/BaseRewardManager.t.sol | 6 +- .../reward-manager/RewardManager.claim.t.sol | 18 ++- .../src/v0.8/operatorforwarder/Operator.sol | 12 +- .../v0.8/shared/access/AuthorizedCallers.sol | 3 +- .../shared/call/CallWithExactGasZKSync.sol | 12 +- .../src/v0.8/shared/ocr2/OCR2Abstract.sol | 12 +- contracts/src/v0.8/shared/ocr2/OCR2Base.sol | 3 +- .../shared/test/call/CallWithExactGas.t.sol | 3 +- .../shared/test/testhelpers/GasConsumer.sol | 3 +- .../BurnMintERC20/BurnMintERC20.burn.t.sol | 4 +- .../BurnMintERC20.burnFrom.t.sol | 3 +- .../BurnMintERC20.burnFromAlias.t.sol | 3 +- .../BurnMintERC20/BurnMintERC20.mint.t.sol | 3 +- .../BurnMintERC20PausableUUPS.upgrade.t.sol | 6 +- .../BurnMintERC20TransparentTest.t.sol | 3 +- .../BurnMintERC20UUPSTest.t.sol | 3 +- ...nMintERC20PausableFreezableTransparent.sol | 6 +- .../BurnMintERC20PausableFreezableUUPS.sol | 6 +- .../upgradeable/BurnMintERC20Transparent.sol | 6 +- .../ERC20/upgradeable/BurnMintERC20UUPS.sol | 3 +- .../shared/util/SortedSetValidationUtil.sol | 6 +- contracts/src/v0.8/vrf/KeepersVRFConsumer.sol | 3 +- contracts/src/v0.8/vrf/VRFV2Wrapper.sol | 3 +- contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol | 15 +- .../src/v0.8/vrf/dev/SubscriptionAPI.sol | 12 +- .../vrf/dev/VRFConsumerBaseV2Upgradeable.sol | 3 +- .../src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol | 3 +- .../vrf/dev/VRFSubscriptionBalanceMonitor.sol | 3 +- .../src/v0.8/vrf/dev/VRFV2PlusWrapper.sol | 21 ++- .../testhelpers/VRFCoordinatorTestV2_5.sol | 3 +- .../VRFCoordinatorV2PlusUpgradedVersion.sol | 3 +- .../test/VRFCoordinatorV2_5_Optimism.t.sol | 3 +- contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol | 12 +- .../vrf/test/VRFV2PlusWrapper_Optimism.t.sol | 3 +- .../v0.8/workflow/dev/v2/WorkflowRegistry.sol | 60 ++++--- .../interfaces/ICapabilityConfiguration.sol | 3 +- .../src/v0.8/workflow/v1/WorkflowRegistry.sol | 18 ++- .../workflow/v1/WorkflowRegistryManager.sol | 18 ++- 163 files changed, 1247 insertions(+), 552 deletions(-) diff --git a/contracts/foundry.toml b/contracts/foundry.toml index 8613eaaac1..6e2bf2c326 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -22,8 +22,8 @@ multiline_func_header = "params_first" sort_imports = true single_line_statement_blocks = "preserve" ignore = ["src/v0.8/vendor/**/*.sol"] -override_spacing = false number_underscore = "thousands" +wrap_comments = true [profile.functions] optimizer_runs = 1_000_000 diff --git a/contracts/src/v0.8/automation/chains/ScrollModule.sol b/contracts/src/v0.8/automation/chains/ScrollModule.sol index 8362620abb..17981c8afd 100644 --- a/contracts/src/v0.8/automation/chains/ScrollModule.sol +++ b/contracts/src/v0.8/automation/chains/ScrollModule.sol @@ -12,7 +12,8 @@ contract ScrollModule is ChainModuleBase, ConfirmedOwner { event L1FeeCoefficientSet(uint8 coefficient); /// @dev SCROLL_L1_FEE_DATA_PADDING includes 140 bytes for L1 data padding for Scroll - /// @dev according to testing, this padding allows automation registry to properly estimates L1 data fee with 3-5% buffer + /// @dev according to testing, this padding allows automation registry to properly estimates L1 data fee with 3-5% + /// buffer /// @dev this MAY NOT work for a different product and this may get out of date if transmit function is changed bytes private constant SCROLL_L1_FEE_DATA_PADDING = hex"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; diff --git a/contracts/src/v0.8/automation/dev/MercuryRegistry.sol b/contracts/src/v0.8/automation/dev/MercuryRegistry.sol index 82daeb1a5a..85d6e38847 100644 --- a/contracts/src/v0.8/automation/dev/MercuryRegistry.sol +++ b/contracts/src/v0.8/automation/dev/MercuryRegistry.sol @@ -71,7 +71,8 @@ contract MercuryRegistry is ConfirmedOwner, AutomationCompatibleInterface, Strea uint32 private constant MIN_GAS_FOR_PERFORM = 200_000; string private constant FEED_PARAM_KEY = "feedIdHex"; // for Mercury v0.2 - format by which feeds are identified - string private constant TIME_PARAM_KEY = "blockNumber"; // for Mercury v0.2 - format by which feeds are filtered to be sufficiently recent + string private constant TIME_PARAM_KEY = "blockNumber"; // for Mercury v0.2 - format by which feeds are filtered to be + // sufficiently recent IVerifierProxy public s_verifier; // for Mercury v0.2 - verifies off-chain reports int192 private constant SCALE = 1_000_000; // a scalar used for measuring deviation with precision diff --git a/contracts/src/v0.8/automation/interfaces/IChainModule.sol b/contracts/src/v0.8/automation/interfaces/IChainModule.sol index 46110518c8..787f0c350e 100644 --- a/contracts/src/v0.8/automation/interfaces/IChainModule.sol +++ b/contracts/src/v0.8/automation/interfaces/IChainModule.sol @@ -39,7 +39,7 @@ interface IChainModule { /* @notice this function provides the overheads of calling this chain module. * @return chainModuleFixedOverhead the fixed overhead incurred by calling this chain module - * @return chainModulePerByteOverhead the fixed overhead per byte incurred by calling this chain module with calldata + * @return chainModulePerByteOverhead the fixed overhead per byte incurred by calling this chain module with calldata */ function getGasOverhead() external diff --git a/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol index f77d815887..c96b793118 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol @@ -348,5 +348,23 @@ interface IAutomationV21PlusCommon { // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* -[{"inputs":[{"internalType":"contract KeeperRegistryLogicB2_1","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MaxCheckDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MaxPerformDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"PaymentGreaterThanAllLINK","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"OwnerFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract KeeperRegistryLogicB2_1","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum KeeperRegistryBase2_1.Trigger","name":"triggerType","type":"uint8"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum KeeperRegistryBase2_1.Mode","name":"mode","type":"uint8"},{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkNativeFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkNativeFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum KeeperRegistryBase2_1.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMode","outputs":[{"internalType":"enum KeeperRegistryBase2_1.Mode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum KeeperRegistryBase2_1.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum KeeperRegistryBase2_1.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum KeeperRegistryBase2_1.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepTranscoderVersion","outputs":[{"internalType":"enum UpkeepFormat","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOwnerFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] -*/ +[{"inputs":[{"internalType":"contract +KeeperRegistryLogicB2_1","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"InsufficientFunds","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MaxCheckDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MaxPerformDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"PaymentGreaterThanAllLINK","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"OwnerFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct +IAutomationV21PlusCommon.OnchainConfigLegacy","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +KeeperRegistryLogicB2_1","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +KeeperRegistryBase2_1.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum +KeeperRegistryBase2_1.Trigger","name":"triggerType","type":"uint8"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum +KeeperRegistryBase2_1.Mode","name":"mode","type":"uint8"},{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkNativeFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract +IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkNativeFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum +KeeperRegistryBase2_1.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMode","outputs":[{"internalType":"enum +KeeperRegistryBase2_1.Mode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum +KeeperRegistryBase2_1.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct +IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct +IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum +KeeperRegistryBase2_1.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct +IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum +KeeperRegistryBase2_1.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepTranscoderVersion","outputs":[{"internalType":"enum +UpkeepFormat","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOwnerFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}]*/ diff --git a/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol index 558b428f13..5ef83f8e76 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_2/IAutomationRegistryMaster.sol @@ -374,5 +374,23 @@ interface IAutomationV21PlusCommon { // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* -[{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_2","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MaxCheckDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MaxPerformDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"PaymentGreaterThanAllLINK","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"OwnerFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"internalType":"struct AutomationRegistryBase2_2.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_2","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkNativeFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkNativeFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum AutomationRegistryBase2_2.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmitCalldataFixedBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransmitCalldataPerSignerBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum AutomationRegistryBase2_2.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum AutomationRegistryBase2_2.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepTranscoderVersion","outputs":[{"internalType":"enum UpkeepFormat","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOwnerFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] -*/ +[{"inputs":[{"internalType":"contract +AutomationRegistryLogicB2_2","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MaxCheckDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MaxPerformDataSizeCanOnlyIncrease","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"PaymentGreaterThanAllLINK","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"OwnerFundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"internalType":"struct +AutomationRegistryBase2_2.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +AutomationRegistryLogicB2_2","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkNative","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_2.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum +AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkNativeFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract +IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkNativeFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"enum +AutomationRegistryBase2_2.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum +AutomationRegistryBase2_2.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct +IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct +IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmitCalldataFixedBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransmitCalldataPerSignerBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum +AutomationRegistryBase2_2.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct +IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"recoverFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum +AutomationRegistryBase2_2.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepTranscoderVersion","outputs":[{"internalType":"enum +UpkeepFormat","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOwnerFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}]*/ diff --git a/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol b/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol index 4d7be31526..dffaf31bd4 100644 --- a/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol +++ b/contracts/src/v0.8/automation/interfaces/v2_3/IAutomationRegistryMaster2_3.sol @@ -482,5 +482,56 @@ interface IAutomationV21PlusCommon { // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* -[{"inputs":[{"internalType":"contract AutomationRegistryLogicA2_3","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientLinkLiquidity","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidFeed","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"MustSettleOffchain","type":"error"},{"inputs":[],"name":"MustSettleOnchain","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyFinanceAdmin","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"indexed":false,"internalType":"struct AutomationRegistryBase2_3.BillingOverrides","name":"overrides","type":"tuple"}],"name":"BillingConfigOverridden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BillingConfigOverrideRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"indexed":false,"internalType":"struct AutomationRegistryBase2_3.BillingConfig","name":"config","type":"tuple"}],"name":"BillingConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"assetAddress","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"payments","type":"uint256[]"}],"name":"NOPsSettledOffchain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint96","name":"gasChargeInBillingToken","type":"uint96"},{"internalType":"uint96","name":"premiumInBillingToken","type":"uint96"},{"internalType":"uint96","name":"gasReimbursementInJuels","type":"uint96"},{"internalType":"uint96","name":"premiumInJuels","type":"uint96"},{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"uint96","name":"linkUSD","type":"uint96"},{"internalType":"uint96","name":"nativeUSD","type":"uint96"},{"internalType":"uint96","name":"billingUSD","type":"uint96"}],"indexed":false,"internalType":"struct AutomationRegistryBase2_3.PaymentReceipt","name":"receipt","type":"tuple"}],"name":"UpkeepCharged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"internalType":"struct AutomationRegistryBase2_3.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"},{"internalType":"contract IERC20Metadata[]","name":"billingTokens","type":"address[]"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct AutomationRegistryBase2_3.BillingConfig[]","name":"billingConfigs","type":"tuple[]"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract AutomationRegistryLogicB2_3","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum AutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract AutomationRegistryLogicC2_3","name":"logicC","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"removeBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct AutomationRegistryBase2_3.BillingOverrides","name":"billingOverrides","type":"tuple"}],"name":"setBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"asset","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20Fees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawLink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkUSDFeed","type":"address"},{"internalType":"address","name":"nativeUSDFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"},{"internalType":"enum AutomationRegistryBase2_3.PayoutMode","name":"payoutMode","type":"uint8"},{"internalType":"address","name":"wrappedNativeTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableOffchainPayments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getAvailableERC20ForPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getBillingConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct AutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverrides","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct AutomationRegistryBase2_3.BillingOverrides","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverridesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"}],"name":"getBillingTokenConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct AutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBillingTokens","outputs":[{"internalType":"contract IERC20Metadata[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"internalType":"struct AutomationRegistryBase2_3.OnchainConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFallbackNativePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHotVars","outputs":[{"components":[{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"reentrancyGuard","type":"bool"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"internalType":"struct AutomationRegistryBase2_3.HotVars","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum AutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumUpkeeps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayoutMode","outputs":[{"internalType":"enum AutomationRegistryBase2_3.PayoutMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum AutomationRegistryBase2_3.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getReserveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStorage","outputs":[{"components":[{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"}],"internalType":"struct AutomationRegistryBase2_3.Storage","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmitCalldataFixedBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransmitCalldataPerSignerBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmittersWithPayees","outputs":[{"components":[{"internalType":"address","name":"transmitterAddress","type":"address"},{"internalType":"address","name":"payeeAddress","type":"address"}],"internalType":"struct AutomationRegistryBase2_3.TransmitterPayeeInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum AutomationRegistryBase2_3.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWrappedNativeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkAvailableForPayment","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum AutomationRegistryBase2_3.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleNOPsOffchain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"}],"name":"supportsBillingToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] -*/ +[{"inputs":[{"internalType":"contract +AutomationRegistryLogicA2_3","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientLinkLiquidity","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidFeed","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"MustSettleOffchain","type":"error"},{"inputs":[],"name":"MustSettleOnchain","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyFinanceAdmin","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"indexed":false,"internalType":"struct +AutomationRegistryBase2_3.BillingOverrides","name":"overrides","type":"tuple"}],"name":"BillingConfigOverridden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BillingConfigOverrideRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract +IERC20Metadata","name":"token","type":"address"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"indexed":false,"internalType":"struct +AutomationRegistryBase2_3.BillingConfig","name":"config","type":"tuple"}],"name":"BillingConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"assetAddress","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"payments","type":"uint256[]"}],"name":"NOPsSettledOffchain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint96","name":"gasChargeInBillingToken","type":"uint96"},{"internalType":"uint96","name":"premiumInBillingToken","type":"uint96"},{"internalType":"uint96","name":"gasReimbursementInJuels","type":"uint96"},{"internalType":"uint96","name":"premiumInJuels","type":"uint96"},{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"uint96","name":"linkUSD","type":"uint96"},{"internalType":"uint96","name":"nativeUSD","type":"uint96"},{"internalType":"uint96","name":"billingUSD","type":"uint96"}],"indexed":false,"internalType":"struct +AutomationRegistryBase2_3.PaymentReceipt","name":"receipt","type":"tuple"}],"name":"UpkeepCharged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"internalType":"struct +AutomationRegistryBase2_3.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"},{"internalType":"contract +IERC20Metadata[]","name":"billingTokens","type":"address[]"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct +AutomationRegistryBase2_3.BillingConfig[]","name":"billingConfigs","type":"tuple[]"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +AutomationRegistryLogicB2_3","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum +AutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract +AutomationRegistryLogicC2_3","name":"logicC","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +AutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"removeBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct +AutomationRegistryBase2_3.BillingOverrides","name":"billingOverrides","type":"tuple"}],"name":"setBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"asset","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20Fees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawLink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkUSDFeed","type":"address"},{"internalType":"address","name":"nativeUSDFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"},{"internalType":"enum +AutomationRegistryBase2_3.PayoutMode","name":"payoutMode","type":"uint8"},{"internalType":"address","name":"wrappedNativeTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableOffchainPayments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getAvailableERC20ForPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getBillingConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct +AutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverrides","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct +AutomationRegistryBase2_3.BillingOverrides","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverridesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingToken","outputs":[{"internalType":"contract +IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"token","type":"address"}],"name":"getBillingTokenConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct +AutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBillingTokens","outputs":[{"internalType":"contract +IERC20Metadata[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"internalType":"struct +AutomationRegistryBase2_3.OnchainConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFallbackNativePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract +IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHotVars","outputs":[{"components":[{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"reentrancyGuard","type":"bool"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"internalType":"struct +AutomationRegistryBase2_3.HotVars","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum +AutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumUpkeeps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayoutMode","outputs":[{"internalType":"enum +AutomationRegistryBase2_3.PayoutMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum +AutomationRegistryBase2_3.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerPerformByteGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getReserveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct +IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct +IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStorage","outputs":[{"components":[{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"}],"internalType":"struct +AutomationRegistryBase2_3.Storage","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmitCalldataFixedBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getTransmitCalldataPerSignerBytesOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmittersWithPayees","outputs":[{"components":[{"internalType":"address","name":"transmitterAddress","type":"address"},{"internalType":"address","name":"payeeAddress","type":"address"}],"internalType":"struct +AutomationRegistryBase2_3.TransmitterPayeeInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum +AutomationRegistryBase2_3.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct +IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWrappedNativeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkAvailableForPayment","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum +AutomationRegistryBase2_3.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleNOPsOffchain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"token","type":"address"}],"name":"supportsBillingToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}]*/ diff --git a/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol b/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol index 0d7938d6e8..03198e1f94 100644 --- a/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol +++ b/contracts/src/v0.8/automation/interfaces/zksync/IZKSyncAutomationRegistryMaster2_3.sol @@ -486,5 +486,56 @@ interface IAutomationV21PlusCommon { // THIS FILE WAS AUTOGENERATED FROM THE FOLLOWING ABI JSON: /* -[{"inputs":[{"internalType":"contract ZKSyncAutomationRegistryLogicA2_3","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientLinkLiquidity","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidFeed","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"MustSettleOffchain","type":"error"},{"inputs":[],"name":"MustSettleOnchain","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyFinanceAdmin","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"indexed":false,"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingOverrides","name":"overrides","type":"tuple"}],"name":"BillingConfigOverridden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BillingConfigOverrideRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Metadata","name":"token","type":"address"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"indexed":false,"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingConfig","name":"config","type":"tuple"}],"name":"BillingConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"assetAddress","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"payments","type":"uint256[]"}],"name":"NOPsSettledOffchain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint96","name":"gasChargeInBillingToken","type":"uint96"},{"internalType":"uint96","name":"premiumInBillingToken","type":"uint96"},{"internalType":"uint96","name":"gasReimbursementInJuels","type":"uint96"},{"internalType":"uint96","name":"premiumInJuels","type":"uint96"},{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"uint96","name":"linkUSD","type":"uint96"},{"internalType":"uint96","name":"nativeUSD","type":"uint96"},{"internalType":"uint96","name":"billingUSD","type":"uint96"}],"indexed":false,"internalType":"struct ZKSyncAutomationRegistryBase2_3.PaymentReceipt","name":"receipt","type":"tuple"}],"name":"UpkeepCharged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"},{"internalType":"contract IERC20Metadata[]","name":"billingTokens","type":"address[]"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingConfig[]","name":"billingConfigs","type":"tuple[]"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ZKSyncAutomationRegistryLogicB2_3","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ZKSyncAutomationRegistryLogicC2_3","name":"logicC","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"removeBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingOverrides","name":"billingOverrides","type":"tuple"}],"name":"setBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"asset","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20Fees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawLink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkUSDFeed","type":"address"},{"internalType":"address","name":"nativeUSDFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.PayoutMode","name":"payoutMode","type":"uint8"},{"internalType":"address","name":"wrappedNativeTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableOffchainPayments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getAvailableERC20ForPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getBillingConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverrides","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingOverrides","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverridesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"}],"name":"getBillingTokenConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBillingTokens","outputs":[{"internalType":"contract IERC20Metadata[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.OnchainConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFallbackNativePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHotVars","outputs":[{"components":[{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"reentrancyGuard","type":"bool"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"contract IChainModule","name":"chainModule","type":"address"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.HotVars","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumUpkeeps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayoutMode","outputs":[{"internalType":"enum ZKSyncAutomationRegistryBase2_3.PayoutMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum ZKSyncAutomationRegistryBase2_3.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"billingToken","type":"address"}],"name":"getReserveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStorage","outputs":[{"components":[{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.Storage","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmittersWithPayees","outputs":[{"components":[{"internalType":"address","name":"transmitterAddress","type":"address"},{"internalType":"address","name":"payeeAddress","type":"address"}],"internalType":"struct ZKSyncAutomationRegistryBase2_3.TransmitterPayeeInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum ZKSyncAutomationRegistryBase2_3.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWrappedNativeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkAvailableForPayment","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum ZKSyncAutomationRegistryBase2_3.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleNOPsOffchain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Metadata","name":"token","type":"address"}],"name":"supportsBillingToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}] -*/ +[{"inputs":[{"internalType":"contract +ZKSyncAutomationRegistryLogicA2_3","name":"logicA","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ArrayHasNoEntries","type":"error"},{"inputs":[],"name":"CannotCancel","type":"error"},{"inputs":[],"name":"CheckDataExceedsLimit","type":"error"},{"inputs":[],"name":"ConfigDigestMismatch","type":"error"},{"inputs":[],"name":"DuplicateEntry","type":"error"},{"inputs":[],"name":"DuplicateSigners","type":"error"},{"inputs":[],"name":"GasLimitCanOnlyIncrease","type":"error"},{"inputs":[],"name":"GasLimitOutsideRange","type":"error"},{"inputs":[],"name":"IncorrectNumberOfFaultyOracles","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSignatures","type":"error"},{"inputs":[],"name":"IncorrectNumberOfSigners","type":"error"},{"inputs":[],"name":"IndexOutOfRange","type":"error"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"},{"internalType":"uint256","name":"requested","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[],"name":"InsufficientLinkLiquidity","type":"error"},{"inputs":[],"name":"InvalidDataLength","type":"error"},{"inputs":[],"name":"InvalidFeed","type":"error"},{"inputs":[],"name":"InvalidPayee","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[],"name":"InvalidReport","type":"error"},{"inputs":[],"name":"InvalidSigner","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"InvalidTransmitter","type":"error"},{"inputs":[],"name":"InvalidTrigger","type":"error"},{"inputs":[],"name":"InvalidTriggerType","type":"error"},{"inputs":[],"name":"MigrationNotPermitted","type":"error"},{"inputs":[],"name":"MustSettleOffchain","type":"error"},{"inputs":[],"name":"MustSettleOnchain","type":"error"},{"inputs":[],"name":"NotAContract","type":"error"},{"inputs":[],"name":"OnlyActiveSigners","type":"error"},{"inputs":[],"name":"OnlyActiveTransmitters","type":"error"},{"inputs":[],"name":"OnlyCallableByAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByLINKToken","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByOwnerOrRegistrar","type":"error"},{"inputs":[],"name":"OnlyCallableByPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedAdmin","type":"error"},{"inputs":[],"name":"OnlyCallableByProposedPayee","type":"error"},{"inputs":[],"name":"OnlyCallableByUpkeepPrivilegeManager","type":"error"},{"inputs":[],"name":"OnlyFinanceAdmin","type":"error"},{"inputs":[],"name":"OnlyPausedUpkeep","type":"error"},{"inputs":[],"name":"OnlySimulatedBackend","type":"error"},{"inputs":[],"name":"OnlyUnpausedUpkeep","type":"error"},{"inputs":[],"name":"ParameterLengthError","type":"error"},{"inputs":[],"name":"ReentrantCall","type":"error"},{"inputs":[],"name":"RegistryPaused","type":"error"},{"inputs":[],"name":"RepeatedSigner","type":"error"},{"inputs":[],"name":"RepeatedTransmitter","type":"error"},{"inputs":[{"internalType":"bytes","name":"reason","type":"bytes"}],"name":"TargetCheckReverted","type":"error"},{"inputs":[],"name":"TooManyOracles","type":"error"},{"inputs":[],"name":"TranscoderNotSet","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"UpkeepAlreadyExists","type":"error"},{"inputs":[],"name":"UpkeepCancelled","type":"error"},{"inputs":[],"name":"UpkeepNotCanceled","type":"error"},{"inputs":[],"name":"UpkeepNotNeeded","type":"error"},{"inputs":[],"name":"ValueNotChanged","type":"error"},{"inputs":[],"name":"ZeroAddressNotAllowed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"AdminPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"indexed":false,"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingOverrides","name":"overrides","type":"tuple"}],"name":"BillingConfigOverridden","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"BillingConfigOverrideRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract +IERC20Metadata","name":"token","type":"address"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"indexed":false,"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingConfig","name":"config","type":"tuple"}],"name":"BillingConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"CancelledUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newModule","type":"address"}],"name":"ChainSpecificModuleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"previousConfigBlockNumber","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"configCount","type":"uint64"},{"indexed":false,"internalType":"address[]","name":"signers","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"uint8","name":"f","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"onchainConfig","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"ConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"DedupKeyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"assetAddress","type":"address"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"FeesWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"uint96","name":"amount","type":"uint96"}],"name":"FundsAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FundsWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"InsufficientFundsUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"payments","type":"uint256[]"}],"name":"NOPsSettledOffchain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"transmitters","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"payees","type":"address[]"}],"name":"PayeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"PayeeshipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"transmitter","type":"address"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"address","name":"payee","type":"address"}],"name":"PaymentWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"ReorgedUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"StaleUpkeepReport","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"indexed":false,"internalType":"uint32","name":"epoch","type":"uint32"}],"name":"Transmitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"UpkeepAdminTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint64","name":"atBlockHeight","type":"uint64"}],"name":"UpkeepCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint96","name":"gasChargeInBillingToken","type":"uint96"},{"internalType":"uint96","name":"premiumInBillingToken","type":"uint96"},{"internalType":"uint96","name":"gasReimbursementInJuels","type":"uint96"},{"internalType":"uint96","name":"premiumInJuels","type":"uint96"},{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"uint96","name":"linkUSD","type":"uint96"},{"internalType":"uint96","name":"nativeUSD","type":"uint96"},{"internalType":"uint96","name":"billingUSD","type":"uint96"}],"indexed":false,"internalType":"struct +ZKSyncAutomationRegistryBase2_3.PaymentReceipt","name":"receipt","type":"tuple"}],"name":"UpkeepCharged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"UpkeepCheckDataSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint96","name":"gasLimit","type":"uint96"}],"name":"UpkeepGasLimitSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"remainingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"destination","type":"address"}],"name":"UpkeepMigrated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"UpkeepOffchainConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepPaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"bool","name":"success","type":"bool"},{"indexed":false,"internalType":"uint96","name":"totalPayment","type":"uint96"},{"indexed":false,"internalType":"uint256","name":"gasUsed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"gasOverhead","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"trigger","type":"bytes"}],"name":"UpkeepPerformed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"privilegeConfig","type":"bytes"}],"name":"UpkeepPrivilegeConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startingBalance","type":"uint256"},{"indexed":false,"internalType":"address","name":"importedFrom","type":"address"}],"name":"UpkeepReceived","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"performGas","type":"uint32"},{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"UpkeepRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"UpkeepTriggerConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"UpkeepUnpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fallbackTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDetails","outputs":[{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"blockNumber","type":"uint32"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestConfigDigestAndEpoch","outputs":[{"internalType":"bool","name":"scanLogs","type":"bool"},{"internalType":"bytes32","name":"configDigest","type":"bytes32"},{"internalType":"uint32","name":"epoch","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bytes","name":"onchainConfigBytes","type":"bytes"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"},{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.OnchainConfig","name":"onchainConfig","type":"tuple"},{"internalType":"uint64","name":"offchainConfigVersion","type":"uint64"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"},{"internalType":"contract +IERC20Metadata[]","name":"billingTokens","type":"address[]"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingConfig[]","name":"billingConfigs","type":"tuple[]"}],"name":"setConfigTypeSafe","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[3]","name":"reportContext","type":"bytes32[3]"},{"internalType":"bytes","name":"rawReport","type":"bytes"},{"internalType":"bytes32[]","name":"rs","type":"bytes32[]"},{"internalType":"bytes32[]","name":"ss","type":"bytes32[]"},{"internalType":"bytes32","name":"rawVs","type":"bytes32"}],"name":"transmit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"typeAndVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +ZKSyncAutomationRegistryLogicB2_3","name":"logicB","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"cancelUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"address","name":"destination","type":"address"}],"name":"migrateUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onTokenTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedUpkeeps","type":"bytes"}],"name":"receiveUpkeeps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"name":"registerUpkeep","outputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract +ZKSyncAutomationRegistryLogicC2_3","name":"logicC","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"acceptUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint96","name":"amount","type":"uint96"}],"name":"addFunds","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes[]","name":"values","type":"bytes[]"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"checkCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerData","type":"bytes"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"checkUpkeep","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"},{"internalType":"uint256","name":"gasLimit","type":"uint256"},{"internalType":"uint256","name":"fastGasWei","type":"uint256"},{"internalType":"uint256","name":"linkUSD","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"executeCallback","outputs":[{"internalType":"bool","name":"upkeepNeeded","type":"bool"},{"internalType":"bytes","name":"performData","type":"bytes"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.UpkeepFailureReason","name":"upkeepFailureReason","type":"uint8"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"pauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"removeBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingOverrides","name":"billingOverrides","type":"tuple"}],"name":"setBillingOverrides","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"newCheckData","type":"bytes"}],"name":"setUpkeepCheckData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint32","name":"gasLimit","type":"uint32"}],"name":"setUpkeepGasLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"config","type":"bytes"}],"name":"setUpkeepOffchainConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"triggerConfig","type":"bytes"}],"name":"setUpkeepTriggerConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"performData","type":"bytes"}],"name":"simulatePerformUpkeep","outputs":[{"internalType":"bool","name":"success","type":"bool"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferUpkeepAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"unpauseUpkeep","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"asset","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawERC20Fees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawLink","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"link","type":"address"},{"internalType":"address","name":"linkUSDFeed","type":"address"},{"internalType":"address","name":"nativeUSDFeed","type":"address"},{"internalType":"address","name":"fastGasFeed","type":"address"},{"internalType":"address","name":"automationForwarderLogic","type":"address"},{"internalType":"address","name":"allowedReadOnlyAddress","type":"address"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.PayoutMode","name":"payoutMode","type":"uint8"},{"internalType":"address","name":"wrappedNativeTokenAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"}],"name":"acceptPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableOffchainPayments","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startIndex","type":"uint256"},{"internalType":"uint256","name":"maxCount","type":"uint256"}],"name":"getActiveUpkeepIDs","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"getAdminPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllowedReadOnlyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAutomationForwarderLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getAvailableERC20ForPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getBalance","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getBillingConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverrides","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingOverrides","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingOverridesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getBillingToken","outputs":[{"internalType":"contract +IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"token","type":"address"}],"name":"getBillingTokenConfig","outputs":[{"components":[{"internalType":"uint32","name":"gasFeePPB","type":"uint32"},{"internalType":"uint24","name":"flatFeeMilliCents","type":"uint24"},{"internalType":"contract +AggregatorV3Interface","name":"priceFeed","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"uint256","name":"fallbackPrice","type":"uint256"},{"internalType":"uint96","name":"minSpend","type":"uint96"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.BillingConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getBillingTokens","outputs":[{"internalType":"contract +IERC20Metadata[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCancellationDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getChainModule","outputs":[{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getConditionalGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getConfig","outputs":[{"components":[{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackNativePrice","type":"uint256"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.OnchainConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFallbackNativePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFastGasFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepID","type":"uint256"}],"name":"getForwarder","outputs":[{"internalType":"contract +IAutomationForwarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHotVars","outputs":[{"components":[{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint8","name":"f","type":"uint8"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bool","name":"reentrancyGuard","type":"bool"},{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"},{"internalType":"contract +IChainModule","name":"chainModule","type":"address"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.HotVars","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLinkUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLogGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.Trigger","name":"triggerType","type":"uint8"},{"internalType":"uint32","name":"gasLimit","type":"uint32"},{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getMaxPaymentForGas","outputs":[{"internalType":"uint96","name":"maxPayment","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalance","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getMinBalanceForUpkeep","outputs":[{"internalType":"uint96","name":"minBalance","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNativeUSDFeedAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumUpkeeps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPayoutMode","outputs":[{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.PayoutMode","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"}],"name":"getPeerRegistryMigrationPermission","outputs":[{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.MigrationPermission","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPerSignerGasOverhead","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getReorgProtectionEnabled","outputs":[{"internalType":"bool","name":"reorgProtectionEnabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"billingToken","type":"address"}],"name":"getReserveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getSignerInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getState","outputs":[{"components":[{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"uint96","name":"ownerLinkBalance","type":"uint96"},{"internalType":"uint256","name":"expectedLinkBalance","type":"uint256"},{"internalType":"uint96","name":"totalPremium","type":"uint96"},{"internalType":"uint256","name":"numUpkeeps","type":"uint256"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"bytes32","name":"latestConfigDigest","type":"bytes32"},{"internalType":"uint32","name":"latestEpoch","type":"uint32"},{"internalType":"bool","name":"paused","type":"bool"}],"internalType":"struct +IAutomationV21PlusCommon.StateLegacy","name":"state","type":"tuple"},{"components":[{"internalType":"uint32","name":"paymentPremiumPPB","type":"uint32"},{"internalType":"uint32","name":"flatFeeMicroLink","type":"uint32"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint24","name":"stalenessSeconds","type":"uint24"},{"internalType":"uint16","name":"gasCeilingMultiplier","type":"uint16"},{"internalType":"uint96","name":"minUpkeepSpend","type":"uint96"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"},{"internalType":"uint256","name":"fallbackGasPrice","type":"uint256"},{"internalType":"uint256","name":"fallbackLinkPrice","type":"uint256"},{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"address[]","name":"registrars","type":"address[]"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"}],"internalType":"struct +IAutomationV21PlusCommon.OnchainConfigLegacy","name":"config","type":"tuple"},{"internalType":"address[]","name":"signers","type":"address[]"},{"internalType":"address[]","name":"transmitters","type":"address[]"},{"internalType":"uint8","name":"f","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getStorage","outputs":[{"components":[{"internalType":"address","name":"transcoder","type":"address"},{"internalType":"uint32","name":"checkGasLimit","type":"uint32"},{"internalType":"uint32","name":"maxPerformGas","type":"uint32"},{"internalType":"uint32","name":"nonce","type":"uint32"},{"internalType":"address","name":"upkeepPrivilegeManager","type":"address"},{"internalType":"uint32","name":"configCount","type":"uint32"},{"internalType":"uint32","name":"latestConfigBlockNumber","type":"uint32"},{"internalType":"uint32","name":"maxCheckDataSize","type":"uint32"},{"internalType":"address","name":"financeAdmin","type":"address"},{"internalType":"uint32","name":"maxPerformDataSize","type":"uint32"},{"internalType":"uint32","name":"maxRevertDataSize","type":"uint32"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.Storage","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"query","type":"address"}],"name":"getTransmitterInfo","outputs":[{"internalType":"bool","name":"active","type":"bool"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint96","name":"lastCollected","type":"uint96"},{"internalType":"address","name":"payee","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTransmittersWithPayees","outputs":[{"components":[{"internalType":"address","name":"transmitterAddress","type":"address"},{"internalType":"address","name":"payeeAddress","type":"address"}],"internalType":"struct +ZKSyncAutomationRegistryBase2_3.TransmitterPayeeInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getTriggerType","outputs":[{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.Trigger","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getUpkeep","outputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"uint32","name":"performGas","type":"uint32"},{"internalType":"bytes","name":"checkData","type":"bytes"},{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"uint64","name":"maxValidBlocknumber","type":"uint64"},{"internalType":"uint32","name":"lastPerformedBlockNumber","type":"uint32"},{"internalType":"uint96","name":"amountSpent","type":"uint96"},{"internalType":"bool","name":"paused","type":"bool"},{"internalType":"bytes","name":"offchainConfig","type":"bytes"}],"internalType":"struct +IAutomationV21PlusCommon.UpkeepInfoLegacy","name":"upkeepInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepPrivilegeConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"}],"name":"getUpkeepTriggerConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWrappedNativeTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"dedupKey","type":"bytes32"}],"name":"hasDedupKey","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"linkAvailableForPayment","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setAdminPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"payees","type":"address[]"}],"name":"setPayees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"peer","type":"address"},{"internalType":"enum +ZKSyncAutomationRegistryBase2_3.MigrationPermission","name":"permission","type":"uint8"}],"name":"setPeerRegistryMigrationPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"upkeepId","type":"uint256"},{"internalType":"bytes","name":"newPrivilegeConfig","type":"bytes"}],"name":"setUpkeepPrivilegeConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleNOPsOffchain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract +IERC20Metadata","name":"token","type":"address"}],"name":"supportsBillingToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"transmitter","type":"address"},{"internalType":"address","name":"proposed","type":"address"}],"name":"transferPayeeship","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upkeepVersion","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawPayment","outputs":[],"stateMutability":"nonpayable","type":"function"}]*/ diff --git a/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol b/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol index 53ad266289..ade8d671e0 100644 --- a/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol +++ b/contracts/src/v0.8/automation/test/MercuryRegistry.t.sol @@ -49,7 +49,8 @@ contract MercuryRegistryTest is Test { function setUp() public virtual { // Set owner, and fork Arbitrum Goerli Testnet (chain ID 421613). - // The fork is only used with the `FORK_TEST` flag enabeld, as to not disrupt CI. For CI, a mock verifier is used instead. + // The fork is only used with the `FORK_TEST` flag enabeld, as to not disrupt CI. For CI, a mock verifier is used + // instead. vm.startPrank(OWNER); try vm.envBool("FORK_TEST") returns (bool /* fork testing enabled */ ) { vm.selectFork(vm.createFork("https://goerli-rollup.arbitrum.io/rpc")); diff --git a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol index 48eb40e18f..4d49f5f24b 100644 --- a/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/AutomationRegistry2_3.t.sol @@ -904,7 +904,8 @@ contract NOPsSettlement is SetUp { registry.settleNOPsOffchain(); } - // 1. transmitter balance zeroed after settlement, 2. admin can withdraw ERC20, 3. switch to onchain mode, 4. link amount owed to NOPs stays the same + // 1. transmitter balance zeroed after settlement, 2. admin can withdraw ERC20, 3. switch to onchain mode, 4. link + // amount owed to NOPs stays the same function testSettleNOPsOffchainSuccessWithERC20MultiSteps() public { // deploy and configure a registry with OFF_CHAIN payout (Registry registry,) = deployAndConfigureRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); @@ -1133,7 +1134,8 @@ contract NOPsSettlement is SetUp { registry.cancelUpkeep(id); vm.roll(100 + block.number); vm.expectEmit(); - // the upkeep spent less than minimum spending limit so upkeep admin can only withdraw upkeep balance - min spend value + // the upkeep spent less than minimum spending limit so upkeep admin can only withdraw upkeep balance - min spend + // value emit FundsWithdrawn(id, 9.9e19, UPKEEP_ADMIN); registry.withdrawFunds(id, UPKEEP_ADMIN); } diff --git a/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol b/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol index 6c1dc4350c..c41e525015 100644 --- a/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3/BaseTest.t.sol @@ -64,7 +64,8 @@ contract BaseTest is Test { address internal constant UPKEEP_ADMIN = address(uint160(uint256(keccak256("UPKEEP_ADMIN")))); address internal constant FINANCE_ADMIN = address(uint160(uint256(keccak256("FINANCE_ADMIN")))); address internal constant STRANGER = address(uint160(uint256(keccak256("STRANGER")))); - address internal constant BROKE_USER = address(uint160(uint256(keccak256("BROKE_USER")))); // do not mint to this address + address internal constant BROKE_USER = address(uint160(uint256(keccak256("BROKE_USER")))); // do not mint to this + // address address internal constant PRIVILEGE_MANAGER = address(uint160(uint256(keccak256("PRIVILEGE_MANAGER")))); // nodes diff --git a/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol b/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol index 3b698cdceb..103d947960 100644 --- a/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3_zksync/BaseTest.t.sol @@ -66,7 +66,8 @@ contract BaseTest is Test { address internal constant UPKEEP_ADMIN = address(uint160(uint256(keccak256("UPKEEP_ADMIN")))); address internal constant FINANCE_ADMIN = address(uint160(uint256(keccak256("FINANCE_ADMIN")))); address internal constant STRANGER = address(uint160(uint256(keccak256("STRANGER")))); - address internal constant BROKE_USER = address(uint160(uint256(keccak256("BROKE_USER")))); // do not mint to this address + address internal constant BROKE_USER = address(uint160(uint256(keccak256("BROKE_USER")))); // do not mint to this + // address address internal constant PRIVILEGE_MANAGER = address(uint160(uint256(keccak256("PRIVILEGE_MANAGER")))); // nodes diff --git a/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol b/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol index 10164c5e8b..05fd386f4a 100644 --- a/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol +++ b/contracts/src/v0.8/automation/test/v2_3_zksync/ZKSyncAutomationRegistry2_3.t.sol @@ -320,7 +320,8 @@ contract Withdraw is SetUp { // default is ON_CHAIN mode function test_WithdrawERC20Fees_RevertsWhen_LinkAvailableForPaymentIsNegative() public { - _transmit(usdUpkeepID18, registry, bytes4(0)); // adds USD token to finance withdrawable, and gives NOPs a LINK balance + _transmit(usdUpkeepID18, registry, bytes4(0)); // adds USD token to finance withdrawable, and gives NOPs a LINK + // balance require(registry.linkAvailableForPayment() < 0, "linkAvailableForPayment should be negative"); require( registry.getAvailableERC20ForPayment(address(usdToken18)) > 0, "ERC20AvailableForPayment should be positive" @@ -904,7 +905,8 @@ contract NOPsSettlement is SetUp { registry.settleNOPsOffchain(); } - // 1. transmitter balance zeroed after settlement, 2. admin can withdraw ERC20, 3. switch to onchain mode, 4. link amount owed to NOPs stays the same + // 1. transmitter balance zeroed after settlement, 2. admin can withdraw ERC20, 3. switch to onchain mode, 4. link + // amount owed to NOPs stays the same function testSettleNOPsOffchainSuccessWithERC20MultiSteps() public { // deploy and configure a registry with OFF_CHAIN payout (Registry registry,) = deployAndConfigureZKSyncRegistryAndRegistrar(AutoBase.PayoutMode.OFF_CHAIN); @@ -1134,7 +1136,8 @@ contract NOPsSettlement is SetUp { registry.cancelUpkeep(id); vm.roll(100 + block.number); vm.expectEmit(); - // the upkeep spent less than minimum spending limit so upkeep admin can only withdraw upkeep balance - min spend value + // the upkeep spent less than minimum spending limit so upkeep admin can only withdraw upkeep balance - min spend + // value emit FundsWithdrawn(id, 9.9e19, UPKEEP_ADMIN); registry.withdrawFunds(id, UPKEEP_ADMIN); } diff --git a/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol b/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol index 3489371556..fef3b44cb3 100644 --- a/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol +++ b/contracts/src/v0.8/automation/testhelpers/DummyProtocol.sol @@ -12,9 +12,12 @@ struct LogTriggerConfig { } contract DummyProtocol { - event LimitOrderSent(uint256 indexed amount, uint256 indexed price, address indexed to); // keccak256(LimitOrderSent(uint256,uint256,address)) => 0x3e9c37b3143f2eb7e9a2a0f8091b6de097b62efcfe48e1f68847a832e521750a - event LimitOrderWithdrawn(uint256 indexed amount, uint256 indexed price, address indexed from); // keccak256(LimitOrderWithdrawn(uint256,uint256,address)) => 0x0a71b8ed921ff64d49e4d39449f8a21094f38a0aeae489c3051aedd63f2c229f - event LimitOrderExecuted(uint256 indexed orderId, uint256 indexed amount, address indexed exchange); // keccak(LimitOrderExecuted(uint256,uint256,address)) => 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd + event LimitOrderSent(uint256 indexed amount, uint256 indexed price, address indexed to); // keccak256(LimitOrderSent(uint256,uint256,address)) + // => 0x3e9c37b3143f2eb7e9a2a0f8091b6de097b62efcfe48e1f68847a832e521750a + event LimitOrderWithdrawn(uint256 indexed amount, uint256 indexed price, address indexed from); // keccak256(LimitOrderWithdrawn(uint256,uint256,address)) + // => 0x0a71b8ed921ff64d49e4d39449f8a21094f38a0aeae489c3051aedd63f2c229f + event LimitOrderExecuted(uint256 indexed orderId, uint256 indexed amount, address indexed exchange); // keccak(LimitOrderExecuted(uint256,uint256,address)) + // => 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd function sendLimitedOrder(uint256 amount, uint256 price, address to) public { // send an order to an exchange @@ -51,7 +54,8 @@ contract DummyProtocol { /** * @notice this function generates bytes for a customizable log trigger config. * @param targetContract the address of contract where events will be emitted from - * @param selector the filter selector. this denotes which topics apply to filter ex 000, 101, 111....only last 3 bits apply + * @param selector the filter selector. this denotes which topics apply to filter ex 000, 101, 111....only last 3 bits + * apply * if 0, it won't filter based on topic 1, 2, 3. * if 1, it will filter based on topic 1, * if 2, it will filter based on topic 2, diff --git a/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol index a33f425574..23702d23ac 100644 --- a/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol +++ b/contracts/src/v0.8/automation/testhelpers/LogTriggeredStreamsLookup.sol @@ -27,7 +27,8 @@ contract LogTriggeredStreamsLookup is ILogAutomation, StreamsLookupCompatibleInt bytes blob, bytes verified ); - event LimitOrderExecuted(uint256 indexed orderId, uint256 indexed amount, address indexed exchange); // keccak(LimitOrderExecuted(uint256,uint256,address)) => 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd + event LimitOrderExecuted(uint256 indexed orderId, uint256 indexed amount, address indexed exchange); // keccak(LimitOrderExecuted(uint256,uint256,address)) + // => 0xd1ffe9e45581c11d7d9f2ed5f75217cd4be9f8b7eee6af0f6d03f46de53956cd event IgnoringErrorHandlerData(); ArbSys internal constant ARB_SYS = ArbSys(0x0000000000000000000000000000000000000064); diff --git a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol index 24ab11eaa5..cab953d36b 100644 --- a/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol +++ b/contracts/src/v0.8/automation/testhelpers/VerifiableLoadBase.sol @@ -17,9 +17,11 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { using EnumerableSet for EnumerableSet.UintSet; ArbSys internal constant ARB_SYS = ArbSys(0x0000000000000000000000000000000000000064); - //bytes32 public constant emittedSig = 0x97009585a4d2440f981ab6f6eec514343e1e6b2aa9b991a26998e6806f41bf08; //keccak256(LogEmitted(uint256,uint256,address)) + //bytes32 public constant emittedSig = 0x97009585a4d2440f981ab6f6eec514343e1e6b2aa9b991a26998e6806f41bf08; + // //keccak256(LogEmitted(uint256,uint256,address)) bytes32 public immutable emittedSig = LogEmitted.selector; - // bytes32 public constant emittedAgainSig = 0xc76416badc8398ce17c93eab7b4f60f263241694cf503e4df24f233a8cc1c50d; //keccak256(LogEmittedAgain(uint256,uint256,address)) + // bytes32 public constant emittedAgainSig = 0xc76416badc8398ce17c93eab7b4f60f263241694cf503e4df24f233a8cc1c50d; + // //keccak256(LogEmittedAgain(uint256,uint256,address)) bytes32 public immutable emittedAgainSig = LogEmittedAgain.selector; mapping(uint256 => uint256) public lastTopUpBlocks; @@ -32,7 +34,8 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { mapping(uint256 => uint256) public performDataSizes; mapping(uint256 => uint256) public gasLimits; mapping(bytes32 => bool) public dummyMap; // used to force storage lookup - mapping(uint256 => uint256[]) public delays; // how to query for delays for a certain past period: calendar day and/or past 24 hours + mapping(uint256 => uint256[]) public delays; // how to query for delays for a certain past period: calendar day and/or + // past 24 hours mapping(uint256 => mapping(uint16 => uint256[])) public bucketedDelays; mapping(uint256 => uint16) public buckets; @@ -345,7 +348,8 @@ abstract contract VerifiableLoadBase is ConfirmedOwner { } /** - * @notice updates pipeline data for an upkeep. In order for the upkeep to be performed, the pipeline data must be the abi encoded upkeep ID. + * @notice updates pipeline data for an upkeep. In order for the upkeep to be performed, the pipeline data must be the + * abi encoded upkeep ID. * @param upkeepId the upkeep ID * @param pipelineData the new pipeline data for the upkeep */ diff --git a/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol index 0717fa7613..52042d63fd 100644 --- a/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/ERC20BalanceMonitor.sol @@ -155,7 +155,8 @@ contract ERC20BalanceMonitor is ConfirmedOwner, Pausable, KeeperCompatibleInterf /** * @notice Gets list of subscription ids that are underfunded and returns a keeper-compatible payload. - * @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need funds + * @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need + * funds */ function checkUpkeep( bytes calldata diff --git a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol index 0f5dff93a5..1ee9df1499 100644 --- a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol @@ -180,7 +180,8 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter if (s_targets[targetAddress].isActive) revert DuplicateAddress(targetAddress); if (targetAddress == address(0) && dstChainSelector == 0) revert InvalidAddress(targetAddress); bool onRampExists = s_onRampAddresses.contains(dstChainSelector); - // if targetAddress is an existing onRamp, there's a need of cleaning the previous onRamp associated to this dstChainSelector + // if targetAddress is an existing onRamp, there's a need of cleaning the previous onRamp associated to this + // dstChainSelector // there's no need to remove any other address that's not an onRamp if (dstChainSelector > 0 && onRampExists) { address oldAddress = s_onRampAddresses.get(dstChainSelector); diff --git a/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol index 8a6d61af9f..8ab99b1d51 100644 --- a/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/UpkeepBalanceMonitor.sol @@ -146,7 +146,8 @@ contract UpkeepBalanceMonitor is ConfirmedOwner, Pausable { // ================================================================ /// @notice Gets list of upkeeps ids that are underfunded and returns a keeper-compatible payload. - /// @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need funds + /// @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need + /// funds function checkUpkeep( bytes calldata ) external view returns (bool upkeepNeeded, bytes memory performData) { diff --git a/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol b/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol index 58f1b492bb..47e6e1a4d9 100644 --- a/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol @@ -10,11 +10,14 @@ import {IKeeperRegistryMaster} from "../interfaces/v2_1/IKeeperRegistryMaster.so /** * @notice Contract to accept requests for upkeep registrations * @dev There are 2 registration workflows in this contract - * Flow 1. auto approve OFF / manual registration - UI calls `register` function on this contract, this contract owner at a later time then manually + * Flow 1. auto approve OFF / manual registration - UI calls `register` function on this contract, this contract owner + * at a later time then manually * calls `approve` to register upkeep and emit events to inform UI and others interested. - * Flow 2. auto approve ON / real time registration - UI calls `register` function as before, which calls the `registerUpkeep` function directly on + * Flow 2. auto approve ON / real time registration - UI calls `register` function as before, which calls the + * `registerUpkeep` function directly on * keeper registry and then emits approved event to finish the flow automatically without manual intervention. - * The idea is to have same interface(functions,events) for UI or anyone using this contract irrespective of auto approve being enabled or not. + * The idea is to have same interface(functions,events) for UI or anyone using this contract irrespective of auto + * approve being enabled or not. * they can just listen to `RegistrationRequested` & `RegistrationApproved` events and know the status on registrations. */ contract AutomationRegistrar2_1 is ITypeAndVersion, ConfirmedOwner, IERC677Receiver { diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol index 04b90a432f..dae5a677e8 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol @@ -54,14 +54,19 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { bytes internal constant L1_FEE_DATA_PADDING = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"; - uint256 internal constant REGISTRY_CONDITIONAL_OVERHEAD = 90_000; // Used in maxPayment estimation, and in capping overheads during actual payment - uint256 internal constant REGISTRY_LOG_OVERHEAD = 110_000; // Used only in maxPayment estimation, and in capping overheads during actual payment. - uint256 internal constant REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD = 20; // Used only in maxPayment estimation, and in capping overheads during actual payment. Value scales with performData length. - uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 7500; // Used only in maxPayment estimation, and in capping overheads during actual payment. Value scales with f. + uint256 internal constant REGISTRY_CONDITIONAL_OVERHEAD = 90_000; // Used in maxPayment estimation, and in capping + // overheads during actual payment + uint256 internal constant REGISTRY_LOG_OVERHEAD = 110_000; // Used only in maxPayment estimation, and in capping + // overheads during actual payment. + uint256 internal constant REGISTRY_PER_PERFORM_BYTE_GAS_OVERHEAD = 20; // Used only in maxPayment estimation, and in + // capping overheads during actual payment. Value scales with performData length. + uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 7500; // Used only in maxPayment estimation, and in + // capping overheads during actual payment. Value scales with f. uint256 internal constant ACCOUNTING_FIXED_GAS_OVERHEAD = 27_500; // Used in actual payment. Fixed overhead per tx uint256 internal constant ACCOUNTING_PER_SIGNER_GAS_OVERHEAD = 1100; // Used in actual payment. overhead per signer - uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7000; // Used in actual payment. overhead per upkeep performed + uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7000; // Used in actual payment. overhead per upkeep + // performed OVM_GasPriceOracle internal constant OPTIMISM_ORACLE = OVM_GasPriceOracle(0x420000000000000000000000000000000000000F); ArbGasInfo internal constant ARB_NITRO_ORACLE = ArbGasInfo(0x000000000000000000000000000000000000006C); @@ -99,11 +104,14 @@ abstract contract KeeperRegistryBase2_1 is ConfirmedOwner, ExecutionPrevention { uint256 internal s_fallbackGasPrice; uint256 internal s_fallbackLinkPrice; uint256 internal s_expectedLinkBalance; // Used in case of erroneous LINK transfers to contract - mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to and fro + mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to + // and fro mapping(uint256 => bytes) internal s_upkeepTriggerConfig; // upkeep triggers mapping(uint256 => bytes) internal s_upkeepOffchainConfig; // general config set by users for each upkeep - mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an upkeep - mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an admin + mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an + // upkeep + mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an + // admin error ArrayHasNoEntries(); error CannotCancel(); diff --git a/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol index 94a80794a1..f68476524c 100644 --- a/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol @@ -152,7 +152,8 @@ contract KeeperRegistryLogicA2_1 is KeeperRegistryBase2_1, Chainable { } /** - * @dev checkCallback is used specifically for automation data streams lookups (see StreamsLookupCompatibleInterface.sol) + * @dev checkCallback is used specifically for automation data streams lookups (see + * StreamsLookupCompatibleInterface.sol) * @param id the upkeepID to execute a callback for * @param values the values returned from the data streams lookup * @param extraData the user-provided extra context data diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol index 1d9159dd17..b4d0cbeee6 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistry2_2.sol @@ -226,7 +226,8 @@ contract AutomationRegistry2_2 is AutomationRegistryBase2_2, OCR2Abstract, Chain /** * @inheritdoc OCR2Abstract - * @dev prefer the type-safe version of setConfig (below) whenever possible. The OnchainConfig could differ between registry versions + * @dev prefer the type-safe version of setConfig (below) whenever possible. The OnchainConfig could differ between + * registry versions */ function setConfig( address[] memory signers, diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol index 86a71a109c..e7c34fe91f 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistryBase2_2.sol @@ -62,8 +62,10 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { uint256 internal constant TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD = 64; // Next block of constants are used in actual payment calculation. We calculate the exact gas used within the - // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed constants - // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates various cases and verifies that + // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed + // constants + // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates + // various cases and verifies that // the variables result in accurate estimation uint256 internal constant ACCOUNTING_FIXED_GAS_OVERHEAD = 22_000; // Fixed overhead per tx uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 7000; // Overhead per upkeep performed in batch @@ -100,11 +102,14 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { uint256 internal s_fallbackGasPrice; uint256 internal s_fallbackLinkPrice; uint256 internal s_expectedLinkBalance; // Used in case of erroneous LINK transfers to contract - mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to and fro + mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to + // and fro mapping(uint256 => bytes) internal s_upkeepTriggerConfig; // upkeep triggers mapping(uint256 => bytes) internal s_upkeepOffchainConfig; // general config set by users for each upkeep - mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an upkeep - mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an admin + mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an + // upkeep + mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an + // admin error ArrayHasNoEntries(); error CannotCancel(); diff --git a/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol b/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol index 7f7a6c683a..d472bf9149 100644 --- a/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol +++ b/contracts/src/v0.8/automation/v2_2/AutomationRegistryLogicA2_2.sol @@ -152,7 +152,8 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { } /** - * @dev checkCallback is used specifically for automation data streams lookups (see StreamsLookupCompatibleInterface.sol) + * @dev checkCallback is used specifically for automation data streams lookups (see + * StreamsLookupCompatibleInterface.sol) * @param id the upkeepID to execute a callback for * @param values the values returned from the data streams lookup * @param extraData the user-provided extra context data diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol index 735dec323f..2d980f8907 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistrar2_3.sol @@ -16,11 +16,14 @@ import {SafeCast} from "@openzeppelin/contracts@4.8.3/utils/math/SafeCast.sol"; /** * @notice Contract to accept requests for upkeep registrations * @dev There are 2 registration workflows in this contract - * Flow 1. auto approve OFF / manual registration - UI calls `register` function on this contract, this contract owner at a later time then manually + * Flow 1. auto approve OFF / manual registration - UI calls `register` function on this contract, this contract owner + * at a later time then manually * calls `approve` to register upkeep and emit events to inform UI and others interested. - * Flow 2. auto approve ON / real time registration - UI calls `register` function as before, which calls the `registerUpkeep` function directly on + * Flow 2. auto approve ON / real time registration - UI calls `register` function as before, which calls the + * `registerUpkeep` function directly on * keeper registry and then emits approved event to finish the flow automatically without manual intervention. - * The idea is to have same interface(functions,events) for UI or anyone using this contract irrespective of auto approve being enabled or not. + * The idea is to have same interface(functions,events) for UI or anyone using this contract irrespective of auto + * approve being enabled or not. * they can just listen to `RegistrationRequested` & `RegistrationApproved` events and know the status on registrations. */ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Receiver { @@ -225,7 +228,8 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei } /** - * @notice cancel will remove a registration request from the pending request queue and return the refunds to the request.admin + * @notice cancel will remove a registration request from the pending request queue and return the refunds to the + * request.admin * @param hash the request hash */ function cancel( @@ -348,7 +352,8 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei if (msg.sender != address(i_LINK)) revert OnlyLink(); RegistrationParams memory params = abi.decode(data, (RegistrationParams)); if (address(params.billingToken) != address(i_LINK)) revert OnlyLink(); - params.amount = uint96(amount); // ignore whatever is sent in registration params, use actual value; casting safe because max supply LINK < 2^96 + params.amount = uint96(amount); // ignore whatever is sent in registration params, use actual value; casting safe + // because max supply LINK < 2^96 _register(params, sender); } @@ -406,8 +411,10 @@ contract AutomationRegistrar2_3 is ITypeAndVersion, ConfirmedOwner, IERC677Recei /** * @dev register upkeep on AutomationRegistry contract and emit RegistrationApproved event - * @dev safeApprove is deprecated and removed from the latest (v5) OZ release, Use safeIncreaseAllowance when we upgrade OZ (we are on v4.8) - * @dev we stick to the safeApprove because of the older version (v4.8) of safeIncreaseAllowance can't handle USDT correctly, but newer version can + * @dev safeApprove is deprecated and removed from the latest (v5) OZ release, Use safeIncreaseAllowance when we + * upgrade OZ (we are on v4.8) + * @dev we stick to the safeApprove because of the older version (v4.8) of safeIncreaseAllowance can't handle USDT + * correctly, but newer version can */ function _approve(RegistrationParams memory params, bytes32 hash) private returns (uint256) { IAutomationRegistryMaster2_3 registry = s_registry; diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol index b2f72d6eef..3cc5f863f3 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistry2_3.sol @@ -222,8 +222,10 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain /** * @inheritdoc OCR2Abstract - * @dev prefer the type-safe version of setConfig (below) whenever possible. The OnchainConfig could differ between registry versions - * @dev this function takes up precious space on the root contract, but must be implemented to conform to the OCR2Abstract interface + * @dev prefer the type-safe version of setConfig (below) whenever possible. The OnchainConfig could differ between + * registry versions + * @dev this function takes up precious space on the root contract, but must be implemented to conform to the + * OCR2Abstract interface */ function setConfig( address[] memory signers, @@ -341,7 +343,8 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain /** * @inheritdoc OCR2Abstract - * @dev this function takes up precious space on the root contract, but must be implemented to conform to the OCR2Abstract interface + * @dev this function takes up precious space on the root contract, but must be implemented to conform to the + * OCR2Abstract interface */ function latestConfigDetails() external @@ -354,7 +357,8 @@ contract AutomationRegistry2_3 is AutomationRegistryBase2_3, OCR2Abstract, Chain /** * @inheritdoc OCR2Abstract - * @dev this function takes up precious space on the root contract, but must be implemented to conform to the OCR2Abstract interface + * @dev this function takes up precious space on the root contract, but must be implemented to conform to the + * OCR2Abstract interface */ function latestConfigDigestAndEpoch() external diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol index deaa9894e4..4264379790 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryBase2_3.sol @@ -58,8 +58,10 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint256 internal constant TRANSMIT_CALLDATA_PER_SIGNER_BYTES_OVERHEAD = 64; // Next block of constants are used in actual payment calculation. We calculate the exact gas used within the - // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed constants - // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates various cases and verifies that + // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed + // constants + // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates + // various cases and verifies that // the variables result in accurate estimation uint256 internal constant ACCOUNTING_FIXED_GAS_OVERHEAD = 51_000; // Fixed overhead per tx uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 14_900; // Overhead per upkeep performed in batch @@ -99,15 +101,21 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint256 internal s_fallbackGasPrice; uint256 internal s_fallbackLinkPrice; uint256 internal s_fallbackNativePrice; - mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to and fro + mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to + // and fro mapping(uint256 => bytes) internal s_upkeepTriggerConfig; // upkeep triggers mapping(uint256 => bytes) internal s_upkeepOffchainConfig; // general config set by users for each upkeep - mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an upkeep - mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an admin + mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an + // upkeep + mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an + // admin // billing - mapping(IERC20 billingToken => uint256 reserveAmount) internal s_reserveAmounts; // unspent user deposits + unwithdrawn NOP payments - mapping(IERC20 billingToken => BillingConfig billingConfig) internal s_billingConfigs; // billing configurations for different tokens - mapping(uint256 upkeepID => BillingOverrides billingOverrides) internal s_billingOverrides; // billing overrides for specific upkeeps + mapping(IERC20 billingToken => uint256 reserveAmount) internal s_reserveAmounts; // unspent user deposits + + // unwithdrawn NOP payments + mapping(IERC20 billingToken => BillingConfig billingConfig) internal s_billingConfigs; // billing configurations for + // different tokens + mapping(uint256 upkeepID => BillingOverrides billingOverrides) internal s_billingOverrides; // billing overrides for + // specific upkeeps IERC20[] internal s_billingTokens; // list of billing tokens PayoutMode internal s_payoutMode; @@ -288,7 +296,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint32 nonce; // Nonce for each upkeep created // 1 EVM word full address upkeepPrivilegeManager; // address which can set privilege for upkeeps - uint32 configCount; // incremented each time a new config is posted, The count is incorporated into the config digest to prevent replay attacks. + uint32 configCount; // incremented each time a new config is posted, The count is incorporated into the config + // digest to prevent replay attacks. uint32 latestConfigBlockNumber; // makes it easier for offchain systems to extract config from logs uint32 maxCheckDataSize; // max length of checkData bytes // 2 EVM word full @@ -438,7 +447,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { /** * @notice struct containing receipt information about a payment or cost estimation * @member gasChargeInBillingToken the amount to charge a user for gas spent using the billing token's native decimals - * @member premiumInBillingToken the premium charged to the user, shared between all nodes, using the billing token's native decimals + * @member premiumInBillingToken the premium charged to the user, shared between all nodes, using the billing token's + * native decimals * @member gasReimbursementInJuels the amount to reimburse a node for gas spent * @member premiumInJuels the premium paid to NOPs, shared between all nodes */ @@ -673,7 +683,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { * @dev use of PaymentParams struct is necessary to avoid stack too deep errors * @dev calculates LINK paid for gas spent plus a configure premium percentage * @dev 1 USD = 1e18 attoUSD - * @dev 1 USD = 1e26 hexaicosaUSD (had to borrow this prefix from geometry because there is no metric prefix for 1e-26) + * @dev 1 USD = 1e26 hexaicosaUSD (had to borrow this prefix from geometry because there is no metric prefix for + * 1e-26) * @dev 1 millicent = 1e-5 USD = 1e13 attoUSD */ function _calculatePaymentAmount( @@ -695,7 +706,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { uint256 gasPaymentHexaicosaUSD = ( gasWei * (paymentParams.gasLimit + paymentParams.gasOverhead) + paymentParams.l1CostWei ) * paymentParams.nativeUSD; // gasPaymentHexaicosaUSD has an extra 8 zeros because of decimals on nativeUSD feed - // gasChargeInBillingToken is scaled by the billing token's decimals. Round up to ensure a minimum billing token is charged for gas + // gasChargeInBillingToken is scaled by the billing token's decimals. Round up to ensure a minimum billing token is + // charged for gas receipt.gasChargeInBillingToken = SafeCast.toUint96( ( (gasPaymentHexaicosaUSD * numeratorScalingFactor) @@ -706,7 +718,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { receipt.gasReimbursementInJuels = SafeCast.toUint96(gasPaymentHexaicosaUSD / paymentParams.linkUSD); // premium calculation - uint256 flatFeeHexaicosaUSD = uint256(paymentParams.billingTokenParams.flatFeeMilliCents) * 1e21; // 1e13 for milliCents to attoUSD and 1e8 for attoUSD to hexaicosaUSD + uint256 flatFeeHexaicosaUSD = uint256(paymentParams.billingTokenParams.flatFeeMilliCents) * 1e21; // 1e13 for + // milliCents to attoUSD and 1e8 for attoUSD to hexaicosaUSD uint256 premiumHexaicosaUSD = ( ( ((gasWei * paymentParams.gasLimit) + paymentParams.l1CostWei) * paymentParams.billingTokenParams.gasFeePPB @@ -1041,7 +1054,8 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { // this shouldn't happen, but in rare edge cases, we charge the full balance in case the user // can't cover the amount owed if (balance < receipt.gasChargeInBillingToken) { - // if the user can't cover the gas fee, then direct all of the payment to the transmitter and distribute no premium to the DON + // if the user can't cover the gas fee, then direct all of the payment to the transmitter and distribute no + // premium to the DON payment = balance; receipt.gasReimbursementInJuels = SafeCast.toUint96( (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol index 20131ddd47..df367b1818 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicB2_3.sol @@ -152,7 +152,8 @@ contract AutomationRegistryLogicB2_3 is AutomationRegistryBase2_3, Chainable { } /** - * @dev checkCallback is used specifically for automation data streams lookups (see StreamsLookupCompatibleInterface.sol) + * @dev checkCallback is used specifically for automation data streams lookups (see + * StreamsLookupCompatibleInterface.sol) * @param id the upkeepID to execute a callback for * @param values the values returned from the data streams lookup * @param extraData the user-provided extra context data diff --git a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol index 4bfe71fe54..87090d558c 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationRegistryLogicC2_3.sol @@ -102,8 +102,10 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { } /** - * @notice this is used by the owner to set the initial payees for newly added transmitters. The owner is not allowed to change payees for existing transmitters. - * @dev the IGNORE_ADDRESS is a "helper" that makes it easier to construct a list of payees when you only care about setting the payee for a small number of transmitters. + * @notice this is used by the owner to set the initial payees for newly added transmitters. The owner is not allowed + * to change payees for existing transmitters. + * @dev the IGNORE_ADDRESS is a "helper" that makes it easier to construct a list of payees when you only care about + * setting the payee for a small number of transmitters. */ function setPayees( address[] calldata payees @@ -333,7 +335,8 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 { admin: s_upkeepAdmin[id], maxValidBlocknumber: reg.maxValidBlocknumber, lastPerformedBlockNumber: reg.lastPerformedBlockNumber, - amountSpent: uint96(reg.amountSpent), // force casting to uint96 for backwards compatibility. Not an issue if it overflows. + amountSpent: uint96(reg.amountSpent), // force casting to uint96 for backwards compatibility. Not an issue if it + // overflows. paused: reg.paused, offchainConfig: s_upkeepOffchainConfig[id] }); diff --git a/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol b/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol index 9a6130fc3e..cf73b6bce6 100644 --- a/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol +++ b/contracts/src/v0.8/automation/v2_3/AutomationUtils2_3.sol @@ -10,7 +10,8 @@ import {AutomationRegistryBase2_3} from "./AutomationRegistryBase2_3.sol"; */ contract AutomationUtils2_3 { /** - * @dev this uses the v2.3 Report, which uses linkUSD instead of linkNative (as in v2.2 and prior). This should be used only in typescript tests. + * @dev this uses the v2.3 Report, which uses linkUSD instead of linkNative (as in v2.2 and prior). This should be + * used only in typescript tests. */ function _report( AutomationRegistryBase2_3.Report memory diff --git a/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol b/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol index c39e73567a..b73209036f 100644 --- a/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol +++ b/contracts/src/v0.8/automation/v2_3/UpkeepTranscoder5_0.sol @@ -14,7 +14,8 @@ enum RegistryVersion { } /** - * @notice UpkeepTranscoder is a contract that allows converting upkeep data from previous registry versions to newer versions + * @notice UpkeepTranscoder is a contract that allows converting upkeep data from previous registry versions to newer + * versions * @dev it currently only supports 2.3 -> 2.3 migrations */ contract UpkeepTranscoder5_0 is UpkeepTranscoderInterfaceV2, ITypeAndVersion { diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol index 037e7dcfcd..baadfbeafc 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistry2_3.sol @@ -216,8 +216,10 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs /** * @inheritdoc OCR2Abstract - * @dev prefer the type-safe version of setConfig (below) whenever possible. The OnchainConfig could differ between registry versions - * @dev this function takes up precious space on the root contract, but must be implemented to conform to the OCR2Abstract interface + * @dev prefer the type-safe version of setConfig (below) whenever possible. The OnchainConfig could differ between + * registry versions + * @dev this function takes up precious space on the root contract, but must be implemented to conform to the + * OCR2Abstract interface */ function setConfig( address[] memory signers, @@ -335,7 +337,8 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs /** * @inheritdoc OCR2Abstract - * @dev this function takes up precious space on the root contract, but must be implemented to conform to the OCR2Abstract interface + * @dev this function takes up precious space on the root contract, but must be implemented to conform to the + * OCR2Abstract interface */ function latestConfigDetails() external @@ -348,7 +351,8 @@ contract ZKSyncAutomationRegistry2_3 is ZKSyncAutomationRegistryBase2_3, OCR2Abs /** * @inheritdoc OCR2Abstract - * @dev this function takes up precious space on the root contract, but must be implemented to conform to the OCR2Abstract interface + * @dev this function takes up precious space on the root contract, but must be implemented to conform to the + * OCR2Abstract interface */ function latestConfigDigestAndEpoch() external diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol index 1c2a2acd59..b50692a09f 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryBase2_3.sol @@ -49,8 +49,10 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint256 internal constant REGISTRY_PER_SIGNER_GAS_OVERHEAD = 5600; // Value scales with f // Next block of constants are used in actual payment calculation. We calculate the exact gas used within the - // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed constants - // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates various cases and verifies that + // tx itself, but since payment processing itself takes gas, and it needs the overhead as input, we use fixed + // constants + // to account for gas used in payment processing. These values are calibrated using hardhat tests which simulates + // various cases and verifies that // the variables result in accurate estimation uint256 internal constant ACCOUNTING_FIXED_GAS_OVERHEAD = 51_000; // Fixed overhead per tx uint256 internal constant ACCOUNTING_PER_UPKEEP_GAS_OVERHEAD = 20_000; // Overhead per upkeep performed in batch @@ -90,15 +92,21 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint256 internal s_fallbackGasPrice; uint256 internal s_fallbackLinkPrice; uint256 internal s_fallbackNativePrice; - mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to and fro + mapping(address => MigrationPermission) internal s_peerRegistryMigrationPermission; // Permissions for migration to + // and fro mapping(uint256 => bytes) internal s_upkeepTriggerConfig; // upkeep triggers mapping(uint256 => bytes) internal s_upkeepOffchainConfig; // general config set by users for each upkeep - mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an upkeep - mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an admin + mapping(uint256 => bytes) internal s_upkeepPrivilegeConfig; // general config set by an administrative role for an + // upkeep + mapping(address => bytes) internal s_adminPrivilegeConfig; // general config set by an administrative role for an + // admin // billing - mapping(IERC20 billingToken => uint256 reserveAmount) internal s_reserveAmounts; // unspent user deposits + unwithdrawn NOP payments - mapping(IERC20 billingToken => BillingConfig billingConfig) internal s_billingConfigs; // billing configurations for different tokens - mapping(uint256 upkeepID => BillingOverrides billingOverrides) internal s_billingOverrides; // billing overrides for specific upkeeps + mapping(IERC20 billingToken => uint256 reserveAmount) internal s_reserveAmounts; // unspent user deposits + + // unwithdrawn NOP payments + mapping(IERC20 billingToken => BillingConfig billingConfig) internal s_billingConfigs; // billing configurations for + // different tokens + mapping(uint256 upkeepID => BillingOverrides billingOverrides) internal s_billingOverrides; // billing overrides for + // specific upkeeps IERC20[] internal s_billingTokens; // list of billing tokens PayoutMode internal s_payoutMode; @@ -279,7 +287,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint32 nonce; // Nonce for each upkeep created // 1 EVM word full address upkeepPrivilegeManager; // address which can set privilege for upkeeps - uint32 configCount; // incremented each time a new config is posted, The count is incorporated into the config digest to prevent replay attacks. + uint32 configCount; // incremented each time a new config is posted, The count is incorporated into the config + // digest to prevent replay attacks. uint32 latestConfigBlockNumber; // makes it easier for offchain systems to extract config from logs uint32 maxCheckDataSize; // max length of checkData bytes // 2 EVM word full @@ -427,7 +436,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { /** * @notice struct containing receipt information about a payment or cost estimation * @member gasChargeInBillingToken the amount to charge a user for gas spent using the billing token's native decimals - * @member premiumInBillingToken the premium charged to the user, shared between all nodes, using the billing token's native decimals + * @member premiumInBillingToken the premium charged to the user, shared between all nodes, using the billing token's + * native decimals * @member gasReimbursementInJuels the amount to reimburse a node for gas spent * @member premiumInJuels the premium paid to NOPs, shared between all nodes */ @@ -662,7 +672,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { * @dev use of PaymentParams struct is necessary to avoid stack too deep errors * @dev calculates LINK paid for gas spent plus a configure premium percentage * @dev 1 USD = 1e18 attoUSD - * @dev 1 USD = 1e26 hexaicosaUSD (had to borrow this prefix from geometry because there is no metric prefix for 1e-26) + * @dev 1 USD = 1e26 hexaicosaUSD (had to borrow this prefix from geometry because there is no metric prefix for + * 1e-26) * @dev 1 millicent = 1e-5 USD = 1e13 attoUSD */ function _calculatePaymentAmount( @@ -684,7 +695,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { uint256 gasPaymentHexaicosaUSD = ( gasWei * (paymentParams.gasLimit + paymentParams.gasOverhead) + paymentParams.l1CostWei ) * paymentParams.nativeUSD; // gasPaymentHexaicosaUSD has an extra 8 zeros because of decimals on nativeUSD feed - // gasChargeInBillingToken is scaled by the billing token's decimals. Round up to ensure a minimum billing token is charged for gas + // gasChargeInBillingToken is scaled by the billing token's decimals. Round up to ensure a minimum billing token is + // charged for gas receipt.gasChargeInBillingToken = SafeCast.toUint96( ( (gasPaymentHexaicosaUSD * numeratorScalingFactor) @@ -695,7 +707,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { receipt.gasReimbursementInJuels = SafeCast.toUint96(gasPaymentHexaicosaUSD / paymentParams.linkUSD); // premium calculation - uint256 flatFeeHexaicosaUSD = uint256(paymentParams.billingTokenParams.flatFeeMilliCents) * 1e21; // 1e13 for milliCents to attoUSD and 1e8 for attoUSD to hexaicosaUSD + uint256 flatFeeHexaicosaUSD = uint256(paymentParams.billingTokenParams.flatFeeMilliCents) * 1e21; // 1e13 for + // milliCents to attoUSD and 1e8 for attoUSD to hexaicosaUSD uint256 premiumHexaicosaUSD = ( ( ((gasWei * paymentParams.gasLimit) + paymentParams.l1CostWei) * paymentParams.billingTokenParams.gasFeePPB @@ -1024,7 +1037,8 @@ abstract contract ZKSyncAutomationRegistryBase2_3 is ConfirmedOwner { // this shouldn't happen, but in rare edge cases, we charge the full balance in case the user // can't cover the amount owed if (balance < receipt.gasChargeInBillingToken) { - // if the user can't cover the gas fee, then direct all of the payment to the transmitter and distribute no premium to the DON + // if the user can't cover the gas fee, then direct all of the payment to the transmitter and distribute no + // premium to the DON payment = balance; receipt.gasReimbursementInJuels = SafeCast.toUint96( (balance * paymentParams.billingTokenParams.priceUSD * scalingFactor1) diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol index 1ac0954cbe..0bee5d3c85 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicB2_3.sol @@ -152,7 +152,8 @@ contract ZKSyncAutomationRegistryLogicB2_3 is ZKSyncAutomationRegistryBase2_3, C } /** - * @dev checkCallback is used specifically for automation data streams lookups (see StreamsLookupCompatibleInterface.sol) + * @dev checkCallback is used specifically for automation data streams lookups (see + * StreamsLookupCompatibleInterface.sol) * @param id the upkeepID to execute a callback for * @param values the values returned from the data streams lookup * @param extraData the user-provided extra context data diff --git a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol index 1437a41c95..4520386970 100644 --- a/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol +++ b/contracts/src/v0.8/automation/v2_3_zksync/ZKSyncAutomationRegistryLogicC2_3.sol @@ -102,8 +102,10 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { } /** - * @notice this is used by the owner to set the initial payees for newly added transmitters. The owner is not allowed to change payees for existing transmitters. - * @dev the IGNORE_ADDRESS is a "helper" that makes it easier to construct a list of payees when you only care about setting the payee for a small number of transmitters. + * @notice this is used by the owner to set the initial payees for newly added transmitters. The owner is not allowed + * to change payees for existing transmitters. + * @dev the IGNORE_ADDRESS is a "helper" that makes it easier to construct a list of payees when you only care about + * setting the payee for a small number of transmitters. */ function setPayees( address[] calldata payees @@ -321,7 +323,8 @@ contract ZKSyncAutomationRegistryLogicC2_3 is ZKSyncAutomationRegistryBase2_3 { admin: s_upkeepAdmin[id], maxValidBlocknumber: reg.maxValidBlocknumber, lastPerformedBlockNumber: reg.lastPerformedBlockNumber, - amountSpent: uint96(reg.amountSpent), // force casting to uint96 for backwards compatibility. Not an issue if it overflows. + amountSpent: uint96(reg.amountSpent), // force casting to uint96 for backwards compatibility. Not an issue if it + // overflows. paused: reg.paused, offchainConfig: s_upkeepOffchainConfig[id] }); diff --git a/contracts/src/v0.8/data-feeds/DataFeedsCache.sol b/contracts/src/v0.8/data-feeds/DataFeedsCache.sol index 8d3d667c16..31f54eecee 100644 --- a/contracts/src/v0.8/data-feeds/DataFeedsCache.sol +++ b/contracts/src/v0.8/data-feeds/DataFeedsCache.sol @@ -28,7 +28,8 @@ contract DataFeedsCache is IDataFeedsCache, IReceiver, ITokenRecover, ITypeAndVe } struct FeedConfig { - uint8[] bundleDecimals; // Only appliciable to Bundle reports - Decimal reports have decimals encoded into the DataId. + uint8[] bundleDecimals; // Only appliciable to Bundle reports - Decimal reports have decimals encoded into the + // DataId. string description; // Description of the feed (e.g. "LINK / USD") WorkflowMetadata[] workflowMetadata; // Metadata for the feed } @@ -58,7 +59,8 @@ contract DataFeedsCache is IDataFeedsCache, IReceiver, ITokenRecover, ITypeAndVe /// The message sender determines which feed is being requested, as each proxy has a single associated feed mapping(address aggProxy => bytes16 dataId) private s_aggregatorProxyToDataId; - /// The latest decimal reports for each decimal feed. This will always equal s_decimalReports[s_dataIdToRoundId[dataId]][dataId] + /// The latest decimal reports for each decimal feed. This will always equal + /// s_decimalReports[s_dataIdToRoundId[dataId]][dataId] mapping(bytes16 dataId => StoredDecimalReport) private s_latestDecimalReports; /// Decimal reports for each feed, per round diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol index b0554122c1..dc0c6db9f3 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsBilling.sol @@ -92,7 +92,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { } /// @notice Sets the Chainlink Coordinator's billing configuration - /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information + /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more + /// information function updateConfig( FunctionsBillingConfig memory config ) public { @@ -284,7 +285,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return (commitment, operationFee); } - /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then charging the subscription + /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then + /// charging the subscription /// @param requestId identifier for the request that was generated by the Registry in the beginBilling commitment /// @param response response data from DON consensus /// @param err error from DON consensus @@ -314,12 +316,14 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { err, juelsPerGas, // The following line represents: "cost without callback or admin fee, those will be added by the Router" - // But because the _offchain_ Commitment is using operation fee in the place of the admin fee, this now adds admin fee (actually operation fee) + // But because the _offchain_ Commitment is using operation fee in the place of the admin fee, this now adds admin + // fee (actually operation fee) // Admin fee is configured to 0 in the Router gasOverheadJuels + commitment.donFee + commitment.adminFee, msg.sender, FunctionsResponse.Commitment({ - adminFee: 0, // The Router should have adminFee set to 0. If it does not this will cause fulfillments to fail with INVALID_COMMITMENT instead of carrying out incorrect bookkeeping. + adminFee: 0, // The Router should have adminFee set to 0. If it does not this will cause fulfillments to fail + // with INVALID_COMMITMENT instead of carrying out incorrect bookkeeping. coordinator: commitment.coordinator, client: commitment.client, subscriptionId: commitment.subscriptionId, @@ -347,7 +351,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // Saves on storage writes that would otherwise be charged to the user s_feePool += commitment.donFee; // Pay the operation fee to the Coordinator owner - s_withdrawableTokens[_owner()] += commitment.adminFee; // OperationFee is used in the slot for Admin Fee in the Offchain Commitment. Admin Fee is set to 0 in the Router (enforced by line 316 in FunctionsBilling.sol). + s_withdrawableTokens[_owner()] += commitment.adminFee; // OperationFee is used in the slot for Admin Fee in the + // Offchain Commitment. Admin Fee is set to 0 in the Router (enforced by line 316 in FunctionsBilling.sol). emit RequestBilled({ requestId: requestId, juelsPerGas: juelsPerGas, diff --git a/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol index 31e98e0fde..bb41fbd93f 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/FunctionsRouter.sol @@ -83,13 +83,21 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // ================================================================ // solhint-disable-next-line gas-struct-packing struct Config { - uint16 maxConsumersPerSubscription; // ═════════╗ Maximum number of consumers which can be added to a single subscription. This bound ensures we are able to loop over all subscription consumers as needed, without exceeding gas limits. Should a user require more consumers, they can use multiple subscriptions. - uint72 adminFee; // ║ Flat fee (in Juels of LINK) that will be paid to the Router owner for operation of the network - bytes4 handleOracleFulfillmentSelector; // ║ The function selector that is used when calling back to the Client contract - uint16 gasForCallExactCheck; // ════════════════╝ Used during calling back to the client. Ensures we have at least enough gas to be able to revert if gasAmount > 63//64*gas available. - uint32[] maxCallbackGasLimits; // ══════════════╸ List of max callback gas limits used by flag with MAX_CALLBACK_GAS_LIMIT_FLAGS_INDEX - uint16 subscriptionDepositMinimumRequests; //═══╗ Amount of requests that must be completed before the full subscription balance will be released when closing a subscription account. - uint72 subscriptionDepositJuels; // ════════════╝ Amount of subscription funds that are held as a deposit until Config.subscriptionDepositMinimumRequests are made using the subscription. + uint16 maxConsumersPerSubscription; // ═════════╗ Maximum number of consumers which can be added + // to a single subscription. This bound ensures we are able to loop over all subscription consumers as needed, + // without exceeding gas limits. Should a user require more consumers, they can use multiple subscriptions. + uint72 adminFee; // ║ Flat fee (in Juels of LINK) that will be paid to the Router + // owner for operation of the network + bytes4 handleOracleFulfillmentSelector; // ║ The function selector that is used when calling back to the + // Client contract + uint16 gasForCallExactCheck; // ════════════════╝ Used during calling back to the + // client. Ensures we have at least enough gas to be able to revert if gasAmount > 63//64*gas available. + uint32[] maxCallbackGasLimits; // ══════════════╸ List of max callback gas limits used + // by flag with MAX_CALLBACK_GAS_LIMIT_FLAGS_INDEX + uint16 subscriptionDepositMinimumRequests; //═══╗ Amount of requests that must be completed before the full + // subscription balance will be released when closing a subscription account. + uint72 subscriptionDepositJuels; // ════════════╝ Amount of subscription funds that are + // held as a deposit until Config.subscriptionDepositMinimumRequests are made using the subscription. } Config private s_config; @@ -508,7 +516,8 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, address proposedContract = proposedContractSetAddresses[i]; if ( proposedContract == address(0) // The Proposed address must be a valid address - || s_route[id] == proposedContract // The Proposed address must point to a different address than what is currently set + || s_route[id] == proposedContract // The Proposed address must point to a different address than what is + // currently set ) { revert InvalidProposal(); } diff --git a/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol index ce51556d72..57ee88a0a7 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/accessControl/TermsOfServiceAllowList.sol @@ -74,7 +74,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @notice Sets the contracts's configuration - /// @param config - See the contents of the TermsOfServiceAllowListConfig struct in ITermsOfServiceAllowList.sol for more information + /// @param config - See the contents of the TermsOfServiceAllowListConfig struct in ITermsOfServiceAllowList.sol for + /// more information function updateConfig( TermsOfServiceAllowListConfig memory config ) public onlyOwner { diff --git a/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol index 261dc627af..7f8250c595 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/accessControl/interfaces/ITermsOfServiceAllowList.sol @@ -17,7 +17,8 @@ interface ITermsOfServiceAllowList { ) external returns (bool); /// @notice Get a list of all allowed senders - /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is + /// designed /// to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that /// this function has an unbounded cost, and using it as part of a state-changing function may render the function /// uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. @@ -77,7 +78,8 @@ interface ITermsOfServiceAllowList { ) external view returns (address[] memory blockedSenders); /// @notice Enables migrating any previously allowed senders to the new contract - /// @param previousSendersToAdd - List of addresses to migrate. These address must be allowed on the previous ToS contract and not blocked + /// @param previousSendersToAdd - List of addresses to migrate. These address must be allowed on the previous ToS + /// contract and not blocked function migratePreviouslyAllowedSenders( address[] memory previousSendersToAdd ) external; @@ -87,6 +89,7 @@ interface ITermsOfServiceAllowList { // | Configuration state | // ================================================================ struct TermsOfServiceAllowListConfig { - bool enabled; // ═════════════╗ When enabled, access will be checked against s_allowedSenders. When disabled, all access will be allowed. + bool enabled; // ═════════════╗ When enabled, access will be checked against + // s_allowedSenders. When disabled, all access will be allowed. address signerPublicKey; // ══╝ The key pair that needs to sign the acceptance data } diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol index 1c6c3fd82f..e8dfe91fa4 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsBilling.sol @@ -13,7 +13,8 @@ interface IFunctionsBilling { function getUsdPerUnitLink() external view returns (uint256, uint8); /// @notice Determine the fee that will be split between Node Operators for servicing a request - /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request + /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a + /// request /// @return fee - Cost in Juels (1e18) of LINK function getDONFeeJuels( bytes memory requestCBOR @@ -27,7 +28,8 @@ interface IFunctionsBilling { /// @return fee - Cost in Juels (1e18) of LINK function getAdminFeeJuels() external view returns (uint72); - /// @notice Estimate the total cost that will be charged to a subscription to make a request: transmitter gas re-reimbursement, plus DON fee, plus Registry fee + /// @notice Estimate the total cost that will be charged to a subscription to make a request: transmitter gas + /// re-reimbursement, plus DON fee, plus Registry fee /// @param - subscriptionId An identifier of the billing account /// @param - data Encoded Chainlink Functions request data, use FunctionsClient API to encode a request /// @param - callbackGasLimit Gas limit for the fulfillment callback @@ -53,7 +55,8 @@ interface IFunctionsBilling { function oracleWithdraw(address recipient, uint96 amount) external; /// @notice Withdraw all LINK earned by Oracles through fulfilling requests - /// @dev transmitter addresses must support LINK tokens to avoid tokens from getting stuck as oracleWithdrawAll() calls will forward tokens directly to transmitters + /// @dev transmitter addresses must support LINK tokens to avoid tokens from getting stuck as oracleWithdrawAll() + /// calls will forward tokens directly to transmitters function oracleWithdrawAll() external; } @@ -62,17 +65,30 @@ interface IFunctionsBilling { // ================================================================ struct FunctionsBillingConfig { - uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for changes in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) - uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and fallback to fallbackNativePerUnitLink. Default of 0 means no fallback. - uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment callback. This amount is always billed for every request. - uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment callback. This amount is always billed for every request. - uint40 minimumEstimateGasPriceWei; // ║ The lowest amount of wei that will be used as the tx.gasprice when estimating the cost to fulfill the request - uint16 maxSupportedRequestDataVersion; // ║ The highest support request data version supported by the node. All lower versions should also be supported. + uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for changes + // in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) + uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and + // fallback to fallbackNativePerUnitLink. Default of 0 means no fallback. + uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment + // callback. This amount is always billed for every request. + uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment + // callback. This amount is always billed for every request. + uint40 minimumEstimateGasPriceWei; // ║ The lowest amount of wei that will be used as the tx.gasprice + // when estimating the cost to fulfill the request + uint16 maxSupportedRequestDataVersion; // ║ The highest support request data version supported by the node. + // All lower versions should also be supported. uint64 fallbackUsdPerUnitLink; // ║ Fallback LINK / USD conversion rate if the data feed is stale - uint8 fallbackUsdPerUnitLinkDecimals; // ════════╝ Fallback LINK / USD conversion rate decimal places if the data feed is stale - uint224 fallbackNativePerUnitLink; // ═══════════╗ Fallback NATIVE CURRENCY / LINK conversion rate if the data feed is stale - uint32 requestTimeoutSeconds; // ════════════════╝ How many seconds it takes before we consider a request to be timed out - uint16 donFeeCentsUsd; // ═══════════════════════════════╗ Additional flat fee (denominated in cents of USD, paid as LINK) that will be split between Node Operators. - uint16 operationFeeCentsUsd; // ║ Additional flat fee (denominated in cents of USD, paid as LINK) that will be paid to the owner of the Coordinator contract. - uint16 transmitTxSizeBytes; // ══════════════════════════╝ The size of the calldata for the transmit transaction in bytes assuming a single 256 byte response payload. Used to estimate L1 cost for fulfillments on L2 chains. + uint8 fallbackUsdPerUnitLinkDecimals; // ════════╝ Fallback LINK / USD conversion rate decimal + // places if the data feed is stale + uint224 fallbackNativePerUnitLink; // ═══════════╗ Fallback NATIVE CURRENCY / LINK conversion + // rate if the data feed is stale + uint32 requestTimeoutSeconds; // ════════════════╝ How many seconds it takes before + // we consider a request to be timed out + uint16 donFeeCentsUsd; // ═══════════════════════════════╗ + // Additional flat fee (denominated in cents of USD, paid as LINK) that will be split between Node Operators. + uint16 operationFeeCentsUsd; // ║ Additional flat fee (denominated in cents of USD, paid as + // LINK) that will be paid to the owner of the Coordinator contract. + uint16 transmitTxSizeBytes; // ══════════════════════════╝ The + // size of the calldata for the transmit transaction in bytes assuming a single 256 byte response payload. Used to + // estimate L1 cost for fulfillments on L2 chains. } diff --git a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol index de074d6373..61de0fc343 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/interfaces/IFunctionsSubscriptions.sol @@ -6,7 +6,8 @@ import {FunctionsResponse} from "../libraries/FunctionsResponse.sol"; /// @title Chainlink Functions Subscription interface. interface IFunctionsSubscriptions { struct Subscription { - uint96 balance; // ═════════╗ Common LINK balance that is controlled by the Router to be used for all consumer requests. + uint96 balance; // ═════════╗ Common LINK balance that is controlled by the Router to be used + // for all consumer requests. address owner; // ══════════╝ The owner can fund/withdraw/cancel the subscription. uint96 blockedBalance; // ══╗ LINK balance that is reserved to pay for pending consumer requests. address proposedOwner; // ══╝ For safely transferring sub ownership. diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol index 530e9c6120..c4482a15d0 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/ChainSpecificUtil.sol @@ -12,8 +12,10 @@ library ChainSpecificUtil { /// @dev reference: https://github.com/OffchainLabs/nitro/blob/v2.0.14/contracts/src/precompiles/ArbGasInfo.sol#L10 address private constant ARBGAS_ADDR = address(0x000000000000000000000000000000000000006C); ArbGasInfo private constant ARBGAS = ArbGasInfo(ARBGAS_ADDR); - /// @dev ARB_DATA_PADDING_SIZE is the max size of the "static" data on Arbitrum for the transaction which refers to the tx data that is not the calldata (signature, etc.) - /// @dev reference: https://docs.arbitrum.io/build-decentralized-apps/how-to-estimate-gas#where-do-we-get-all-this-information-from + /// @dev ARB_DATA_PADDING_SIZE is the max size of the "static" data on Arbitrum for the transaction which refers to + /// the tx data that is not the calldata (signature, etc.) + /// @dev reference: + /// https://docs.arbitrum.io/build-decentralized-apps/how-to-estimate-gas#where-do-we-get-all-this-information-from uint256 private constant ARB_DATA_PADDING_SIZE = 140; uint256 private constant ARB_MAINNET_CHAIN_ID = 42_161; diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol index 2170ae67f3..e8132a081e 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsRequest.sol @@ -23,11 +23,17 @@ library FunctionsRequest { // In future version we may add other languages struct Request { - Location codeLocation; // ════════════╸ The location of the source code that will be executed on each node in the DON - Location secretsLocation; // ═════════╸ The location of secrets that will be passed into the source code. *Only Remote secrets are supported + Location codeLocation; // ════════════╸ The location of the source code that will be + // executed on each node in the DON + Location secretsLocation; // ═════════╸ The location of secrets that will be passed into the + // source code. *Only Remote secrets are supported CodeLanguage language; // ════════════╸ The coding language that the source code is written in - string source; // ════════════════════╸ Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted - bytes encryptedSecretsReference; // ══╸ Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets()) + string source; // ════════════════════╸ Raw source code for + // Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal + // number for Request.codeLocation of Location.DONHosted + bytes encryptedSecretsReference; // ══╸ Encrypted URLs for Request.secretsLocation of Location.Remote (use + // addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use + // addDONHostedSecrets()) string[] args; // ════════════════════╸ String arguments that will be passed into the source code bytes[] bytesArgs; // ════════════════╸ Bytes arguments that will be passed into the source code } diff --git a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol index eb7eb60266..409c8191d2 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/libraries/FunctionsResponse.sol @@ -5,11 +5,14 @@ pragma solidity ^0.8.19; library FunctionsResponse { // Used to send request information from the Router to the Coordinator struct RequestMeta { - bytes data; // ══════════════════╸ CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request + bytes data; // ══════════════════╸ CBOR encoded Chainlink Functions request + // data, use FunctionsRequest library to encode a request bytes32 flags; // ═══════════════╸ Per-subscription flags address requestingContract; // ══╗ The client contract that is sending the request - uint96 availableBalance; // ═════╝ Common LINK balance of the subscription that is controlled by the Router to be used for all consumer requests. - uint72 adminFee; // ═════════════╗ Flat fee (in Juels of LINK) that will be paid to the Router Owner for operation of the network + uint96 availableBalance; // ═════╝ Common LINK balance of the subscription that is controlled by the + // Router to be used for all consumer requests. + uint72 adminFee; // ═════════════╗ Flat fee (in Juels of LINK) that will be paid to the + // Router Owner for operation of the network uint64 subscriptionId; // ║ Identifier of the billing subscription that will be charged for the request uint64 initiatedRequests; // ║ The number of requests that have been started uint32 callbackGasLimit; // ║ The amount of gas that the callback to the consuming contract will be given @@ -32,12 +35,15 @@ library FunctionsResponse { struct Commitment { bytes32 requestId; // ═════════════════╸ A unique identifier for a Chainlink Functions request address coordinator; // ═══════════════╗ The Coordinator contract that manages the DON that is servicing a request - uint96 estimatedTotalCostJuels; // ════╝ The maximum cost in Juels (1e18) of LINK that will be charged to fulfill a request + uint96 estimatedTotalCostJuels; // ════╝ The maximum cost in Juels (1e18) of LINK that will be charged to + // fulfill a request address client; // ════════════════════╗ The client contract that sent the request uint64 subscriptionId; // ║ Identifier of the billing subscription that will be charged for the request uint32 callbackGasLimit; // ═══════════╝ The amount of gas that the callback to the consuming contract will be given - uint72 adminFee; // ═══════════════════╗ Flat fee (in Juels of LINK) that will be paid to the Router Owner for operation of the network - uint72 donFee; // ║ Fee (in Juels of LINK) that will be split between Node Operators for servicing a request + uint72 adminFee; // ═══════════════════╗ Flat fee (in Juels of LINK) that + // will be paid to the Router Owner for operation of the network + uint72 donFee; // ║ Fee (in Juels of LINK) that will be split between Node Operators for + // servicing a request uint40 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment callback. uint40 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment callback. uint32 timeoutTimestamp; // ═══════════╝ The timestamp at which a request will be eligible to be timed out diff --git a/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol index b859a20f88..3513adb2d5 100644 --- a/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/dev/v1_X/ocr/OCR2Base.sol @@ -270,7 +270,8 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in + // _report + rs.length * 32 // 32 bytes per entry in _rs + ss.length * 32 // 32 bytes per entry in _ss + 0; // placeholder @@ -313,8 +314,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { emit Transmitted(configDigest, uint32(epochAndRound >> 8)); - // The following check is disabled to allow both current and proposed routes to submit reports using the same OCR config digest - // Chainlink Functions uses globally unique request IDs. Metadata about the request is stored and checked in the Coordinator and Router + // The following check is disabled to allow both current and proposed routes to submit reports using the same OCR + // config digest + // Chainlink Functions uses globally unique request IDs. Metadata about the request is stored and checked in the + // Coordinator and Router // require(configInfo.latestConfigDigest == configDigest, "configDigest mismatch"); _requireExpectedMsgDataLength(report, rs, ss); diff --git a/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol b/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol index 8bb967771b..29ab31a13e 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/ChainSpecificUtil.t.sol @@ -102,7 +102,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Arbitrum is FunctionsFulfillmentS /// @notice #_getL1FeeUpperLimit Optimism /// @dev Optimism gas formula: https://docs.optimism.io/stack/transactions/fees#ecotone /// @dev Note that the docs fail to mention the calculation also requires a division by 10^6 -/// @dev See here: https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da +/// @dev See here: +/// https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da /// @dev Also, we conservatively assume all non-zero bytes: tx_compressed_size = tx_data_size_bytes contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentSetup { address private constant GAS_PRICE_ORACLE_ADDR = address(0x420000000000000000000000000000000000000F); @@ -187,7 +188,8 @@ contract ChainSpecificUtil__getL1FeeUpperLimit_Optimism is FunctionsFulfillmentS } /// @notice #_getL1FeeUpperLimit Base -/// @dev Base gas formula uses Optimism formula since it is build on the OP chain stack (See comments above for Optimism tests) +/// @dev Base gas formula uses Optimism formula since it is build on the OP chain stack (See comments above for Optimism +/// tests) contract ChainSpecificUtil__getL1FeeUpperLimit_Base is FunctionsFulfillmentSetup { address private constant GAS_PRICE_ORACLE_ADDR = address(0x420000000000000000000000000000000000000F); GasPriceOracle private constant GAS_PRICE_ORACLE = GasPriceOracle(GAS_PRICE_ORACLE_ADDR); diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol index e608d137ac..e1347b30de 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsBilling.t.sol @@ -83,7 +83,8 @@ contract FunctionsBilling_UpdateConfig is FunctionsRouterSetup { event ConfigUpdated(FunctionsBillingConfig config); function test_UpdateConfig_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -301,7 +302,8 @@ contract FunctionsBilling__FulfillAndBill is FunctionsClientRequestSetup { uint96 callbackCostGas = 5072; // Taken manually uint96 callbackCostJuels = juelsPerGas * callbackCostGas; - // topic0 (function signature, always checked), check topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), check topic1 (true), NOT topic2 (false), NOT topic3 (false), and + // data (true). bool checkTopic1 = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -343,7 +345,8 @@ contract FunctionsBilling_DeleteCommitment is FunctionsClientRequestSetup { vm.stopPrank(); vm.startPrank(address(s_functionsRouter)); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol index f340441d84..72c1299d89 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsClient.t.sol @@ -60,7 +60,8 @@ contract FunctionsClient_HandleOracleFulfillment is FunctionsClientRequestSetup vm.stopPrank(); vm.startPrank(address(s_functionsRouter)); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol index 1a322ba804..7e01e1f67f 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsRouter.t.sol @@ -89,7 +89,8 @@ contract FunctionsRouter_UpdateConfig is FunctionsRouterSetup { event ConfigUpdated(FunctionsRouter.Config config); function test_UpdateConfig_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -446,7 +447,8 @@ contract FunctionsRouter_SendRequest is FunctionsSubscriptionSetup { /// @notice #sendRequestToProposed contract FunctionsRouter_SendRequestToProposed is FunctionsSubscriptionSetup { - FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of helper + FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of + // helper function setUp() public virtual override { FunctionsSubscriptionSetup.setUp(); @@ -727,7 +729,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { bytes32 invalidRequestId = bytes32("this does not exist"); commitment.requestId = invalidRequestId; - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -761,7 +764,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { // Modify request commitment to have charge more than quoted commitment.estimatedTotalCostJuels = 10 * JUELS_PER_LINK; // 10 LINK - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -799,7 +803,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { // Coordinator sends enough gas that would get through callback and payment, but fail after uint256 gasToUse = getCoordinatorConfig().gasOverheadBeforeCallback + callbackGasLimit + 10_000; - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1RequestId = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -843,7 +848,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { bytes memory err = new bytes(0); errors[0] = err; - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1RequestId = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -877,7 +883,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { bytes memory err = new bytes(0); errors[0] = err; - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1RequestId = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -970,7 +977,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { bytes memory err = new bytes(0); errors[0] = err; - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1RequestId = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1014,7 +1022,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { bytes memory err = new bytes(0); errors[0] = err; - // topic0 (function signature, always checked), topic1: request ID(true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1: request ID(true), NOT topic2 (false), NOT topic3 (false), + // and data (true). vm.expectEmit(true, false, false, true); emit RequestProcessed({ requestId: s_requests[requestToFulfill].requestId, @@ -1080,7 +1089,8 @@ contract FunctionsRouter_Fulfill is FunctionsClientRequestSetup { bytes memory err = new bytes(0); errors[0] = err; - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1RequestId = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1130,7 +1140,8 @@ contract FunctionsRouter_GetContractById is FunctionsRoutesSetup { /// @notice #getProposedContractById contract FunctionsRouter_GetProposedContractById is FunctionsRoutesSetup { - FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of helper + FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of + // helper function setUp() public virtual override { FunctionsRoutesSetup.setUp(); @@ -1172,7 +1183,8 @@ contract FunctionsRouter_GetProposedContractById is FunctionsRoutesSetup { /// @notice #getProposedContractSet contract FunctionsRouter_GetProposedContractSet is FunctionsRoutesSetup { - FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of helper + FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of + // helper bytes32[] s_proposedContractSetIds; address[] s_proposedContractSetAddresses; @@ -1210,7 +1222,8 @@ contract FunctionsRouter_GetProposedContractSet is FunctionsRoutesSetup { /// @notice #proposeContractsUpdate contract FunctionsRouter_ProposeContractsUpdate is FunctionsRoutesSetup { - FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of helper + FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of + // helper bytes32[] s_proposedContractSetIds; address[] s_proposedContractSetAddresses; @@ -1290,7 +1303,8 @@ contract FunctionsRouter_ProposeContractsUpdate is FunctionsRoutesSetup { ); function test_ProposeContractsUpdate_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1308,7 +1322,8 @@ contract FunctionsRouter_ProposeContractsUpdate is FunctionsRoutesSetup { /// @notice #updateContracts contract FunctionsRouter_UpdateContracts is FunctionsRoutesSetup { - FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of helper + FunctionsCoordinatorTestHelper internal s_functionsCoordinator2; // TODO: use actual FunctionsCoordinator instead of + // helper bytes32[] s_proposedContractSetIds; address[] s_proposedContractSetAddresses; @@ -1341,7 +1356,8 @@ contract FunctionsRouter_UpdateContracts is FunctionsRoutesSetup { event ContractUpdated(bytes32 id, address from, address to); function test_UpdateContracts_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol index 002dfed988..99b8fa611f 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsSubscriptions.t.sol @@ -120,7 +120,8 @@ contract FunctionsSubscriptions_OwnerCancelSubscription is FunctionsSubscription function test_OwnerCancelSubscription_Success() public { uint256 subscriptionOwnerBalanceBefore = s_linkToken.balanceOf(OWNER_ADDRESS); - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1SubscriptionId = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -143,7 +144,8 @@ contract FunctionsSubscriptions_RecoverFunds is FunctionsRouterSetup { uint256 fundsTransferred = 1 * 1e18; // 1 LINK s_linkToken.transfer(address(s_functionsRouter), fundsTransferred); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -216,7 +218,8 @@ contract FunctionsSubscriptions_OracleWithdraw is FunctionsFulfillmentSetup { // vm.startPrank(address(s_functionsCoordinator)); // TODO: Use internal function helper contract to modify s_totalLinkBalance // uint96 amountToWithdraw = s_fulfillmentCoordinatorBalance; - // vm.expectRevert(abi.encodeWithSelector(FunctionsSubscriptions.TotalBalanceInvariantViolated.selector, 0, amountToWithdraw)); + // vm.expectRevert(abi.encodeWithSelector(FunctionsSubscriptions.TotalBalanceInvariantViolated.selector, 0, + // amountToWithdraw)); // s_functionsRouter.oracleWithdraw(NOP_TRANSMITTER_ADDRESS_1, amountToWithdraw); } @@ -273,7 +276,8 @@ contract FunctionsSubscriptions_OwnerWithdraw is FunctionsFulfillmentSetup { function test_OwnerWithdraw_RevertIfBalanceInvariant() public { // TODO: Use internal function helper contract to modify s_totalLinkBalance // uint96 amountToWithdraw = s_fulfillmentRouterOwnerBalance; - // vm.expectRevert(abi.encodeWithSelector(FunctionsSubscriptions.TotalBalanceInvariantViolated.selector, 0, amountToWithdraw)); + // vm.expectRevert(abi.encodeWithSelector(FunctionsSubscriptions.TotalBalanceInvariantViolated.selector, 0, + // amountToWithdraw)); // s_functionsRouter.ownerWithdraw(OWNER_ADDRESS, amountToWithdraw); } @@ -511,7 +515,8 @@ contract FunctionsSubscriptions_createSubscription is FunctionsOwnerAcceptTermsO event SubscriptionCreated(uint64 indexed subscriptionId, address owner); function test_CreateSubscription_Success() public { - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -556,7 +561,8 @@ contract FunctionsSubscriptions_CreateSubscriptionWithConsumer is FunctionsClien event SubscriptionConsumerAdded(uint64 indexed subscriptionId, address consumer); function test_CreateSubscriptionWithConsumer_Success() public { - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -682,7 +688,8 @@ contract FunctionsSubscriptions_ProposeSubscriptionOwnerTransfer is FunctionsSub event SubscriptionOwnerTransferRequested(uint64 indexed subscriptionId, address from, address to); function test_ProposeSubscriptionOwnerTransfer_Success() public { - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -695,7 +702,8 @@ contract FunctionsSubscriptions_ProposeSubscriptionOwnerTransfer is FunctionsSub } function test_ProposeSubscriptionOwnerTransfer_SuccessChangeProposedOwner() public { - // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), topic1 (true), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = true; bool checkTopic2 = false; bool checkTopic3 = false; @@ -806,7 +814,8 @@ contract FunctionsSubscriptions_AcceptSubscriptionOwnerTransfer is FunctionsSubs vm.stopPrank(); vm.startPrank(NEW_OWNER_ADDRESS_WITH_TOS); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -883,7 +892,8 @@ contract FunctionsSubscriptions_RemoveConsumer is FunctionsSubscriptionSetup { event SubscriptionConsumerRemoved(uint64 indexed subscriptionId, address consumer); function test_RemoveConsumer_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -975,7 +985,8 @@ contract FunctionsSubscriptions_AddConsumer is FunctionsSubscriptionSetup { event SubscriptionConsumerAdded(uint64 indexed subscriptionId, address consumer); function test_AddConsumer_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1056,7 +1067,8 @@ contract FunctionsSubscriptions_CancelSubscription is FunctionsSubscriptionSetup uint96 expectedRefund = 0; - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1091,7 +1103,8 @@ contract FunctionsSubscriptions_CancelSubscription is FunctionsSubscriptionSetup uint256 subscriptionOwnerBalanceBefore = s_linkToken.balanceOf(OWNER_ADDRESS); uint96 expectedRefund = (s_subscriptionInitialFunding * 2) - s_subscriptionDepositJuels; - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1127,7 +1140,8 @@ contract FunctionsSubscriptions_CancelSubscription_ReceiveDeposit is FunctionsFu uint256 subscriptionOwnerBalanceBefore = s_linkToken.balanceOf(OWNER_ADDRESS); uint96 expectedRefund = s_subscriptionInitialFunding - totalCostJuels; - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -1259,7 +1273,8 @@ contract FunctionsSubscriptions_TimeoutRequests is FunctionsClientRequestSetup { uint64 consumerCompletedRequestsBefore = s_functionsRouter.getConsumer(address(s_functionsClient), s_subscriptionId).completedRequests; - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; diff --git a/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol b/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol index 38981d0f3c..e1da6248bd 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/FunctionsTermsOfServiceAllowList.t.sol @@ -48,7 +48,8 @@ contract FunctionsTermsOfServiceAllowList_UpdateConfig is FunctionsRoutesSetup { TermsOfServiceAllowListConfig memory configToSet = TermsOfServiceAllowListConfig({enabled: false, signerPublicKey: TOS_SIGNER}); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -185,7 +186,8 @@ contract FunctionsTermsOfServiceAllowList_AcceptTermsOfService is FunctionsRoute bytes32 prefixedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", message)); (uint8 v, bytes32 r, bytes32 s) = vm.sign(TOS_SIGNER_PRIVATE_KEY, prefixedMessage); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -217,7 +219,8 @@ contract FunctionsTermsOfServiceAllowList_AcceptTermsOfService is FunctionsRoute bytes32 prefixedMessage = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", message)); (uint8 v, bytes32 r, bytes32 s) = vm.sign(TOS_SIGNER_PRIVATE_KEY, prefixedMessage); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -370,7 +373,8 @@ contract FunctionsTermsOfServiceAllowList_BlockSender is FunctionsRoutesSetup { function test_BlockSender_Success() public { assertFalse(s_termsOfServiceAllowList.isBlockedSender(STRANGER_ADDRESS)); - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; @@ -411,7 +415,8 @@ contract FunctionsTermsOfServiceAllowList_UnblockSender is FunctionsRoutesSetup event UnblockedAccess(address user); function test_UnblockSender_Success() public { - // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data (true). + // topic0 (function signature, always checked), NOT topic1 (false), NOT topic2 (false), NOT topic3 (false), and data + // (true). bool checkTopic1 = false; bool checkTopic2 = false; bool checkTopic3 = false; diff --git a/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol b/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol index d6e9bc3375..cff4b795a9 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/Gas.t.sol @@ -172,7 +172,8 @@ contract Gas_FulfillRequest_Setup is FunctionsClientRequestSetup { // Deploy consumer that has large revert return data s_functionsClientWithMaximumReturnData = new FunctionsClientTestHelper(address(s_functionsRouter)); s_functionsClientWithMaximumReturnData.setRevertFulfillRequest(true); - string memory revertMessage = _makeStringOfBytesSize(30_000); // 30kb - FunctionsRouter cuts off response at MAX_CALLBACK_RETURN_BYTES = 4 + 4 * 32 = 132bytes, go well above that + string memory revertMessage = _makeStringOfBytesSize(30_000); // 30kb - FunctionsRouter cuts off response at + // MAX_CALLBACK_RETURN_BYTES = 4 + 4 * 32 = 132bytes, go well above that s_functionsClientWithMaximumReturnData.setRevertFulfillRequestMessage(revertMessage); s_functionsRouter.addConsumer(s_subscriptionId, address(s_functionsClientWithMaximumReturnData)); } @@ -227,7 +228,8 @@ contract Gas_FulfillRequest_Setup is FunctionsClientRequestSetup { { // Send requests minimum gas test uint8 requestsToSend = 1; - uint8 requestNumberOffset = 3; // the setup already has request #1 sent, and the previous test case uses request #2, start from request #3 + uint8 requestNumberOffset = 3; // the setup already has request #1 sent, and the previous test case uses request + // #2, start from request #3 string memory sourceCode = "return Functions.encodeString('hello world');"; bytes memory secrets = new bytes(0); diff --git a/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol b/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol index 2d80887d34..d21f25a288 100644 --- a/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_X/Setup.t.sol @@ -20,7 +20,8 @@ import {ZKSyncFunctionsRouter, ZKSyncFunctionsRouterHarness} from "./testhelpers import "forge-std/Vm.sol"; -/// @notice Set up to deploy the following contracts: FunctionsRouter, FunctionsCoordinator, LINK/ETH Feed, ToS Allow List, and LINK token +/// @notice Set up to deploy the following contracts: FunctionsRouter, FunctionsCoordinator, LINK/ETH Feed, ToS Allow +/// List, and LINK token contract FunctionsRouterSetup is BaseTest { FunctionsRouterHarness internal s_functionsRouter; FunctionsCoordinatorHarness internal s_functionsCoordinator; @@ -30,7 +31,8 @@ contract FunctionsRouterSetup is BaseTest { MockLinkToken internal s_linkToken; uint16 internal s_maxConsumersPerSubscription = 3; - uint72 internal s_adminFee = 0; // Keep as 0. Setting this to anything else will cause fulfillments to fail with INVALID_COMMITMENT + uint72 internal s_adminFee = 0; // Keep as 0. Setting this to anything else will cause fulfillments to fail with + // INVALID_COMMITMENT uint16 internal s_donFee = 100; // $1 uint16 internal s_operationFee = 100; // $1 bytes4 internal s_handleOracleFulfillmentSelector = 0x0ca76175; @@ -102,13 +104,15 @@ contract FunctionsRouterSetup is BaseTest { } } -/// @notice Set up to deploy the following contracts: FunctionsRouter, FunctionsCoordinator, LINK/ETH Feed, ToS Allow List, and LINK token +/// @notice Set up to deploy the following contracts: FunctionsRouter, FunctionsCoordinator, LINK/ETH Feed, ToS Allow +/// List, and LINK token contract ZKSyncFunctionsRouterSetup is BaseTest { ZKSyncFunctionsRouterHarness internal s_functionsRouter; MockLinkToken internal s_linkToken; uint16 internal s_maxConsumersPerSubscription = 3; - uint72 internal s_adminFee = 0; // Keep as 0. Setting this to anything else will cause fulfillments to fail with INVALID_COMMITMENT + uint72 internal s_adminFee = 0; // Keep as 0. Setting this to anything else will cause fulfillments to fail with + // INVALID_COMMITMENT bytes4 internal s_handleOracleFulfillmentSelector = 0x0ca76175; uint16 s_subscriptionDepositMinimumRequests = 1; uint72 s_subscriptionDepositJuels = 11 * JUELS_PER_LINK; @@ -252,7 +256,8 @@ contract FunctionsClientSetup is FunctionsOwnerAcceptTermsOfServiceSetup { } } -/// @notice Set up to create a subscription, add the consumer contract as a consumer of the subscription, and fund the subscription with 's_subscriptionInitialFunding' +/// @notice Set up to create a subscription, add the consumer contract as a consumer of the subscription, and fund the +/// subscription with 's_subscriptionInitialFunding' contract FunctionsSubscriptionSetup is FunctionsClientSetup { uint64 s_subscriptionId; uint96 s_subscriptionInitialFunding = 10 * JUELS_PER_LINK; // 10 LINK @@ -290,7 +295,8 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { struct Request { RequestData requestData; bytes32 requestId; - FunctionsResponse.Commitment commitment; // Offchain commitment that contains operation fee in the place of admin fee + FunctionsResponse.Commitment commitment; // Offchain commitment that contains operation fee in the place of admin + // fee FunctionsResponse.Commitment commitmentOnchain; // Commitment that is persisted as a hash in the Router } @@ -354,8 +360,10 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { /// @notice Send a request and store information about it in s_requests /// @param requestNumberKey - the key that the request will be stored in `s_requests` in - /// @param sourceCode - Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted - /// @param secrets - Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets()) + /// @param sourceCode - Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of + /// Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted + /// @param secrets - Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or + /// CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets()) /// @param args - String arguments that will be passed into the source code /// @param bytesArgs - Bytes arguments that will be passed into the source code /// @param callbackGasLimit - Gas limit for the fulfillment callback @@ -413,12 +421,15 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { /// @notice Send a request and store information about it in s_requests /// @param requestNumberKey - the key that the request will be stored in `s_requests` in - /// @param sourceCode - Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted - /// @param secrets - Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets()) + /// @param sourceCode - Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of + /// Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted + /// @param secrets - Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or + /// CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets()) /// @param args - String arguments that will be passed into the source code /// @param bytesArgs - Bytes arguments that will be passed into the source code /// @param callbackGasLimit - Gas limit for the fulfillment callback - /// @dev @param client - The consumer contract to send the request from (overloaded to fill client with s_functionsClient) + /// @dev @param client - The consumer contract to send the request from (overloaded to fill client with + /// s_functionsClient) function _sendAndStoreRequest( uint256 requestNumberKey, string memory sourceCode, @@ -526,14 +537,22 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { return Report({report: report, reportContext: reportContext, rs: rawRs, ss: rawSs, vs: rawVs}); } - /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON & Admin - /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of the requests, that will be added to the report - /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. - /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. + /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON + /// & Admin + /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of + /// the requests, that will be added to the report + /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. + /// result[index] or errors[index], only one of should be filled. + /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] + /// or errors[index], only one of should be filled. /// @param transmitter - The address that will send the `.report` transaction - /// @param expectedToSucceed - Boolean representing if the report transmission is expected to produce a RequestProcessed event for every fulfillment. If not, we ignore retrieving the event log. - /// @param requestProcessedStartIndex - On a successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) - /// @param transmitterGasToUse - Override the default amount of gas that the transmitter sends the `.report` transaction with + /// @param expectedToSucceed - Boolean representing if the report transmission is expected to produce a + /// RequestProcessed event for every fulfillment. If not, we ignore retrieving the event log. + /// @param requestProcessedStartIndex - On a successful fulfillment the Router will emit a RequestProcessed event. To + /// grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This + /// can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) + /// @param transmitterGasToUse - Override the default amount of gas that the transmitter sends the `.report` + /// transaction with function _reportAndStore( uint256[] memory requestNumberKeys, string[] memory results, @@ -585,14 +604,22 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { vm.startPrank(OWNER_ADDRESS, OWNER_ADDRESS); } - /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON & Admin - /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of the requests, that will be added to the report - /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. - /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. + /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON + /// & Admin + /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of + /// the requests, that will be added to the report + /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. + /// result[index] or errors[index], only one of should be filled. + /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] + /// or errors[index], only one of should be filled. /// @param transmitter - The address that will send the `.report` transaction - /// @param expectedToSucceed - Boolean representing if the report transmission is expected to produce a RequestProcessed event for every fulfillment. If not, we ignore retrieving the event log. - /// @param requestProcessedIndex - On a successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) - /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction with the default amount of gas + /// @param expectedToSucceed - Boolean representing if the report transmission is expected to produce a + /// RequestProcessed event for every fulfillment. If not, we ignore retrieving the event log. + /// @param requestProcessedIndex - On a successful fulfillment the Router will emit a RequestProcessed event. To grab + /// that event we must know the order at which this event was thrown in the report transmission lifecycle. This can + /// change depending on the test setup (e.g. the Client contract gives an extra event during its callback) + /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction + /// with the default amount of gas function _reportAndStore( uint256[] memory requestNumberKeys, string[] memory results, @@ -604,14 +631,23 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { _reportAndStore(requestNumberKeys, results, errors, transmitter, expectedToSucceed, requestProcessedIndex, 0); } - /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON & Admin - /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of the requests, that will be added to the report - /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. - /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. + /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON + /// & Admin + /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of + /// the requests, that will be added to the report + /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. + /// result[index] or errors[index], only one of should be filled. + /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] + /// or errors[index], only one of should be filled. /// @param transmitter - The address that will send the `.report` transaction - /// @param expectedToSucceed - Boolean representing if the report transmission is expected to produce a RequestProcessed event for every fulfillment. If not, we ignore retrieving the event log. - /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) - /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction with the default amount of gas + /// @param expectedToSucceed - Boolean representing if the report transmission is expected to produce a + /// RequestProcessed event for every fulfillment. If not, we ignore retrieving the event log. + /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a + /// successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at + /// which this event was thrown in the report transmission lifecycle. This can change depending on the test setup + /// (e.g. the Client contract gives an extra event during its callback) + /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction + /// with the default amount of gas function _reportAndStore( uint256[] memory requestNumberKeys, string[] memory results, @@ -622,14 +658,23 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { _reportAndStore(requestNumberKeys, results, errors, transmitter, expectedToSucceed, 3); } - /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON & Admin - /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of the requests, that will be added to the report - /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. - /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. + /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON + /// & Admin + /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of + /// the requests, that will be added to the report + /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. + /// result[index] or errors[index], only one of should be filled. + /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] + /// or errors[index], only one of should be filled. /// @param transmitter - The address that will send the `.report` transaction - /// @dev @param expectedToSucceed is overloaded to give the value as true - The report transmission is expected to produce a RequestProcessed event for every fulfillment - /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) - /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction with the default amount of gas + /// @dev @param expectedToSucceed is overloaded to give the value as true - The report transmission is expected to + /// produce a RequestProcessed event for every fulfillment + /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a + /// successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at + /// which this event was thrown in the report transmission lifecycle. This can change depending on the test setup + /// (e.g. the Client contract gives an extra event during its callback) + /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction + /// with the default amount of gas function _reportAndStore( uint256[] memory requestNumberKeys, string[] memory results, @@ -639,14 +684,24 @@ contract FunctionsClientRequestSetup is FunctionsSubscriptionSetup { _reportAndStore(requestNumberKeys, results, errors, transmitter, true); } - /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON & Admin - /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of the requests, that will be added to the report - /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. - /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] or errors[index], only one of should be filled. - /// @dev @param transmitter is overloaded to give the value of transmitter #1 - The address that will send the `.report` transaction - /// @dev @param expectedToSucceed is overloaded to give the value as true - The report transmission is expected to produce a RequestProcessed event for every fulfillment - /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at which this event was thrown in the report transmission lifecycle. This can change depending on the test setup (e.g. the Client contract gives an extra event during its callback) - /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction with the default amount of gas + /// @notice Provide a response from the DON to fulfill one or more requests and store the updated balances of the DON + /// & Admin + /// @param requestNumberKeys - One or more requestNumberKeys that were used to store the request in `s_requests` of + /// the requests, that will be added to the report + /// @param results - The result that will be sent to the consumer contract's callback. For each index, e.g. + /// result[index] or errors[index], only one of should be filled. + /// @param errors - The error that will be sent to the consumer contract's callback. For each index, e.g. result[index] + /// or errors[index], only one of should be filled. + /// @dev @param transmitter is overloaded to give the value of transmitter #1 - The address that will send the + /// `.report` transaction + /// @dev @param expectedToSucceed is overloaded to give the value as true - The report transmission is expected to + /// produce a RequestProcessed event for every fulfillment + /// @dev @param requestProcessedIndex is overloaded to give requestProcessedIndex as 3 (happy path value)] - On a + /// successful fulfillment the Router will emit a RequestProcessed event. To grab that event we must know the order at + /// which this event was thrown in the report transmission lifecycle. This can change depending on the test setup + /// (e.g. the Client contract gives an extra event during its callback) + /// @dev @param transmitterGasToUse is overloaded to give transmitterGasToUse as 0] - Sends the `.report` transaction + /// with the default amount of gas function _reportAndStore(uint256[] memory requestNumberKeys, string[] memory results, bytes[] memory errors) internal { _reportAndStore(requestNumberKeys, results, errors, NOP_TRANSMITTER_ADDRESS_1); } @@ -672,7 +727,8 @@ contract FunctionsFulfillmentSetup is FunctionsClientRequestSetup { } } -/// @notice Set up to send and fulfill two more requests, s_request[2] reported by transmitter #2 and s_request[3] reported by transmitter #3 +/// @notice Set up to send and fulfill two more requests, s_request[2] reported by transmitter #2 and s_request[3] +/// reported by transmitter #3 contract FunctionsMultipleFulfillmentsSetup is FunctionsFulfillmentSetup { function setUp() public virtual override { FunctionsFulfillmentSetup.setUp(); diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol index 53ad186095..25882ee38f 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsBilling.sol @@ -31,14 +31,22 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ struct Config { - uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for changes in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) - uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and fallback to fallbackNativePerUnitLink. - uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment callback. This amount is always billed for every request. - uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment callback. This amount is always billed for every request. - uint32 requestTimeoutSeconds; // ║ How many seconds it takes before we consider a request to be timed out - uint72 donFee; // ║ Additional flat fee (in Juels of LINK) that will be split between Node Operators. Max value is 2^80 - 1 == 1.2m LINK. - uint16 maxSupportedRequestDataVersion; // ═══════╝ The highest support request data version supported by the node. All lower versions should also be supported. - uint224 fallbackNativePerUnitLink; // ═══════════╸ fallback NATIVE CURRENCY / LINK conversion rate if the data feed is stale + uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for + // changes in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) + uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and + // fallback to fallbackNativePerUnitLink. + uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the + // fulfillment callback. This amount is always billed for every request. + uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment + // callback. This amount is always billed for every request. + uint32 requestTimeoutSeconds; // ║ How many seconds it takes before we consider a request to be + // timed out + uint72 donFee; // ║ Additional flat fee (in Juels of LINK) that will be split + // between Node Operators. Max value is 2^80 - 1 == 1.2m LINK. + uint16 maxSupportedRequestDataVersion; // ═══════╝ The highest support request data version + // supported by the node. All lower versions should also be supported. + uint224 fallbackNativePerUnitLink; // ═══════════╸ fallback NATIVE CURRENCY / LINK + // conversion rate if the data feed is stale } Config private s_config; @@ -238,7 +246,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return keccak256(abi.encode(don, client, subscriptionId, nonce)); } - /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then charging the subscription + /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then + /// charging the subscription /// @param requestId identifier for the request that was generated by the Registry in the beginBilling commitment /// @param response response data from DON consensus /// @param err error from DON consensus diff --git a/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol b/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol index 3450d8198e..e9cc9c5e2f 100644 --- a/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol +++ b/contracts/src/v0.8/functions/v1_0_0/FunctionsRouter.sol @@ -82,13 +82,20 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, // | Configuration state | // ================================================================ struct Config { - uint16 maxConsumersPerSubscription; // ═════════╗ Maximum number of consumers which can be added to a single subscription. This bound ensures we are able to loop over all subscription consumers as needed, without exceeding gas limits. Should a user require more consumers, they can use multiple subscriptions. - uint72 adminFee; // ║ Flat fee (in Juels of LINK) that will be paid to the Router owner for operation of the network - bytes4 handleOracleFulfillmentSelector; // ║ The function selector that is used when calling back to the Client contract - uint16 gasForCallExactCheck; // ════════════════╝ Used during calling back to the client. Ensures we have at least enough gas to be able to revert if gasAmount > 63//64*gas available. + uint16 maxConsumersPerSubscription; // ═════════╗ Maximum number of consumers which can be added + // to a single subscription. This bound ensures we are able to loop over all subscription consumers as needed, + // without exceeding gas limits. Should a user require more consumers, they can use multiple subscriptions. + uint72 adminFee; // ║ Flat fee (in Juels of LINK) that will be paid to the Router + // owner for operation of the network + bytes4 handleOracleFulfillmentSelector; // ║ The function selector that is used when calling back to the + // Client contract + uint16 gasForCallExactCheck; // ════════════════╝ Used during calling back to the + // client. Ensures we have at least enough gas to be able to revert if gasAmount > 63//64*gas available. uint32[] maxCallbackGasLimits; // ══════════════╸ List of max callback gas limits used by flag with GAS_FLAG_INDEX - uint16 subscriptionDepositMinimumRequests; //═══╗ Amount of requests that must be completed before the full subscription balance will be released when closing a subscription account. - uint72 subscriptionDepositJuels; // ════════════╝ Amount of subscription funds that are held as a deposit until Config.subscriptionDepositMinimumRequests are made using the subscription. + uint16 subscriptionDepositMinimumRequests; //═══╗ Amount of requests that must be completed before the full + // subscription balance will be released when closing a subscription account. + uint72 subscriptionDepositJuels; // ════════════╝ Amount of subscription funds that are + // held as a deposit until Config.subscriptionDepositMinimumRequests are made using the subscription. } Config private s_config; @@ -506,7 +513,8 @@ contract FunctionsRouter is IFunctionsRouter, FunctionsSubscriptions, Pausable, address proposedContract = proposedContractSetAddresses[i]; if ( proposedContract == address(0) // The Proposed address must be a valid address - || s_route[id] == proposedContract // The Proposed address must point to a different address than what is currently set + || s_route[id] == proposedContract // The Proposed address must point to a different address than what is + // currently set ) { revert InvalidProposal(); } diff --git a/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol index f3ad0ee1bd..5c43fa160a 100644 --- a/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_0_0/accessControl/TermsOfServiceAllowList.sol @@ -33,7 +33,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, // | Configuration state | // ================================================================ struct Config { - bool enabled; // ═════════════╗ When enabled, access will be checked against s_allowedSenders. When disabled, all access will be allowed. + bool enabled; // ═════════════╗ When enabled, access will be checked against + // s_allowedSenders. When disabled, all access will be allowed. address signerPublicKey; // ══╝ The key pair that needs to sign the acceptance data } diff --git a/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol index 5b5d76b2cf..3b8e038a08 100644 --- a/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol @@ -17,7 +17,8 @@ interface ITermsOfServiceAllowList { ) external returns (bool); /// @notice Get a list of all allowed senders - /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is + /// designed /// to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that /// this function has an unbounded cost, and using it as part of a state-changing function may render the function /// uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol index 1b04a7d94e..9a5137ceac 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsBilling.sol @@ -8,7 +8,8 @@ interface IFunctionsBilling { function getWeiPerUnitLink() external view returns (uint256); /// @notice Determine the fee that will be split between Node Operators for servicing a request - /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request + /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a + /// request /// @return fee - Cost in Juels (1e18) of LINK function getDONFee( bytes memory requestCBOR @@ -18,7 +19,8 @@ interface IFunctionsBilling { /// @return fee - Cost in Juels (1e18) of LINK function getAdminFee() external view returns (uint72); - /// @notice Estimate the total cost that will be charged to a subscription to make a request: transmitter gas re-reimbursement, plus DON fee, plus Registry fee + /// @notice Estimate the total cost that will be charged to a subscription to make a request: transmitter gas + /// re-reimbursement, plus DON fee, plus Registry fee /// @param - subscriptionId An identifier of the billing account /// @param - data Encoded Chainlink Functions request data, use FunctionsClient API to encode a request /// @param - callbackGasLimit Gas limit for the fulfillment callback diff --git a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol index de074d6373..61de0fc343 100644 --- a/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol +++ b/contracts/src/v0.8/functions/v1_0_0/interfaces/IFunctionsSubscriptions.sol @@ -6,7 +6,8 @@ import {FunctionsResponse} from "../libraries/FunctionsResponse.sol"; /// @title Chainlink Functions Subscription interface. interface IFunctionsSubscriptions { struct Subscription { - uint96 balance; // ═════════╗ Common LINK balance that is controlled by the Router to be used for all consumer requests. + uint96 balance; // ═════════╗ Common LINK balance that is controlled by the Router to be used + // for all consumer requests. address owner; // ══════════╝ The owner can fund/withdraw/cancel the subscription. uint96 blockedBalance; // ══╗ LINK balance that is reserved to pay for pending consumer requests. address proposedOwner; // ══╝ For safely transferring sub ownership. diff --git a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol index 11a76c613e..6b4c6acfe2 100644 --- a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol +++ b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsRequest.sol @@ -23,11 +23,17 @@ library FunctionsRequest { // In future version we may add other languages struct Request { - Location codeLocation; // ════════════╸ The location of the source code that will be executed on each node in the DON - Location secretsLocation; // ═════════╸ The location of secrets that will be passed into the source code. *Only Remote secrets are supported + Location codeLocation; // ════════════╸ The location of the source code that will be + // executed on each node in the DON + Location secretsLocation; // ═════════╸ The location of secrets that will be passed into the + // source code. *Only Remote secrets are supported CodeLanguage language; // ════════════╸ The coding language that the source code is written in - string source; // ════════════════════╸ Raw source code for Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal number for Request.codeLocation of Location.DONHosted - bytes encryptedSecretsReference; // ══╸ Encrypted URLs for Request.secretsLocation of Location.Remote (use addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use addDONHostedSecrets()) + string source; // ════════════════════╸ Raw source code for + // Request.codeLocation of Location.Inline, URL for Request.codeLocation of Location.Remote, or slot decimal + // number for Request.codeLocation of Location.DONHosted + bytes encryptedSecretsReference; // ══╸ Encrypted URLs for Request.secretsLocation of Location.Remote (use + // addSecretsReference()), or CBOR encoded slotid+version for Request.secretsLocation of Location.DONHosted (use + // addDONHostedSecrets()) string[] args; // ════════════════════╸ String arguments that will be passed into the source code bytes[] bytesArgs; // ════════════════╸ Bytes arguments that will be passed into the source code } diff --git a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol index eb7eb60266..409c8191d2 100644 --- a/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol +++ b/contracts/src/v0.8/functions/v1_0_0/libraries/FunctionsResponse.sol @@ -5,11 +5,14 @@ pragma solidity ^0.8.19; library FunctionsResponse { // Used to send request information from the Router to the Coordinator struct RequestMeta { - bytes data; // ══════════════════╸ CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request + bytes data; // ══════════════════╸ CBOR encoded Chainlink Functions request + // data, use FunctionsRequest library to encode a request bytes32 flags; // ═══════════════╸ Per-subscription flags address requestingContract; // ══╗ The client contract that is sending the request - uint96 availableBalance; // ═════╝ Common LINK balance of the subscription that is controlled by the Router to be used for all consumer requests. - uint72 adminFee; // ═════════════╗ Flat fee (in Juels of LINK) that will be paid to the Router Owner for operation of the network + uint96 availableBalance; // ═════╝ Common LINK balance of the subscription that is controlled by the + // Router to be used for all consumer requests. + uint72 adminFee; // ═════════════╗ Flat fee (in Juels of LINK) that will be paid to the + // Router Owner for operation of the network uint64 subscriptionId; // ║ Identifier of the billing subscription that will be charged for the request uint64 initiatedRequests; // ║ The number of requests that have been started uint32 callbackGasLimit; // ║ The amount of gas that the callback to the consuming contract will be given @@ -32,12 +35,15 @@ library FunctionsResponse { struct Commitment { bytes32 requestId; // ═════════════════╸ A unique identifier for a Chainlink Functions request address coordinator; // ═══════════════╗ The Coordinator contract that manages the DON that is servicing a request - uint96 estimatedTotalCostJuels; // ════╝ The maximum cost in Juels (1e18) of LINK that will be charged to fulfill a request + uint96 estimatedTotalCostJuels; // ════╝ The maximum cost in Juels (1e18) of LINK that will be charged to + // fulfill a request address client; // ════════════════════╗ The client contract that sent the request uint64 subscriptionId; // ║ Identifier of the billing subscription that will be charged for the request uint32 callbackGasLimit; // ═══════════╝ The amount of gas that the callback to the consuming contract will be given - uint72 adminFee; // ═══════════════════╗ Flat fee (in Juels of LINK) that will be paid to the Router Owner for operation of the network - uint72 donFee; // ║ Fee (in Juels of LINK) that will be split between Node Operators for servicing a request + uint72 adminFee; // ═══════════════════╗ Flat fee (in Juels of LINK) that + // will be paid to the Router Owner for operation of the network + uint72 donFee; // ║ Fee (in Juels of LINK) that will be split between Node Operators for + // servicing a request uint40 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment callback. uint40 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment callback. uint32 timeoutTimestamp; // ═══════════╝ The timestamp at which a request will be eligible to be timed out diff --git a/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol index 1d5b4f326e..e25ba647df 100644 --- a/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/v1_0_0/ocr/OCR2Base.sol @@ -274,7 +274,8 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in + // _report + rs.length * 32 // 32 bytes per entry in _rs + ss.length * 32 // 32 bytes per entry in _ss + 0; // placeholder diff --git a/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol index b6d425ecf7..034eecae3b 100644 --- a/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_1_0/FunctionsBilling.sol @@ -42,15 +42,24 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // ================================================================ struct Config { - uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for changes in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) - uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and fallback to fallbackNativePerUnitLink. - uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment callback. This amount is always billed for every request. - uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment callback. This amount is always billed for every request. - uint72 donFee; // ║ Additional flat fee (in Juels of LINK) that will be split between Node Operators. Max value is 2^80 - 1 == 1.2m LINK. - uint40 minimumEstimateGasPriceWei; // ║ The lowest amount of wei that will be used as the tx.gasprice when estimating the cost to fulfill the request - uint16 maxSupportedRequestDataVersion; // ═══════╝ The highest support request data version supported by the node. All lower versions should also be supported. - uint224 fallbackNativePerUnitLink; // ═══════════╗ Fallback NATIVE CURRENCY / LINK conversion rate if the data feed is stale - uint32 requestTimeoutSeconds; // ════════════════╝ How many seconds it takes before we consider a request to be timed out + uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for + // changes in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) + uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and + // fallback to fallbackNativePerUnitLink. + uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the + // fulfillment callback. This amount is always billed for every request. + uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment + // callback. This amount is always billed for every request. + uint72 donFee; // ║ Additional flat fee (in Juels of LINK) that will be split + // between Node Operators. Max value is 2^80 - 1 == 1.2m LINK. + uint40 minimumEstimateGasPriceWei; // ║ The lowest amount of wei that will be used as the tx.gasprice + // when estimating the cost to fulfill the request + uint16 maxSupportedRequestDataVersion; // ═══════╝ The highest support request data version + // supported by the node. All lower versions should also be supported. + uint224 fallbackNativePerUnitLink; // ═══════════╗ Fallback NATIVE CURRENCY / LINK + // conversion rate if the data feed is stale + uint32 requestTimeoutSeconds; // ════════════════╝ How many seconds it takes + // before we consider a request to be timed out } Config private s_config; @@ -257,7 +266,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return commitment; } - /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then charging the subscription + /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then + /// charging the subscription /// @param requestId identifier for the request that was generated by the Registry in the beginBilling commitment /// @param response response data from DON consensus /// @param err error from DON consensus diff --git a/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol index 3789508ec7..f60491cf7b 100644 --- a/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/v1_1_0/ocr/OCR2Base.sol @@ -269,7 +269,8 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in + // _report + rs.length * 32 // 32 bytes per entry in _rs + ss.length * 32 // 32 bytes per entry in _ss + 0; // placeholder @@ -304,8 +305,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { emit Transmitted(configDigest, uint32(epochAndRound >> 8)); - // The following check is disabled to allow both current and proposed routes to submit reports using the same OCR config digest - // Chainlink Functions uses globally unique request IDs. Metadata about the request is stored and checked in the Coordinator and Router + // The following check is disabled to allow both current and proposed routes to submit reports using the same OCR + // config digest + // Chainlink Functions uses globally unique request IDs. Metadata about the request is stored and checked in the + // Coordinator and Router // require(configInfo.latestConfigDigest == configDigest, "configDigest mismatch"); _requireExpectedMsgDataLength(report, rs, ss); diff --git a/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol index f5d89c911c..e066c5b610 100644 --- a/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0/FunctionsBilling.sol @@ -92,7 +92,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { } /// @notice Sets the Chainlink Coordinator's billing configuration - /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information + /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more + /// information function updateConfig( FunctionsBillingConfig memory config ) public { @@ -280,7 +281,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return (commitment, operationFee); } - /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then charging the subscription + /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then + /// charging the subscription /// @param requestId identifier for the request that was generated by the Registry in the beginBilling commitment /// @param response response data from DON consensus /// @param err error from DON consensus @@ -310,12 +312,14 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { err, juelsPerGas, // The following line represents: "cost without callback or admin fee, those will be added by the Router" - // But because the _offchain_ Commitment is using operation fee in the place of the admin fee, this now adds admin fee (actually operation fee) + // But because the _offchain_ Commitment is using operation fee in the place of the admin fee, this now adds admin + // fee (actually operation fee) // Admin fee is configured to 0 in the Router gasOverheadJuels + commitment.donFee + commitment.adminFee, msg.sender, FunctionsResponse.Commitment({ - adminFee: 0, // The Router should have adminFee set to 0. If it does not this will cause fulfillments to fail with INVALID_COMMITMENT instead of carrying out incorrect bookkeeping. + adminFee: 0, // The Router should have adminFee set to 0. If it does not this will cause fulfillments to fail + // with INVALID_COMMITMENT instead of carrying out incorrect bookkeeping. coordinator: commitment.coordinator, client: commitment.client, subscriptionId: commitment.subscriptionId, @@ -343,7 +347,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // Saves on storage writes that would otherwise be charged to the user s_feePool += commitment.donFee; // Pay the operation fee to the Coordinator owner - s_withdrawableTokens[_owner()] += commitment.adminFee; // OperationFee is used in the slot for Admin Fee in the Offchain Commitment. Admin Fee is set to 0 in the Router (enforced by line 316 in FunctionsBilling.sol). + s_withdrawableTokens[_owner()] += commitment.adminFee; // OperationFee is used in the slot for Admin Fee in the + // Offchain Commitment. Admin Fee is set to 0 in the Router (enforced by line 316 in FunctionsBilling.sol). emit RequestBilled({ requestId: requestId, juelsPerGas: juelsPerGas, diff --git a/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol index 2aaa161d40..ec660419a8 100644 --- a/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_3_0/accessControl/TermsOfServiceAllowList.sol @@ -70,7 +70,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, } /// @notice Sets the contracts's configuration - /// @param config - See the contents of the TermsOfServiceAllowListConfig struct in ITermsOfServiceAllowList.sol for more information + /// @param config - See the contents of the TermsOfServiceAllowListConfig struct in ITermsOfServiceAllowList.sol for + /// more information function updateConfig( TermsOfServiceAllowListConfig memory config ) public onlyOwner { diff --git a/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol index 2a1a0d60c5..e4d0e16127 100644 --- a/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol +++ b/contracts/src/v0.8/functions/v1_3_0/accessControl/interfaces/ITermsOfServiceAllowList.sol @@ -17,7 +17,8 @@ interface ITermsOfServiceAllowList { ) external returns (bool); /// @notice Get a list of all allowed senders - /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed + /// @dev WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is + /// designed /// to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that /// this function has an unbounded cost, and using it as part of a state-changing function may render the function /// uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. @@ -81,6 +82,7 @@ interface ITermsOfServiceAllowList { // | Configuration state | // ================================================================ struct TermsOfServiceAllowListConfig { - bool enabled; // ═════════════╗ When enabled, access will be checked against s_allowedSenders. When disabled, all access will be allowed. + bool enabled; // ═════════════╗ When enabled, access will be checked against + // s_allowedSenders. When disabled, all access will be allowed. address signerPublicKey; // ══╝ The key pair that needs to sign the acceptance data } diff --git a/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol index 369518489e..1b69a0cbef 100644 --- a/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0/interfaces/IFunctionsBilling.sol @@ -13,7 +13,8 @@ interface IFunctionsBilling { function getUsdPerUnitLink() external view returns (uint256, uint8); /// @notice Determine the fee that will be split between Node Operators for servicing a request - /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a request + /// @param requestCBOR - CBOR encoded Chainlink Functions request data, use FunctionsRequest library to encode a + /// request /// @return fee - Cost in Juels (1e18) of LINK function getDONFeeJuels( bytes memory requestCBOR @@ -27,7 +28,8 @@ interface IFunctionsBilling { /// @return fee - Cost in Juels (1e18) of LINK function getAdminFeeJuels() external view returns (uint72); - /// @notice Estimate the total cost that will be charged to a subscription to make a request: transmitter gas re-reimbursement, plus DON fee, plus Registry fee + /// @notice Estimate the total cost that will be charged to a subscription to make a request: transmitter gas + /// re-reimbursement, plus DON fee, plus Registry fee /// @param - subscriptionId An identifier of the billing account /// @param - data Encoded Chainlink Functions request data, use FunctionsClient API to encode a request /// @param - callbackGasLimit Gas limit for the fulfillment callback @@ -53,7 +55,8 @@ interface IFunctionsBilling { function oracleWithdraw(address recipient, uint96 amount) external; /// @notice Withdraw all LINK earned by Oracles through fulfilling requests - /// @dev transmitter addresses must support LINK tokens to avoid tokens from getting stuck as oracleWithdrawAll() calls will forward tokens directly to transmitters + /// @dev transmitter addresses must support LINK tokens to avoid tokens from getting stuck as oracleWithdrawAll() + /// calls will forward tokens directly to transmitters function oracleWithdrawAll() external; } @@ -62,16 +65,28 @@ interface IFunctionsBilling { // ================================================================ struct FunctionsBillingConfig { - uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for changes in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) - uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and fallback to fallbackNativePerUnitLink. - uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment callback. This amount is always billed for every request. - uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment callback. This amount is always billed for every request. - uint40 minimumEstimateGasPriceWei; // ║ The lowest amount of wei that will be used as the tx.gasprice when estimating the cost to fulfill the request - uint16 maxSupportedRequestDataVersion; // ║ The highest support request data version supported by the node. All lower versions should also be supported. + uint32 fulfillmentGasPriceOverEstimationBP; // ══╗ Percentage of gas price overestimation to account for changes + // in gas price between request and response. Held as basis points (one hundredth of 1 percentage point) + uint32 feedStalenessSeconds; // ║ How long before we consider the feed price to be stale and + // fallback to fallbackNativePerUnitLink. + uint32 gasOverheadBeforeCallback; // ║ Represents the average gas execution cost before the fulfillment + // callback. This amount is always billed for every request. + uint32 gasOverheadAfterCallback; // ║ Represents the average gas execution cost after the fulfillment + // callback. This amount is always billed for every request. + uint40 minimumEstimateGasPriceWei; // ║ The lowest amount of wei that will be used as the tx.gasprice + // when estimating the cost to fulfill the request + uint16 maxSupportedRequestDataVersion; // ║ The highest support request data version supported by the node. + // All lower versions should also be supported. uint64 fallbackUsdPerUnitLink; // ║ Fallback LINK / USD conversion rate if the data feed is stale - uint8 fallbackUsdPerUnitLinkDecimals; // ════════╝ Fallback LINK / USD conversion rate decimal places if the data feed is stale - uint224 fallbackNativePerUnitLink; // ═══════════╗ Fallback NATIVE CURRENCY / LINK conversion rate if the data feed is stale - uint32 requestTimeoutSeconds; // ════════════════╝ How many seconds it takes before we consider a request to be timed out - uint16 donFeeCentsUsd; // ═══════════════════════════════╗ Additional flat fee (denominated in cents of USD, paid as LINK) that will be split between Node Operators. - uint16 operationFeeCentsUsd; // ═════════════════════════╝ Additional flat fee (denominated in cents of USD, paid as LINK) that will be paid to the owner of the Coordinator contract. + uint8 fallbackUsdPerUnitLinkDecimals; // ════════╝ Fallback LINK / USD conversion rate decimal + // places if the data feed is stale + uint224 fallbackNativePerUnitLink; // ═══════════╗ Fallback NATIVE CURRENCY / LINK conversion + // rate if the data feed is stale + uint32 requestTimeoutSeconds; // ════════════════╝ How many seconds it takes before + // we consider a request to be timed out + uint16 donFeeCentsUsd; // ═══════════════════════════════╗ + // Additional flat fee (denominated in cents of USD, paid as LINK) that will be split between Node Operators. + uint16 operationFeeCentsUsd; // ═════════════════════════╝ + // Additional flat fee (denominated in cents of USD, paid as LINK) that will be paid to the owner of the Coordinator + // contract. } diff --git a/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol index 5103b93504..3c8b817d1c 100644 --- a/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol +++ b/contracts/src/v0.8/functions/v1_3_0/ocr/OCR2Base.sol @@ -270,7 +270,8 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in _report + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte pure entry in + // _report + rs.length * 32 // 32 bytes per entry in _rs + ss.length * 32 // 32 bytes per entry in _ss + 0; // placeholder @@ -313,8 +314,10 @@ abstract contract OCR2Base is ConfirmedOwner, OCR2Abstract { emit Transmitted(configDigest, uint32(epochAndRound >> 8)); - // The following check is disabled to allow both current and proposed routes to submit reports using the same OCR config digest - // Chainlink Functions uses globally unique request IDs. Metadata about the request is stored and checked in the Coordinator and Router + // The following check is disabled to allow both current and proposed routes to submit reports using the same OCR + // config digest + // Chainlink Functions uses globally unique request IDs. Metadata about the request is stored and checked in the + // Coordinator and Router // require(configInfo.latestConfigDigest == configDigest, "configDigest mismatch"); _requireExpectedMsgDataLength(report, rs, ss); diff --git a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol index e41fae80e9..584b179370 100644 --- a/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol +++ b/contracts/src/v0.8/functions/v1_3_0_zksync/FunctionsBilling.sol @@ -90,7 +90,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { } /// @notice Sets the Chainlink Coordinator's billing configuration - /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more information + /// @param config - See the contents of the FunctionsBillingConfig struct in IFunctionsBilling.sol for more + /// information function updateConfig( FunctionsBillingConfig memory config ) public { @@ -277,7 +278,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { return (commitment, operationFee); } - /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then charging the subscription + /// @notice Finalize billing process for an Functions request by sending a callback to the Client contract and then + /// charging the subscription /// @param requestId identifier for the request that was generated by the Registry in the beginBilling commitment /// @param response response data from DON consensus /// @param err error from DON consensus @@ -305,12 +307,14 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { err, juelsPerGas, // The following line represents: "cost without callback or admin fee, those will be added by the Router" - // But because the _offchain_ Commitment is using operation fee in the place of the admin fee, this now adds admin fee (actually operation fee) + // But because the _offchain_ Commitment is using operation fee in the place of the admin fee, this now adds admin + // fee (actually operation fee) // Admin fee is configured to 0 in the Router gasOverheadJuels + commitment.donFee + commitment.adminFee, msg.sender, FunctionsResponse.Commitment({ - adminFee: 0, // The Router should have adminFee set to 0. If it does not this will cause fulfillments to fail with INVALID_COMMITMENT instead of carrying out incorrect bookkeeping. + adminFee: 0, // The Router should have adminFee set to 0. If it does not this will cause fulfillments to fail + // with INVALID_COMMITMENT instead of carrying out incorrect bookkeeping. coordinator: commitment.coordinator, client: commitment.client, subscriptionId: commitment.subscriptionId, @@ -338,7 +342,8 @@ abstract contract FunctionsBilling is Routable, IFunctionsBilling { // Saves on storage writes that would otherwise be charged to the user s_feePool += commitment.donFee; // Pay the operation fee to the Coordinator owner - s_withdrawableTokens[_owner()] += commitment.adminFee; // OperationFee is used in the slot for Admin Fee in the Offchain Commitment. Admin Fee is set to 0 in the Router (enforced by line 316 in FunctionsBilling.sol). + s_withdrawableTokens[_owner()] += commitment.adminFee; // OperationFee is used in the slot for Admin Fee in the + // Offchain Commitment. Admin Fee is set to 0 in the Router (enforced by line 316 in FunctionsBilling.sol). emit RequestBilled({ requestId: requestId, juelsPerGas: juelsPerGas, diff --git a/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol b/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol index cdd1228839..219dee51c8 100644 --- a/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol +++ b/contracts/src/v0.8/keystone/KeystoneFeedsPermissionHandler.sol @@ -4,7 +4,8 @@ pragma solidity ^0.8.19; import {Ownable2StepMsgSender} from "../shared/access/Ownable2StepMsgSender.sol"; /// @title Keystone Feeds Permission Handler -/// @notice This contract is designed to manage and validate permissions for accessing specific reports within a decentralized system. +/// @notice This contract is designed to manage and validate permissions for accessing specific reports within a +/// decentralized system. /// @dev The contract uses mappings to keep track of report permissions associated with a unique report ID. abstract contract KeystoneFeedsPermissionHandler is Ownable2StepMsgSender { /// @notice Holds the details for permissions of a report diff --git a/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol b/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol index 6b2741c744..00f6f6ea01 100644 --- a/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol +++ b/contracts/src/v0.8/keystone/interfaces/ICapabilityConfiguration.sol @@ -25,7 +25,8 @@ interface ICapabilityConfiguration { /// @notice Called by the registry prior to the config being set for a particular DON. /// @param nodes The nodes that the configuration is being set for. /// @param donCapabilityConfig The configuration being set on the capability registry. - /// @param donCapabilityConfigCount The number of times the DON has been configured, tracked on the capability registry. + /// @param donCapabilityConfigCount The number of times the DON has been configured, tracked on the capability + /// registry. /// @param donId The DON ID on the capability registry. function beforeCapabilityConfigSet( bytes32[] calldata nodes, diff --git a/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol b/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol index 35e41bbbd8..c117b9c0bc 100644 --- a/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol +++ b/contracts/src/v0.8/keystone/test/KeystoneForwarder_ReportTest.t.sol @@ -231,7 +231,8 @@ contract KeystoneForwarder_ReportTest is BaseTest { MaliciousRevertingReceiver maliciousReceiver = new MaliciousRevertingReceiver(); // This should not revert if gas tracking is effective // It may revert if it fails to reserve sufficient gas for routing - // This POC requires pretty specific initial gas, so that 1/64 of gas passed to `onReport()` is insufficient to store the success + // This POC requires pretty specific initial gas, so that 1/64 of gas passed to `onReport()` is insufficient to + // store the success s_forwarder.report{gas: 200_000}(address(maliciousReceiver), report, reportContext, signatures); IRouter.TransmissionInfo memory transmissionInfo = diff --git a/contracts/src/v0.8/l2ep/CrossDomainDelegateForwarder.sol b/contracts/src/v0.8/l2ep/CrossDomainDelegateForwarder.sol index 859c6f0e7f..c10707a13d 100644 --- a/contracts/src/v0.8/l2ep/CrossDomainDelegateForwarder.sol +++ b/contracts/src/v0.8/l2ep/CrossDomainDelegateForwarder.sol @@ -6,7 +6,8 @@ import {IDelegateForwarder} from "./interfaces/IDelegateForwarder.sol"; /** * @title CrossDomainDelegateForwarder - L1 xDomain account representation (with delegatecall support) - * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. + * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the + * destination. * @dev Any other L2 contract which uses this contract's address as a privileged position, * can consider that position to be held by the `l1Owner` */ diff --git a/contracts/src/v0.8/l2ep/CrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/CrossDomainForwarder.sol index c097057f8a..f456909e89 100644 --- a/contracts/src/v0.8/l2ep/CrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/CrossDomainForwarder.sol @@ -6,7 +6,8 @@ import {IForwarder} from "./interfaces/IForwarder.sol"; /** * @title CrossDomainForwarder - L1 xDomain account representation - * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. + * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the + * destination. * @dev Any other L2 contract which uses this contract's address as a privileged position, * can consider that position to be held by the `l1Owner` */ diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol index c4544ff53d..0a4ca6ae12 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainForwarder.sol @@ -13,7 +13,8 @@ import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** * @title ArbitrumCrossDomainForwarder - L1 xDomain account representation - * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. + * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the + * destination. * @dev Any other L2 contract which uses this contract's address as a privileged position, * can be considered to be owned by the `l1Owner` */ diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol index 4ec234407f..7ab19b26c1 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumCrossDomainGovernor.sol @@ -13,7 +13,8 @@ import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** * @title ArbitrumCrossDomainGovernor - L1 xDomain account representation (with delegatecall support) for Arbitrum - * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. + * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the + * destination. * @dev Any other L2 contract which uses this contract's address as a privileged position, * can be considered to be simultaneously owned by the `l1Owner` and L2 `owner` */ diff --git a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol index a408f88970..fd75fd7227 100644 --- a/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol +++ b/contracts/src/v0.8/l2ep/arbitrum/ArbitrumValidator.sol @@ -37,7 +37,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim address gasPriceL1FeedAddr; } - /// @dev Precompiled contract that exists in every Arbitrum chain at address(100). Exposes a variety of system-level functionality. + /// @dev Precompiled contract that exists in every Arbitrum chain at address(100). Exposes a variety of system-level + /// functionality. address internal constant ARBSYS_ADDR = address(0x0000000000000000000000000000000000000064); int256 private constant ANSWER_SEQ_OFFLINE = 1; @@ -65,7 +66,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * @notice emitted when a new gas configuration is set * @param maxGas gas limit for immediate L2 execution attempt. * @param gasPriceBid maximum L2 gas price to pay - * @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket submission cost) + * @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket + * submission cost) */ event GasConfigSet(uint256 maxGas, uint256 gasPriceBid, address indexed gasPriceL1FeedAddr); @@ -89,7 +91,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * @param configACAddr address of the access controller for managing gas price on Arbitrum * @param maxGas gas limit for immediate L2 execution attempt. A value around 1M should be sufficient * @param gasPriceBid maximum L2 gas price to pay - * @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket submission cost) + * @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket + * submission cost) * @param _paymentStrategy strategy describing how the contract pays for xDomain calls */ constructor( @@ -197,7 +200,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim uint256 gasPriceBid = s_gasConfig.gasPriceBid; uint256 l1PaymentValue = s_paymentStrategy == PaymentStrategy.L1 ? _maxRetryableTicketCost(maxSubmissionCost, maxGas, gasPriceBid) : 0; - // NOTICE: In the case of PaymentStrategy.L2 the L2 xDomain alias address needs to be funded, as it will be paying the fee. + // NOTICE: In the case of PaymentStrategy.L2 the L2 xDomain alias address needs to be funded, as it will be paying + // the fee. id = IArbitrumDelayedInbox(CROSS_DOMAIN_MESSENGER).createRetryableTicketNoRefundAliasRewrite{value: l1PaymentValue}( ARBSYS_ADDR, // target amount, // L2 call value (requested) @@ -229,7 +233,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim * @dev access control provided by `configAC` * @param maxGas gas limit for immediate L2 execution attempt. A value around 1M should be sufficient * @param gasPriceBid maximum L2 gas price to pay - * @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket submission cost) + * @param gasPriceL1FeedAddr address of the L1 gas price feed (used to approximate Arbitrum retryable ticket + * submission cost) */ function setGasConfig( uint256 maxGas, @@ -285,7 +290,8 @@ contract ArbitrumValidator is ITypeAndVersion, AggregatorValidatorInterface, Sim uint256 gasPriceBid = s_gasConfig.gasPriceBid; uint256 l1PaymentValue = s_paymentStrategy == PaymentStrategy.L1 ? _maxRetryableTicketCost(maxSubmissionCost, maxGas, gasPriceBid) : 0; - // NOTICE: In the case of PaymentStrategy.L2 the L2 xDomain alias address needs to be funded, as it will be paying the fee. + // NOTICE: In the case of PaymentStrategy.L2 the L2 xDomain alias address needs to be funded, as it will be paying + // the fee. // We also ignore the returned msg number, that can be queried via the `InboxMessageDelivered` event. IArbitrumDelayedInbox(CROSS_DOMAIN_MESSENGER).createRetryableTicketNoRefundAliasRewrite{value: l1PaymentValue}( L2_SEQ_STATUS_RECORDER, // target diff --git a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol index d911d7bd03..474d71becc 100644 --- a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainForwarder.sol @@ -15,7 +15,8 @@ import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** * @title OptimismCrossDomainForwarder - L1 xDomain account representation - * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. + * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the + * destination. * @dev Any other L2 contract which uses this contract's address as a privileged position, * can be considered to be owned by the `l1Owner` */ diff --git a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol index 70ccc39c02..2fa790aef8 100644 --- a/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/optimism/OptimismCrossDomainGovernor.sol @@ -13,7 +13,8 @@ import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; /** * @title OptimismCrossDomainGovernor - L1 xDomain account representation (with delegatecall support) for Optimism - * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. + * @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the + * destination. * @dev Any other L2 contract which uses this contract's address as a privileged position, * can be considered to be simultaneously owned by the `l1Owner` and L2 `owner` */ diff --git a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol index d814701cd4..5349030765 100644 --- a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainForwarder.sol @@ -11,7 +11,8 @@ import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; import {IScrollMessenger} from "@scroll-tech/contracts/libraries/IScrollMessenger.sol"; /// @title ScrollCrossDomainForwarder - L1 xDomain account representation -/// @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. +/// @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the +/// destination. /// @dev Any other L2 contract which uses this contract's address as a privileged position, /// can be considered to be owned by the `l1Owner` contract ScrollCrossDomainForwarder is ITypeAndVersion, CrossDomainForwarder { diff --git a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol index e657889909..7022bd07a7 100644 --- a/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/scroll/ScrollCrossDomainGovernor.sol @@ -13,7 +13,8 @@ import {Address} from "@openzeppelin/contracts@4.7.3/utils/Address.sol"; import {IScrollMessenger} from "@scroll-tech/contracts/libraries/IScrollMessenger.sol"; /// @title ScrollCrossDomainGovernor - L1 xDomain account representation (with delegatecall support) for Scroll -/// @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the destination. +/// @notice L2 Contract which receives messages from a specific L1 address and transparently forwards them to the +/// destination. /// @dev Any other L2 contract which uses this contract's address as a privileged position, /// can be considered to be simultaneously owned by the `l1Owner` and L2 `owner` contract ScrollCrossDomainGovernor is IDelegateForwarder, ITypeAndVersion, CrossDomainForwarder { diff --git a/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol b/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol index 5c02377991..370ad94e44 100644 --- a/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/libraries/test/ByteUtilTest.t.sol @@ -67,7 +67,8 @@ contract ByteUtilTest is Test { //read the first 32 bytes uint256 result = B_512._readUint256(31); - //the result should be the last byte from the first word (ff), and 31 bytes from the second word (0000) (0xFF...0000) + //the result should be the last byte from the first word (ff), and 31 bytes from the second word (0000) + // (0xFF...0000) assertEq(result, type(uint256).max << 248); } @@ -75,7 +76,8 @@ contract ByteUtilTest is Test { //read the first 24 bytes uint256 result = B_512._readUint192(31); - //the result should be the last byte from the first word (ff), and 23 bytes from the second word (0000) (0xFF...0000) + //the result should be the last byte from the first word (ff), and 23 bytes from the second word (0000) + // (0xFF...0000) assertEq(result, type(uint192).max << 184); } @@ -164,7 +166,8 @@ contract ByteUtilTest is Test { //read the first 20 bytes after byte 13 address result = B_512._readAddress(13); - //the result should be the value last 19 bytes of the first word (ffff..) and the first byte of the second word (00) (0xFFFF..00) + //the result should be the value last 19 bytes of the first word (ffff..) and the first byte of the second word (00) + // (0xFFFF..00) assertEq(result, address(type(uint160).max << 8)); } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol index adac316d56..5a2a97e935 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/FeeManager.sol @@ -126,7 +126,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { /** * @notice Construct the FeeManager contract * @param _linkAddress The address of the LINK token - * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or wrapped) + * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or + * wrapped) * @param _proxyAddress The address of the proxy contract * @param _rewardManagerAddress The address of the reward manager contract */ @@ -203,7 +204,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { ) external payable override onlyProxy { FeeAndReward[] memory feesAndRewards = new IFeeManager.FeeAndReward[](payloads.length); - //keep track of the number of fees to prevent over initialising the FeePayment array within _convertToLinkAndNativeFees + //keep track of the number of fees to prevent over initialising the FeePayment array within + // _convertToLinkAndNativeFees uint256 numberOfLinkFees; uint256 numberOfNativeFees; diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol index c599b15071..b48b1746e5 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/RewardManager.sol @@ -13,7 +13,8 @@ import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC * @title RewardManager * @author Michael Fletcher * @author Austin Born - * @notice This contract will be used to reward any configured recipients within a pool. Recipients will receive a share of their pool relative to their configured weight. + * @notice This contract will be used to reward any configured recipients within a pool. Recipients will receive a share + * of their pool relative to their configured weight. */ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { using SafeERC20 for IERC20; @@ -21,10 +22,12 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { // @dev The mapping of total fees collected for a particular pot: s_totalRewardRecipientFees[poolId] mapping(bytes32 => uint256) public s_totalRewardRecipientFees; - // @dev The mapping of fee balances for each pot last time the recipient claimed: s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] + // @dev The mapping of fee balances for each pot last time the recipient claimed: + // s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] mapping(bytes32 => mapping(address => uint256)) public s_totalRewardRecipientFeesLastClaimedAmounts; - // @dev The mapping of RewardRecipient weights for a particular poolId: s_rewardRecipientWeights[poolId][rewardRecipient]. + // @dev The mapping of RewardRecipient weights for a particular poolId: + // s_rewardRecipientWeights[poolId][rewardRecipient]. mapping(bytes32 => mapping(address => uint256)) public s_rewardRecipientWeights; // @dev Keep track of the reward recipient weights that have been set to prevent duplicates @@ -111,7 +114,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { for (uint256 i; i < payments.length; ++i) { unchecked { //the total amount for any ERC-20 asset cannot exceed 2^256 - 1 - //see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/36bf1e46fa811f0f07d38eb9cfbc69a955f300ce/contracts/token/ERC20/ERC20.sol#L266 + //see + // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/36bf1e46fa811f0f07d38eb9cfbc69a955f300ce/contracts/token/ERC20/ERC20.sol#L266 //for example implementation. s_totalRewardRecipientFees[payments[i].poolId] += payments[i].amount; @@ -153,7 +157,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { //get the claimable amount for this recipient, this calculation will never exceed the amount in the pot uint256 claimableAmount = totalFeesInPot - s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient]; - //calculate the recipients share of the fees, which is their weighted share of the difference between the last amount they claimed and the current amount in the pot. This can never be more than the total amount in existence + //calculate the recipients share of the fees, which is their weighted share of the difference between the last + // amount they claimed and the current amount in the pot. This can never be more than the total amount in + // existence uint256 recipientShare = (claimableAmount * s_rewardRecipientWeights[poolId][recipient]) / PERCENTAGE_SCALAR; //if there's no fees to claim, continue as there's nothing to update @@ -196,7 +202,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { //keep track of which pools have had their reward recipients set s_rewardRecipientWeightsSet[poolId] = true; - //set the reward recipients, this will only be called once and contain the full set of RewardRecipients with a total weight of 100% + //set the reward recipients, this will only be called once and contain the full set of RewardRecipients with a total + // weight of 100% _setRewardRecipientWeights(poolId, rewardRecipientAndWeights, PERCENTAGE_SCALAR); emit RewardRecipientsUpdated(poolId, rewardRecipientAndWeights); @@ -260,7 +267,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } } - //update the reward recipients, if the new collective weight isn't equal to the previous collective weight, the fees will either be under or over distributed + //update the reward recipients, if the new collective weight isn't equal to the previous collective weight, the fees + // will either be under or over distributed _setRewardRecipientWeights(poolId, newRewardRecipients, existingTotalWeight); //emit event @@ -319,7 +327,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { uint256 totalPoolAmount = s_totalRewardRecipientFees[poolId]; //if the recipient has any LINK, then add the poolId to the array unchecked { - //s_totalRewardRecipientFeesLastClaimedAmounts can never exceed total pool amount, and the number of pools can't exceed the max array length + //s_totalRewardRecipientFeesLastClaimedAmounts can never exceed total pool amount, and the number of pools + // can't exceed the max array length if (totalPoolAmount - s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] != 0) { claimablePoolIds[poolIdArrayIndex++] = poolId; } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol index ac3daf6f4c..ad8ade5b91 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/Verifier.sol @@ -69,7 +69,8 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { /// It is used to keep a historical record of verified reports. event ReportVerified(bytes32 indexed feedId, address requester); - /// @notice This event is emitted whenever a new configuration is set for a feed. It triggers a new run of the offchain reporting protocol. + /// @notice This event is emitted whenever a new configuration is set for a feed. It triggers a new run of the + /// offchain reporting protocol. event ConfigSet( bytes32 indexed feedId, uint32 previousConfigBlockNumber, @@ -278,8 +279,10 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { /// signers and that enough signers have signed the reports. /// @param hashedReport The keccak256 hash of the raw report's bytes /// @param reportContext The context the report was signed in - /// @param rs ith element is the R components of the ith signature on report. Must have at most MAX_NUM_ORACLES entries - /// @param ss ith element is the S components of the ith signature on report. Must have at most MAX_NUM_ORACLES entries + /// @param rs ith element is the R components of the ith signature on report. Must have at most MAX_NUM_ORACLES + /// entries + /// @param ss ith element is the S components of the ith signature on report. Must have at most MAX_NUM_ORACLES + /// entries /// @param rawVs ith element is the the V component of the ith signature /// @param s_config The config digest the report was signed for function _verifySignatures( @@ -374,7 +377,8 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { /// @param f number of faulty oracles the system can tolerate /// @param onchainConfig serialized configuration used by the contract (and possibly oracles) /// @param offchainConfigVersion version number for offchainEncoding schema - /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the contract + /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the + /// contract /// @param recipientAddressesAndWeights the addresses and weights of all the recipients to receive rewards function _setConfig( bytes32 feedId, @@ -453,11 +457,13 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { /// @param sourceAddress Address of source config Verifier /// @param configCount ordinal number of this config setting among all config settings over the life of this contract /// @param signers ith element is address ith oracle uses to sign a report - /// @param offchainTransmitters ith element is address ith oracle used to transmit reports (in this case used for flexible additional field, such as CSA pub keys) + /// @param offchainTransmitters ith element is address ith oracle used to transmit reports (in this case used for + /// flexible additional field, such as CSA pub keys) /// @param f maximum number of faulty/dishonest oracles the protocol can tolerate while still working correctly /// @param onchainConfig serialized configuration used by the contract (and possibly oracles) /// @param offchainConfigVersion version of the serialization format used for "offchainConfig" parameter - /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the contract + /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the + /// contract /// @dev This function is a modified version of the method from OCR2Abstract function _configDigestFromConfigData( bytes32 feedId, diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol index 5029221206..2ee7bd0def 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IFeeManager.sol @@ -7,7 +7,8 @@ import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IFeeManager is IERC165, IVerifierFeeManager { /** - * @notice Calculate the applied fee and the reward from a report. If the sender is a subscriber, they will receive a discount. + * @notice Calculate the applied fee and the reward from a report. If the sender is a subscriber, they will receive a + * discount. * @param subscriber address trying to verify * @param report report to calculate the fee for * @param quoteAddress address of the quote payment token diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol index 644cde5b5e..7ae18969cc 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/interfaces/IRewardManager.sol @@ -21,14 +21,16 @@ interface IRewardManager is IERC165 { ) external; /** - * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else updateRewardRecipients should be used. + * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else + * updateRewardRecipients should be used. * @param poolId poolId to set RewardRecipients and weights for * @param rewardRecipientAndWeights array of each RewardRecipient and associated weight */ function setRewardRecipients(bytes32 poolId, Common.AddressAndWeight[] calldata rewardRecipientAndWeights) external; /** - * @notice Updates a subset the reward recipients for a specific poolId. The collective weight of the recipients should add up to the recipients existing weights. Any recipients with a weight of 0 will be removed. + * @notice Updates a subset the reward recipients for a specific poolId. The collective weight of the recipients + * should add up to the recipients existing weights. Any recipients with a weight of 0 will be removed. * @param poolId the poolId to update * @param newRewardRecipients array of new reward recipients */ diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol index 3a8bce89c7..3735ab24e2 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/BaseFeeManager.t.sol @@ -15,7 +15,8 @@ import {Test} from "forge-std/Test.sol"; * @title BaseFeeManagerTest * @author Michael Fletcher * @notice Base class for all feeManager tests - * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup the feeManager + * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup the + * feeManager */ contract BaseFeeManagerTest is Test { //contracts diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol index 3f1b797fff..96b3bedd6e 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFee.t.sol @@ -224,7 +224,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { //get the default payload bytes memory payload = getPayload(getV3Report(DEFAULT_FEED_1_V3)); - //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds would be returned to the caller of the proxy. + //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds + // would be returned to the caller of the proxy. processFee(payload, PROXY, address(link), DEFAULT_REPORT_NATIVE_FEE); //check the native unwrapped is no longer in the account @@ -248,7 +249,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { //get the default payload bytes memory payload = getPayload(getV3Report(DEFAULT_FEED_1_V3)); - //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds would be returned to the caller of the proxy. + //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds + // would be returned to the caller of the proxy. processFee(payload, PROXY, address(native), DEFAULT_REPORT_NATIVE_FEE * 2); //check the native has been transferred and converted to wrapped native diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol index 1c6a4f9b0d..cc20ba3b7c 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/fee-manager/FeeManager.processFeeBulk.t.sol @@ -32,7 +32,8 @@ contract FeeManagerProcessFeeTest is BaseFeeManagerTest { assertEq(getLinkBalance(address(feeManager)), 0); assertEq(getLinkBalance(USER), DEFAULT_LINK_MINT_QUANTITY - DEFAULT_REPORT_LINK_FEE * NUMBER_OF_REPORTS); - //the subscriber (user) should receive funds back and not the proxy, although when live the proxy will forward the funds sent and not cover it seen here + //the subscriber (user) should receive funds back and not the proxy, although when live the proxy will forward the + // funds sent and not cover it seen here assertEq(USER.balance, DEFAULT_NATIVE_MINT_QUANTITY); assertEq(PROXY.balance, DEFAULT_NATIVE_MINT_QUANTITY); } diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol index a750c2c802..1188fa6fca 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/BaseRewardManager.t.sol @@ -12,7 +12,8 @@ import {Test} from "forge-std/Test.sol"; * @title BaseRewardManagerTest * @author Michael Fletcher * @notice Base class for all reward manager tests - * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup a primary and secondary pool + * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup a + * primary and secondary pool */ contract BaseRewardManagerTest is Test { //contracts @@ -114,7 +115,8 @@ contract BaseRewardManagerTest is Test { rewardManager.setRewardRecipients(SECONDARY_POOL_ID, getSecondaryRecipients()); } - //override this to test variations of different recipients. changing this function will require existing tests to be updated as constants are hardcoded to be explicit + //override this to test variations of different recipients. changing this function will require existing tests to be + // updated as constants are hardcoded to be explicit function getPrimaryRecipients() public virtual returns (Common.AddressAndWeight[] memory) { //array of recipients Common.AddressAndWeight[] memory recipients = new Common.AddressAndWeight[](4); diff --git a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol index 1774be972b..f77dab0328 100644 --- a/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.3.0/test/reward-manager/RewardManager.claim.t.sol @@ -113,7 +113,8 @@ contract RewardManagerClaimTest is BaseRewardManagerTest { } function test_claimUnevenAmountRoundsDown() public { - //adding 1 to the pool should leave 1 wei worth of dust, which the contract doesn't handle due to it being economically infeasible + //adding 1 to the pool should leave 1 wei worth of dust, which the contract doesn't handle due to it being + // economically infeasible addFundsToPool(PRIMARY_POOL_ID, getAsset(1), FEE_MANAGER); //expected recipient amount is 1/4 of the pool deposit @@ -310,7 +311,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { //expected recipient amount is 1/4 of the pool deposit uint256 expectedRecipientAmount = POOL_DEPOSIT_AMOUNT / 4; - //check the recipients balance matches the ratio the recipient should have received. The first recipient is shared across both pools so should receive 1/4 of each pool + //check the recipients balance matches the ratio the recipient should have received. The first recipient is shared + // across both pools so should receive 1/4 of each pool assertEq(getAssetBalance(getPrimaryRecipients()[0].addr), expectedRecipientAmount * 2); assertEq(getAssetBalance(getPrimaryRecipients()[1].addr), expectedRecipientAmount); assertEq(getAssetBalance(getSecondaryRecipients()[1].addr), expectedRecipientAmount); @@ -408,7 +410,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { } function test_claimUnevenAmountRoundsDown() public { - //adding an uneven amount of dust to each pool, this should round down to the nearest whole number with 4 remaining in the contract + //adding an uneven amount of dust to each pool, this should round down to the nearest whole number with 4 remaining + // in the contract addFundsToPool(PRIMARY_POOL_ID, getAsset(3), FEE_MANAGER); addFundsToPool(SECONDARY_POOL_ID, getAsset(1), FEE_MANAGER); @@ -462,7 +465,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { //check the recipients balance matches the ratio the recipient should have received assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount); - //check the rewardManager has the remaining quantity, which is 3/4 of the initial deposit plus the deposit from the second pool + //check the rewardManager has the remaining quantity, which is 3/4 of the initial deposit plus the deposit from the + // second pool assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT * 2 - expectedRecipientAmount); //add funds to the pool to be split among the recipients @@ -521,7 +525,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount * 2); } - //the reward manager balance should again be the balance of the secondary pool as the primary pool has been emptied twice + //the reward manager balance should again be the balance of the secondary pool as the primary pool has been emptied + // twice assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT); } @@ -708,7 +713,8 @@ contract RewardManagerRecipientClaimUnevenWeightTest is BaseRewardManagerTest { assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount); } - //smaller deposits will consequently have less precision and will not be able to be split as evenly, the remaining 1 will be lost due to 333...|... being paid out instead of 333...4| + //smaller deposits will consequently have less precision and will not be able to be split as evenly, the remaining 1 + // will be lost due to 333...|... being paid out instead of 333...4| assertEq(getAssetBalance(address(rewardManager)), 1); } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol index cebb0bffc8..85cda876e6 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationFeeManager.sol @@ -136,7 +136,8 @@ contract DestinationFeeManager is /** * @notice Construct the FeeManager contract * @param _linkAddress The address of the LINK token - * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or wrapped) + * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or + * wrapped) * @param _verifierAddress The address of the verifier contract * @param _rewardManagerAddress The address of the reward manager contract */ @@ -215,7 +216,8 @@ contract DestinationFeeManager is IDestinationFeeManager.FeeAndReward[] memory feesAndRewards = new IDestinationFeeManager.FeeAndReward[](payloads.length); - //keep track of the number of fees to prevent over initialising the FeePayment array within _convertToLinkAndNativeFees + //keep track of the number of fees to prevent over initialising the FeePayment array within + // _convertToLinkAndNativeFees uint256 numberOfLinkFees; uint256 numberOfNativeFees; diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol index ad25a2aad4..7ce58a70ff 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationRewardManager.sol @@ -13,7 +13,8 @@ import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC * @title DestinationRewardManager * @author Michael Fletcher * @author Austin Born - * @notice This contract will be used to reward any configured recipients within a pool. Recipients will receive a share of their pool relative to their configured weight. + * @notice This contract will be used to reward any configured recipients within a pool. Recipients will receive a share + * of their pool relative to their configured weight. */ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, ITypeAndVersion { using SafeERC20 for IERC20; @@ -21,10 +22,12 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, // @dev The mapping of total fees collected for a particular pot: s_totalRewardRecipientFees[poolId] mapping(bytes32 => uint256) public s_totalRewardRecipientFees; - // @dev The mapping of fee balances for each pot last time the recipient claimed: s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] + // @dev The mapping of fee balances for each pot last time the recipient claimed: + // s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] mapping(bytes32 => mapping(address => uint256)) public s_totalRewardRecipientFeesLastClaimedAmounts; - // @dev The mapping of RewardRecipient weights for a particular poolId: s_rewardRecipientWeights[poolId][rewardRecipient]. + // @dev The mapping of RewardRecipient weights for a particular poolId: + // s_rewardRecipientWeights[poolId][rewardRecipient]. mapping(bytes32 => mapping(address => uint256)) public s_rewardRecipientWeights; // @dev Keep track of the reward recipient weights that have been set to prevent duplicates @@ -111,7 +114,8 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, for (uint256 i; i < payments.length; ++i) { unchecked { //the total amount for any ERC-20 asset cannot exceed 2^256 - 1 - //see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/36bf1e46fa811f0f07d38eb9cfbc69a955f300ce/contracts/token/ERC20/ERC20.sol#L266 + //see + // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/36bf1e46fa811f0f07d38eb9cfbc69a955f300ce/contracts/token/ERC20/ERC20.sol#L266 //for example implementation. s_totalRewardRecipientFees[payments[i].poolId] += payments[i].amount; @@ -153,7 +157,9 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, //get the claimable amount for this recipient, this calculation will never exceed the amount in the pot uint256 claimableAmount = totalFeesInPot - s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient]; - //calculate the recipients share of the fees, which is their weighted share of the difference between the last amount they claimed and the current amount in the pot. This can never be more than the total amount in existence + //calculate the recipients share of the fees, which is their weighted share of the difference between the last + // amount they claimed and the current amount in the pot. This can never be more than the total amount in + // existence uint256 recipientShare = (claimableAmount * s_rewardRecipientWeights[poolId][recipient]) / PERCENTAGE_SCALAR; //if there's no fees to claim, continue as there's nothing to update @@ -196,7 +202,8 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, //keep track of which pools have had their reward recipients set s_rewardRecipientWeightsSet[poolId] = true; - //set the reward recipients, this will only be called once and contain the full set of RewardRecipients with a total weight of 100% + //set the reward recipients, this will only be called once and contain the full set of RewardRecipients with a total + // weight of 100% _setRewardRecipientWeights(poolId, rewardRecipientAndWeights, PERCENTAGE_SCALAR); emit RewardRecipientsUpdated(poolId, rewardRecipientAndWeights); @@ -260,7 +267,8 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, } } - //update the reward recipients, if the new collective weight isn't equal to the previous collective weight, the fees will either be under or over distributed + //update the reward recipients, if the new collective weight isn't equal to the previous collective weight, the fees + // will either be under or over distributed _setRewardRecipientWeights(poolId, newRewardRecipients, existingTotalWeight); //emit event @@ -328,7 +336,8 @@ contract DestinationRewardManager is IDestinationRewardManager, ConfirmedOwner, uint256 totalPoolAmount = s_totalRewardRecipientFees[poolId]; //if the recipient has any LINK, then add the poolId to the array unchecked { - //s_totalRewardRecipientFeesLastClaimedAmounts can never exceed total pool amount, and the number of pools can't exceed the max array length + //s_totalRewardRecipientFeesLastClaimedAmounts can never exceed total pool amount, and the number of pools + // can't exceed the max array length if (totalPoolAmount - s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] != 0) { claimablePoolIds[poolIdArrayIndex++] = poolId; } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol index d1eff030cf..729c21e5ec 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifier.sol @@ -19,7 +19,9 @@ uint256 constant MAX_NUM_ORACLES = 31; /** * @title DestinationVerifier * @author Michael Fletcher - * @notice This contract will be used to verify reports based on the oracle signatures. This is not the source verifier which required individual fee configurations, instead, this checks that a report has been signed by one of the configured oracles. + * @notice This contract will be used to verify reports based on the oracle signatures. This is not the source verifier + * which required individual fee configurations, instead, this checks that a report has been signed by one of the + * configured oracles. */ contract DestinationVerifier is IDestinationVerifier, @@ -27,7 +29,8 @@ contract DestinationVerifier is ConfirmedOwner, ITypeAndVersion { - /// @notice The list of DON configurations by hash(address|donConfigId) - set to true if the signer is part of the config + /// @notice The list of DON configurations by hash(address|donConfigId) - set to true if the signer is part of the + /// config mapping(bytes32 => bool) private s_signerByAddressAndDonConfigId; /// array of DON configs @@ -52,7 +55,8 @@ contract DestinationVerifier is /// @param maxSigners The maximum number of signers that can sign a report error ExcessSigners(uint256 numSigners, uint256 maxSigners); - /// @notice This error is thrown whenever a report is signed or expected to be signed with less than the minimum number of signers + /// @notice This error is thrown whenever a report is signed or expected to be signed with less than the minimum + /// number of signers /// @param numSigners The number of signers who have signed the report /// @param minSigners The minimum number of signers that need to sign a report error InsufficientSigners(uint256 numSigners, uint256 minSigners); @@ -73,8 +77,10 @@ contract DestinationVerifier is /// @notice This error is thrown whenever setting a config with duplicate signatures error NonUniqueSignatures(); - /* @notice This error is thrown whenever a report fails to verify. This error be thrown for multiple reasons and it's purposely like - * this to prevent information being leaked about the verification process which could be used to enable free verifications maliciously + /* @notice This error is thrown whenever a report fails to verify. This error be thrown for multiple reasons and it's + purposely like + * this to prevent information being leaked about the verification process which could be used to enable free + verifications maliciously */ error BadVerification(); @@ -315,12 +321,14 @@ contract DestinationVerifier is revert BadActivationTime(); } - // Check the config we're setting isn't already set as the current active config as this will increase search costs unnecessarily when verifying historic reports + // Check the config we're setting isn't already set as the current active config as this will increase search costs + // unnecessarily when verifying historic reports if (donConfigLength > 0 && s_donConfigs[donConfigLength - 1].donConfigId == donConfigId) { revert DonConfigAlreadyExists(donConfigId); } - // We may want to register these later or skip this step in the unlikely scenario they've previously been registered in the RewardsManager + // We may want to register these later or skip this step in the unlikely scenario they've previously been registered + // in the RewardsManager if (recipientAddressesAndWeights.length != 0) { if (s_feeManager == address(0)) { revert FeeManagerInvalid(); @@ -397,7 +405,8 @@ contract DestinationVerifier is ) internal view returns (DonConfig memory) { DonConfig memory activeDonConfig; - // 99% of the time the signer config will be the last index, however for historic reports generated by a previous configuration we'll need to cycle back + // 99% of the time the signer config will be the last index, however for historic reports generated by a previous + // configuration we'll need to cycle back uint256 i = s_donConfigs.length; while (i > 0) { --i; diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol index 251cef1739..18bd7f8b45 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/DestinationVerifierProxy.sol @@ -11,7 +11,9 @@ import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; /** * @title DestinationVerifierProxy * @author Michael Fletcher - * @notice This contract will be used to route all requests through to the assigned verifier contract. This contract does not support individual feed configurations and is aimed at being a simple proxy for the verifier contract on any destination chain. + * @notice This contract will be used to route all requests through to the assigned verifier contract. This contract + * does not support individual feed configurations and is aimed at being a simple proxy for the verifier contract on any + * destination chain. */ contract DestinationVerifierProxy is IDestinationVerifierProxy, ConfirmedOwner, ITypeAndVersion { /// @notice The active verifier for this proxy diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol index bcc9075387..e7de7bc8b1 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationFeeManager.sol @@ -6,7 +6,8 @@ import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IDestinationFeeManager is IERC165 { /** - * @notice Calculate the applied fee and the reward from a report. If the sender is a subscriber, they will receive a discount. + * @notice Calculate the applied fee and the reward from a report. If the sender is a subscriber, they will receive a + * discount. * @param subscriber address trying to verify * @param report report to calculate the fee for * @param quoteAddress address of the quote payment token diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol index d94d88b057..0135ddfec0 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationRewardManager.sol @@ -21,14 +21,16 @@ interface IDestinationRewardManager is IERC165 { ) external; /** - * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else updateRewardRecipients should be used. + * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else + * updateRewardRecipients should be used. * @param poolId poolId to set RewardRecipients and weights for * @param rewardRecipientAndWeights array of each RewardRecipient and associated weight */ function setRewardRecipients(bytes32 poolId, Common.AddressAndWeight[] calldata rewardRecipientAndWeights) external; /** - * @notice Updates a subset the reward recipients for a specific poolId. The collective weight of the recipients should add up to the recipients existing weights. Any recipients with a weight of 0 will be removed. + * @notice Updates a subset the reward recipients for a specific poolId. The collective weight of the recipients + * should add up to the recipients existing weights. Any recipients with a weight of 0 will be removed. * @param poolId the poolId to update * @param newRewardRecipients array of new reward recipients */ diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxyVerifier.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxyVerifier.sol index 1c504cb375..c9c50d1dbb 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxyVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/interfaces/IDestinationVerifierProxyVerifier.sol @@ -19,7 +19,8 @@ interface IDestinationVerifierProxyVerifier is IERC165 { ) external payable returns (bytes memory verifierResponse); /** - * @notice Bulk verifies that the data encoded has been signed correctly using the signatures included within the payload. + * @notice Bulk verifies that the data encoded has been signed correctly using the signatures included within the + * payload. * @param signedReports The encoded data to be verified. * @param parameterPayload The encoded parameters to be used in the verification and billing process. * @param sender The address that requested to verify the contract. Used for logging and applying the fee. diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol index de728a713d..d0efc18c27 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/BaseDestinationFeeManager.t.sol @@ -15,7 +15,8 @@ import {Test} from "forge-std/Test.sol"; * @title BaseDestinationFeeManagerTest * @author Michael Fletcher * @notice Base class for all feeManager tests - * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup the feeManager + * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup the + * feeManager */ contract BaseDestinationFeeManagerTest is Test { //contracts diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol index 0bebbced3b..ef14b4ac2d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFee.t.sol @@ -224,7 +224,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { //get the default payload bytes memory payload = getPayload(getV3Report(DEFAULT_FEED_1_V3)); - //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds would be returned to the caller of the proxy. + //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds + // would be returned to the caller of the proxy. processFee(DEFAULT_CONFIG_DIGEST, payload, PROXY, address(link), DEFAULT_REPORT_NATIVE_FEE); //check the native unwrapped is no longer in the account @@ -248,7 +249,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { //get the default payload bytes memory payload = getPayload(getV3Report(DEFAULT_FEED_1_V3)); - //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds would be returned to the caller of the proxy. + //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds + // would be returned to the caller of the proxy. processFee(DEFAULT_CONFIG_DIGEST, payload, PROXY, address(native), DEFAULT_REPORT_NATIVE_FEE * 2); //check the native has been transferred and converted to wrapped native diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol index 258d5672e6..aff81cbe45 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/fee-manager/DestinationFeeManager.processFeeBulk.t.sol @@ -37,7 +37,8 @@ contract DestinationFeeManagerProcessFeeTest is BaseDestinationFeeManagerTest { assertEq(getLinkBalance(address(feeManager)), 0); assertEq(getLinkBalance(USER), DEFAULT_LINK_MINT_QUANTITY - DEFAULT_REPORT_LINK_FEE * NUMBER_OF_REPORTS); - //the subscriber (user) should receive funds back and not the proxy, although when live the proxy will forward the funds sent and not cover it seen here + //the subscriber (user) should receive funds back and not the proxy, although when live the proxy will forward the + // funds sent and not cover it seen here assertEq(USER.balance, DEFAULT_NATIVE_MINT_QUANTITY); assertEq(PROXY.balance, DEFAULT_NATIVE_MINT_QUANTITY); } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol index 1335db9513..b42be8eb74 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/BaseDestinationRewardManager.t.sol @@ -12,7 +12,8 @@ import {Test} from "forge-std/Test.sol"; * @title DestinationRewardManagerTest * @author Michael Fletcher * @notice Base class for all reward manager tests - * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup a primary and secondary pool + * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup a + * primary and secondary pool */ contract BaseDestinationRewardManagerTest is Test { //contracts @@ -116,7 +117,8 @@ contract BaseDestinationRewardManagerTest is Test { rewardManager.setRewardRecipients(SECONDARY_POOL_ID, getSecondaryRecipients()); } - //override this to test variations of different recipients. changing this function will require existing tests to be updated as constants are hardcoded to be explicit + //override this to test variations of different recipients. changing this function will require existing tests to be + // updated as constants are hardcoded to be explicit function getPrimaryRecipients() public virtual returns (Common.AddressAndWeight[] memory) { //array of recipients Common.AddressAndWeight[] memory recipients = new Common.AddressAndWeight[](4); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol index 1315fd920c..1dae07112d 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/reward-manager/DestinationRewardManager.claim.t.sol @@ -113,7 +113,8 @@ contract DestinationRewardManagerClaimTest is BaseDestinationRewardManagerTest { } function test_claimUnevenAmountRoundsDown() public { - //adding 1 to the pool should leave 1 wei worth of dust, which the contract doesn't handle due to it being economically infeasible + //adding 1 to the pool should leave 1 wei worth of dust, which the contract doesn't handle due to it being + // economically infeasible addFundsToPool(PRIMARY_POOL_ID, getAsset(1), FEE_MANAGER); //expected recipient amount is 1/4 of the pool deposit @@ -310,7 +311,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat //expected recipient amount is 1/4 of the pool deposit uint256 expectedRecipientAmount = POOL_DEPOSIT_AMOUNT / 4; - //check the recipients balance matches the ratio the recipient should have received. The first recipient is shared across both pools so should receive 1/4 of each pool + //check the recipients balance matches the ratio the recipient should have received. The first recipient is shared + // across both pools so should receive 1/4 of each pool assertEq(getAssetBalance(getPrimaryRecipients()[0].addr), expectedRecipientAmount * 2); assertEq(getAssetBalance(getPrimaryRecipients()[1].addr), expectedRecipientAmount); assertEq(getAssetBalance(getSecondaryRecipients()[1].addr), expectedRecipientAmount); @@ -408,7 +410,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat } function test_claimUnevenAmountRoundsDown() public { - //adding an uneven amount of dust to each pool, this should round down to the nearest whole number with 4 remaining in the contract + //adding an uneven amount of dust to each pool, this should round down to the nearest whole number with 4 remaining + // in the contract addFundsToPool(PRIMARY_POOL_ID, getAsset(3), FEE_MANAGER); addFundsToPool(SECONDARY_POOL_ID, getAsset(1), FEE_MANAGER); @@ -462,7 +465,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat //check the recipients balance matches the ratio the recipient should have received assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount); - //check the rewardManager has the remaining quantity, which is 3/4 of the initial deposit plus the deposit from the second pool + //check the rewardManager has the remaining quantity, which is 3/4 of the initial deposit plus the deposit from the + // second pool assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT * 2 - expectedRecipientAmount); //add funds to the pool to be split among the recipients @@ -521,7 +525,8 @@ contract DestinationRewardManagerRecipientClaimMultiplePoolsTest is BaseDestinat assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount * 2); } - //the reward manager balance should again be the balance of the secondary pool as the primary pool has been emptied twice + //the reward manager balance should again be the balance of the secondary pool as the primary pool has been emptied + // twice assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT); } @@ -708,7 +713,8 @@ contract DestinationRewardManagerRecipientClaimUnevenWeightTest is BaseDestinati assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount); } - //smaller deposits will consequently have less precision and will not be able to be split as evenly, the remaining 1 will be lost due to 333...|... being paid out instead of 333...4| + //smaller deposits will consequently have less precision and will not be able to be split as evenly, the remaining 1 + // will be lost due to 333...|... being paid out instead of 333...4| assertEq(getAssetBalance(address(rewardManager)), 1); } diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol index 1b0e2c4628..70ab57a6de 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierInterfacesTest.t.sol @@ -30,7 +30,8 @@ interface IVerifierProxy { * correctly by routing to the correct verifier, and bills the user if applicable. * @param payload The encoded data to be verified, including the signed * report. - * @param parameterPayload Fee metadata for billing. For the current implementation this is just the abi-encoded fee token ERC-20 address. + * @param parameterPayload Fee metadata for billing. For the current implementation this is just the abi-encoded fee + * token ERC-20 address. * @return verifierResponse The encoded report from the verifier. */ function verify( @@ -44,7 +45,8 @@ interface IVerifierProxy { interface IFeeManager { /** * @notice Calculates the fee and reward associated with verifying a report, including discounts for subscribers. - * This function assesses the fee and reward for report verification, applying a discount for recognized subscriber addresses. + * This function assesses the fee and reward for report verification, applying a discount for recognized subscriber + * addresses. * @param subscriber The address attempting to verify the report. A discount is applied if this address * is recognized as a subscriber. * @param unverifiedReport The report data awaiting verification. The content of this report is used to diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol index d63d8cc257..46926391c5 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierSetConfigTest.t.sol @@ -88,7 +88,8 @@ contract DestinationVerifierSetConfigTest is BaseTest { vm.warp(block.timestamp + 1); - // testing adding a different set of Signers with same FAULT_TOLERENCE does not result in DonConfigAlreadyExists revert + // testing adding a different set of Signers with same FAULT_TOLERENCE does not result in DonConfigAlreadyExists + // revert address[] memory signerAddrsMinusOne = new address[](signerAddrs.length - 1); for (uint256 i = 0; i < signerAddrs.length - 1; i++) { signerAddrsMinusOne[i] = signerAddrs[i]; diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol index ac604e0340..da69433808 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewards.t.sol @@ -155,7 +155,7 @@ contract VerifierBillingTests is VerifierWithFeeManager { function test_rewardsAreDistributedAccordingToWeightsUsingHistoricalConfigs() public { /* - Verifies that reports verified with historical give rewards according to the verifying config AddressAndWeight. + Verifies that reports verified with historical give rewards according to the verifying config AddressAndWeight. - Sets two Configs: ConfigA and ConfigB, These two Configs have different Recipient and Weights - Verifies a couple reports with each config - Pays recipients diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol index d7ec9e4d6b..e2a6235bd0 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierTestRewardsMultiVefifierFeeManager.t.sol @@ -82,7 +82,7 @@ contract MultiVerifierBillingTests is MultipleVerifierWithMultipleFeeManagers { - feeManager is used by verifier3 - Rewardmanager is used by feeManager and feeManager2 - In this test we do verificatons via verifier1, verifier2 and verifier3 and check that rewards are set accordingly + In this test we do verificatons via verifier1, verifier2 and verifier3 and check that rewards are set accordingly */ Signer[] memory signers = _getSigners(MAX_ORACLES); diff --git a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol index d954b60b11..ddb0b6d66a 100644 --- a/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.4.0/test/verifier/DestinationVerifierVerifyTest.t.sol @@ -174,8 +174,8 @@ contract VerifierVerifyTest is BaseTest { - DonConfigA has signers {A, B, C, E} is set at time T1 - DonConfigB has signers {A, B, C, D} is set at time T2 - checks we can verify a report with {B, C, D} signers (via DonConfigB) - - checks we can verify a report with {B, C, E} signers and timestamp below T2 (via DonConfigA historical config) - - checks we can't verify a report with {B, C, E} signers and timestamp above T2 (it gets verivied via DonConfigB) + - checks we can verify a report with {B, C, E} signers and timestamp below T2 (via DonConfigA historical config) + - checks we can't verify a report with {B, C, E} signers and timestamp above T2 (it gets verivied via DonConfigB) - sets DonConfigA as deactivated - checks we can't verify a report with {B, C, E} signers and timestamp below T2 (via DonConfigA) */ @@ -374,7 +374,8 @@ contract VerifierVerifyTest is BaseTest { - checks we can verify a report with {D, E, F} signers (via DonConfigB) at time between T2 and T3 - checks we can verify a report with {D, E, F} signers (via DonConfigC) at time > T3 - checks we can't verify a report with {A, B, C} signers (via DonConfigC) and timestamp >T3 at time > T3 - - checks we can verify a report with {A, B, C} signers (via DonConfigC) and timestamp between T2 and T3 at time > T3 (historical check) + - checks we can verify a report with {A, B, C} signers (via DonConfigC) and timestamp between T2 and T3 at time > + T3 (historical check) */ diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol index f7000385b9..cf875d19f8 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol @@ -129,7 +129,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { /** * @notice Construct the FeeManager contract * @param _linkAddress The address of the LINK token - * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or wrapped) + * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or + * wrapped) * @param _proxyAddress The address of the proxy contract * @param _rewardManagerAddress The address of the reward manager contract */ @@ -206,7 +207,8 @@ contract FeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { ) external payable override onlyProxy { FeeAndReward[] memory feesAndRewards = new IFeeManager.FeeAndReward[](payloads.length); - //keep track of the number of fees to prevent over initialising the FeePayment array within _convertToLinkAndNativeFees + //keep track of the number of fees to prevent over initialising the FeePayment array within + // _convertToLinkAndNativeFees uint256 numberOfLinkFees; uint256 numberOfNativeFees; diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol index c599b15071..b48b1746e5 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/RewardManager.sol @@ -13,7 +13,8 @@ import {SafeERC20} from "@openzeppelin/contracts@4.8.3/token/ERC20/utils/SafeERC * @title RewardManager * @author Michael Fletcher * @author Austin Born - * @notice This contract will be used to reward any configured recipients within a pool. Recipients will receive a share of their pool relative to their configured weight. + * @notice This contract will be used to reward any configured recipients within a pool. Recipients will receive a share + * of their pool relative to their configured weight. */ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { using SafeERC20 for IERC20; @@ -21,10 +22,12 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { // @dev The mapping of total fees collected for a particular pot: s_totalRewardRecipientFees[poolId] mapping(bytes32 => uint256) public s_totalRewardRecipientFees; - // @dev The mapping of fee balances for each pot last time the recipient claimed: s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] + // @dev The mapping of fee balances for each pot last time the recipient claimed: + // s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] mapping(bytes32 => mapping(address => uint256)) public s_totalRewardRecipientFeesLastClaimedAmounts; - // @dev The mapping of RewardRecipient weights for a particular poolId: s_rewardRecipientWeights[poolId][rewardRecipient]. + // @dev The mapping of RewardRecipient weights for a particular poolId: + // s_rewardRecipientWeights[poolId][rewardRecipient]. mapping(bytes32 => mapping(address => uint256)) public s_rewardRecipientWeights; // @dev Keep track of the reward recipient weights that have been set to prevent duplicates @@ -111,7 +114,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { for (uint256 i; i < payments.length; ++i) { unchecked { //the total amount for any ERC-20 asset cannot exceed 2^256 - 1 - //see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/36bf1e46fa811f0f07d38eb9cfbc69a955f300ce/contracts/token/ERC20/ERC20.sol#L266 + //see + // https://github.com/OpenZeppelin/openzeppelin-contracts/blob/36bf1e46fa811f0f07d38eb9cfbc69a955f300ce/contracts/token/ERC20/ERC20.sol#L266 //for example implementation. s_totalRewardRecipientFees[payments[i].poolId] += payments[i].amount; @@ -153,7 +157,9 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { //get the claimable amount for this recipient, this calculation will never exceed the amount in the pot uint256 claimableAmount = totalFeesInPot - s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient]; - //calculate the recipients share of the fees, which is their weighted share of the difference between the last amount they claimed and the current amount in the pot. This can never be more than the total amount in existence + //calculate the recipients share of the fees, which is their weighted share of the difference between the last + // amount they claimed and the current amount in the pot. This can never be more than the total amount in + // existence uint256 recipientShare = (claimableAmount * s_rewardRecipientWeights[poolId][recipient]) / PERCENTAGE_SCALAR; //if there's no fees to claim, continue as there's nothing to update @@ -196,7 +202,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { //keep track of which pools have had their reward recipients set s_rewardRecipientWeightsSet[poolId] = true; - //set the reward recipients, this will only be called once and contain the full set of RewardRecipients with a total weight of 100% + //set the reward recipients, this will only be called once and contain the full set of RewardRecipients with a total + // weight of 100% _setRewardRecipientWeights(poolId, rewardRecipientAndWeights, PERCENTAGE_SCALAR); emit RewardRecipientsUpdated(poolId, rewardRecipientAndWeights); @@ -260,7 +267,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { } } - //update the reward recipients, if the new collective weight isn't equal to the previous collective weight, the fees will either be under or over distributed + //update the reward recipients, if the new collective weight isn't equal to the previous collective weight, the fees + // will either be under or over distributed _setRewardRecipientWeights(poolId, newRewardRecipients, existingTotalWeight); //emit event @@ -319,7 +327,8 @@ contract RewardManager is IRewardManager, ConfirmedOwner, ITypeAndVersion { uint256 totalPoolAmount = s_totalRewardRecipientFees[poolId]; //if the recipient has any LINK, then add the poolId to the array unchecked { - //s_totalRewardRecipientFeesLastClaimedAmounts can never exceed total pool amount, and the number of pools can't exceed the max array length + //s_totalRewardRecipientFeesLastClaimedAmounts can never exceed total pool amount, and the number of pools + // can't exceed the max array length if (totalPoolAmount - s_totalRewardRecipientFeesLastClaimedAmounts[poolId][recipient] != 0) { claimablePoolIds[poolIdArrayIndex++] = poolId; } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol index bf3adfffd3..e4598d614e 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/Verifier.sol @@ -209,8 +209,10 @@ contract Verifier is IVerifier, ConfirmedOwner, ITypeAndVersion { /// signers and that enough signers have signed the reports. /// @param hashedReport The keccak256 hash of the raw report's bytes /// @param reportContext The context the report was signed in - /// @param rs ith element is the R components of the ith signature on report. Must have at most MAX_NUM_ORACLES entries - /// @param ss ith element is the S components of the ith signature on report. Must have at most MAX_NUM_ORACLES entries + /// @param rs ith element is the R components of the ith signature on report. Must have at most MAX_NUM_ORACLES + /// entries + /// @param ss ith element is the S components of the ith signature on report. Must have at most MAX_NUM_ORACLES + /// entries /// @param rawVs ith element is the the V component of the ith signature /// @param config The config digest the report was signed for function _verifySignatures( diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol index 8b2ab37be2..7705002eca 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/Configurator.sol @@ -45,15 +45,18 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 /// @param version The version of the onchainConfig error UnsupportedOnchainConfigVersion(uint256 version); - /// @notice This event is emitted when a production config is set with a non-zero predecessor config digest in the on-chain config. + /// @notice This event is emitted when a production config is set with a non-zero predecessor config digest in the + /// on-chain config. /// @param predecessorConfigDigest The predecessor config digest error NonZeroPredecessorConfigDigest(bytes32 predecessorConfigDigest); - /// @notice This event is emitted when a staging config is set with a predecessor config digest that does not match the current production config digest. + /// @notice This event is emitted when a staging config is set with a predecessor config digest that does not match + /// the current production config digest. /// @param predecessorConfigDigest The predecessor config digest error InvalidPredecessorConfigDigest(bytes32 predecessorConfigDigest); - /// @notice This event is emitted during promoteStagingConfig if the isGreenProduction flag does not match the contract state + /// @notice This event is emitted during promoteStagingConfig if the isGreenProduction flag does not match the + /// contract state /// @param configId The configId /// @param isGreenProductionContractState The current (correct) isGreenProduction state according to the contract error IsGreenProductionMustMatchContractState(bytes32 configId, bool isGreenProductionContractState); @@ -67,7 +70,8 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 /// @param isGreenProduction The isGreenProduction flag error ConfigUnsetStaging(bytes32 configId, bool isGreenProduction); - /// @notice This event is emitted during promoteStagingConfig if the configId has never been set as a production config + /// @notice This event is emitted during promoteStagingConfig if the configId has never been set as a production + /// config /// @param configId The configId that has never been set as a production config /// @param isGreenProduction The isGreenProduction flag error ConfigUnsetProduction(bytes32 configId, bool isGreenProduction); @@ -221,7 +225,8 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 /// @param f number of faulty oracles the system can tolerate /// @param onchainConfig serialized configuration used by the contract (and possibly oracles) /// @param offchainConfigVersion version number for offchainEncoding schema - /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the contract + /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the + /// contract function _setConfig( bytes32 configId, uint256 sourceChainId, @@ -292,11 +297,13 @@ contract Configurator is IConfigurator, ConfirmedOwner, ITypeAndVersion, IERC165 /// @param sourceAddress Address of configurator contract /// @param configCount ordinal number of this config setting among all config settings over the life of this contract /// @param signers ith element is address ith oracle uses to sign a report - /// @param offchainTransmitters ith element is address ith oracle used to transmit reports (in this case used for flexible additional field, such as CSA pub keys) + /// @param offchainTransmitters ith element is address ith oracle used to transmit reports (in this case used for + /// flexible additional field, such as CSA pub keys) /// @param f maximum number of faulty/dishonest oracles the protocol can tolerate while still working correctly /// @param onchainConfig serialized configuration used by the contract (and possibly oracles) /// @param offchainConfigVersion version of the serialization format used for "offchainConfig" parameter - /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the contract + /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the + /// contract /// @dev This function is a modified version of the method from OCR2Abstract function _configDigestFromConfigData( bytes32 configId, diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/interfaces/IConfigurator.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/interfaces/IConfigurator.sol index 5f9b14b29c..e90f83b1f0 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/interfaces/IConfigurator.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/interfaces/IConfigurator.sol @@ -2,7 +2,8 @@ pragma solidity 0.8.19; interface IConfigurator { - /// @notice This event is emitted whenever a new production configuration is set for a feed. It triggers a new run of the offchain reporting protocol. + /// @notice This event is emitted whenever a new production configuration is set for a feed. It triggers a new run of + /// the offchain reporting protocol. event ProductionConfigSet( bytes32 indexed configId, uint32 previousConfigBlockNumber, @@ -17,7 +18,8 @@ interface IConfigurator { bool isGreenProduction ); - /// @notice This event is emitted whenever a new staging configuration is set for a feed. It triggers a new run of the offchain reporting protocol. + /// @notice This event is emitted whenever a new staging configuration is set for a feed. It triggers a new run of the + /// offchain reporting protocol. event StagingConfigSet( bytes32 indexed configId, uint32 previousConfigBlockNumber, diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol index e1a0a9cd79..701a3fdb36 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetProductionConfigTest.t.sol @@ -261,7 +261,8 @@ contract ConfiguratorSetProductionConfigTest is BaseTest { configurationState = s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); assertEq(configurationState.configDigest[0], cd2); // the previous config left unchanged - assertEq(configurationState.configDigest[1], cd3); // new config is on green now because green is production due to isGreenProduction=true + assertEq(configurationState.configDigest[1], cd3); // new config is on green now because green is production due to + // isGreenProduction=true assertEq(configurationState.configCount, 3); assertEq(configurationState.isGreenProduction, true); assertEq(configurationState.latestConfigBlockNumber, block.number); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol index a482fe61f1..c7ac50a61b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/configuration/test/configurator/ConfiguratorSetStagingConfigTest.t.sol @@ -187,7 +187,8 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { // when isGreenProduction=true s_exposedConfigurator.exposedSetIsGreenProduction(CONFIG_ID_1, true); - onchainConfig = abi.encodePacked(uint256(1), cd2); // predecessorConfigDigest the production digest is now the green digest + onchainConfig = abi.encodePacked(uint256(1), cd2); // predecessorConfigDigest the production digest is now the green + // digest // go to new block vm.roll(15); @@ -226,7 +227,8 @@ contract ConfiguratorSetStagingConfigTest is BaseTest { ); configurationState = s_exposedConfigurator.exposedReadConfigurationStates(CONFIG_ID_1); - assertEq(configurationState.configDigest[0], cd3); // new config is on blue now because blue is staging due to isGreenProduction=true + assertEq(configurationState.configDigest[0], cd3); // new config is on blue now because blue is staging due to + // isGreenProduction=true assertEq(configurationState.configDigest[1], cd2); // the previous config left unchanged assertEq(configurationState.configCount, 4); assertEq(configurationState.isGreenProduction, true); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol index 162eb92805..2e8379ac6b 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IFeeManager.sol @@ -7,7 +7,8 @@ import {IERC165} from "@openzeppelin/contracts@4.8.3/interfaces/IERC165.sol"; interface IFeeManager is IERC165, IVerifierFeeManager { /** - * @notice Calculate the applied fee and the reward from a report. If the sender is a subscriber, they will receive a discount. + * @notice Calculate the applied fee and the reward from a report. If the sender is a subscriber, they will receive a + * discount. * @param subscriber address trying to verify * @param report report to calculate the fee for * @param quoteAddress address of the quote payment token diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol index 644cde5b5e..7ae18969cc 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/interfaces/IRewardManager.sol @@ -21,14 +21,16 @@ interface IRewardManager is IERC165 { ) external; /** - * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else updateRewardRecipients should be used. + * @notice Set the RewardRecipients and weights for a specific pool. This should only be called once per pool Id. Else + * updateRewardRecipients should be used. * @param poolId poolId to set RewardRecipients and weights for * @param rewardRecipientAndWeights array of each RewardRecipient and associated weight */ function setRewardRecipients(bytes32 poolId, Common.AddressAndWeight[] calldata rewardRecipientAndWeights) external; /** - * @notice Updates a subset the reward recipients for a specific poolId. The collective weight of the recipients should add up to the recipients existing weights. Any recipients with a weight of 0 will be removed. + * @notice Updates a subset the reward recipients for a specific poolId. The collective weight of the recipients + * should add up to the recipients existing weights. Any recipients with a weight of 0 will be removed. * @param poolId the poolId to update * @param newRewardRecipients array of new reward recipients */ diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol index e253a56072..1a5eb41551 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/BaseFeeManager.t.sol @@ -15,7 +15,8 @@ import {Test} from "forge-std/Test.sol"; * @title BaseFeeManagerTest * @author Michael Fletcher * @notice Base class for all feeManager tests - * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup the feeManager + * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup the + * feeManager */ contract BaseFeeManagerTest is Test { //contracts diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol index 392bad7cc8..34083bac60 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFee.t.sol @@ -224,7 +224,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { //get the default payload bytes memory payload = getPayload(getV3Report(DEFAULT_FEED_1_V3)); - //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds would be returned to the caller of the proxy. + //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds + // would be returned to the caller of the proxy. processFee(payload, PROXY, address(link), DEFAULT_REPORT_NATIVE_FEE); //check the native unwrapped is no longer in the account @@ -248,7 +249,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { //get the default payload bytes memory payload = getPayload(getV3Report(DEFAULT_FEED_1_V3)); - //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds would be returned to the caller of the proxy. + //call processFee from the proxy to test whether the funds are returned to the subscriber. In reality, the funds + // would be returned to the caller of the proxy. processFee(payload, PROXY, address(native), DEFAULT_REPORT_NATIVE_FEE * 2); //check the native has been transferred and converted to wrapped native diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol index 1e941173f6..72a1ed66cd 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/fee-manager/FeeManager.processFeeBulk.t.sol @@ -32,7 +32,8 @@ contract FeeManagerProcessFeeTestV05 is BaseFeeManagerTest { assertEq(getLinkBalance(address(feeManager)), 0); assertEq(getLinkBalance(USER), DEFAULT_LINK_MINT_QUANTITY - DEFAULT_REPORT_LINK_FEE * NUMBER_OF_REPORTS); - //the subscriber (user) should receive funds back and not the proxy, although when live the proxy will forward the funds sent and not cover it seen here + //the subscriber (user) should receive funds back and not the proxy, although when live the proxy will forward the + // funds sent and not cover it seen here assertEq(USER.balance, DEFAULT_NATIVE_MINT_QUANTITY); assertEq(PROXY.balance, DEFAULT_NATIVE_MINT_QUANTITY); } diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol index 674cb6ccbd..9ef1708ca3 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/mocks/MockFeeManager.sol @@ -124,7 +124,8 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { /** * @notice Construct the FeeManager contract * @param _linkAddress The address of the LINK token - * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or wrapped) + * @param _nativeAddress The address of the wrapped ERC-20 version of the native token (represents fee in native or + * wrapped) * @param _proxyAddress The address of the proxy contract * @param _rewardManagerAddress The address of the reward manager contract */ @@ -186,7 +187,8 @@ contract MockFeeManager is IFeeManager, ConfirmedOwner, ITypeAndVersion { ) external payable override onlyProxy { FeeAndReward[] memory feesAndRewards = new IFeeManager.FeeAndReward[](payloads.length); - //keep track of the number of fees to prevent over initialising the FeePayment array within _convertToLinkAndNativeFees + //keep track of the number of fees to prevent over initialising the FeePayment array within + // _convertToLinkAndNativeFees uint256 numberOfLinkFees; uint256 numberOfNativeFees; diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol index d51207a098..0203b17278 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/BaseRewardManager.t.sol @@ -12,7 +12,8 @@ import {Test} from "forge-std/Test.sol"; * @title BaseRewardManagerTest * @author Michael Fletcher * @notice Base class for all reward manager tests - * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup a primary and secondary pool + * @dev This contract is intended to be inherited from and not used directly. It contains functionality to setup a + * primary and secondary pool */ contract BaseRewardManagerTest is Test { //contracts @@ -114,7 +115,8 @@ contract BaseRewardManagerTest is Test { rewardManager.setRewardRecipients(SECONDARY_POOL_ID, getSecondaryRecipients()); } - //override this to test variations of different recipients. changing this function will require existing tests to be updated as constants are hardcoded to be explicit + //override this to test variations of different recipients. changing this function will require existing tests to be + // updated as constants are hardcoded to be explicit function getPrimaryRecipients() public virtual returns (Common.AddressAndWeight[] memory) { //array of recipients Common.AddressAndWeight[] memory recipients = new Common.AddressAndWeight[](4); diff --git a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol index 1774be972b..f77dab0328 100644 --- a/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol +++ b/contracts/src/v0.8/llo-feeds/v0.5.0/test/reward-manager/RewardManager.claim.t.sol @@ -113,7 +113,8 @@ contract RewardManagerClaimTest is BaseRewardManagerTest { } function test_claimUnevenAmountRoundsDown() public { - //adding 1 to the pool should leave 1 wei worth of dust, which the contract doesn't handle due to it being economically infeasible + //adding 1 to the pool should leave 1 wei worth of dust, which the contract doesn't handle due to it being + // economically infeasible addFundsToPool(PRIMARY_POOL_ID, getAsset(1), FEE_MANAGER); //expected recipient amount is 1/4 of the pool deposit @@ -310,7 +311,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { //expected recipient amount is 1/4 of the pool deposit uint256 expectedRecipientAmount = POOL_DEPOSIT_AMOUNT / 4; - //check the recipients balance matches the ratio the recipient should have received. The first recipient is shared across both pools so should receive 1/4 of each pool + //check the recipients balance matches the ratio the recipient should have received. The first recipient is shared + // across both pools so should receive 1/4 of each pool assertEq(getAssetBalance(getPrimaryRecipients()[0].addr), expectedRecipientAmount * 2); assertEq(getAssetBalance(getPrimaryRecipients()[1].addr), expectedRecipientAmount); assertEq(getAssetBalance(getSecondaryRecipients()[1].addr), expectedRecipientAmount); @@ -408,7 +410,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { } function test_claimUnevenAmountRoundsDown() public { - //adding an uneven amount of dust to each pool, this should round down to the nearest whole number with 4 remaining in the contract + //adding an uneven amount of dust to each pool, this should round down to the nearest whole number with 4 remaining + // in the contract addFundsToPool(PRIMARY_POOL_ID, getAsset(3), FEE_MANAGER); addFundsToPool(SECONDARY_POOL_ID, getAsset(1), FEE_MANAGER); @@ -462,7 +465,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { //check the recipients balance matches the ratio the recipient should have received assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount); - //check the rewardManager has the remaining quantity, which is 3/4 of the initial deposit plus the deposit from the second pool + //check the rewardManager has the remaining quantity, which is 3/4 of the initial deposit plus the deposit from the + // second pool assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT * 2 - expectedRecipientAmount); //add funds to the pool to be split among the recipients @@ -521,7 +525,8 @@ contract RewardManagerRecipientClaimMultiplePoolsTest is BaseRewardManagerTest { assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount * 2); } - //the reward manager balance should again be the balance of the secondary pool as the primary pool has been emptied twice + //the reward manager balance should again be the balance of the secondary pool as the primary pool has been emptied + // twice assertEq(getAssetBalance(address(rewardManager)), POOL_DEPOSIT_AMOUNT); } @@ -708,7 +713,8 @@ contract RewardManagerRecipientClaimUnevenWeightTest is BaseRewardManagerTest { assertEq(getAssetBalance(recipient.addr), expectedRecipientAmount); } - //smaller deposits will consequently have less precision and will not be able to be split as evenly, the remaining 1 will be lost due to 333...|... being paid out instead of 333...4| + //smaller deposits will consequently have less precision and will not be able to be split as evenly, the remaining 1 + // will be lost due to 333...|... being paid out instead of 333...4| assertEq(getAssetBalance(address(rewardManager)), 1); } diff --git a/contracts/src/v0.8/operatorforwarder/Operator.sol b/contracts/src/v0.8/operatorforwarder/Operator.sol index f55e732b09..1b3a130da3 100644 --- a/contracts/src/v0.8/operatorforwarder/Operator.sol +++ b/contracts/src/v0.8/operatorforwarder/Operator.sol @@ -153,8 +153,10 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, "Must provide consumer enough gas"); // All updates to the oracle's fulfillment should come before calling the // callback(addr+functionId) as it is untrusted. - // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern - (bool success,) = callbackAddress.call(abi.encodeWithSelector(callbackFunctionId, requestId, data)); // solhint-disable-line avoid-low-level-calls + // See: + // https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern + (bool success,) = callbackAddress.call(abi.encodeWithSelector(callbackFunctionId, requestId, data)); // solhint-disable-line + // avoid-low-level-calls return success; } @@ -190,8 +192,10 @@ contract Operator is AuthorizedReceiver, ConfirmedOwner, LinkTokenReceiver, Oper require(gasleft() >= MINIMUM_CONSUMER_GAS_LIMIT, "Must provide consumer enough gas"); // All updates to the oracle's fulfillment should come before calling the // callback(addr+functionId) as it is untrusted. - // See: https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern - (bool success,) = callbackAddress.call(abi.encodePacked(callbackFunctionId, data)); // solhint-disable-line avoid-low-level-calls + // See: + // https://solidity.readthedocs.io/en/develop/security-considerations.html#use-the-checks-effects-interactions-pattern + (bool success,) = callbackAddress.call(abi.encodePacked(callbackFunctionId, data)); // solhint-disable-line + // avoid-low-level-calls return success; } diff --git a/contracts/src/v0.8/shared/access/AuthorizedCallers.sol b/contracts/src/v0.8/shared/access/AuthorizedCallers.sol index ccf85ece41..9746760801 100644 --- a/contracts/src/v0.8/shared/access/AuthorizedCallers.sol +++ b/contracts/src/v0.8/shared/access/AuthorizedCallers.sol @@ -5,7 +5,8 @@ import {Ownable2StepMsgSender} from "./Ownable2StepMsgSender.sol"; import {EnumerableSet} from "@openzeppelin/contracts@4.8.3/utils/structs/EnumerableSet.sol"; /// @title The AuthorizedCallers contract -/// @notice A contract that manages multiple authorized callers. Enables restricting access to certain functions to a set of addresses. +/// @notice A contract that manages multiple authorized callers. Enables restricting access to certain functions to a +/// set of addresses. contract AuthorizedCallers is Ownable2StepMsgSender { using EnumerableSet for EnumerableSet.AddressSet; diff --git a/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol b/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol index 0197010acc..961c96f347 100644 --- a/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol +++ b/contracts/src/v0.8/shared/call/CallWithExactGasZKSync.sol @@ -9,12 +9,14 @@ ISystemContext constant SYSTEM_CONTEXT_CONTRACT = ISystemContext(address(0x800b) * @title CallWithExactGasZKSync * @notice Library that attempts to call a target contract with exactly `gasAmount` gas on zkSync * and measures how much gas was actually used. - * Implementation based on the GasBoundCaller contract, https://github.com/matter-labs/era-contracts/blob/main/gas-bound-caller/contracts/GasBoundCaller.sol + * Implementation based on the GasBoundCaller contract, + * https://github.com/matter-labs/era-contracts/blob/main/gas-bound-caller/contracts/GasBoundCaller.sol */ library CallWithExactGasZKSync { error NoContract(); error NotEnoughGasForPubdata(); - /// @notice We assume that no more than `CALL_RETURN_OVERHEAD` ergs are used for the O(1) operations at the end of the execution, + /// @notice We assume that no more than `CALL_RETURN_OVERHEAD` ergs are used for the O(1) operations at the end of the + /// execution, /// as such relaying the return. uint256 internal constant CALL_RETURN_OVERHEAD = 400; @@ -28,8 +30,10 @@ library CallWithExactGasZKSync { /// (`CALL_ENTRY_OVERHEAD` + `CALL_RETURN_OVERHEAD`) to ensure that the call will not exceed the limit, so it may /// actually spend a bit less than `_maxTotalGas` in the end. /// @dev The entire `gas` passed to this function could be used, regardless - /// of the `_maxTotalGas` parameter. In other words, `max(gas(), _maxTotalGas)` is the maximum amount of gas that can be spent by this function. - /// @dev The function relays the `returndata` returned by the callee. In case the `callee` reverts, it reverts with the same error. + /// of the `_maxTotalGas` parameter. In other words, `max(gas(), _maxTotalGas)` is the maximum amount of gas that can + /// be spent by this function. + /// @dev The function relays the `returndata` returned by the callee. In case the `callee` reverts, it reverts with + /// the same error. /// @param _to The address of the contract to call. /// @param _maxTotalGas the maximum amount of gas that can be spent by the call. /// @param _data The calldata for the call. diff --git a/contracts/src/v0.8/shared/ocr2/OCR2Abstract.sol b/contracts/src/v0.8/shared/ocr2/OCR2Abstract.sol index cd3f197113..c4e0b75441 100644 --- a/contracts/src/v0.8/shared/ocr2/OCR2Abstract.sol +++ b/contracts/src/v0.8/shared/ocr2/OCR2Abstract.sol @@ -17,7 +17,8 @@ abstract contract OCR2Abstract is ITypeAndVersion { /// @param f maximum number of faulty/dishonest oracles the protocol can tolerate while still working correctly /// @param onchainConfig serialized configuration used by the contract (and possibly oracles) /// @param offchainConfigVersion version of the serialization format used for "offchainConfig" parameter - /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the contract + /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the + /// contract event ConfigSet( uint32 previousConfigBlockNumber, bytes32 configDigest, @@ -36,7 +37,8 @@ abstract contract OCR2Abstract is ITypeAndVersion { /// @param f number of faulty oracles the system can tolerate /// @param onchainConfig serialized configuration used by the contract (and possibly oracles) /// @param offchainConfigVersion version number for offchainEncoding schema - /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the contract + /// @param offchainConfig serialized configuration used by the oracles exclusively and only passed through the + /// contract function setConfig( address[] memory signers, address[] memory transmitters, @@ -107,8 +109,10 @@ abstract contract OCR2Abstract is ITypeAndVersion { /// @notice transmit is called to post a new report to the contract /// @param reportContext [0]: ConfigDigest, [1]: 27 byte padding, 4-byte epoch and 1-byte round, [2]: ExtraHash /// @param report serialized report, which the signatures are signing. - /// @param rs ith element is the R components of the ith signature on report. Must have at most MAX_NUM_ORACLES entries - /// @param ss ith element is the S components of the ith signature on report. Must have at most MAX_NUM_ORACLES entries + /// @param rs ith element is the R components of the ith signature on report. Must have at most MAX_NUM_ORACLES + /// entries + /// @param ss ith element is the S components of the ith signature on report. Must have at most MAX_NUM_ORACLES + /// entries /// @param rawVs ith element is the the V component of the ith signature function transmit( // NOTE: If these parameters are changed, expectedMsgDataLength and/or diff --git a/contracts/src/v0.8/shared/ocr2/OCR2Base.sol b/contracts/src/v0.8/shared/ocr2/OCR2Base.sol index 4c7a1e2aa1..20ebdf9cbf 100644 --- a/contracts/src/v0.8/shared/ocr2/OCR2Base.sol +++ b/contracts/src/v0.8/shared/ocr2/OCR2Base.sol @@ -246,7 +246,8 @@ abstract contract OCR2Base is OwnerIsCreator, OCR2Abstract { bytes32[] calldata ss ) private pure { // calldata will never be big enough to make this overflow - uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte per entry in report + uint256 expected = uint256(TRANSMIT_MSGDATA_CONSTANT_LENGTH_COMPONENT) + report.length // one byte per entry in + // report + rs.length * 32 // 32 bytes per entry in _rs + ss.length * 32 // 32 bytes per entry in _ss + 0; // placeholder diff --git a/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol b/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol index 394cb58eb4..56494048f2 100644 --- a/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol +++ b/contracts/src/v0.8/shared/test/call/CallWithExactGas.t.sol @@ -227,7 +227,8 @@ contract CallWithExactGas__callWithExactGasSafeReturnData is CallWithExactGasSet assertTrue(success, "Error: External Call Failed"); - // Assert equal within a margin of error of 1/64 of the gas limit to account for excess gas used by execution library + // Assert equal within a margin of error of 1/64 of the gas limit to account for excess gas used by execution + // library assertApproxEqAbs( gasUsed - CALL_WITH_EXACT_GAS_SAFE_RETURN_DATA_GAS_OVERHEAD, gasLimit, diff --git a/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol b/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol index e50a2599ec..33e229decf 100644 --- a/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol +++ b/contracts/src/v0.8/shared/test/testhelpers/GasConsumer.sol @@ -3,7 +3,8 @@ pragma solidity ^0.8.0; contract GasConsumer { function consumeAllGas() external view { assembly { - // While loop that operates indefinitely, written in yul to ensure better granularity over exactly how much gas is spent + // While loop that operates indefinitely, written in yul to ensure better granularity over exactly how much gas is + // spent for { // Loop will run forever since 0 < 1 } lt(0, 1) {} { diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol index c8730aacbf..23f48ef580 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burn.t.sol @@ -23,8 +23,8 @@ contract BurnMintERC20_burn is BurnMintERC20Setup { // Revert function test_burn_RevertWhen_SenderNotBurner() public { - // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful - // and should be checked + // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still + // useful and should be checked vm.expectRevert( abi.encodePacked( "AccessControl: account ", diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol index d4c6511ee7..b6a08f0894 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFrom.t.sol @@ -24,7 +24,8 @@ contract BurnMintERC20_burnFrom is BurnMintERC20Setup { // Reverts function test_burnFrom_RevertWhen_SenderNotBurner() public { - // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful + // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still + // useful // and should be checked vm.expectRevert( abi.encodePacked( diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol index cc30c09846..18bcc32b29 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.burnFromAlias.t.sol @@ -24,7 +24,8 @@ contract BurnMintERC20_burnFromAlias is BurnMintERC20Setup { // Reverts function test_burn_RevertWhen_SenderNotBurner() public { - // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful + // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still + // useful // and should be checked vm.expectRevert( abi.encodePacked( diff --git a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol index 389bbc2696..452f33b595 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/BurnMintERC20/BurnMintERC20.mint.t.sol @@ -26,7 +26,8 @@ contract BurnMintERC20_mint is BurnMintERC20Setup { function test_mint_RevertWhen_SenderNotMinter() public { vm.startPrank(STRANGER); - // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful + // OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still + // useful // and should be checked vm.expectRevert( abi.encodePacked( diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol index 51f054ac03..ad28ea71d9 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20PausableUUPS/BurnMintERC20PausableUUPS.upgrade.t.sol @@ -12,7 +12,8 @@ interface IUpgradeableProxy { /// @dev Mock contract with limited functionality used for testing only. /// @dev It adds a new freeze functionality to the BurnMintERC20PausableUUPS contract. -/// @dev We want to test that the new implementation works as expected and keeps track of the balances from previous version. +/// @dev We want to test that the new implementation works as expected and keeps track of the balances from previous +/// version. contract MockBurnMintERC20PausableUUPSV2 is BurnMintERC20PausableUUPS { error MockBurnMintERC20PausableUUPSV2__AccountFrozen(address account); @@ -23,7 +24,8 @@ contract MockBurnMintERC20PausableUUPSV2 is BurnMintERC20PausableUUPS { mapping(address => bool) s_isFrozen; } - // keccak256(abi.encode(uint256(keccak256("chainlink.storage.MockBurnMintERC20PausableUUPSV2")) - 1)) & ~bytes32(uint256(0xff)); + // keccak256(abi.encode(uint256(keccak256("chainlink.storage.MockBurnMintERC20PausableUUPSV2")) - 1)) & + // ~bytes32(uint256(0xff)); bytes32 private constant V2_STORAGE_LOCATION = 0x98bca5456fc57bb77324f8627b5055944605eb027b3a0652fea6ac1ede88a400; function _getV2Storage() private pure returns (MockBurnMintERC20PausableUUPSV2Storage storage $) { diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol index 6f1247c6f0..5cbb2907bc 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20Transparent/BurnMintERC20TransparentTest.t.sol @@ -101,7 +101,8 @@ contract BurnMintERC20TransparentTest is s_burnMintERC20Transparent.initialize(NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN); } - /// @dev Adding _disableInitializers() function to implementation's constructor ensures that no one can call initialize directly on the implementation. + /// @dev Adding _disableInitializers() function to implementation's constructor ensures that no one can call + /// initialize directly on the implementation. /// @dev The initialize should be only callable through Proxy. /// @dev This test tests that case. function test_Initialize_RevertWhen_CallIsNotThroughProxy() public { diff --git a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol index e6ac6f5068..263088824c 100644 --- a/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol +++ b/contracts/src/v0.8/shared/test/token/ERC20/upgradeable/BurnMintERC20UUPS/BurnMintERC20UUPSTest.t.sol @@ -104,7 +104,8 @@ contract BurnMintERC20UUPSTest is s_burnMintERC20UUPS.initialize(NAME, SYMBOL, DECIMALS, MAX_SUPPLY, PRE_MINT, DEFAULT_ADMIN, DEFAULT_UPGRADER); } - /// @dev Adding _disableInitializers() function to implementation's constructor ensures that no one can call initialize directly on the implementation. + /// @dev Adding _disableInitializers() function to implementation's constructor ensures that no one can call + /// initialize directly on the implementation. /// @dev The initialize should be only callable through Proxy. /// @dev This test tests that case. function test_Initialize_RevertWhen_CallIsNotThroughProxy() public { diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol index 8e97f0b7eb..459aee2574 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableTransparent.sol @@ -23,7 +23,8 @@ contract BurnMintERC20PausableFreezableTransparent is BurnMintERC20PausableTrans mapping(address => bool) isFrozen; } - // keccak256(abi.encode(uint256(keccak256("chainlink.storage.BurnMintERC20PausableFreezableTransparent")) - 1)) & ~bytes32(uint256(0xff)); + // keccak256(abi.encode(uint256(keccak256("chainlink.storage.BurnMintERC20PausableFreezableTransparent")) - 1)) & + // ~bytes32(uint256(0xff)); bytes32 private constant BURN_MINT_ERC20_PAUSABLE_FREEZABLE_TRANSPARENT_STORAGE_LOCATION = 0xe4a0d511ce93f7d3bf378a3a2c82dfeda12e9faf72c0533ddcd2be06e2d60f00; @@ -83,7 +84,8 @@ contract BurnMintERC20PausableFreezableTransparent is BurnMintERC20PausableTrans // │ ERC20 │ // ================================================================ - /// @dev Uses BurnMintERC20PausableTransparent _update hook to disallow transfers, minting and burning from/to frozen addresses. + /// @dev Uses BurnMintERC20PausableTransparent _update hook to disallow transfers, minting and burning from/to frozen + /// addresses. function _update(address from, address to, uint256 value) internal virtual override { BurnMintERC20PausableFreezableTransparentStorage storage $ = _getBurnMintERC20PausableFreezableTransparentStorage(); if ($.isFrozen[from]) revert BurnMintERC20PausableFreezableTransparent__AccountFrozen(from); diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol index 3568e094a8..3a8fecb40c 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20PausableFreezableUUPS.sol @@ -23,7 +23,8 @@ contract BurnMintERC20PausableFreezableUUPS is BurnMintERC20PausableUUPS { mapping(address => bool) isFrozen; } - // keccak256(abi.encode(uint256(keccak256("chainlink.storage.BurnMintERC20PausableFreezableUUPS")) - 1)) & ~bytes32(uint256(0xff)); + // keccak256(abi.encode(uint256(keccak256("chainlink.storage.BurnMintERC20PausableFreezableUUPS")) - 1)) & + // ~bytes32(uint256(0xff)); bytes32 private constant BURN_MINT_ERC20_PAUSABLE_FREEZABLE_UUPS_STORAGE_LOCATION = 0x36a30f686feb055c8d90421e230dafb8f47433e358189345608518a408badc00; @@ -83,7 +84,8 @@ contract BurnMintERC20PausableFreezableUUPS is BurnMintERC20PausableUUPS { // │ ERC20 │ // ================================================================ - /// @dev Uses BurnMintERC20PausableUUPS _update hook to disallow transfers, minting and burning from/to frozen addresses. + /// @dev Uses BurnMintERC20PausableUUPS _update hook to disallow transfers, minting and burning from/to frozen + /// addresses. function _update(address from, address to, uint256 value) internal virtual override { BurnMintERC20PausableFreezableUUPSStorage storage $ = _getBurnMintERC20PausableFreezableUUPSStorage(); if ($.isFrozen[from]) revert BurnMintERC20PausableFreezableUUPS__AccountFrozen(from); diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol index adf06b393f..04a0de440a 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20Transparent.sol @@ -36,7 +36,8 @@ contract BurnMintERC20Transparent is /// @custom:storage-location erc7201:chainlink.storage.BurnMintERC20Transparent struct BurnMintERC20TransparentStorage { - /// @dev the CCIPAdmin can be used to register with the CCIP token admin registry, but has no other special powers, and can only be transferred by the owner. + /// @dev the CCIPAdmin can be used to register with the CCIP token admin registry, but has no other special powers, + /// and can only be transferred by the owner. address ccipAdmin; /// @dev The number of decimals for the token uint8 decimals; @@ -44,7 +45,8 @@ contract BurnMintERC20Transparent is uint256 maxSupply; } - // keccak256(abi.encode(uint256(keccak256("chainlink.storage.BurnMintERC20Transparent")) - 1)) & ~bytes32(uint256(0xff)); + // keccak256(abi.encode(uint256(keccak256("chainlink.storage.BurnMintERC20Transparent")) - 1)) & + // ~bytes32(uint256(0xff)); bytes32 private constant BURN_MINT_ERC20_TRANSPARENT_STORAGE_LOCATION = 0xc5ce4c6194754ec56151469c4af5ff17dd2a95dab96bf61ba95b3ff079048900; diff --git a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol index dd88d321ad..afe3be9005 100644 --- a/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol +++ b/contracts/src/v0.8/shared/token/ERC20/upgradeable/BurnMintERC20UUPS.sol @@ -41,7 +41,8 @@ contract BurnMintERC20UUPS is /// @custom:storage-location erc7201:chainlink.storage.BurnMintERC20UUPS struct BurnMintERC20UUPSStorage { - /// @dev the CCIPAdmin can be used to register with the CCIP token admin registry, but has no other special powers, and can only be transferred by the owner. + /// @dev the CCIPAdmin can be used to register with the CCIP token admin registry, but has no other special powers, + /// and can only be transferred by the owner. address ccipAdmin; /// @dev The number of decimals for the token uint8 decimals; diff --git a/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol b/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol index 27107c042b..d127137747 100644 --- a/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol +++ b/contracts/src/v0.8/shared/util/SortedSetValidationUtil.sol @@ -14,7 +14,8 @@ library SortedSetValidationUtil { /// @notice Checks if `subset` is a valid and unique subset of `superset`. /// NOTE: Empty set is not considered a valid subset of superset for our use case. - /// @dev Both arrays must be valid sets (unique, sorted in ascending order) and `subset` must be entirely contained within `superset`. + /// @dev Both arrays must be valid sets (unique, sorted in ascending order) and `subset` must be entirely contained + /// within `superset`. /// @param subset The array of bytes32 to validate as a subset. /// @param superset The array of bytes32 in which subset is checked against. /// @custom:revert EmptySet If either `subset` or `superset` is empty. @@ -49,7 +50,8 @@ library SortedSetValidationUtil { /// @notice Validates that a given set is sorted and has unique elements. /// @dev Iterates through the array to check that each element is greater than the previous. /// @param set The array of bytes32 to validate. - /// @custom:revert NotASortedSet If any element is not greater than its predecessor or if any two consecutive elements are equal. + /// @custom:revert NotASortedSet If any element is not greater than its predecessor or if any two consecutive elements + /// are equal. function _checkIsValidSet( bytes32[] memory set ) private pure { diff --git a/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol b/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol index dbda4cf1f7..ab51b29b29 100644 --- a/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol +++ b/contracts/src/v0.8/vrf/KeepersVRFConsumer.sol @@ -60,7 +60,8 @@ contract KeepersVRFConsumer is KeeperCompatibleInterface, VRFConsumerBaseV2 { /** * @notice Returns true if and only if at least UPKEEP_INTERVAL seconds have elapsed * since the last upkeep or since construction of the contract. - * @return upkeepNeeded true if and only if at least UPKEEP_INTERVAL seconds have elapsed since the last upkeep or since construction + * @return upkeepNeeded true if and only if at least UPKEEP_INTERVAL seconds have elapsed since the last upkeep or + * since construction * of the contract. */ // solhint-disable-next-line chainlink-solidity/explicit-returns diff --git a/contracts/src/v0.8/vrf/VRFV2Wrapper.sol b/contracts/src/v0.8/vrf/VRFV2Wrapper.sol index e20f91302d..63f84fedf9 100644 --- a/contracts/src/v0.8/vrf/VRFV2Wrapper.sol +++ b/contracts/src/v0.8/vrf/VRFV2Wrapper.sol @@ -259,7 +259,8 @@ contract VRFV2Wrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2, VRF _requestGasPrice * (_gas + s_wrapperGasOverhead + s_coordinatorGasOverhead) + ChainSpecificUtil._getL1CalldataGasCost(s_fulfillmentTxSizeBytes) ); - // (1e18 juels/link) * ((wei/gas * (gas)) + l1wei) / (wei/link) == 1e18 juels * wei/link / (wei/link) == 1e18 juels * wei/link * link/wei == juels + // (1e18 juels/link) * ((wei/gas * (gas)) + l1wei) / (wei/link) == 1e18 juels * wei/link / (wei/link) == 1e18 juels + // * wei/link * link/wei == juels // baseFee is the base fee denominated in juels (link) uint256 baseFee = (1e18 * costWei) / uint256(_weiPerUnitLink); // feeWithPremium is the fee after the percentage premium is applied diff --git a/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol b/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol index 6e9f978d3a..fd6d001c0f 100644 --- a/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol +++ b/contracts/src/v0.8/vrf/dev/OptimismL1Fees.sol @@ -11,7 +11,8 @@ abstract contract OptimismL1Fees is ConfirmedOwner { /// @dev The padding size was estimated based on hypothetical max RLP-encoded transaction size uint256 internal constant L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE = 71; /// @dev Signature data size used in the GasPriceOracle predeploy - /// @dev reference: https://github.com/ethereum-optimism/optimism/blob/a96cbe7c8da144d79d4cec1303d8ae60a64e681e/packages/contracts-bedrock/contracts/L2/GasPriceOracle.sol#L145 + /// @dev reference: + /// https://github.com/ethereum-optimism/optimism/blob/a96cbe7c8da144d79d4cec1303d8ae60a64e681e/packages/contracts-bedrock/contracts/L2/GasPriceOracle.sol#L145 uint256 internal constant L1_TX_SIGNATURE_DATA_BYTES_SIZE = 68; /// @dev L1_FEE_DATA_PADDING includes 71 bytes for L1 data padding for Optimism bytes internal constant L1_FEE_DATA_PADDING = @@ -28,7 +29,8 @@ abstract contract OptimismL1Fees is ConfirmedOwner { /// @dev fulfillment calldata payload (number of non-zero bytes estimated based on historical data) /// @dev This option is available for the Coordinator and the Wrapper contract uint8 internal constant L1_CALLDATA_GAS_COST_MODE = 1; - /// @dev Option 3: getL1FeeUpperBound() function from predeploy GasPriceOracle contract (available after Fjord upgrade) + /// @dev Option 3: getL1FeeUpperBound() function from predeploy GasPriceOracle contract (available after Fjord + /// upgrade) /// @dev This option is available for the Coordinator and the Wrapper contract uint8 internal constant L1_GAS_FEES_UPPER_BOUND_MODE = 2; @@ -79,7 +81,8 @@ abstract contract OptimismL1Fees is ConfirmedOwner { s_l1FeeCoefficient * _calculateOptimismL1DataFee(calldataSizeBytes + L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE) ) / 100; } else if (l1FeeCalculationMode == L1_GAS_FEES_UPPER_BOUND_MODE) { - // getL1FeeUpperBound expects unsigned fully RLP-encoded transaction size so we have to account for paddding bytes as well + // getL1FeeUpperBound expects unsigned fully RLP-encoded transaction size so we have to account for paddding bytes + // as well return ( s_l1FeeCoefficient * OVM_GASPRICEORACLE.getL1FeeUpperBound(calldataSizeBytes + L1_UNSIGNED_RLP_ENC_TX_DATA_BYTES_SIZE) @@ -92,8 +95,10 @@ abstract contract OptimismL1Fees is ConfirmedOwner { uint256 calldataSizeBytes ) internal view returns (uint256) { // reference: https://docs.optimism.io/stack/transactions/fees#ecotone - // also: https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da - // we treat all bytes in the calldata payload as non-zero bytes (cost: 16 gas) because accurate estimation is too expensive + // also: + // https://github.com/ethereum-optimism/specs/blob/main/specs/protocol/exec-engine.md#ecotone-l1-cost-fee-changes-eip-4844-da + // we treat all bytes in the calldata payload as non-zero bytes (cost: 16 gas) because accurate estimation is too + // expensive // we also have to account for the signature data size uint256 l1GasUsed = (calldataSizeBytes + L1_TX_SIGNATURE_DATA_BYTES_SIZE) * 16; uint256 scaledBaseFee = OVM_GASPRICEORACLE.baseFeeScalar() * 16 * OVM_GASPRICEORACLE.l1BaseFee(); diff --git a/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol b/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol index c2deb6c587..5d98556531 100644 --- a/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol +++ b/contracts/src/v0.8/vrf/dev/SubscriptionAPI.sol @@ -121,9 +121,12 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr // if certain chains do not implement certain EIP's. // 21000 + // base cost of the transaction // 100 + 5000 + // warm subscription balance read and update. See https://eips.ethereum.org/EIPS/eip-2929 - // 2*2100 + 5000 - // cold read oracle address and oracle balance and first time oracle balance update, note first time will be 20k, but 5k subsequently - // 4800 + // request delete refund (refunds happen after execution), note pre-london fork was 15k. See https://eips.ethereum.org/EIPS/eip-3529 - // 6685 + // Positive static costs of argument encoding etc. note that it varies by +/- x*12 for every x bytes of non-zero data in the proof. + // 2*2100 + 5000 - // cold read oracle address and oracle balance and first time oracle balance update, note first + // time will be 20k, but 5k subsequently + // 4800 + // request delete refund (refunds happen after execution), note pre-london fork was 15k. See + // https://eips.ethereum.org/EIPS/eip-3529 + // 6685 + // Positive static costs of argument encoding etc. note that it varies by +/- x*12 for every x bytes of + // non-zero data in the proof. // Total: 37,185 gas. uint32 gasAfterPaymentCalculation; // Flat fee charged per fulfillment in millionths of native. @@ -133,7 +136,8 @@ abstract contract SubscriptionAPI is ConfirmedOwner, IERC677Receiver, IVRFSubscr // Should not exceed fulfillmentFlatFeeNativePPM // So fee range is [0, 2^32/10^6]. uint32 fulfillmentFlatFeeLinkDiscountPPM; - // nativePremiumPercentage is the percentage of the total gas costs that is added to the final premium for native payment + // nativePremiumPercentage is the percentage of the total gas costs that is added to the final premium for native + // payment // nativePremiumPercentage = 10 means 10% of the total gas costs is added. only integral percentage is allowed uint8 nativePremiumPercentage; // linkPremiumPercentage is the percentage of total gas costs that is added to the final premium for link payment diff --git a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol index 3c18083513..6a70e5e0a7 100644 --- a/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol +++ b/contracts/src/v0.8/vrf/dev/VRFConsumerBaseV2Upgradeable.sol @@ -111,7 +111,8 @@ abstract contract VRFConsumerBaseV2Upgradeable is Initializable { address private vrfCoordinator; // See https://github.com/OpenZeppelin/openzeppelin-sdk/issues/37. - // Each uint256 covers a single storage slot, see https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html. + // Each uint256 covers a single storage slot, see + // https://docs.soliditylang.org/en/latest/internals/layout_in_storage.html. // solhint-disable-next-line chainlink-solidity/prefix-storage-variables-with-s-underscore uint256[49] private __gap; diff --git a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol index 1fe5b5f2fb..ebbaf0a913 100644 --- a/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/VRFCoordinatorV2_5.sol @@ -251,7 +251,8 @@ contract VRFCoordinatorV2_5 is VRF, SubscriptionAPI, IVRFCoordinatorV2Plus { * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * extraArgs - Encoded extra arguments that has a boolean flag for whether payment - * should be made in native or LINK. Payment in LINK is only available if the LINK token is available to this contract. + * should be made in native or LINK. Payment in LINK is only available if the LINK token is available to this + * contract. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ diff --git a/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol b/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol index d6b21e2775..da76211636 100644 --- a/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol +++ b/contracts/src/v0.8/vrf/dev/VRFSubscriptionBalanceMonitor.sol @@ -169,7 +169,8 @@ contract VRFSubscriptionBalanceMonitor is ConfirmedOwner, Pausable, KeeperCompat /** * @notice Gets list of subscription ids that are underfunded and returns a keeper-compatible payload. - * @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need funds + * @return upkeepNeeded signals if upkeep is needed, performData is an abi encoded list of subscription ids that need + * funds */ function checkUpkeep( bytes calldata diff --git a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol index 1e02c0987f..7d9d28045e 100644 --- a/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol +++ b/contracts/src/v0.8/vrf/dev/VRFV2PlusWrapper.sol @@ -219,9 +219,11 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * @param _coordinatorGasOverheadPerWord reflects the gas overhead per word of the coordinator's * fulfillRandomWords function. * - * @param _coordinatorNativePremiumPercentage is the coordinator's premium ratio in percentage for requests paid in native. + * @param _coordinatorNativePremiumPercentage is the coordinator's premium ratio in percentage for requests paid in + * native. * - * @param _coordinatorLinkPremiumPercentage is the coordinator's premium ratio in percentage for requests paid in link. + * @param _coordinatorLinkPremiumPercentage is the coordinator's premium ratio in percentage for requests paid in + * link. * * @param _keyHash to use for requesting randomness. * @param _maxNumWords is the max number of words that can be requested in a single wrapped VRF request @@ -234,7 +236,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * @param _fulfillmentFlatFeeNativePPM is the flat fee in millionths of native that VRFCoordinatorV2Plus * charges for native payment. * - * @param _fulfillmentFlatFeeLinkDiscountPPM is the flat fee discount in millionths of native that VRFCoordinatorV2Plus + * @param _fulfillmentFlatFeeLinkDiscountPPM is the flat fee discount in millionths of native that + * VRFCoordinatorV2Plus * charges for link payment. */ /// @dev This function while having only 12 parameters is causing a Stack too deep error when running forge coverage. @@ -306,7 +309,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * @return fulfillmentFlatFeeNativePPM is the flat fee in millionths of native that VRFCoordinatorV2Plus * charges for native payment. * - * @return fulfillmentFlatFeeLinkDiscountPPM is the flat fee discount in millionths of native that VRFCoordinatorV2Plus + * @return fulfillmentFlatFeeLinkDiscountPPM is the flat fee discount in millionths of native that + * VRFCoordinatorV2Plus * charges for link payment. * * @return wrapperGasOverhead reflects the gas overhead of the wrapper's fulfillRandomWords @@ -321,7 +325,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P * @return coordinatorGasOverheadPerWord reflects the gas overhead per word of the coordinator's * fulfillRandomWords function. * - * @return wrapperNativePremiumPercentage is the premium ratio in percentage for native payment. For example, a value of 0 + * @return wrapperNativePremiumPercentage is the premium ratio in percentage for native payment. For example, a value + * of 0 * indicates no premium. A value of 15 indicates a 15 percent premium. * * @return wrapperLinkPremiumPercentage is the premium ratio in percentage for link payment. For example, a value of 0 @@ -434,7 +439,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // (wei/gas) * gas uint256 wrapperCostWei = _requestGasPrice * s_wrapperGasOverhead; - // coordinatorCostWei takes into account the L1 posting costs of the VRF fulfillment transaction, if we are on an L2. + // coordinatorCostWei takes into account the L1 posting costs of the VRF fulfillment transaction, if we are on an + // L2. // (wei/gas) * gas + l1wei uint256 coordinatorCostWei = _requestGasPrice * (_gas + _getCoordinatorGasOverhead(_numWords, true)) + _getL1CostWei(); @@ -458,7 +464,8 @@ contract VRFV2PlusWrapper is ConfirmedOwner, ITypeAndVersion, VRFConsumerBaseV2P // (wei/gas) * gas uint256 wrapperCostWei = _requestGasPrice * s_wrapperGasOverhead; - // coordinatorCostWei takes into account the L1 posting costs of the VRF fulfillment transaction, if we are on an L2. + // coordinatorCostWei takes into account the L1 posting costs of the VRF fulfillment transaction, if we are on an + // L2. // (wei/gas) * gas + l1wei uint256 coordinatorCostWei = _requestGasPrice * (_gas + _getCoordinatorGasOverhead(_numWords, false)) + _getL1CostWei(); diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol index 0cfc6307d8..9415508c1b 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorTestV2_5.sol @@ -250,7 +250,8 @@ contract VRFCoordinatorTestV2_5 is VRFOld, SubscriptionAPI, IVRFCoordinatorV2Plu * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * extraArgs - Encoded extra arguments that has a boolean flag for whether payment - * should be made in native or LINK. Payment in LINK is only available if the LINK token is available to this contract. + * should be made in native or LINK. Payment in LINK is only available if the LINK token is available to this + * contract. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ diff --git a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol index 1d1c2d41a0..561bb9f399 100644 --- a/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol +++ b/contracts/src/v0.8/vrf/dev/testhelpers/VRFCoordinatorV2PlusUpgradedVersion.sol @@ -245,7 +245,8 @@ contract VRFCoordinatorV2PlusUpgradedVersion is * in your fulfillRandomWords callback. Note these numbers are expanded in a * secure way by the VRFCoordinator from a single random value supplied by the oracle. * extraArgs - Encoded extra arguments that has a boolean flag for whether payment - * should be made in native or LINK. Payment in LINK is only available if the LINK token is available to this contract. + * should be made in native or LINK. Payment in LINK is only available if the LINK token is available to this + * contract. * @return requestId - A unique identifier of the request. Can be used to match * a request to a response in fulfillRandomWords. */ diff --git a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol index 38ef557ac4..2ea707d06f 100644 --- a/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFCoordinatorV2_5_Optimism.t.sol @@ -39,7 +39,8 @@ contract VRFV2CoordinatorV2_5_Optimism is BaseTest { /// @dev fulfillment calldata payload (number of non-zero bytes estimated based on historical data) /// @dev This option is available for the Coordinator and the Wrapper contract uint8 internal constant L1_CALLDATA_GAS_COST_MODE = 1; - /// @dev Option 3: getL1FeeUpperBound() function from predeploy GasPriceOracle contract (available after Fjord upgrade) + /// @dev Option 3: getL1FeeUpperBound() function from predeploy GasPriceOracle contract (available after Fjord + /// upgrade) /// @dev This option is available for the Coordinator and the Wrapper contract uint8 internal constant L1_GAS_FEES_UPPER_BOUND_MODE = 2; diff --git a/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol b/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol index f83ab70a30..ad5e56c42b 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2Plus.t.sol @@ -431,7 +431,8 @@ contract VRFV2Plus is BaseTest { // gasAfterPaymentCalculation is 50_000. // // The cost of the VRF fulfillment charged to the user is: - // paymentNoFee = (weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft() + l1CostWei) / link_native_ratio) + // paymentNoFee = (weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft() + l1CostWei) / + // link_native_ratio) // paymentNoFee = (1e11 * (50_000 + 86_000 + 0)) / .5 // paymentNoFee = 2.72e16 // flatFeeWei = 1e12 * (fulfillmentFlatFeeNativePPM - fulfillmentFlatFeeLinkDiscountPPM) @@ -492,7 +493,8 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, CALLBACK_GAS_LIMIT, NUM_WORDS, - VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})), // nativePayment, // nativePayment + VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})), // nativePayment, // + // nativePayment address(s_testConsumer) // requester ); s_testConsumer.requestRandomWords(CALLBACK_GAS_LIMIT, MIN_CONFIRMATIONS, NUM_WORDS, vrfKeyHash, false); @@ -741,7 +743,8 @@ contract VRFV2Plus is BaseTest { // gasAfterPaymentCalculation is 50_000. // // The cost of the VRF fulfillment charged to the user is: - // paymentNoFee = (weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft() + l1CostWei) / link_native_ratio) + // paymentNoFee = (weiPerUnitGas * (gasAfterPaymentCalculation + startGas - gasleft() + l1CostWei) / + // link_native_ratio) // network gas price is capped at gas lane max gas (5000 gwei) // paymentNoFee = (5e12 * (50_000 + 89_100 + 0)) / .5 // paymentNoFee = 1.391e+18 @@ -904,7 +907,8 @@ contract VRFV2Plus is BaseTest { MIN_CONFIRMATIONS, CALLBACK_GAS_LIMIT, NUM_WORDS, - VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})), // nativePayment, // nativePayment + VRFV2PlusClient._argsToBytes(VRFV2PlusClient.ExtraArgsV1({nativePayment: false})), // nativePayment, // + // nativePayment address(consumer) // requester ); consumer.requestRandomWords( diff --git a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol index cf7de04b0b..9f726c1a30 100644 --- a/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol +++ b/contracts/src/v0.8/vrf/test/VRFV2PlusWrapper_Optimism.t.sol @@ -35,7 +35,8 @@ contract VRFV2PlusWrapperOptimismAndBaseTest is BaseTest { /// @dev fulfillment calldata payload (number of non-zero bytes estimated based on historical data) /// @dev This option is available for the Coordinator and the Wrapper contract uint8 internal constant L1_CALLDATA_GAS_COST_MODE = 1; - /// @dev Option 3: getL1FeeUpperBound() function from predeploy GasPriceOracle contract (available after Fjord upgrade) + /// @dev Option 3: getL1FeeUpperBound() function from predeploy GasPriceOracle contract (available after Fjord + /// upgrade) /// @dev This option is available for the Coordinator and the Wrapper contract uint8 internal constant L1_GAS_FEES_UPPER_BOUND_MODE = 2; diff --git a/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol b/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol index c4e5ccb2db..7e0bcdab5c 100644 --- a/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol +++ b/contracts/src/v0.8/workflow/dev/v2/WorkflowRegistry.sol @@ -40,36 +40,48 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { /// Ownership proofs are signed messages generated by a trusted entity, with each proof being unique for each owner /// address. The owner address is embedded into the proof itself together with other relevant metadata that uniquely /// represents an off-chain account. - /// Fundamental assumption is that only a person (or a group of people) who has access both to the private key of the owner - /// address and to the off-chain account, may be able to generate a valid signature signed by the trusted entity. Once this + /// Fundamental assumption is that only a person (or a group of people) who has access both to the private key of the + /// owner + /// address and to the off-chain account, may be able to generate a valid signature signed by the trusted entity. Once + /// this /// valid signature is submitted to this contract, it can be verified and used to link or unlink the owner address. EnumerableMap.AddressToBytes32Map private s_linkedOwners; - /// @dev This is a mapping of ownership proofs indicating whether the proof has been previously used or not. This is used - /// to prevent someone from re-using the same proof for linking more than once, and ensures that each proof is unique per - /// single linking request, not matter if it originates from the same owner address or not. This allows us to verifiably + /// @dev This is a mapping of ownership proofs indicating whether the proof has been previously used or not. This is + /// used + /// to prevent someone from re-using the same proof for linking more than once, and ensures that each proof is unique + /// per + /// single linking request, not matter if it originates from the same owner address or not. This allows us to + /// verifiably /// enforce an invariant on proofs. mapping(bytes32 proof => bool used) private s_usedProofs; - /// @dev workflowRid (reference ID) is a hash of (owner ∥ name ∥ label). It functions as the primary index for the workflow storage. + /// @dev workflowRid (reference ID) is a hash of (owner ∥ name ∥ label). It functions as the primary index for the + /// workflow storage. mapping(bytes32 workflowRid => WorkflowMetadata workflowMetadata) private s_workflows; - /// @dev workflowKey is a hash of (owner ∥ name ) and maps to a set of Rids. It is used for filtering workflows based on just + /// @dev workflowKey is a hash of (owner ∥ name ) and maps to a set of Rids. It is used for filtering workflows + /// based on just /// the name, as there may be multiple workflows with the same name under a different tag. mapping(bytes32 workflowKey => EnumerableSet.Bytes32Set) private s_workflowKeyToRids; - /// @dev workflowId ⇒ workflowRid. This mapping lets us enforce global uniqueness of workflowId while also allows us to lookup + /// @dev workflowId ⇒ workflowRid. This mapping lets us enforce global uniqueness of workflowId while also allows us + /// to lookup /// workflows through the workflowId. mapping(bytes32 workflowId => bytes32 workflowRid) private s_idToRid; // Secondary indices for iteration / queries - mapping(address owner => EnumerableSet.Bytes32Set workflowRids) private s_activeOwnerWorkflowRids; // owner -> workflowRid set - mapping(bytes32 donHash => EnumerableSet.Bytes32Set workflowRids) private s_activeDONWorkflowRids; // donHash -> workflowRid set + mapping(address owner => EnumerableSet.Bytes32Set workflowRids) private s_activeOwnerWorkflowRids; // owner -> + // workflowRid set + mapping(bytes32 donHash => EnumerableSet.Bytes32Set workflowRids) private s_activeDONWorkflowRids; // donHash -> + // workflowRid set /// @dev Every workflow ever registered under `donFamily` as donHash. Pruned only on delete. mapping(bytes32 donHash => EnumerableSet.Bytes32Set workflowRids) private s_allDONRids; /// @dev Every workflow ever registered for an owner. Pruned only on delete. mapping(address owner => EnumerableSet.Bytes32Set workflowRids) private s_allOwnerRids; - mapping(bytes32 workflowKey => EnumerableSet.Bytes32Set activeRids) private s_activeRidsByWorkflowKey; // workflowKey → active Rids + mapping(bytes32 workflowKey => EnumerableSet.Bytes32Set activeRids) private s_activeRidsByWorkflowKey; // workflowKey + // → active Rids /// @dev Fast counters for limits enforcement - mapping(address owner => mapping(bytes32 donHash => uint32 workflowCount)) private s_userDONCount; // owner -> (donHash -> #workflows) + mapping(address owner => mapping(bytes32 donHash => uint32 workflowCount)) private s_userDONCount; // owner -> + // (donHash -> #workflows) /// @dev The don family (as a hash) that the workflow is assigned to. Only active workflows are assigned don families. /// When a workflow is paused it is removed from the don family. mapping(bytes32 rid => bytes32 donHash) private s_donByWorkflowRid; @@ -78,7 +90,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { mapping(bytes32 ownerDigestHash => uint32 expiryTimestamp) private s_requestsAllowlist; /// @dev Storing allowlisted requests for all owners, enabling fetching all non-expired requests OwnerAllowlistedRequest[] private s_requestAllowlistArray; - /// @dev Map each owner address to their arbitrary config. Can be used to control billing parameters or any other data per owner + /// @dev Map each owner address to their arbitrary config. Can be used to control billing parameters or any other data + /// per owner mapping(address owner => bytes config) private s_ownerConfig; /// @dev DON configs storage. @@ -249,7 +262,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { uint32 limit; } - /// @notice CapabilitiesRegistryConfig struct stores the pointer to the Capabilities Registry this Workflow Registry uses. + /// @notice CapabilitiesRegistryConfig struct stores the pointer to the Capabilities Registry this Workflow Registry + /// uses. /// @dev `registry` is the contract address; `chainSelector` identifies the /// chain where the registry lives (Chainlink selector). struct CapabilitiesRegistryConfig { @@ -257,7 +271,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { uint64 chainSelector; } - /// @dev Struct for EventRecord. This is used to store the events that were emited related to capacity and workflow life-cycle. + /// @dev Struct for EventRecord. This is used to store the events that were emited related to capacity and workflow + /// life-cycle. struct EventRecord { EventType eventType; uint32 timestamp; @@ -572,7 +587,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { /// @param proof The ownership proof to be submitted. /// @param signature The signature of the ownership proof metadata. /// @dev This function is used to verify if the ownership proof is valid without actually linking the owner address. - /// The ownership proof metadata is a combination of the claimed owner address, validity timestamp, and the proof hash. + /// The ownership proof metadata is a combination of the claimed owner address, validity timestamp, and the proof + /// hash. /// Request will be rejected if the validity timestamp has expired, owner addres is already linked, if the proof does /// not match the one that was originally submitted, or if the signature is not valid (for different reasons). function canLinkOwner(address owner, uint256 validityTimestamp, bytes32 proof, bytes calldata signature) public view { @@ -601,7 +617,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { /// @param proof The ownership proof to be submitted. /// @param signature The signature of the ownership proof metadata. /// @dev Run the verification process first by calling canLinkOwner() function. If the verification does not result - /// in a revert, then the ownership proof is valid and the owner address can be linked. Only the caller can link their address. + /// in a revert, then the ownership proof is valid and the owner address can be linked. Only the caller can link their + /// address. function linkOwner(uint256 validityTimestamp, bytes32 proof, bytes calldata signature) external { canLinkOwner(msg.sender, validityTimestamp, proof, signature); @@ -615,7 +632,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { /// @param validityTimestamp Validity of the ownership proof. /// @param signature The signature of the ownership proof metadata. /// @dev This function is used to verify if the ownership proof is valid without actually unlinking the owner address. - /// The ownership proof metadata is a combination of the claimed owner address, validity timestamp, and the proof hash. + /// The ownership proof metadata is a combination of the claimed owner address, validity timestamp, and the proof + /// hash. /// Request will be rejected if the validity timestamp has expired, owner address is not linked, if the proof does not /// match the one that was originally submitted, or if the signature is not valid (for different reasons). /// @dev Important difference between linking and unlinking is that unlinking may be called by any address, as @@ -642,7 +660,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { } } - /// @notice Transaction sender submits ownership proof for verification and approval. Upon approval, owner is unlinked. + /// @notice Transaction sender submits ownership proof for verification and approval. Upon approval, owner is + /// unlinked. /// This function can be called by anyone with signatures for the owner. /// @param owner The address of the owner to be unlinked. /// @param validityTimestamp Validity of the ownership proof. @@ -1221,7 +1240,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { ) external onlyOwner { EnumerableSet.Bytes32Set storage activeSet = s_activeOwnerWorkflowRids[owner]; - // Loop until the set is empty, always pausing the last element. We also know that all workflows in the list are active. + // Loop until the set is empty, always pausing the last element. We also know that all workflows in the list are + // active. while (activeSet.length() > 0) { bytes32 rid = activeSet.at(activeSet.length() - 1); WorkflowMetadata storage rec = s_workflows[rid]; // no msg.sender check when fetched directly from mapping diff --git a/contracts/src/v0.8/workflow/dev/v2/interfaces/ICapabilityConfiguration.sol b/contracts/src/v0.8/workflow/dev/v2/interfaces/ICapabilityConfiguration.sol index 6b2741c744..00f6f6ea01 100644 --- a/contracts/src/v0.8/workflow/dev/v2/interfaces/ICapabilityConfiguration.sol +++ b/contracts/src/v0.8/workflow/dev/v2/interfaces/ICapabilityConfiguration.sol @@ -25,7 +25,8 @@ interface ICapabilityConfiguration { /// @notice Called by the registry prior to the config being set for a particular DON. /// @param nodes The nodes that the configuration is being set for. /// @param donCapabilityConfig The configuration being set on the capability registry. - /// @param donCapabilityConfigCount The number of times the DON has been configured, tracked on the capability registry. + /// @param donCapabilityConfigCount The number of times the DON has been configured, tracked on the capability + /// registry. /// @param donId The DON ID on the capability registry. function beforeCapabilityConfigSet( bytes32[] calldata nodes, diff --git a/contracts/src/v0.8/workflow/v1/WorkflowRegistry.sol b/contracts/src/v0.8/workflow/v1/WorkflowRegistry.sol index 5dfd200b07..839895f761 100644 --- a/contracts/src/v0.8/workflow/v1/WorkflowRegistry.sol +++ b/contracts/src/v0.8/workflow/v1/WorkflowRegistry.sol @@ -24,7 +24,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { } struct WorkflowMetadata { - bytes32 workflowID; // Unique identifier from hash of owner address, WASM binary content, config content and secrets URL. + bytes32 workflowID; // Unique identifier from hash of owner address, WASM binary content, config content and + // secrets URL. address owner; // ─────────╮ Workflow owner. uint32 donID; // │ Unique identifier for the Workflow DON. WorkflowStatus status; // ─╯ Current status of the workflow (active, paused). @@ -46,7 +47,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { /// @dev Keep track of all workflowIDs to ensure uniqueness. mapping(bytes32 workflowID => bool inUse) private s_workflowIDs; - /// @dev List of all authorized EOAs/contracts allowed to access this contract's state functions. All view functions are open access. + /// @dev List of all authorized EOAs/contracts allowed to access this contract's state functions. All view functions + /// are open access. EnumerableSet.AddressSet private s_authorizedAddresses; /// @dev List of all authorized DON IDs. EnumerableSet.UintSet private s_allowedDONs; @@ -260,10 +262,12 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { /// /// Requirements: /// - `binaryURL` must always be provided, as it is required. - /// - If only one field is being updated, the other fields must be provided with their current values to keep them unchanged, otherwise + /// - If only one field is being updated, the other fields must be provided with their current values to keep them + /// unchanged, otherwise /// they will be treated as empty strings. /// - The DON ID must be in the allowed list to perform updates. - /// - The caller must be an authorized address. This means that even if the caller is the owner of the workflow, if they were later + /// - The caller must be an authorized address. This means that even if the caller is the owner of the workflow, if + /// they were later /// removed from the authorized addresses list, they will not be able to perform updates. /// /// Emits: @@ -391,7 +395,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { // Retrieve workflow metadata from storage WorkflowMetadata storage workflow = _getWorkflowFromStorage(msg.sender, workflowKey); - // Only checking access for the caller instead of using _validatePermissions so that even if the DON was removed from the + // Only checking access for the caller instead of using _validatePermissions so that even if the DON was removed + // from the // allowed list, the workflow can still be deleted. if (!s_authorizedAddresses.contains(msg.sender)) { revert AddressNotAuthorized(msg.sender); @@ -411,7 +416,8 @@ contract WorkflowRegistry is Ownable2StepMsgSender, ITypeAndVersion { s_secretsHashToWorkflows[secretsHash].remove(workflowKey); } - // Emit an event indicating the workflow has been deleted. We need to do this before deleting the workflow from storage. + // Emit an event indicating the workflow has been deleted. We need to do this before deleting the workflow from + // storage. emit WorkflowDeletedV1(workflow.workflowID, msg.sender, workflow.donID, workflow.workflowName); // Delete the workflow metadata from storage diff --git a/contracts/src/v0.8/workflow/v1/WorkflowRegistryManager.sol b/contracts/src/v0.8/workflow/v1/WorkflowRegistryManager.sol index dadd4335d9..94792363e2 100644 --- a/contracts/src/v0.8/workflow/v1/WorkflowRegistryManager.sol +++ b/contracts/src/v0.8/workflow/v1/WorkflowRegistryManager.sol @@ -91,8 +91,10 @@ contract WorkflowRegistryManager is Ownable2StepMsgSender, ITypeAndVersion { } /// @notice Activates a specific WorkflowRegistry version by its version number. - /// @dev This contract uses a 1-based index, meaning the `versionNumber` parameter must start at 1, with 1 representing the - /// first version. Setting `versionNumber` to 0 will revert, as 0 is not a valid index in this context. Only one version + /// @dev This contract uses a 1-based index, meaning the `versionNumber` parameter must start at 1, with 1 + /// representing the + /// first version. Setting `versionNumber` to 0 will revert, as 0 is not a valid index in this context. Only one + /// version /// can be active at a time; activating a new version automatically deactivates the currently active one (if any). /// @param versionNumber The 1-based version number to activate (minimum value is 1). /// @custom:throws VersionNotRegistered if the `versionNumber` is not valid or not registered. @@ -102,7 +104,8 @@ contract WorkflowRegistryManager is Ownable2StepMsgSender, ITypeAndVersion { _activateVersion(versionNumber); } - /// @dev This private function deactivates the currently active version (if any) before activating the specified version. It + /// @dev This private function deactivates the currently active version (if any) before activating the specified + /// version. It /// emits events for both deactivation and activation. /// @param versionNumber The version number of the version to activate. /// @custom:throws IndexOutOfBounds if the version number does not exist. @@ -139,13 +142,15 @@ contract WorkflowRegistryManager is Ownable2StepMsgSender, ITypeAndVersion { // ================================================================ /// @notice Returns a paginated list of all WorkflowRegistry versions. - /// @dev This function retrieves a range of versions based on the provided `start` and `limit` parameters. The contract uses + /// @dev This function retrieves a range of versions based on the provided `start` and `limit` parameters. The + /// contract uses /// a 1-based index, so the `start` parameter must be at least 1, representing the first version. If `limit` is set to /// 0 or exceeds `MAX_PAGINATION_LIMIT`, it defaults to `MAX_PAGINATION_LIMIT`. If `start` exceeds the total number of /// versions, an empty array is returned. /// @param start The index at which to start retrieving versions (1-based index, minimum value is 1). /// @param limit The maximum number of versions to retrieve (maximum is `MAX_PAGINATION_LIMIT`). - /// @return versions An array of `Version` structs containing version details, starting from the `start` index up to the + /// @return versions An array of `Version` structs containing version details, starting from the `start` index up to + /// the /// specified `limit`. function getAllVersions(uint32 start, uint32 limit) external view returns (Version[] memory versions) { uint32 totalVersions = s_latestVersionNumber; @@ -172,7 +177,8 @@ contract WorkflowRegistryManager is Ownable2StepMsgSender, ITypeAndVersion { /// @notice Retrieves the details of a specific WorkflowRegistry version by its version number. /// @dev This contract uses a 1-based index, so `versionNumber` must be at least 1. This means the first version is - /// represented by `versionNumber` of 1, not 0. Attempting to retrieve a version with a `versionNumber` of 0 or exceeding + /// represented by `versionNumber` of 1, not 0. Attempting to retrieve a version with a `versionNumber` of 0 or + /// exceeding /// `s_latestVersionNumber` will revert. /// @param versionNumber The 1-based version number of the version to retrieve (minimum value is 1). /// @return A `Version` struct containing the details of the specified version. From c0e14a6e1103689176fc7ba69ae3497c384641c0 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Sun, 31 Aug 2025 19:35:14 +0200 Subject: [PATCH 14/14] make payable in automation test & automation snapshot --- .../gas-snapshots/automation.gas-snapshot | 340 +++++++++++++++++- .../test/AutomationRegistry2_2.t.sol | 5 +- 2 files changed, 330 insertions(+), 15 deletions(-) diff --git a/contracts/gas-snapshots/automation.gas-snapshot b/contracts/gas-snapshots/automation.gas-snapshot index 620e0b2255..f319ddd434 100644 --- a/contracts/gas-snapshots/automation.gas-snapshot +++ b/contracts/gas-snapshots/automation.gas-snapshot @@ -1,13 +1,327 @@ -AutomationForwarder_forward:testBasicSuccess() (gas: 87630) -AutomationForwarder_forward:testNotAuthorizedReverts() (gas: 24560) -AutomationForwarder_forward:testWrongFunctionSelectorSuccess() (gas: 17958) -AutomationForwarder_updateRegistry:testBasicSuccess() (gas: 14577) -AutomationForwarder_updateRegistry:testNotFromRegistryNotAuthorizedReverts() (gas: 17665) -HeartbeatRequester_getAggregatorRequestHeartbeat:testBasicSuccess() (gas: 75412) -HeartbeatRequester_getAggregatorRequestHeartbeat:testHeartbeatNotPermittedReverts() (gas: 21730) -HeartbeatRequester_permitHeartbeat:testBasicDeployerSuccess() (gas: 48229) -HeartbeatRequester_permitHeartbeat:testBasicSuccess() (gas: 45844) -HeartbeatRequester_permitHeartbeat:testOnlyCallableByOwnerReverts() (gas: 17584) -HeartbeatRequester_removeHeartbeat:testBasicSuccess() (gas: 30192) -HeartbeatRequester_removeHeartbeat:testOnlyCallableByOwnerReverts() (gas: 15417) -HeartbeatRequester_removeHeartbeat:testRemoveNoPermitsSuccess() (gas: 15660) \ No newline at end of file +AcceptPayeeship:test_PayeeChanged() (gas: 190392) +AcceptPayeeship:test_PayeeChanged() (gas: 190437) +AcceptPayeeship:test_RevertsWhen_NotCalledByProposedPayee() (gas: 196687) +AcceptPayeeship:test_RevertsWhen_NotCalledByProposedPayee() (gas: 196732) +AcceptUpkeepAdmin:test_RevertsWhen_NotCalledByProposedAdmin() (gas: 74808) +AcceptUpkeepAdmin:test_RevertsWhen_NotCalledByProposedAdmin() (gas: 74808) +AcceptUpkeepAdmin:test_RevertsWhen_UpkeepCanceled() (gas: 116500) +AcceptUpkeepAdmin:test_RevertsWhen_UpkeepCanceled() (gas: 116500) +AcceptUpkeepAdmin:test_UpkeepAdminChanged() (gas: 80170) +AcceptUpkeepAdmin:test_UpkeepAdminChanged() (gas: 80192) +AddFunds:test_HappyWhen_NativeUpkeep_WithMsgValue0() (gas: 72996) +AddFunds:test_HappyWhen_NativeUpkeep_WithMsgValue0() (gas: 72997) +AddFunds:test_HappyWhen_NativeUpkeep_WithMsgValueNot0() (gas: 73024) +AddFunds:test_HappyWhen_NativeUpkeep_WithMsgValueNot0() (gas: 73025) +AddFunds:test_RevertsWhen_NativePaymentDoesntMatchBillingToken() (gas: 30117) +AddFunds:test_RevertsWhen_NativePaymentDoesntMatchBillingToken() (gas: 30117) +AddFunds:test_RevertsWhen_UpkeepDoesNotExist() (gas: 43337) +AddFunds:test_RevertsWhen_UpkeepDoesNotExist() (gas: 43337) +AddFunds:test_RevertsWhen_UpkeepIsCanceled() (gas: 64553) +AddFunds:test_RevertsWhen_UpkeepIsCanceled() (gas: 64553) +AddFunds:test_anyoneCanAddFunds() (gas: 79808) +AddFunds:test_anyoneCanAddFunds() (gas: 79874) +AddFunds:test_emitsAnEvent() (gas: 54698) +AddFunds:test_emitsAnEvent() (gas: 54698) +AddFunds:test_movesFundFromCorrectToken() (gas: 122551) +AddFunds:test_movesFundFromCorrectToken() (gas: 122683) +ApproveUpkeep:testUSDToken_happy() (gas: 593090) +AutomationForwarderTest_constructor:testInitialValues() (gas: 16547) +AutomationForwarderTest_constructor:testTypeAndVersion() (gas: 12393) +AutomationForwarderTest_forward:testOnlyCallableByTheRegistry() (gas: 16528) +AutomationForwarderTest_forward:testReturnsSuccessValueAndGasUsed() (gas: 18153) +AutomationForwarderTest_updateRegistry:testOnlyCallableByTheActiveRegistry() (gas: 19225) +AutomationRegistry2_2_CheckUpkeep:testPreventExecutionOnCheckUpkeep() (gas: 14758) +AutomationRegistry2_2_LatestConfigDetails:testGet() (gas: 13570) +AutomationRegistry2_2_SetConfig:testSetConfigSuccess() (gas: 882481) +BillingOverrides:test_Happy_MaxGasPayment_WithBillingOverrides() (gas: 125684) +BillingOverrides:test_Happy_MaxGasPayment_WithBillingOverrides() (gas: 130811) +BillingOverrides:test_Happy_RemoveBillingOverrides() (gas: 25575) +BillingOverrides:test_Happy_RemoveBillingOverrides() (gas: 25575) +BillingOverrides:test_Happy_SetBillingOverrides() (gas: 50439) +BillingOverrides:test_Happy_SetBillingOverrides() (gas: 50439) +BillingOverrides:test_RevertsWhen_NotPrivilegeManager() (gas: 18549) +BillingOverrides:test_RevertsWhen_NotPrivilegeManager() (gas: 18549) +BillingOverrides:test_RevertsWhen_UpkeepCancelled() (gas: 66755) +BillingOverrides:test_RevertsWhen_UpkeepCancelled() (gas: 66755) +CancelUpkeep:testUSDToken_happy() (gas: 140268) +CancelUpkeep:test_CancelUpkeep_EmitEvent_CalledByAdmin() (gas: 64039) +CancelUpkeep:test_CancelUpkeep_EmitEvent_CalledByAdmin() (gas: 64039) +CancelUpkeep:test_CancelUpkeep_EmitEvent_CalledByOwner() (gas: 62633) +CancelUpkeep:test_CancelUpkeep_EmitEvent_CalledByOwner() (gas: 62633) +CancelUpkeep:test_CancelUpkeep_SetMaxValidBlockNumber_CalledByAdmin() (gas: 82474) +CancelUpkeep:test_CancelUpkeep_SetMaxValidBlockNumber_CalledByAdmin() (gas: 82496) +CancelUpkeep:test_CancelUpkeep_SetMaxValidBlockNumber_CalledByOwner() (gas: 83073) +CancelUpkeep:test_CancelUpkeep_SetMaxValidBlockNumber_CalledByOwner() (gas: 83095) +CancelUpkeep:test_RevertsWhen_IdIsInvalid_CalledByAdmin() (gas: 27846) +CancelUpkeep:test_RevertsWhen_IdIsInvalid_CalledByAdmin() (gas: 27846) +CancelUpkeep:test_RevertsWhen_IdIsInvalid_CalledByOwner() (gas: 28818) +CancelUpkeep:test_RevertsWhen_IdIsInvalid_CalledByOwner() (gas: 28818) +CancelUpkeep:test_RevertsWhen_NotCalledByOwnerOrAdmin() (gas: 32270) +CancelUpkeep:test_RevertsWhen_NotCalledByOwnerOrAdmin() (gas: 32282) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByAdmin_CalledByAdmin() (gas: 65424) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByAdmin_CalledByAdmin() (gas: 65430) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByAdmin_CalledByOwner() (gas: 66774) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByAdmin_CalledByOwner() (gas: 66780) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByOwner_CalledByAdmin() (gas: 64417) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByOwner_CalledByAdmin() (gas: 64444) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByOwner_CalledByOwner() (gas: 64091) +CancelUpkeep:test_RevertsWhen_UpkeepAlreadyCanceledByOwner_CalledByOwner() (gas: 64118) +CheckUpkeep:testPreventExecutionOnCheckUpkeep() (gas: 17737) +CheckUpkeep:testPreventExecutionOnCheckUpkeep() (gas: 17737) +GetActiveUpkeepIDs:test_ReturnsAllRemainingUpkeeps_WhenMaxCountIsTooLarge() (gas: 28639) +GetActiveUpkeepIDs:test_ReturnsAllRemainingUpkeeps_WhenMaxCountIsTooLarge() (gas: 28639) +GetActiveUpkeepIDs:test_ReturnsAllUpkeeps_WhenMaxCountIsZero() (gas: 40237) +GetActiveUpkeepIDs:test_ReturnsAllUpkeeps_WhenMaxCountIsZero() (gas: 40237) +GetActiveUpkeepIDs:test_ReturnsUpkeeps_BoundByMaxCount() (gas: 30927) +GetActiveUpkeepIDs:test_ReturnsUpkeeps_BoundByMaxCount() (gas: 30927) +GetActiveUpkeepIDs:test_RevertsWhen_IndexOutOfRange() (gas: 35344) +GetActiveUpkeepIDs:test_RevertsWhen_IndexOutOfRange() (gas: 35344) +GetMinBalanceForUpkeep:test_accountsForFlatFee_with18Decimals() (gas: 588684) +GetMinBalanceForUpkeep:test_accountsForFlatFee_with18Decimals() (gas: 591097) +GetMinBalanceForUpkeep:test_accountsForFlatFee_with6Decimals() (gas: 589493) +GetMinBalanceForUpkeep:test_accountsForFlatFee_with6Decimals() (gas: 591901) +LatestConfigDetails:testGet() (gas: 13623) +LatestConfigDetails:testGet() (gas: 13623) +MercuryRegistryTest:testMercuryRegistry() (gas: 956144) +MercuryRegistryTest:testMercuryRegistryBatchUpkeep() (gas: 1778429) +MigrateReceive:test_RevertsWhen_CalledByNonAdmin() (gas: 41075) +MigrateReceive:test_RevertsWhen_CalledByNonAdmin() (gas: 41078) +MigrateReceive:test_RevertsWhen_PermissionsNotSet() (gas: 489049) +MigrateReceive:test_RevertsWhen_PermissionsNotSet() (gas: 489115) +MigrateReceive:test_RevertsWhen_ReceivingRegistryDoesNotSupportToken() (gas: 1960823) +MigrateReceive:test_RevertsWhen_ReceivingRegistryDoesNotSupportToken() (gas: 1960997) +MigrateReceive:test_Success() (gas: 1490580) +MigrateReceive:test_Success() (gas: 1491753) +NOPsSettlement:testDisableOffchainPaymentsRevertDueToUnauthorizedCaller() (gas: 20029749) +NOPsSettlement:testDisableOffchainPaymentsRevertDueToUnauthorizedCaller() (gas: 20051480) +NOPsSettlement:testDisableOffchainPaymentsSuccess() (gas: 20012442) +NOPsSettlement:testDisableOffchainPaymentsSuccess() (gas: 20034151) +NOPsSettlement:testMultiplePerformsAndNodesCanWithdrawOnchain() (gas: 28569687) +NOPsSettlement:testMultiplePerformsAndNodesCanWithdrawOnchain() (gas: 28904565) +NOPsSettlement:testSettleNOPsOffchainForDeactivatedTransmittersSuccess() (gas: 21069095) +NOPsSettlement:testSettleNOPsOffchainForDeactivatedTransmittersSuccess() (gas: 21208718) +NOPsSettlement:testSettleNOPsOffchainRevertDueToOffchainSettlementDisabled() (gas: 20013169) +NOPsSettlement:testSettleNOPsOffchainRevertDueToOffchainSettlementDisabled() (gas: 20034900) +NOPsSettlement:testSettleNOPsOffchainRevertDueToUnauthorizedCaller() (gas: 20181700) +NOPsSettlement:testSettleNOPsOffchainRevertDueToUnauthorizedCaller() (gas: 20203365) +NOPsSettlement:testSettleNOPsOffchainSuccess() (gas: 20169977) +NOPsSettlement:testSettleNOPsOffchainSuccess() (gas: 20191642) +NOPsSettlement:testSettleNOPsOffchainSuccessWithERC20MultiSteps() (gas: 20920203) +NOPsSettlement:testSettleNOPsOffchainSuccessWithERC20MultiSteps() (gas: 21062243) +NOPsSettlement:testSinglePerformAndNodesCanWithdrawOnchain() (gas: 20847162) +NOPsSettlement:testSinglePerformAndNodesCanWithdrawOnchain() (gas: 20987528) +OnTokenTransfer:test_Happy() (gas: 43136) +OnTokenTransfer:test_Happy() (gas: 43180) +OnTokenTransfer:test_RevertsWhen_NotCalledByTheLinkToken() (gas: 14138) +OnTokenTransfer:test_RevertsWhen_NotCalledByTheLinkToken() (gas: 14138) +OnTokenTransfer:test_RevertsWhen_NotCalledWithExactly32Bytes() (gas: 66466) +OnTokenTransfer:test_RevertsWhen_NotCalledWithExactly32Bytes() (gas: 66466) +OnTokenTransfer:test_RevertsWhen_TheUpkeepDoesNotUseLINKAsItsBillingToken() (gas: 21105) +OnTokenTransfer:test_RevertsWhen_TheUpkeepDoesNotUseLINKAsItsBillingToken() (gas: 21105) +OnTokenTransfer:test_RevertsWhen_TheUpkeepIsCancelledOrDNE() (gas: 39300) +OnTokenTransfer:test_RevertsWhen_TheUpkeepIsCancelledOrDNE() (gas: 39300) +Pause:test_CalledByOwner_success() (gas: 80302) +Pause:test_CalledByOwner_success() (gas: 80347) +Pause:test_RevertsWhen_CalledByNonOwner() (gas: 19870) +Pause:test_RevertsWhen_CalledByNonOwner() (gas: 19892) +Pause:test_revertsWhen_registerUpkeepInPausedRegistry() (gas: 411358) +Pause:test_revertsWhen_transmitInPausedRegistry() (gas: 80321) +Pause:test_revertsWhen_transmitInPausedRegistry() (gas: 80354) +PauseUpkeep:test_EmitEvent_CalledByAdmin() (gas: 47717) +PauseUpkeep:test_EmitEvent_CalledByAdmin() (gas: 47717) +PauseUpkeep:test_RevertsWhen_InvalidUpkeepId() (gas: 18754) +PauseUpkeep:test_RevertsWhen_InvalidUpkeepId() (gas: 18754) +PauseUpkeep:test_RevertsWhen_NotCalledByUpkeepAdmin() (gas: 18704) +PauseUpkeep:test_RevertsWhen_NotCalledByUpkeepAdmin() (gas: 18704) +PauseUpkeep:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 66817) +PauseUpkeep:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 66817) +PauseUpkeep:test_RevertsWhen_UpkeepAlreadyPaused() (gas: 49260) +PauseUpkeep:test_RevertsWhen_UpkeepAlreadyPaused() (gas: 49260) +RegisterUpkeep:testLink_autoApproveOff_happy() (gas: 143975) +RegisterUpkeep:testLink_autoApproveOff_revertOnDuplicateEntry() (gas: 161891) +RegisterUpkeep:testLink_autoApproveOn_happy() (gas: 595101) +RegisterUpkeep:testNative_autoApproveOff_msgValue0() (gas: 142342) +RegisterUpkeep:testNative_autoApproveOff_msgValueNot0() (gas: 167388) +RegisterUpkeep:testNative_autoApproveOn_happy() (gas: 623830) +RegisterUpkeep:testUSDToken_autoApproveOff_happy() (gas: 143667) +RegisterUpkeep:testUSDToken_autoApproveOn_happy() (gas: 601551) +RegisterUpkeep:test_Happy() (gas: 6600435) +RegisterUpkeep:test_Happy() (gas: 6757989) +RegisterUpkeep:test_RevertsWhen_CalledByNonOwner() (gas: 24207) +RegisterUpkeep:test_RevertsWhen_CalledByNonOwner() (gas: 24207) +RegisterUpkeep:test_RevertsWhen_CheckDataIsTooLarge() (gas: 2183414) +RegisterUpkeep:test_RevertsWhen_CheckDataIsTooLarge() (gas: 2340881) +RegisterUpkeep:test_RevertsWhen_ExecuteGasIsTooHigh() (gas: 243958) +RegisterUpkeep:test_RevertsWhen_ExecuteGasIsTooHigh() (gas: 401503) +RegisterUpkeep:test_RevertsWhen_ExecuteGasIsTooLow() (gas: 241591) +RegisterUpkeep:test_RevertsWhen_ExecuteGasIsTooLow() (gas: 399136) +RegisterUpkeep:test_RevertsWhen_Paused() (gas: 252544) +RegisterUpkeep:test_RevertsWhen_Paused() (gas: 410111) +RegisterUpkeep:test_RevertsWhen_TargetIsNotAContract() (gas: 44715) +RegisterUpkeep:test_RevertsWhen_TargetIsNotAContract() (gas: 44715) +RegisterUpkeep:test_RevertsWhen_TheBillingTokenIsNotConfigured() (gas: 268713) +RegisterUpkeep:test_RevertsWhen_TheBillingTokenIsNotConfigured() (gas: 426258) +RegisterUpkeep:test_revertOnInsufficientPayment() (gas: 63553) +RegisterUpkeep:test_revertOnInvalidAdminAddress() (gas: 63509) +RegisterUpkeep:test_revertOnInvalidBillingToken() (gas: 78305) +SetAdminPrivilegeConfig:test_RevertsWhen_CalledByNonManager() (gas: 42408) +SetAdminPrivilegeConfig:test_RevertsWhen_CalledByNonManager() (gas: 42430) +SetAdminPrivilegeConfig:test_SetAdminPrivilegeConfig_CalledByManager() (gas: 71362) +SetAdminPrivilegeConfig:test_SetAdminPrivilegeConfig_CalledByManager() (gas: 71406) +SetAdminPrivilegeConfig:test_UpkeepHasEmptyConfig() (gas: 43387) +SetAdminPrivilegeConfig:test_UpkeepHasEmptyConfig() (gas: 43409) +SetConfig:testSetConfigDuplicateBillingConfigFailure() (gas: 143645) +SetConfig:testSetConfigDuplicateBillingConfigFailure() (gas: 143645) +SetConfig:testSetConfigMultipleBillingConfigsSuccess() (gas: 407673) +SetConfig:testSetConfigMultipleBillingConfigsSuccess() (gas: 407761) +SetConfig:testSetConfigOnTransmittersAndPayees() (gas: 165268) +SetConfig:testSetConfigOnTransmittersAndPayees() (gas: 165290) +SetConfig:testSetConfigRevertDueToInvalidDecimals() (gas: 124953) +SetConfig:testSetConfigRevertDueToInvalidDecimals() (gas: 124953) +SetConfig:testSetConfigRevertDueToInvalidToken() (gas: 16778427) +SetConfig:testSetConfigRevertDueToInvalidToken() (gas: 16800093) +SetConfig:testSetConfigSuccess() (gas: 403052) +SetConfig:testSetConfigSuccess() (gas: 403140) +SetConfig:testSetConfigTwiceAndLastSetOverwrites() (gas: 608876) +SetConfig:testSetConfigTwiceAndLastSetOverwrites() (gas: 609018) +SetConfig:testSetConfigWithNewTransmittersSuccess() (gas: 17893476) +SetConfig:testSetConfigWithNewTransmittersSuccess() (gas: 17915275) +SetPayees:test_DotNotSetPayeesToIgnoredAddress() (gas: 20290013) +SetPayees:test_DotNotSetPayeesToIgnoredAddress() (gas: 20311678) +SetPayees:test_RevertsWhen_InvalidPayee() (gas: 37253) +SetPayees:test_RevertsWhen_InvalidPayee() (gas: 37253) +SetPayees:test_RevertsWhen_NotCalledByOwner() (gas: 31194) +SetPayees:test_RevertsWhen_NotCalledByOwner() (gas: 31194) +SetPayees:test_RevertsWhen_PayeesLengthError() (gas: 23676) +SetPayees:test_RevertsWhen_PayeesLengthError() (gas: 23676) +SetPayees:test_SetPayees_WhenExistingPayeesAreEmpty() (gas: 20345653) +SetPayees:test_SetPayees_WhenExistingPayeesAreEmpty() (gas: 20367318) +SetPeerRegistryMigrationPermission:test_RevertsWhen_CalledByNonOwner() (gas: 42540) +SetPeerRegistryMigrationPermission:test_RevertsWhen_CalledByNonOwner() (gas: 42562) +SetPeerRegistryMigrationPermission:test_RevertsWhen_InvalidPermission_CalledByOwner() (gas: 42774) +SetPeerRegistryMigrationPermission:test_RevertsWhen_InvalidPermission_CalledByOwner() (gas: 42796) +SetPeerRegistryMigrationPermission:test_SetPeerRegistryMigrationPermission_CalledByOwner() (gas: 60503) +SetPeerRegistryMigrationPermission:test_SetPeerRegistryMigrationPermission_CalledByOwner() (gas: 60569) +SetUpkeepCheckData:test_RevertsWhen_InvalidUpkeepId() (gas: 19204) +SetUpkeepCheckData:test_RevertsWhen_InvalidUpkeepId() (gas: 19204) +SetUpkeepCheckData:test_RevertsWhen_NewCheckDataTooLarge() (gas: 52398) +SetUpkeepCheckData:test_RevertsWhen_NewCheckDataTooLarge() (gas: 52398) +SetUpkeepCheckData:test_RevertsWhen_NotCalledByAdmin() (gas: 19105) +SetUpkeepCheckData:test_RevertsWhen_NotCalledByAdmin() (gas: 19105) +SetUpkeepCheckData:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 67261) +SetUpkeepCheckData:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 67261) +SetUpkeepCheckData:test_UpdateOffchainConfigOnPausedUpkeep_CalledByAdmin() (gas: 103993) +SetUpkeepCheckData:test_UpdateOffchainConfigOnPausedUpkeep_CalledByAdmin() (gas: 104037) +SetUpkeepCheckData:test_UpdateOffchainConfig_CalledByAdmin() (gas: 71165) +SetUpkeepCheckData:test_UpdateOffchainConfig_CalledByAdmin() (gas: 71187) +SetUpkeepGasLimit:test_RevertsWhen_InvalidUpkeepId() (gas: 21099) +SetUpkeepGasLimit:test_RevertsWhen_InvalidUpkeepId() (gas: 21099) +SetUpkeepGasLimit:test_RevertsWhen_NewGasLimitOutOfRange() (gas: 25771) +SetUpkeepGasLimit:test_RevertsWhen_NewGasLimitOutOfRange() (gas: 25771) +SetUpkeepGasLimit:test_RevertsWhen_NotCalledByAdmin() (gas: 20988) +SetUpkeepGasLimit:test_RevertsWhen_NotCalledByAdmin() (gas: 20988) +SetUpkeepGasLimit:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 69101) +SetUpkeepGasLimit:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 69101) +SetUpkeepGasLimit:test_UpdateGasLimit_CalledByAdmin() (gas: 51219) +SetUpkeepGasLimit:test_UpdateGasLimit_CalledByAdmin() (gas: 51241) +SetUpkeepOffchainConfig:test_RevertsWhen_InvalidUpkeepId() (gas: 19128) +SetUpkeepOffchainConfig:test_RevertsWhen_InvalidUpkeepId() (gas: 19128) +SetUpkeepOffchainConfig:test_RevertsWhen_NotCalledByAdmin() (gas: 19118) +SetUpkeepOffchainConfig:test_RevertsWhen_NotCalledByAdmin() (gas: 19118) +SetUpkeepOffchainConfig:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 67209) +SetUpkeepOffchainConfig:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 67209) +SetUpkeepOffchainConfig:test_UpdateOffchainConfig_CalledByAdmin() (gas: 68980) +SetUpkeepOffchainConfig:test_UpdateOffchainConfig_CalledByAdmin() (gas: 69002) +SetUpkeepPrivilegeConfig:test_RevertsWhen_CalledByNonManager() (gas: 21806) +SetUpkeepPrivilegeConfig:test_RevertsWhen_CalledByNonManager() (gas: 21806) +SetUpkeepPrivilegeConfig:test_SetUpkeepPrivilegeConfig_CalledByManager() (gas: 50651) +SetUpkeepPrivilegeConfig:test_SetUpkeepPrivilegeConfig_CalledByManager() (gas: 50673) +SetUpkeepPrivilegeConfig:test_UpkeepHasEmptyConfig() (gas: 22758) +SetUpkeepPrivilegeConfig:test_UpkeepHasEmptyConfig() (gas: 22780) +SetUpkeepTriggerConfig:test_RevertsWhen_InvalidUpkeepId() (gas: 19150) +SetUpkeepTriggerConfig:test_RevertsWhen_InvalidUpkeepId() (gas: 19150) +SetUpkeepTriggerConfig:test_RevertsWhen_NotCalledByAdmin() (gas: 19052) +SetUpkeepTriggerConfig:test_RevertsWhen_NotCalledByAdmin() (gas: 19052) +SetUpkeepTriggerConfig:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 67231) +SetUpkeepTriggerConfig:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 67231) +SetUpkeepTriggerConfig:test_UpdateTriggerConfig_CalledByAdmin() (gas: 55130) +SetUpkeepTriggerConfig:test_UpdateTriggerConfig_CalledByAdmin() (gas: 55152) +TransferPayeeship:test_EmitEvent_CalledByPayee() (gas: 200766) +TransferPayeeship:test_EmitEvent_CalledByPayee() (gas: 200810) +TransferPayeeship:test_RevertsWhen_NotCalledByPayee() (gas: 46552) +TransferPayeeship:test_RevertsWhen_NotCalledByPayee() (gas: 46574) +TransferPayeeship:test_RevertsWhen_TransferToSelf() (gas: 147354) +TransferPayeeship:test_RevertsWhen_TransferToSelf() (gas: 147376) +TransferPayeeship:test_Transfer_DoesNotChangePayee() (gas: 202465) +TransferPayeeship:test_Transfer_DoesNotChangePayee() (gas: 202487) +TransferUpkeepAdmin:test_CancelTransfer_ByTransferToEmptyAddress() (gas: 57236) +TransferUpkeepAdmin:test_CancelTransfer_ByTransferToEmptyAddress() (gas: 57236) +TransferUpkeepAdmin:test_DoesNotChangeUpkeepAdmin() (gas: 89523) +TransferUpkeepAdmin:test_DoesNotChangeUpkeepAdmin() (gas: 89545) +TransferUpkeepAdmin:test_EmitEvent_CalledByAdmin() (gas: 73760) +TransferUpkeepAdmin:test_EmitEvent_CalledByAdmin() (gas: 73760) +TransferUpkeepAdmin:test_RevertsWhen_NotCalledByAdmin() (gas: 41371) +TransferUpkeepAdmin:test_RevertsWhen_NotCalledByAdmin() (gas: 41371) +TransferUpkeepAdmin:test_RevertsWhen_TransferToSelf() (gas: 21041) +TransferUpkeepAdmin:test_RevertsWhen_TransferToSelf() (gas: 21041) +TransferUpkeepAdmin:test_RevertsWhen_UpkeepCanceled() (gas: 89483) +TransferUpkeepAdmin:test_RevertsWhen_UpkeepCanceled() (gas: 89483) +Transmit:test_handlesInsufficientBalanceWithUSDToken18() (gas: 20777310) +Transmit:test_handlesInsufficientBalanceWithUSDToken18() (gas: 20917676) +Transmit:test_handlesInsufficientBalanceWithUSDToken6() (gas: 20798730) +Transmit:test_handlesInsufficientBalanceWithUSDToken6() (gas: 20939096) +Transmit:test_handlesMixedBatchOfBillingTokens() (gas: 401438) +Transmit:test_handlesMixedBatchOfBillingTokens() (gas: 410727) +Transmit:test_transmitRevertWithExtraBytes() (gas: 21021) +Transmit:test_transmitRevertWithExtraBytes() (gas: 21031) +Transmit:test_whenFirstUpkeepFails_subsequentUpkeepsPerform() (gas: 349647) +Transmit:test_whenFirstUpkeepFails_subsequentUpkeepsPerformZK() (gas: 356690) +Transmit:test_whenSecondUpkeepFails_FirstAndThirdUpkeepsPerform() (gas: 349669) +Transmit:test_whenSecondUpkeepFails_FirstAndThirdUpkeepsPerform() (gas: 356712) +Unpause:test_CalledByOwner_success() (gas: 96987) +Unpause:test_CalledByOwner_success() (gas: 97099) +Unpause:test_RevertsWhen_CalledByNonOwner() (gas: 29149) +Unpause:test_RevertsWhen_CalledByNonOwner() (gas: 29171) +UnpauseUpkeep:test_RevertsWhen_InvalidUpkeepId() (gas: 18798) +UnpauseUpkeep:test_RevertsWhen_InvalidUpkeepId() (gas: 18798) +UnpauseUpkeep:test_RevertsWhen_NotCalledByUpkeepAdmin() (gas: 48648) +UnpauseUpkeep:test_RevertsWhen_NotCalledByUpkeepAdmin() (gas: 48648) +UnpauseUpkeep:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 71359) +UnpauseUpkeep:test_RevertsWhen_UpkeepAlreadyCanceled() (gas: 71359) +UnpauseUpkeep:test_RevertsWhen_UpkeepIsNotPaused() (gas: 25738) +UnpauseUpkeep:test_RevertsWhen_UpkeepIsNotPaused() (gas: 25738) +UnpauseUpkeep:test_UnpauseUpkeep_CalledByUpkeepAdmin() (gas: 79480) +UnpauseUpkeep:test_UnpauseUpkeep_CalledByUpkeepAdmin() (gas: 79480) +UpkeepCounterNew:testRange() (gas: 2374) +Withdraw:testLinkAvailableForPaymentReturnsLinkBalance() (gas: 46687) +Withdraw:testLinkAvailableForPaymentReturnsLinkBalance() (gas: 46731) +Withdraw:testWithdrawERC20FeeSuccess() (gas: 90660) +Withdraw:testWithdrawERC20FeeSuccess() (gas: 90720) +Withdraw:testWithdrawLinkRevertsBecauseOfInsufficientBalance() (gas: 27645) +Withdraw:testWithdrawLinkRevertsBecauseOfInsufficientBalance() (gas: 27648) +Withdraw:testWithdrawLinkRevertsBecauseOfInvalidRecipient() (gas: 17390) +Withdraw:testWithdrawLinkRevertsBecauseOfInvalidRecipient() (gas: 17390) +Withdraw:testWithdrawLinkRevertsBecauseOnlyFinanceAdminAllowed() (gas: 18756) +Withdraw:testWithdrawLinkRevertsBecauseOnlyFinanceAdminAllowed() (gas: 18759) +Withdraw:testWithdrawLinkSuccess() (gas: 74357) +Withdraw:testWithdrawLinkSuccess() (gas: 74363) +Withdraw:test_WithdrawERC20Fees_InOffChainMode_Happy() (gas: 20673819) +Withdraw:test_WithdrawERC20Fees_InOffChainMode_Happy() (gas: 20814179) +Withdraw:test_WithdrawERC20Fees_RespectsReserveAmount() (gas: 46535) +Withdraw:test_WithdrawERC20Fees_RespectsReserveAmount() (gas: 46579) +Withdraw:test_WithdrawERC20Fees_RevertsWhen_AttemptingToWithdrawLINK() (gas: 59835) +Withdraw:test_WithdrawERC20Fees_RevertsWhen_AttemptingToWithdrawLINK() (gas: 59835) +Withdraw:test_WithdrawERC20Fees_RevertsWhen_LinkAvailableForPaymentIsNegative() (gas: 243026) +Withdraw:test_WithdrawERC20Fees_RevertsWhen_LinkAvailableForPaymentIsNegative() (gas: 247461) +WithdrawFunds:test_Happy_Link() (gas: 104441) +WithdrawFunds:test_Happy_Link() (gas: 104529) +WithdrawFunds:test_Happy_USDToken() (gas: 99549) +WithdrawFunds:test_Happy_USDToken() (gas: 99649) +WithdrawFunds:test_RevertsWhen_CalledByNonAdmin() (gas: 30700) +WithdrawFunds:test_RevertsWhen_CalledByNonAdmin() (gas: 30700) +WithdrawFunds:test_RevertsWhen_InvalidRecipient() (gas: 21812) +WithdrawFunds:test_RevertsWhen_InvalidRecipient() (gas: 21812) +WithdrawFunds:test_RevertsWhen_UpkeepNotCanceled() (gas: 35947) +WithdrawFunds:test_RevertsWhen_UpkeepNotCanceled() (gas: 35947) +WithdrawPayment:testWithdrawPaymentRevertDueToOffchainPayoutMode() (gas: 16718395) +WithdrawPayment:testWithdrawPaymentRevertDueToOffchainPayoutMode() (gas: 16740038) \ No newline at end of file diff --git a/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol b/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol index 5d4a9aa464..2df67dde5b 100644 --- a/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol +++ b/contracts/src/v0.8/automation/test/AutomationRegistry2_2.t.sol @@ -51,8 +51,9 @@ contract AutomationRegistry2_2_SetUp is BaseTest { AutomationRegistryLogicB2_2 logicB2_2 = new AutomationRegistryLogicB2_2(LINK_TOKEN, LINK_ETH_FEED, FAST_GAS_FEED, address(forwarderLogic), ZERO_ADDRESS); AutomationRegistryLogicA2_2 logicA2_2 = new AutomationRegistryLogicA2_2(logicB2_2); - registryMaster = - IAutomationRegistryMaster(address(new AutomationRegistry2_2(AutomationRegistryLogicB2_2(address(logicA2_2))))); + registryMaster = IAutomationRegistryMaster( + payable(address(new AutomationRegistry2_2(AutomationRegistryLogicB2_2(address(logicA2_2))))) + ); } }