From 77dfb667a882aafe072a1f5c00f5f1f84eceaf0a Mon Sep 17 00:00:00 2001 From: chudilka1 Date: Thu, 14 Sep 2023 15:56:07 +0300 Subject: [PATCH 01/26] [BCF-2506] Fix: id instead of legacy evmChainId in errors verbatim (#10314) --- core/cmd/evm_transaction_commands.go | 2 +- core/cmd/shell_remote_test.go | 2 +- core/web/common.go | 6 +++--- docs/CHANGELOG.md | 10 ++++++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/core/cmd/evm_transaction_commands.go b/core/cmd/evm_transaction_commands.go index 8239ff3456..68fffde303 100644 --- a/core/cmd/evm_transaction_commands.go +++ b/core/cmd/evm_transaction_commands.go @@ -133,7 +133,7 @@ func (s *Shell) ShowTransaction(c *cli.Context) (err error) { // SendEther transfers ETH from the node's account to a specified address. func (s *Shell) SendEther(c *cli.Context) (err error) { if c.NArg() < 3 { - return s.errorOut(errors.New("three arguments expected: amount, fromAddress and toAddress")) + return s.errorOut(errors.New("the following arguments expected: (chain) id (in multi-chain setup), amount, fromAddress and toAddress")) } var amount assets.Eth diff --git a/core/cmd/shell_remote_test.go b/core/cmd/shell_remote_test.go index 69fa592482..07b0119130 100644 --- a/core/cmd/shell_remote_test.go +++ b/core/cmd/shell_remote_test.go @@ -131,7 +131,7 @@ func TestShell_ReplayBlocks(t *testing.T) { require.NoError(t, set.Set("evm-chain-id", "12345678")) c = cli.NewContext(nil, set, nil) - assert.ErrorContains(t, client.ReplayFromBlock(c), "evmChainID does not match any local chains") + assert.ErrorContains(t, client.ReplayFromBlock(c), "chain id does not match any local chains") require.NoError(t, set.Set("evm-chain-id", "0")) c = cli.NewContext(nil, set, nil) diff --git a/core/web/common.go b/core/web/common.go index 0253e0593d..9586fa798e 100644 --- a/core/web/common.go +++ b/core/web/common.go @@ -9,9 +9,9 @@ import ( ) var ( - ErrMissingChainID = errors.New("evmChainID does not match any local chains") - ErrInvalidChainID = errors.New("invalid evmChainID") - ErrMultipleChains = errors.New("more than one chain available, you must specify evmChainID parameter") + ErrMissingChainID = errors.New("chain id does not match any local chains") + ErrInvalidChainID = errors.New("invalid chain id") + ErrMultipleChains = errors.New("more than one chain available, you must specify chain id parameter") ) func getChain(legacyChains evm.LegacyChainContainer, chainIDstr string) (chain evm.Chain, err error) { diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 69ea7739f5..9b648d9268 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -20,6 +20,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 All nodes will have to remove the following configuration field: `ExplorerURL` ### Fixed +- Unauthenticated users executing CLI commands previously generated a confusing error log, which is now removed: +```[ERROR] Error in transaction, rolling back: session missing or expired, please login again pg/transaction.go:118 ``` +- Fixed a bug that was preventing job runs to be displayed when the job `chainID` was disabled. +- `chainlink txs evm create` returns a transaction hash for the attempted transaction in the CLI. Previously only the sender, recipient and `unstarted` state were returned. +- Fixed a bug when when `evmChainId` is requested instead of `id` or `evm-chain-id` in CLI error verbatim + +## 2.5.0 - UNRELEASED +======= - Unauthenticated users executing CLI commands previously generated a confusing error log, which is now removed: ``` @@ -37,8 +45,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -## 2.5.0 - 2023-09-13 - ### Upcoming Required Configuration Change - Starting in 2.6.0, chainlink nodes will no longer allow insecure configuration for production builds. Any TOML configuration that sets the following line will fail validation checks in `node start` or `node validate`: From 61af2254e2b248b42e40004ce210216520d15a96 Mon Sep 17 00:00:00 2001 From: Tate Date: Thu, 14 Sep 2023 07:58:26 -0600 Subject: [PATCH 02/26] [TT-593] Don't Fail Workflow On E2E Smoke Go Cache (#10642) --- .github/workflows/integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9fdb42cbbe..982fc93244 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -418,6 +418,7 @@ jobs: needs: [eth-smoke-tests] runs-on: ubuntu20.04-16cores-64GB name: ETH Smoke Tests Go Mod Cache + continue-on-error: true steps: - name: Checkout the repo uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 From fe3f7d4705f670c88b0a7ef6db8df6f0f6f3a2f4 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Thu, 14 Sep 2023 16:44:32 +0200 Subject: [PATCH 03/26] lock foundry version (#10616) * lock foundry version * set to more stable Foundry version opt out Automation from snapshots * Update llo-feeds.gas-snapshot * Update functions.gas-snapshot --- .github/workflows/solidity-foundry.yml | 3 +- contracts/GNUmakefile | 12 ++++--- .../gas-snapshots/functions.gas-snapshot | 12 +++---- .../gas-snapshots/llo-feeds.gas-snapshot | 32 +++++++++---------- 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index f504f58b62..29022197bd 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -52,7 +52,8 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: - version: nightly + # Has to match the `make foundry` version. + version: nightly-ca67d15f4abd46394b324c50e21e66f306a1162d - name: Run Forge build run: | diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile index 58ff23575e..328c921545 100644 --- a/contracts/GNUmakefile +++ b/contracts/GNUmakefile @@ -1,7 +1,6 @@ # ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry -# profile defined. Adding a product to this list will make it available for -# snapshotting. -ALL_FOUNDRY_PRODUCTS = vrf automation llo-feeds functions shared +# profile defined and use the Foundry snapshots. +ALL_FOUNDRY_PRODUCTS = llo-feeds functions shared # To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var # or call the target with `FOUNDRY_PROFILE=product` @@ -37,9 +36,12 @@ abigen: ## Build & install abigen. mockery: $(mockery) ## Install mockery. go install github.com/vektra/mockery/v2@v2.28.1 +.PHONY: foundry +foundry: ## Install foundry. + foundryup --version nightly-ca67d15f4abd46394b324c50e21e66f306a1162d + .PHONY: foundry-refresh -foundry-refresh: - foundryup +foundry-refresh: foundry git submodule deinit -f . git submodule update --init --recursive diff --git a/contracts/gas-snapshots/functions.gas-snapshot b/contracts/gas-snapshots/functions.gas-snapshot index da2a8f4958..9b501e677b 100644 --- a/contracts/gas-snapshots/functions.gas-snapshot +++ b/contracts/gas-snapshots/functions.gas-snapshot @@ -87,9 +87,9 @@ FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_RevertIfNotAll FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_RevertIfNotSubscriptionOwner() (gas: 89340) FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_RevertIfPaused() (gas: 20191) FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_RevertIfPendingRequests() (gas: 193277) -FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessForfeitAllBalanceAsDeposit() (gas: 114636) -FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessForfeitSomeBalanceAsDeposit() (gas: 125891) -FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessRecieveDeposit() (gas: 312021) +FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessForfeitAllBalanceAsDeposit() (gas: 113352) +FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessForfeitSomeBalanceAsDeposit() (gas: 124604) +FunctionsSubscriptions_CancelSubscription:test_CancelSubscription_SuccessRecieveDeposit() (gas: 310123) FunctionsSubscriptions_Constructor:test_Constructor_Success() (gas: 7654) FunctionsSubscriptions_CreateSubscriptionWithConsumer:test_CreateSubscriptionWithConsumer_RevertIfNotAllowedSender() (gas: 28637) FunctionsSubscriptions_CreateSubscriptionWithConsumer:test_CreateSubscriptionWithConsumer_RevertIfPaused() (gas: 17948) @@ -98,8 +98,8 @@ FunctionsSubscriptions_GetConsumer:test_GetConsumer_Success() (gas: 16225) FunctionsSubscriptions_GetFlags:test_GetFlags_Success() (gas: 40858) FunctionsSubscriptions_GetSubscription:test_GetSubscription_Success() (gas: 30959) FunctionsSubscriptions_GetSubscriptionCount:test_GetSubscriptionCount_Success() (gas: 12967) -FunctionsSubscriptions_GetSubscriptionsInRange:test_GetSubscriptionsInRange_RevertIfEndIsAfterLastSubscription() (gas: 16523) -FunctionsSubscriptions_GetSubscriptionsInRange:test_GetSubscriptionsInRange_RevertIfStartIsAfterEnd() (gas: 13436) +FunctionsSubscriptions_GetSubscriptionsInRange:test_GetSubscriptionsInRange_RevertIfEndIsAfterLastSubscription() (gas: 14949) +FunctionsSubscriptions_GetSubscriptionsInRange:test_GetSubscriptionsInRange_RevertIfStartIsAfterEnd() (gas: 11863) FunctionsSubscriptions_GetSubscriptionsInRange:test_GetSubscriptionsInRange_Success() (gas: 59568) FunctionsSubscriptions_GetTotalBalance:test_GetTotalBalance_Success() (gas: 15032) FunctionsSubscriptions_OnTokenTransfer:test_OnTokenTransfer_RevertIfCallerIsNoCalldata() (gas: 27594) @@ -116,7 +116,7 @@ FunctionsSubscriptions_OracleWithdraw:test_OracleWithdraw_SuccessSetsBalanceToZe FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_RevertIfNoSubscription() (gas: 12818) FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_RevertIfNotOwner() (gas: 15549) FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_Success() (gas: 54867) -FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_SuccessDeletesSubscription() (gas: 49624) +FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_SuccessDeletesSubscription() (gas: 48362) FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_SuccessSubOwnerRefunded() (gas: 50896) FunctionsSubscriptions_OwnerCancelSubscription:test_OwnerCancelSubscription_SuccessWhenRequestInFlight() (gas: 163911) FunctionsSubscriptions_OwnerWithdraw:test_OwnerWithdraw_RevertIfAmountMoreThanBalance() (gas: 17924) diff --git a/contracts/gas-snapshots/llo-feeds.gas-snapshot b/contracts/gas-snapshots/llo-feeds.gas-snapshot index 3d388678ac..4cc6be66be 100644 --- a/contracts/gas-snapshots/llo-feeds.gas-snapshot +++ b/contracts/gas-snapshots/llo-feeds.gas-snapshot @@ -20,7 +20,7 @@ FeeManagerProcessFeeTest:test_discountIsNoLongerAppliedAfterRemoving() (gas: 464 FeeManagerProcessFeeTest:test_discountIsNotAppliedForInvalidTokenAddress() (gas: 17568) FeeManagerProcessFeeTest:test_discountIsNotAppliedToOtherFeeds() (gas: 54571) FeeManagerProcessFeeTest:test_discountIsReturnedForLink() (gas: 49581) -FeeManagerProcessFeeTest:test_emptyQuoteRevertsWithError() (gas: 12392) +FeeManagerProcessFeeTest:test_emptyQuoteRevertsWithError() (gas: 11525) FeeManagerProcessFeeTest:test_eventIsEmittedAfterSurchargeIsSet() (gas: 41390) FeeManagerProcessFeeTest:test_eventIsEmittedIfNotEnoughLink() (gas: 259493) FeeManagerProcessFeeTest:test_eventIsEmittedUponWithdraw() (gas: 68996) @@ -89,7 +89,7 @@ FeeManagerProcessFeeTest:test_surchargeIsAppliedForNativeFeeWithDiscount() (gas: FeeManagerProcessFeeTest:test_surchargeIsNoLongerAppliedAfterRemoving() (gas: 46968) FeeManagerProcessFeeTest:test_surchargeIsNotAppliedForLinkFee() (gas: 49840) FeeManagerProcessFeeTest:test_surchargeIsNotAppliedWith100PercentDiscount() (gas: 78211) -FeeManagerProcessFeeTest:test_testRevertIfReportHasExpired() (gas: 15251) +FeeManagerProcessFeeTest:test_testRevertIfReportHasExpired() (gas: 14383) RewardManagerClaimTest:test_claimAllRecipients() (gas: 275763) RewardManagerClaimTest:test_claimMultipleRecipients() (gas: 153306) RewardManagerClaimTest:test_claimRewardsWithDuplicatePoolIdsDoesNotPayoutTwice() (gas: 328345) @@ -125,7 +125,7 @@ RewardManagerRecipientClaimMultiplePoolsTest:test_claimSingleUniqueRecipient() ( RewardManagerRecipientClaimMultiplePoolsTest:test_claimUnevenAmountRoundsDown() (gas: 576289) RewardManagerRecipientClaimMultiplePoolsTest:test_claimUnregisteredRecipient() (gas: 63555) RewardManagerRecipientClaimMultiplePoolsTest:test_getAvailableRewardsCursorAndTotalPoolsEqual() (gas: 10202) -RewardManagerRecipientClaimMultiplePoolsTest:test_getAvailableRewardsCursorCannotBeGreaterThanTotalPools() (gas: 12680) +RewardManagerRecipientClaimMultiplePoolsTest:test_getAvailableRewardsCursorCannotBeGreaterThanTotalPools() (gas: 11107) RewardManagerRecipientClaimMultiplePoolsTest:test_getAvailableRewardsCursorSingleResult() (gas: 19606) RewardManagerRecipientClaimMultiplePoolsTest:test_getRewardsAvailableToRecipientInBothPools() (gas: 29052) RewardManagerRecipientClaimMultiplePoolsTest:test_getRewardsAvailableToRecipientInBothPoolsWhereAlreadyClaimed() (gas: 147218) @@ -194,11 +194,11 @@ VerifierBulkVerifyBillingReport:test_verifyWithBulkNativeUnwrappedReturnsChange( VerifierConstructorTest:test_revertsIfInitializedWithEmptyVerifierProxy() (gas: 59939) VerifierConstructorTest:test_setsTheCorrectProperties() (gas: 1788491) VerifierDeactivateFeedWithVerifyTest:test_currentReportAllowsVerification() (gas: 192062) -VerifierDeactivateFeedWithVerifyTest:test_currentReportFailsVerification() (gas: 113377) +VerifierDeactivateFeedWithVerifyTest:test_currentReportFailsVerification() (gas: 111727) VerifierDeactivateFeedWithVerifyTest:test_previousReportAllowsVerification() (gas: 99613) -VerifierDeactivateFeedWithVerifyTest:test_previousReportFailsVerification() (gas: 69932) +VerifierDeactivateFeedWithVerifyTest:test_previousReportFailsVerification() (gas: 68305) VerifierProxyAccessControlledVerificationTest:test_proxiesToTheVerifierIfHasAccess() (gas: 204836) -VerifierProxyAccessControlledVerificationTest:test_revertsIfNoAccess() (gas: 109546) +VerifierProxyAccessControlledVerificationTest:test_revertsIfNoAccess() (gas: 107889) VerifierProxyConstructorTest:test_correctlySetsTheCorrectAccessControllerInterface() (gas: 1439877) VerifierProxyConstructorTest:test_correctlySetsTheOwner() (gas: 1419891) VerifierProxyConstructorTest:test_correctlySetsVersion() (gas: 6873) @@ -220,7 +220,7 @@ VerifierProxyUnsetVerifierTest:test_revertsIfNotAdmin() (gas: 14965) VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest:test_correctlyUnsetsVerifier() (gas: 12697) VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest:test_emitsAnEventAfterUnsettingVerifier() (gas: 17965) VerifierProxyVerifyTest:test_proxiesToTheCorrectVerifier() (gas: 198420) -VerifierProxyVerifyTest:test_revertsIfNoVerifierConfigured() (gas: 116319) +VerifierProxyVerifyTest:test_revertsIfNoVerifierConfigured() (gas: 114671) VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlySetsConfigWhenDigestsAreRemoved() (gas: 538582) VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlyUpdatesDigestsOnMultipleVerifiersInTheProxy() (gas: 964048) VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlyUpdatesTheDigestInTheProxy() (gas: 520140) @@ -243,17 +243,17 @@ VerifierTestBillingReport:test_verifyWithNativeUnwrapped() (gas: 321498) VerifierTestBillingReport:test_verifyWithNativeUnwrappedReturnsChange() (gas: 328564) VerifierVerifyMultipleConfigDigestTest:test_canVerifyNewerReportsWithNewerConfigs() (gas: 131228) VerifierVerifyMultipleConfigDigestTest:test_canVerifyOlderReportsWithOlderConfigs() (gas: 187132) -VerifierVerifyMultipleConfigDigestTest:test_revertsIfAReportIsVerifiedWithAnExistingButIncorrectDigest() (gas: 88205) -VerifierVerifyMultipleConfigDigestTest:test_revertsIfVerifyingWithAnUnsetDigest() (gas: 128062) +VerifierVerifyMultipleConfigDigestTest:test_revertsIfAReportIsVerifiedWithAnExistingButIncorrectDigest() (gas: 86566) +VerifierVerifyMultipleConfigDigestTest:test_revertsIfVerifyingWithAnUnsetDigest() (gas: 126411) VerifierVerifySingleConfigDigestTest:test_emitsAnEventIfReportVerified() (gas: 186945) VerifierVerifySingleConfigDigestTest:test_returnsThePriceAndBlockNumIfReportVerified() (gas: 187114) -VerifierVerifySingleConfigDigestTest:test_revertsIfConfigDigestNotSet() (gas: 116130) -VerifierVerifySingleConfigDigestTest:test_revertsIfDuplicateSignersHaveSigned() (gas: 182315) -VerifierVerifySingleConfigDigestTest:test_revertsIfMismatchedSignatureLength() (gas: 53037) -VerifierVerifySingleConfigDigestTest:test_revertsIfReportHasUnconfiguredFeedID() (gas: 103976) -VerifierVerifySingleConfigDigestTest:test_revertsIfVerifiedByNonProxy() (gas: 100992) -VerifierVerifySingleConfigDigestTest:test_revertsIfVerifiedWithIncorrectAddresses() (gas: 184066) -VerifierVerifySingleConfigDigestTest:test_revertsIfWrongNumberOfSigners() (gas: 110031) +VerifierVerifySingleConfigDigestTest:test_revertsIfConfigDigestNotSet() (gas: 114479) +VerifierVerifySingleConfigDigestTest:test_revertsIfDuplicateSignersHaveSigned() (gas: 180665) +VerifierVerifySingleConfigDigestTest:test_revertsIfMismatchedSignatureLength() (gas: 51479) +VerifierVerifySingleConfigDigestTest:test_revertsIfReportHasUnconfiguredFeedID() (gas: 102318) +VerifierVerifySingleConfigDigestTest:test_revertsIfVerifiedByNonProxy() (gas: 99348) +VerifierVerifySingleConfigDigestTest:test_revertsIfVerifiedWithIncorrectAddresses() (gas: 182416) +VerifierVerifySingleConfigDigestTest:test_revertsIfWrongNumberOfSigners() (gas: 108382) VerifierVerifySingleConfigDigestTest:test_setsTheCorrectEpoch() (gas: 194270) Verifier_accessControlledVerify:testVerifyWithAccessControl_gas() (gas: 208853) Verifier_bulkVerifyWithFee:testBulkVerifyProxyWithLinkFeeSuccess_gas() (gas: 540715) From d6363e006021c9a3fb63ac24698d1ba81bd463ea Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 14 Sep 2023 12:01:15 -0400 Subject: [PATCH 04/26] Pump the Brakes (#10646) --- .github/workflows/integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 982fc93244..3c58df87e5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -3,8 +3,8 @@ on: merge_group: pull_request: schedule: - # - cron: "0 0 * * *" - - cron: "0 * * * *" # DEBUG: Run every hour to nail down flakes + - cron: "0 0 * * *" + # - cron: "0 * * * *" # DEBUG: Run every hour to nail down flakes push: tags: - "*" From d43a8099a07f9d689ed9cbe0666c7e74e51b84c2 Mon Sep 17 00:00:00 2001 From: Bolek <1416262+bolekk@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:08:05 -0700 Subject: [PATCH 05/26] [Gateway] Fix address lookup in handlers (#10637) Making sure config is always lowercased and adding more nil checks --- core/services/gateway/connectionmanager.go | 12 +++++++++- .../gateway/connectionmanager_test.go | 19 ++++++++++++++++ core/services/gateway/gateway.go | 9 ++++++++ core/services/gateway/gateway_test.go | 22 +++++++++++++++++++ .../gateway_integration_test.go | 3 +++ 5 files changed, 64 insertions(+), 1 deletion(-) diff --git a/core/services/gateway/connectionmanager.go b/core/services/gateway/connectionmanager.go index 17a31014c8..86660f03dc 100644 --- a/core/services/gateway/connectionmanager.go +++ b/core/services/gateway/connectionmanager.go @@ -87,6 +87,9 @@ func NewConnectionManager(gwConfig *config.GatewayConfig, clock utils.Clock, lgg return nil, fmt.Errorf("duplicate node address %s in DON %s", nodeAddress, donConfig.DonId) } nodes[nodeAddress] = &nodeState{conn: network.NewWSConnectionWrapper()} + if nodes[nodeAddress].conn == nil { + return nil, fmt.Errorf("error creating WSConnectionWrapper for node %s", nodeAddress) + } } dons[donConfig.DonId] = &donConnectionManager{ donConfig: &donConfig, @@ -232,11 +235,18 @@ func (m *donConnectionManager) SetHandler(handler handlers.Handler) { } func (m *donConnectionManager) SendToNode(ctx context.Context, nodeAddress string, msg *api.Message) error { + if msg == nil { + return errors.New("nil message") + } data, err := m.codec.EncodeRequest(msg) if err != nil { return fmt.Errorf("error encoding request for node %s: %v", nodeAddress, err) } - return m.nodes[nodeAddress].conn.Write(ctx, websocket.BinaryMessage, data) + nodeState := m.nodes[nodeAddress] + if nodeState == nil { + return fmt.Errorf("node %s not found", nodeAddress) + } + return nodeState.conn.Write(ctx, websocket.BinaryMessage, data) } func (m *donConnectionManager) readLoop(nodeAddress string, nodeState *nodeState) { diff --git a/core/services/gateway/connectionmanager_test.go b/core/services/gateway/connectionmanager_test.go index f924761439..d198ef6729 100644 --- a/core/services/gateway/connectionmanager_test.go +++ b/core/services/gateway/connectionmanager_test.go @@ -8,8 +8,10 @@ import ( "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway" + "github.com/smartcontractkit/chainlink/v2/core/services/gateway/api" gc "github.com/smartcontractkit/chainlink/v2/core/services/gateway/common" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/config" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/network" @@ -208,3 +210,20 @@ func TestConnectionManager_FinalizeHandshake(t *testing.T) { err = mgr.FinalizeHandshake(attemptId, response, nil) require.ErrorIs(t, err, network.ErrChallengeInvalidSignature) } + +func TestConnectionManager_SendToNode_Failures(t *testing.T) { + t.Parallel() + + config, nodes := newTestConfig(t, 2) + clock := utils.NewFixedClock(time.Now()) + mgr, err := gateway.NewConnectionManager(config, clock, logger.TestLogger(t)) + require.NoError(t, err) + + donMgr := mgr.DONConnectionManager("my_don_1") + err = donMgr.SendToNode(testutils.Context(t), nodes[0].Address, nil) + require.Error(t, err) + + message := &api.Message{} + err = donMgr.SendToNode(testutils.Context(t), "some_other_node", message) + require.Error(t, err) +} diff --git a/core/services/gateway/gateway.go b/core/services/gateway/gateway.go index 8c77e9b748..d64ee43233 100644 --- a/core/services/gateway/gateway.go +++ b/core/services/gateway/gateway.go @@ -4,9 +4,12 @@ import ( "context" "encoding/json" "fmt" + "strings" "go.uber.org/multierr" + "github.com/ethereum/go-ethereum/common" + "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/api" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/config" @@ -59,6 +62,12 @@ func NewGatewayFromConfig(config *config.GatewayConfig, handlerFactory HandlerFa if donConnMgr == nil { return nil, fmt.Errorf("connection manager ID %s not found", donConfig.DonId) } + for idx, nodeConfig := range donConfig.Members { + donConfig.Members[idx].Address = strings.ToLower(nodeConfig.Address) + if !common.IsHexAddress(nodeConfig.Address) { + return nil, fmt.Errorf("invalid node address %s", nodeConfig.Address) + } + } handler, err := handlerFactory.NewHandler(donConfig.HandlerName, donConfig.HandlerConfig, &donConfig, donConnMgr) if err != nil { return nil, err diff --git a/core/services/gateway/gateway_test.go b/core/services/gateway/gateway_test.go index a6662505db..a2ee8f7a6c 100644 --- a/core/services/gateway/gateway_test.go +++ b/core/services/gateway/gateway_test.go @@ -49,6 +49,10 @@ HandlerName = "dummy" [[dons]] DonId = "my_don_2" HandlerName = "dummy" + +[[dons.Members]] +Name = "node one" +Address = "0x0001020304050607080900010203040506070809" `) lggr := logger.TestLogger(t) @@ -102,6 +106,24 @@ SomeOtherField = "abcd" require.Error(t, err) } +func TestGateway_NewGatewayFromConfig_InvalidNodeAddress(t *testing.T) { + t.Parallel() + + tomlConfig := buildConfig(` +[[dons]] +HandlerName = "dummy" +DonId = "my_don" + +[[dons.Members]] +Name = "node one" +Address = "0xnot_an_address" +`) + + lggr := logger.TestLogger(t) + _, err := gateway.NewGatewayFromConfig(parseTOMLConfig(t, tomlConfig), gateway.NewHandlerFactory(nil, lggr), lggr) + require.Error(t, err) +} + func TestGateway_CleanStartAndClose(t *testing.T) { t.Parallel() diff --git a/core/services/gateway/integration_tests/gateway_integration_test.go b/core/services/gateway/integration_tests/gateway_integration_test.go index 7a0204a315..310047950e 100644 --- a/core/services/gateway/integration_tests/gateway_integration_test.go +++ b/core/services/gateway/integration_tests/gateway_integration_test.go @@ -6,6 +6,7 @@ import ( "crypto/ecdsa" "fmt" "net/http" + "strings" "sync/atomic" "testing" @@ -110,6 +111,8 @@ func TestIntegration_Gateway_NoFullNodes_BasicConnectionAndMessage(t *testing.T) t.Parallel() nodeKeys := common.NewTestNodes(t, 1)[0] + // Verify that addresses in config are case-insensitive + nodeKeys.Address = strings.ToUpper(nodeKeys.Address) // Launch Gateway lggr := logger.TestLogger(t) From c9e080b827e82d9cdc3d44020387719da7fa7b00 Mon Sep 17 00:00:00 2001 From: ilija42 <57732589+ilija42@users.noreply.github.com> Date: Thu, 14 Sep 2023 18:29:25 +0200 Subject: [PATCH 06/26] BCF-2492 Remove evm default chain id (#10490) * Remove evm default chain id usage - Remove default chain id from LegacyChainContainer - Add alternate function for default chainID in tests * Remove the rest of evm default chain id usage - Remove default chain id from LoopRelayAdapter - Remove default chain id use from common.go getChain - Remove default chain id use from evm relayer init * Enforce evmChainID to be defined in all jobspecs where present * Remove setdefault chain id from NewLegacyChainsWithChain() mock * Change cltest NewApplicationWithConfig to init evmopts if evm enabled * Fix pipeline & eth_keys & jobs controller tests to encode evmChainID * Add evmChainID to test tomls and to VRFSpecParams testspec struct * Add evmChainID to vrf submit_tx pipeline vars and testspec source * Add evmChainID to testspecs job specs where missing * Add evmChainID flags to shell local tests * Change TestORM_CreateJob_OCR_DuplicatedContractAddress - Remove code that relied on default chainID * Change orm validation missing evmChainID error message * Change tests that relied on default chainID to use replacement func - Fix evm transfer controller tests - Fix integration test helpers - Fix head tracker tests - Fix evm transaction commands test * Add deprecated tag to default chainID helper funcs and update err msg * comment out test case in TestShell_ReplayBlock * minor tests fix * Add evmchainID to spec to keepers and flux integration tests * Add evmChainID to vrfv2 pipeline vars * Fix evmChainID parsing in estimategas pipeline task * Add evmChainID to estimate gas and eth call pipeline tasks vars spec * Fix/Change cmds tests to use evmChainID * Fix vrf integration tests and helpers to use evmChainID * Add evmChainID parsing string as default val to pipeline tasks that use it * Add evmChainID to specs in internal features_test * Add evmChainID to vrf and ocr smoke test job specs * Fix evmChainID in keepers tests * Fix evmChainID in fluxmonitorv2 tests * Fix estimategas, ethcall/tx default evmChainID values for parsing vars * Remove default tag from EstimateGasLimitTask.EVMChainID * Add evmChainID to pipeline vars in directRequest handleOracleRequest * Add evmChainID to all pipeline vars where needed * Resolve develop merge issues * Fix evmChainID pipeline vars parsing * Add mock calls to direct request tests for EVMChainID() call * Run make go generate * Add unit tests for job creation evmChainID validation * Fix keepers and flux smoke tests to have evmChainID in the jobspec * Fix smoke test job spec evmChainID for ocr, reorg, runlog and vrf * Fix integration tests by adding chainID to OCR task and Bootstrap Spec * Fix integrations test OCRTaskJobSpec struct field naming case * minor fix to keeper job creation smoke test * Remove unnecessary error wrap in ValidatedOracleSpecToml * Remove shell_remote test case that relied on default evmChainID * Remove keystore migrate as all v1 keys should have been migrated by now * Use %q in (c *LegacyChains) Get() for better error msg output * Fix TestShell_ReplayBlocks test by fixing err message assert * Add changes to CHANGELOG.md --- core/chains/evm/chain.go | 19 +-- .../evm/config/mocks/chain_scoped_config.go | 18 --- .../evm/headtracker/head_tracker_test.go | 18 +-- .../evm/mocks/legacy_chain_container.go | 31 ---- core/chains/evm/txmgr/evm_tx_store_test.go | 2 +- core/cmd/eth_keys_commands_test.go | 31 ++-- core/cmd/evm_transaction_commands_test.go | 4 + core/cmd/forwarders_commands_test.go | 4 +- core/cmd/shell_local.go | 12 -- core/cmd/shell_local_test.go | 3 + core/cmd/shell_remote_test.go | 6 +- core/config/app_config.go | 2 - core/config/ethereum_config.go | 9 -- core/internal/cltest/cltest.go | 25 ++-- core/internal/cltest/factories.go | 14 +- core/internal/cltest/job_factories.go | 1 + core/internal/cltest/mocks.go | 4 +- core/internal/cltest/simulated_backend.go | 9 +- core/internal/features/features_test.go | 25 ++-- core/internal/testutils/evmtest/evmtest.go | 21 ++- core/services/blockhashstore/delegate_test.go | 4 +- core/services/chainlink/application.go | 1 + core/services/chainlink/config_general.go | 10 -- .../services/chainlink/config_general_test.go | 1 - .../chainlink/mocks/general_config.go | 21 +-- .../chainlink/relayer_chain_interoperators.go | 10 -- core/services/directrequest/delegate.go | 2 + core/services/directrequest/delegate_test.go | 7 +- core/services/feeds/service_test.go | 1 + core/services/fluxmonitorv2/flux_monitor.go | 2 + .../fluxmonitorv2/flux_monitor_test.go | 2 + .../fluxmonitorv2/integrations_test.go | 12 +- core/services/fluxmonitorv2/orm_test.go | 2 + core/services/job/helpers_test.go | 4 + core/services/job/job_orm_test.go | 139 +++++++++++++----- core/services/job/orm.go | 37 +++-- core/services/job/runner_integration_test.go | 4 + core/services/keeper/integration_test.go | 2 + core/services/keeper/upkeep_executer_test.go | 26 +++- core/services/keystore/master.go | 88 ----------- core/services/keystore/mocks/master.go | 14 -- core/services/pipeline/task.estimategas.go | 13 +- core/services/pipeline/task.eth_call.go | 9 +- core/services/pipeline/task.eth_call_test.go | 18 +-- core/services/pipeline/task.eth_tx.go | 9 +- core/services/pipeline/task.eth_tx_test.go | 30 ++-- core/services/relay/evm/loop_impl.go | 6 +- .../relay/evm/mocks/loop_relay_adapter.go | 14 -- core/services/relay/evm/relayer_extender.go | 29 +--- core/services/vrf/delegate_test.go | 2 +- core/services/vrf/v1/integration_test.go | 7 +- core/services/vrf/v1/listener_v1.go | 1 + .../vrf/v2/integration_helpers_test.go | 6 +- core/services/vrf/v2/integration_v2_test.go | 1 + core/services/vrf/v2/listener_v2.go | 1 + core/testdata/testspecs/v2_specs.go | 26 +++- .../tomlspecs/direct-request-spec-cbor.toml | 1 + .../tomlspecs/direct-request-spec.toml | 1 + .../tomlspecs/multiword-response-spec.toml | 1 + .../tomlspecs/ocr-bootstrap-spec.toml | 1 + core/web/common.go | 7 +- core/web/eth_keys_controller_test.go | 7 +- core/web/evm_transfer_controller_test.go | 11 +- core/web/jobs_controller_test.go | 12 +- core/web/pipeline_runs_controller_test.go | 9 +- docs/CHANGELOG.md | 2 + integration-tests/actions/keeper_helpers.go | 4 + .../actions/keeper_helpers_local.go | 3 + integration-tests/actions/ocr_helpers.go | 6 + .../actions/ocr_helpers_local.go | 14 +- integration-tests/chaos/ocr_chaos_test.go | 2 +- integration-tests/client/chainlink_models.go | 32 ++-- .../performance/directrequest_test.go | 1 + integration-tests/performance/flux_test.go | 1 + integration-tests/performance/keeper_test.go | 2 +- integration-tests/performance/ocr_test.go | 2 +- integration-tests/reorg/reorg_test.go | 1 + integration-tests/smoke/flux_test.go | 1 + integration-tests/smoke/forwarder_ocr_test.go | 2 +- integration-tests/smoke/keeper_test.go | 27 ++-- integration-tests/smoke/ocr_test.go | 2 +- integration-tests/smoke/runlog_test.go | 1 + integration-tests/smoke/vrf_test.go | 1 + .../testsetups/keeper_benchmark.go | 2 +- integration-tests/testsetups/ocr.go | 4 +- 85 files changed, 496 insertions(+), 483 deletions(-) delete mode 100644 core/config/ethereum_config.go diff --git a/core/chains/evm/chain.go b/core/chains/evm/chain.go index 39c92252c7..6a948a4cdd 100644 --- a/core/chains/evm/chain.go +++ b/core/chains/evm/chain.go @@ -74,8 +74,6 @@ type LegacyChains struct { // //go:generate mockery --quiet --name LegacyChainContainer --output ./mocks/ --case=underscore type LegacyChainContainer interface { - SetDefault(Chain) - Default() (Chain, error) Get(id string) (Chain, error) Len() int List(ids ...string) ([]Chain, error) @@ -100,27 +98,14 @@ func (c *LegacyChains) ChainNodeConfigs() evmtypes.Configs { return c.cfgs } -// TODO BCR-2510 this may not be needed if EVM is not enabled by default -func (c *LegacyChains) SetDefault(dflt Chain) { - c.dflt = dflt -} - -func (c *LegacyChains) Default() (Chain, error) { - if c.dflt == nil { - return nil, fmt.Errorf("no default chain specified") - } - return c.dflt, nil -} - // backward compatibility. // eth keys are represented as multiple types in the code base; -// *big.Int, string, and int64. this lead to special 'default' handling -// of nil big.Int and empty string. +// *big.Int, string, and int64. // // TODO BCF-2507 unify the type system func (c *LegacyChains) Get(id string) (Chain, error) { if id == nilBigInt.String() || id == emptyString { - return c.Default() + return nil, fmt.Errorf("invalid chain id requested: %q", id) } return c.ChainsKV.Get(id) } diff --git a/core/chains/evm/config/mocks/chain_scoped_config.go b/core/chains/evm/config/mocks/chain_scoped_config.go index f1e09cc54a..b8347f6e4b 100644 --- a/core/chains/evm/config/mocks/chain_scoped_config.go +++ b/core/chains/evm/config/mocks/chain_scoped_config.go @@ -3,8 +3,6 @@ package mocks import ( - big "math/big" - config "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" @@ -100,22 +98,6 @@ func (_m *ChainScopedConfig) Database() coreconfig.Database { return r0 } -// DefaultChainID provides a mock function with given fields: -func (_m *ChainScopedConfig) DefaultChainID() *big.Int { - ret := _m.Called() - - var r0 *big.Int - if rf, ok := ret.Get(0).(func() *big.Int); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - return r0 -} - // EVM provides a mock function with given fields: func (_m *ChainScopedConfig) EVM() config.EVM { ret := _m.Called() diff --git a/core/chains/evm/headtracker/head_tracker_test.go b/core/chains/evm/headtracker/head_tracker_test.go index 12fcb19531..330142b9dc 100644 --- a/core/chains/evm/headtracker/head_tracker_test.go +++ b/core/chains/evm/headtracker/head_tracker_test.go @@ -428,7 +428,7 @@ func TestHeadTracker_SwitchesToLongestChainWithHeadSamplingEnabled(t *testing.T) ethClient := evmtest.NewEthClientMockWithDefaultChain(t) checker := commonmocks.NewHeadTrackable[*evmtypes.Head, gethCommon.Hash](t) - orm := headtracker.NewORM(db, logger, config.Database(), *config.DefaultChainID()) + orm := headtracker.NewORM(db, logger, config.Database(), *evmtest.MustGetDefaultChainID(t, config.EVMConfigs())) csCfg := evmtest.NewChainScopedConfig(t, config) ht := createHeadTrackerWithChecker(t, ethClient, csCfg.EVM(), csCfg.EVM().HeadTracker(), orm, checker) @@ -779,7 +779,7 @@ func TestHeadTracker_Backfill(t *testing.T) { } ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ht := createHeadTrackerWithNeverSleeper(t, ethClient, cfg, orm) err := ht.Backfill(ctx, &h12, 2) @@ -796,7 +796,7 @@ func TestHeadTracker_Backfill(t *testing.T) { } ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ethClient.On("HeadByHash", mock.Anything, head10.Hash). Return(&head10, nil) @@ -832,7 +832,7 @@ func TestHeadTracker_Backfill(t *testing.T) { } ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ht := createHeadTrackerWithNeverSleeper(t, ethClient, cfg, orm) @@ -865,7 +865,7 @@ func TestHeadTracker_Backfill(t *testing.T) { } ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ht := createHeadTrackerWithNeverSleeper(t, ethClient, cfg, orm) @@ -883,7 +883,7 @@ func TestHeadTracker_Backfill(t *testing.T) { orm := headtracker.NewORM(db, logger, cfg.Database(), cltest.FixtureChainID) ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ethClient.On("HeadByHash", mock.Anything, head0.Hash). Return(&head0, nil) @@ -911,7 +911,7 @@ func TestHeadTracker_Backfill(t *testing.T) { } ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ethClient.On("HeadByHash", mock.Anything, head10.Hash). Return(&head10, nil). Once() @@ -942,7 +942,7 @@ func TestHeadTracker_Backfill(t *testing.T) { } ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ethClient.On("HeadByHash", mock.Anything, head10.Hash). Return(&head10, nil) ethClient.On("HeadByHash", mock.Anything, head8.Hash). @@ -967,7 +967,7 @@ func TestHeadTracker_Backfill(t *testing.T) { logger := logger.TestLogger(t) orm := headtracker.NewORM(db, logger, cfg.Database(), cltest.FixtureChainID) ethClient := evmtest.NewEthClientMock(t) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ethClient.On("HeadByHash", mock.Anything, h14.Hash).Return(&h14, nil).Once() ethClient.On("HeadByHash", mock.Anything, h13.Hash).Return(&h13, nil).Once() ethClient.On("HeadByHash", mock.Anything, h12.Hash).Return(nil, errors.New("not found")).Once() diff --git a/core/chains/evm/mocks/legacy_chain_container.go b/core/chains/evm/mocks/legacy_chain_container.go index fe906234f1..d8dfa209a0 100644 --- a/core/chains/evm/mocks/legacy_chain_container.go +++ b/core/chains/evm/mocks/legacy_chain_container.go @@ -30,32 +30,6 @@ func (_m *LegacyChainContainer) ChainNodeConfigs() types.Configs { return r0 } -// Default provides a mock function with given fields: -func (_m *LegacyChainContainer) Default() (evm.Chain, error) { - ret := _m.Called() - - var r0 evm.Chain - var r1 error - if rf, ok := ret.Get(0).(func() (evm.Chain, error)); ok { - return rf() - } - if rf, ok := ret.Get(0).(func() evm.Chain); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(evm.Chain) - } - } - - if rf, ok := ret.Get(1).(func() error); ok { - r1 = rf() - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - // Get provides a mock function with given fields: id func (_m *LegacyChainContainer) Get(id string) (evm.Chain, error) { ret := _m.Called(id) @@ -128,11 +102,6 @@ func (_m *LegacyChainContainer) List(ids ...string) ([]evm.Chain, error) { return r0, r1 } -// SetDefault provides a mock function with given fields: _a0 -func (_m *LegacyChainContainer) SetDefault(_a0 evm.Chain) { - _m.Called(_a0) -} - // Slice provides a mock function with given fields: func (_m *LegacyChainContainer) Slice() []evm.Chain { ret := _m.Called() diff --git a/core/chains/evm/txmgr/evm_tx_store_test.go b/core/chains/evm/txmgr/evm_tx_store_test.go index 0cf2fd83cf..c4837f81e8 100644 --- a/core/chains/evm/txmgr/evm_tx_store_test.go +++ b/core/chains/evm/txmgr/evm_tx_store_test.go @@ -417,7 +417,7 @@ func TestORM_SetBroadcastBeforeBlockNum(t *testing.T) { t.Run("only updates evm.tx_attempts for the current chain", func(t *testing.T) { require.NoError(t, ethKeyStore.Add(fromAddress, testutils.SimulatedChainID)) require.NoError(t, ethKeyStore.Enable(fromAddress, testutils.SimulatedChainID)) - etxThisChain := cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, txStore, 1, fromAddress, cfg.DefaultChainID()) + etxThisChain := cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, txStore, 1, fromAddress, cfg.EVM().ChainID()) etxOtherChain := cltest.MustInsertUnconfirmedEthTxWithBroadcastLegacyAttempt(t, txStore, 0, fromAddress, testutils.SimulatedChainID) require.NoError(t, txStore.SetBroadcastBeforeBlockNum(headNum, chainID)) diff --git a/core/cmd/eth_keys_commands_test.go b/core/cmd/eth_keys_commands_test.go index da0a9ce5a6..30e115e948 100644 --- a/core/cmd/eth_keys_commands_test.go +++ b/core/cmd/eth_keys_commands_test.go @@ -15,6 +15,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/web/presenters" @@ -182,28 +183,21 @@ func TestShell_CreateETHKey(t *testing.T) { require.NoError(t, err) require.Equal(t, 1, len(keys)) - // create a key on the default chain - set := flag.NewFlagSet("test", 0) - cltest.FlagSetApplyFromAction(client.CreateETHKey, set, "") - c := cli.NewContext(nil, set, nil) - assert.NoError(t, client.CreateETHKey(c)) - - // create the key on a specific chainID id := big.NewInt(0) - set = flag.NewFlagSet("test", 0) + set := flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.CreateETHKey, set, "") - require.NoError(t, set.Set("evmChainID", "")) + require.NoError(t, set.Set("evm-chain-id", testutils.FixtureChainID.String())) - c = cli.NewContext(nil, set, nil) - require.NoError(t, set.Parse([]string{"-evmChainID", id.String()})) + c := cli.NewContext(nil, set, nil) + require.NoError(t, set.Parse([]string{"-evm-chain-id", id.String()})) assert.NoError(t, client.CreateETHKey(c)) - cltest.AssertCount(t, db, "evm.key_states", 3) + cltest.AssertCount(t, db, "evm.key_states", 2) keys, err = app.KeyStore.Eth().GetAll() require.NoError(t, err) - require.Equal(t, 3, len(keys)) + require.Equal(t, 2, len(keys)) } func TestShell_DeleteETHKey(t *testing.T) { @@ -308,9 +302,12 @@ func TestShell_ImportExportETHKey_NoChains(t *testing.T) { // Import the key set = flag.NewFlagSet("test", 0) - set.String("old-password", "../internal/fixtures/incorrect_password.txt", "") - err = set.Parse([]string{keyfilepath}) - require.NoError(t, err) + cltest.FlagSetApplyFromAction(client.ImportETHKey, set, "") + + require.NoError(t, set.Set("evmChainID", testutils.FixtureChainID.String())) + require.NoError(t, set.Set("old-password", "../internal/fixtures/incorrect_password.txt")) + require.NoError(t, set.Parse([]string{keyfilepath})) + c = cli.NewContext(nil, set, nil) err = client.ImportETHKey(c) require.NoError(t, err) @@ -412,6 +409,8 @@ func TestShell_ImportExportETHKey_WithChains(t *testing.T) { set = flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.ImportETHKey, set, "") + require.NoError(t, set.Set("evmChainID", testutils.FixtureChainID.String())) + require.NoError(t, set.Set("evmChainID", testutils.FixtureChainID.String())) require.NoError(t, set.Set("old-password", "../internal/fixtures/incorrect_password.txt")) require.NoError(t, set.Parse([]string{keyfilepath})) diff --git a/core/cmd/evm_transaction_commands_test.go b/core/cmd/evm_transaction_commands_test.go index 67e4da0375..f213aefb15 100644 --- a/core/cmd/evm_transaction_commands_test.go +++ b/core/cmd/evm_transaction_commands_test.go @@ -17,6 +17,8 @@ import ( evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/store/models" ) @@ -160,6 +162,7 @@ func TestShell_SendEther_From_Txm(t *testing.T) { amount := "100.5" to := "0x342156c8d3bA54Abc67920d35ba1d1e67201aC9C" require.NoError(t, set.Parse([]string{amount, fromAddress.Hex(), to})) + require.NoError(t, set.Set("id", evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs()).String())) cliapp := cli.NewApp() c := cli.NewContext(cliapp, set, nil) @@ -215,6 +218,7 @@ func TestShell_SendEther_From_Txm_WEI(t *testing.T) { set := flag.NewFlagSet("sendether", 0) cltest.FlagSetApplyFromAction(client.SendEther, set, "") + require.NoError(t, set.Set("id", testutils.FixtureChainID.String())) require.NoError(t, set.Set("wei", "false")) amount := "1000000000000000000" diff --git a/core/cmd/forwarders_commands_test.go b/core/cmd/forwarders_commands_test.go index 7d519917d5..4381b5ca68 100644 --- a/core/cmd/forwarders_commands_test.go +++ b/core/cmd/forwarders_commands_test.go @@ -77,7 +77,7 @@ func TestShell_TrackEVMForwarder(t *testing.T) { cltest.FlagSetApplyFromAction(client.TrackForwarder, set, "") require.NoError(t, set.Set("address", "0x5431F5F973781809D18643b87B44921b11355d81")) - require.NoError(t, set.Set("evmChainID", id.String())) + require.NoError(t, set.Set("evm-chain-id", id.String())) err := client.TrackForwarder(cli.NewContext(nil, set, nil)) require.NoError(t, err) @@ -122,7 +122,7 @@ func TestShell_TrackEVMForwarder_BadAddress(t *testing.T) { cltest.FlagSetApplyFromAction(client.TrackForwarder, set, "") require.NoError(t, set.Set("address", "0xWrongFormatAddress")) - require.NoError(t, set.Set("evmChainID", id.String())) + require.NoError(t, set.Set("evm-chain-id", id.String())) err := client.TrackForwarder(cli.NewContext(nil, set, nil)) require.Contains(t, err.Error(), "could not decode address: invalid hex string") diff --git a/core/cmd/shell_local.go b/core/cmd/shell_local.go index cd4f170523..db4d0476fb 100644 --- a/core/cmd/shell_local.go +++ b/core/cmd/shell_local.go @@ -375,18 +375,6 @@ func (s *Shell) runNode(c *cli.Context) error { legacyEVMChains := app.GetRelayers().LegacyEVMChains() - // By passing in a function we can be lazy trying to look up a default - // chain - if there are no existing keys, there is no need to check for - // a chain ID - DefaultEVMChainIDFunc := func() (*big.Int, error) { - def, err2 := legacyEVMChains.Default() - if err2 != nil { - return nil, errors.Wrap(err2, "cannot get default EVM chain ID; no default EVM chain available") - } - return def.ID(), nil - } - err = keyStore.Migrate(s.Config.Password().VRF(), DefaultEVMChainIDFunc) - if s.Config.EVMEnabled() { if err != nil { return errors.Wrap(err, "error migrating keystore") diff --git a/core/cmd/shell_local_test.go b/core/cmd/shell_local_test.go index 88e323ad5c..8d2b5f1fab 100644 --- a/core/cmd/shell_local_test.go +++ b/core/cmd/shell_local_test.go @@ -323,6 +323,7 @@ func TestShell_RebroadcastTransactions_Txm(t *testing.T) { set := flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.RebroadcastTransactions, set, "") + require.NoError(t, set.Set("evmChainID", testutils.FixtureChainID.String())) require.NoError(t, set.Set("beginningNonce", strconv.FormatUint(beginningNonce, 10))) require.NoError(t, set.Set("endingNonce", strconv.FormatUint(endingNonce, 10))) require.NoError(t, set.Set("gasPriceWei", "100000000000")) @@ -402,6 +403,7 @@ func TestShell_RebroadcastTransactions_OutsideRange_Txm(t *testing.T) { set := flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.RebroadcastTransactions, set, "") + require.NoError(t, set.Set("evmChainID", testutils.FixtureChainID.String())) require.NoError(t, set.Set("beginningNonce", strconv.FormatUint(uint64(beginningNonce), 10))) require.NoError(t, set.Set("endingNonce", strconv.FormatUint(uint64(endingNonce), 10))) require.NoError(t, set.Set("gasPriceWei", gasPrice.String())) @@ -482,6 +484,7 @@ func TestShell_RebroadcastTransactions_AddressCheck(t *testing.T) { set := flag.NewFlagSet("test", 0) cltest.FlagSetApplyFromAction(client.RebroadcastTransactions, set, "") + require.NoError(t, set.Set("evmChainID", testutils.FixtureChainID.String())) require.NoError(t, set.Set("address", fromAddress.Hex())) require.NoError(t, set.Set("password", "../internal/fixtures/correct_password.txt")) c := cli.NewContext(nil, set, nil) diff --git a/core/cmd/shell_remote_test.go b/core/cmd/shell_remote_test.go index 07b0119130..83686443fa 100644 --- a/core/cmd/shell_remote_test.go +++ b/core/cmd/shell_remote_test.go @@ -125,12 +125,8 @@ func TestShell_ReplayBlocks(t *testing.T) { cltest.FlagSetApplyFromAction(client.ReplayFromBlock, set, "") require.NoError(t, set.Set("block-number", "42")) - - c := cli.NewContext(nil, set, nil) - assert.NoError(t, client.ReplayFromBlock(c)) - require.NoError(t, set.Set("evm-chain-id", "12345678")) - c = cli.NewContext(nil, set, nil) + c := cli.NewContext(nil, set, nil) assert.ErrorContains(t, client.ReplayFromBlock(c), "chain id does not match any local chains") require.NoError(t, set.Set("evm-chain-id", "0")) diff --git a/core/config/app_config.go b/core/config/app_config.go index 1e60644dd0..20e877e6ec 100644 --- a/core/config/app_config.go +++ b/core/config/app_config.go @@ -1,7 +1,6 @@ package config import ( - "math/big" "time" "github.com/google/uuid" @@ -21,7 +20,6 @@ type AppConfig interface { RootDir() string ShutdownGracePeriod() time.Duration InsecureFastScrypt() bool - DefaultChainID() *big.Int EVMEnabled() bool EVMRPCEnabled() bool CosmosEnabled() bool diff --git a/core/config/ethereum_config.go b/core/config/ethereum_config.go deleted file mode 100644 index de3ccf2804..0000000000 --- a/core/config/ethereum_config.go +++ /dev/null @@ -1,9 +0,0 @@ -package config - -import ( - "math/big" -) - -type Ethereum interface { - DefaultChainID() *big.Int -} diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index 0122895464..8799ff4277 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -378,9 +378,6 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn } } - if ethClient == nil { - ethClient = evmclient.NewNullClient(cfg.DefaultChainID(), lggr) - } keyStore := keystore.New(db, utils.FastScryptParams, lggr, cfg.Database()) @@ -395,22 +392,28 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn GRPCOpts: loop.GRPCOpts{}, } - chainId := ethClient.ConfiguredChainID() evmOpts := chainlink.EVMFactoryConfig{ RelayerConfig: &evm.RelayerConfig{ AppConfig: cfg, EventBroadcaster: eventBroadcaster, MailMon: mailMon, - GenEthClient: func(_ *big.Int) evmclient.Client { - if chainId.Cmp(cfg.DefaultChainID()) != 0 { - t.Fatalf("expected eth client ChainID %d to match configured DefaultChainID %d", chainId, cfg.DefaultChainID()) - } - return ethClient - }, }, CSAETHKeystore: keyStore, } + if cfg.EVMEnabled() { + if ethClient == nil { + ethClient = evmclient.NewNullClient(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), lggr) + } + chainId := ethClient.ConfiguredChainID() + evmOpts.GenEthClient = func(_ *big.Int) evmclient.Client { + if chainId.Cmp(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs())) != 0 { + t.Fatalf("expected eth client ChainID %d to match evm config chain id %d", chainId, evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs())) + } + return ethClient + } + } + testCtx := testutils.Context(t) // evm alway enabled for backward compatibility initOps := []chainlink.CoreRelayerChainInitFunc{chainlink.InitEVM(testCtx, relayerFactory, evmOpts)} @@ -1290,7 +1293,7 @@ func MockApplicationEthCalls(t *testing.T, app *TestApplication, ethClient *evmc // Start ethClient.On("Dial", mock.Anything).Return(nil) ethClient.On("SubscribeNewHead", mock.Anything, mock.Anything).Return(sub, nil).Maybe() - ethClient.On("ConfiguredChainID", mock.Anything).Return(app.GetConfig().DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(evmtest.MustGetDefaultChainID(t, app.GetConfig().EVMConfigs()), nil) ethClient.On("PendingNonceAt", mock.Anything, mock.Anything).Return(uint64(0), nil).Maybe() ethClient.On("HeadByNumber", mock.Anything, mock.Anything).Return(nil, nil).Maybe() ethClient.On("Close").Return().Maybe() diff --git a/core/internal/cltest/factories.go b/core/internal/cltest/factories.go index f4b154218a..36a89971ca 100644 --- a/core/internal/cltest/factories.go +++ b/core/internal/cltest/factories.go @@ -481,6 +481,14 @@ func MustAddRandomKeyToKeystore(t testing.TB, ethKeyStore keystore.Eth) (ethkey. return k, k.Address } +func MustAddRandomKeyToKeystoreWithChainID(t testing.TB, chainID *big.Int, ethKeyStore keystore.Eth) (ethkey.KeyV2, common.Address) { + t.Helper() + k := MustGenerateRandomKey(t) + MustAddKeyToKeystore(t, k, chainID, ethKeyStore) + + return k, k.Address +} + func MustAddKeyToKeystore(t testing.TB, key ethkey.KeyV2, chainID *big.Int, ethKeyStore keystore.Eth) { t.Helper() ethKeyStore.XXXTestingOnlyAdd(key) @@ -624,7 +632,7 @@ NOW(),NOW(),$1,'{}',false,$2,$3,0,0,0,0,0,0,0,0 func MakeDirectRequestJobSpec(t *testing.T) *job.Job { t.Helper() - drs := &job.DirectRequestSpec{} + drs := &job.DirectRequestSpec{EVMChainID: (*utils.Big)(testutils.FixtureChainID)} spec := &job.Job{ Type: job.DirectRequest, SchemaVersion: 1, @@ -640,7 +648,7 @@ func MustInsertKeeperJob(t *testing.T, db *sqlx.DB, korm keeper.ORM, from ethkey t.Helper() var keeperSpec job.KeeperSpec - err := korm.Q().Get(&keeperSpec, `INSERT INTO keeper_specs (contract_address, from_address, created_at, updated_at) VALUES ($1, $2, NOW(), NOW()) RETURNING *`, contract, from) + err := korm.Q().Get(&keeperSpec, `INSERT INTO keeper_specs (contract_address, from_address, created_at, updated_at,evm_chain_id) VALUES ($1, $2, NOW(), NOW(), $3) RETURNING *`, contract, from, testutils.SimulatedChainID.Int64()) require.NoError(t, err) var pipelineSpec pipeline.Spec @@ -668,7 +676,7 @@ func MustInsertKeeperJob(t *testing.T, db *sqlx.DB, korm keeper.ORM, from ethkey } func MustInsertKeeperRegistry(t *testing.T, db *sqlx.DB, korm keeper.ORM, ethKeyStore keystore.Eth, keeperIndex, numKeepers, blockCountPerTurn int32) (keeper.Registry, job.Job) { - key, _ := MustAddRandomKeyToKeystore(t, ethKeyStore) + key, _ := MustAddRandomKeyToKeystoreWithChainID(t, testutils.SimulatedChainID, ethKeyStore) from := key.EIP55Address t.Helper() contractAddress := NewEIP55Address() diff --git a/core/internal/cltest/job_factories.go b/core/internal/cltest/job_factories.go index ef59a9d312..910ffe79e3 100644 --- a/core/internal/cltest/job_factories.go +++ b/core/internal/cltest/job_factories.go @@ -24,6 +24,7 @@ const ( type = "offchainreporting" schemaVersion = 1 contractAddress = "%s" + evmChainID = "0" p2pPeerID = "%s" p2pBootstrapPeers = ["/dns4/chain.link/tcp/1234/p2p/16Uiu2HAm58SP7UL8zsnpeuwHfytLocaqgnyaYKP8wu7qRdrixLju"] isBootstrapPeer = false diff --git a/core/internal/cltest/mocks.go b/core/internal/cltest/mocks.go index 423791f716..439ca2b721 100644 --- a/core/internal/cltest/mocks.go +++ b/core/internal/cltest/mocks.go @@ -429,7 +429,5 @@ func NewLegacyChainsWithMockChain(t testing.TB, ethClient evmclient.Client, cfg func NewLegacyChainsWithChain(ch evm.Chain, cfg evm.AppConfig) evm.LegacyChainContainer { m := map[string]evm.Chain{ch.ID().String(): ch} - legacyChains := evm.NewLegacyChains(m, cfg.EVMConfigs()) - legacyChains.SetDefault(ch) - return legacyChains + return evm.NewLegacyChains(m, cfg.EVMConfigs()) } diff --git a/core/internal/cltest/simulated_backend.go b/core/internal/cltest/simulated_backend.go index 9a3dcfd518..010478837d 100644 --- a/core/internal/cltest/simulated_backend.go +++ b/core/internal/cltest/simulated_backend.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/pg" @@ -36,8 +37,8 @@ func NewApplicationWithConfigV2OnSimulatedBlockchain( if bid := backend.Blockchain().Config().ChainID; bid.Cmp(testutils.SimulatedChainID) != 0 { t.Fatalf("expected backend chain ID to be %s but it was %s", testutils.SimulatedChainID.String(), bid.String()) } - defID := cfg.DefaultChainID() - require.Zero(t, defID.Cmp(testutils.SimulatedChainID)) + + require.Zero(t, evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()).Cmp(testutils.SimulatedChainID)) chainID := utils.NewBig(testutils.SimulatedChainID) client := client.NewSimulatedBackendClient(t, backend, testutils.SimulatedChainID) eventBroadcaster := pg.NewEventBroadcaster(cfg.Database().URL(), 0, 0, logger.TestLogger(t), uuid.New()) @@ -61,8 +62,8 @@ func NewApplicationWithConfigV2AndKeyOnSimulatedBlockchain( if bid := backend.Blockchain().Config().ChainID; bid.Cmp(testutils.SimulatedChainID) != 0 { t.Fatalf("expected backend chain ID to be %s but it was %s", testutils.SimulatedChainID.String(), bid.String()) } - defID := cfg.DefaultChainID() - require.Zero(t, defID.Cmp(testutils.SimulatedChainID)) + + require.Zero(t, evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()).Cmp(testutils.SimulatedChainID)) chainID := utils.NewBig(testutils.SimulatedChainID) client := client.NewSimulatedBackendClient(t, backend, testutils.SimulatedChainID) eventBroadcaster := pg.NewEventBroadcaster(cfg.Database().URL(), 0, 0, logger.TestLogger(t), uuid.New()) diff --git a/core/internal/features/features_test.go b/core/internal/features/features_test.go index 2e2d29c248..39eee3f7b4 100644 --- a/core/internal/features/features_test.go +++ b/core/internal/features/features_test.go @@ -505,13 +505,14 @@ observationSource = """ data="%s" minConfirmations="2" failOnRevert=false + evmChainID="%s" from="[\\"%s\\"]" ] """ ` // This succeeds for whatever reason revertingData := "0xdeadbeef" - tomlSpec = fmt.Sprintf(tomlSpec, operatorContracts.linkTokenAddress.String(), revertingData, sendingAddr) + tomlSpec = fmt.Sprintf(tomlSpec, operatorContracts.linkTokenAddress.String(), revertingData, testutils.SimulatedChainID.String(), sendingAddr) j := cltest.CreateJobViaWeb(t, app, []byte(cltest.MustJSONMarshal(t, web.CreateJobRequest{TOML: tomlSpec}))) cltest.AwaitJobActive(t, app.JobSpawner(), j.ID, testutils.WaitTimeout(t)) @@ -550,13 +551,14 @@ observationSource = """ data="%s" minConfirmations="2" failOnRevert=true + evmChainID="%s" from="[\\"%s\\"]" ] """ ` // This data is a call to link token's `transfer` function and will revert due to insufficient LINK on the sender address revertingData := "0xa9059cbb000000000000000000000000526485b5abdd8ae9c6a63548e0215a83e7135e6100000000000000000000000000000000000000000000000db069932ea4fe1400" - tomlSpec = fmt.Sprintf(tomlSpec, operatorContracts.linkTokenAddress.String(), revertingData, sendingAddr) + tomlSpec = fmt.Sprintf(tomlSpec, operatorContracts.linkTokenAddress.String(), revertingData, testutils.SimulatedChainID.String(), sendingAddr) j := cltest.CreateJobViaWeb(t, app, []byte(cltest.MustJSONMarshal(t, web.CreateJobRequest{TOML: tomlSpec}))) cltest.AwaitJobActive(t, app.JobSpawner(), j.ID, testutils.WaitTimeout(t)) @@ -587,13 +589,14 @@ observationSource = """ data="%s" minConfirmations="2" failOnRevert=false + evmChainID="%s" from="[\\"%s\\"]" ] """ ` // This data is a call to link token's `transfer` function and will revert due to insufficient LINK on the sender address revertingData := "0xa9059cbb000000000000000000000000526485b5abdd8ae9c6a63548e0215a83e7135e6100000000000000000000000000000000000000000000000db069932ea4fe1400" - tomlSpec = fmt.Sprintf(tomlSpec, operatorContracts.linkTokenAddress.String(), revertingData, sendingAddr) + tomlSpec = fmt.Sprintf(tomlSpec, operatorContracts.linkTokenAddress.String(), revertingData, testutils.SimulatedChainID.String(), sendingAddr) j := cltest.CreateJobViaWeb(t, app, []byte(cltest.MustJSONMarshal(t, web.CreateJobRequest{TOML: tomlSpec}))) cltest.AwaitJobActive(t, app.JobSpawner(), j.ID, testutils.WaitTimeout(t)) @@ -929,8 +932,9 @@ type = "offchainreporting" schemaVersion = 1 name = "boot" contractAddress = "%s" +evmChainID = "%s" isBootstrapPeer = true -`, ocrContractAddress)) +`, ocrContractAddress, testutils.SimulatedChainID.String())) require.NoError(t, err) jb.Name = null.NewString("boot", true) err = appBootstrap.AddJobV2(testutils.Context(t), &jb) @@ -997,6 +1001,7 @@ type = "offchainreporting" schemaVersion = 1 name = "web oracle spec" contractAddress = "%s" +evmChainID = "%s" isBootstrapPeer = false p2pBootstrapPeers = [ "/ip4/127.0.0.1/tcp/%d/p2p/%s" @@ -1022,7 +1027,7 @@ observationSource = """ answer1 [type=median index=0]; """ -`, ocrContractAddress, bootstrapNodePortV1, bootstrapPeerID, keys[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i)) +`, ocrContractAddress, testutils.SimulatedChainID.String(), bootstrapNodePortV1, bootstrapPeerID, keys[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i)) require.NoError(t, err) jb.Name = null.NewString("testocr", true) err = apps[i].AddJobV2(testutils.Context(t), &jb) @@ -1157,9 +1162,10 @@ type = "offchainreporting" schemaVersion = 1 name = "boot" contractAddress = "%s" +evmChainID = "%s" forwardingAllowed = true isBootstrapPeer = true -`, ocrContractAddress)) +`, ocrContractAddress, testutils.SimulatedChainID.String())) require.NoError(t, err) jb.Name = null.NewString("boot", true) err = appBootstrap.AddJobV2(testutils.Context(t), &jb) @@ -1227,6 +1233,7 @@ type = "offchainreporting" schemaVersion = 1 name = "web oracle spec" contractAddress = "%s" +evmChainID = "%s" forwardingAllowed = true isBootstrapPeer = false p2pBootstrapPeers = [ @@ -1253,7 +1260,7 @@ observationSource = """ answer1 [type=median index=0]; """ -`, ocrContractAddress, bootstrapNodePortV1, bootstrapPeerID, keys[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i)) +`, ocrContractAddress, testutils.SimulatedChainID.String(), bootstrapNodePortV1, bootstrapPeerID, keys[i].ID(), transmitters[i], fmt.Sprintf("bridge%d", i), i, slowServers[i].URL, i)) require.NoError(t, err) jb.Name = null.NewString("testocr", true) err = apps[i].AddJobV2(testutils.Context(t), &jb) @@ -1342,7 +1349,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { Transactions: cltest.LegacyTransactionsFromGasPrices(48_000_000_000, 49_000_000_000, 31_000_000_000), } - evmChainID := utils.NewBig(cfg.DefaultChainID()) + evmChainID := utils.NewBig(evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs())) h40 := evmtypes.Head{Hash: utils.NewHash(), Number: 40, EVMChainID: evmChainID} h41 := evmtypes.Head{Hash: b41.Hash, ParentHash: h40.Hash, Number: 41, EVMChainID: evmChainID} h42 := evmtypes.Head{Hash: b42.Hash, ParentHash: h41.Hash, Number: 42, EVMChainID: evmChainID} @@ -1373,7 +1380,7 @@ func TestIntegration_BlockHistoryEstimator(t *testing.T) { }) ethClient.On("Dial", mock.Anything).Return(nil) - ethClient.On("ConfiguredChainID", mock.Anything).Return(cfg.DefaultChainID(), nil) + ethClient.On("ConfiguredChainID", mock.Anything).Return(*evmtest.MustGetDefaultChainID(t, cfg.EVMConfigs()), nil) ethClient.On("BalanceAt", mock.Anything, mock.Anything, mock.Anything).Maybe().Return(oneETH.ToInt(), nil) // HeadTracker backfill ethClient.On("HeadByHash", mock.Anything, h40.Hash).Return(&h40, nil).Maybe() diff --git a/core/internal/testutils/evmtest/evmtest.go b/core/internal/testutils/evmtest/evmtest.go index 4532e79ac0..62696f75d9 100644 --- a/core/internal/testutils/evmtest/evmtest.go +++ b/core/internal/testutils/evmtest/evmtest.go @@ -45,7 +45,7 @@ func NewChainScopedConfig(t testing.TB, cfg evm.AppConfig) evmconfig.ChainScoped if len(cfg.EVMConfigs()) > 0 { evmCfg = cfg.EVMConfigs()[0] } else { - chainID := utils.NewBigI(0) + var chainID = (*utils.Big)(testutils.FixtureChainID) evmCfg = &evmtoml.EVMConfig{ ChainID: chainID, Chain: evmtoml.Defaults(chainID), @@ -95,7 +95,7 @@ func NewChainRelayExtOpts(t testing.TB, testopts TestChainOpts) evm.ChainRelayEx if testopts.Client != nil { return testopts.Client } - return evmclient.NewNullClient(testopts.GeneralConfig.DefaultChainID(), logger.TestLogger(t)) + return evmclient.NewNullClient(MustGetDefaultChainID(t, testopts.GeneralConfig.EVMConfigs()), logger.TestLogger(t)) } if testopts.LogBroadcaster != nil { opts.GenLogBroadcaster = func(*big.Int) log.Broadcaster { @@ -129,10 +129,21 @@ func NewChainRelayExtOpts(t testing.TB, testopts TestChainOpts) evm.ChainRelayEx return opts } +// Deprecated, this is a replacement function for tests for now removed default evmChainID logic +func MustGetDefaultChainID(t testing.TB, evmCfgs evmtoml.EVMConfigs) *big.Int { + if len(evmCfgs) == 0 { + t.Fatalf("at least one evm chain config must be defined") + } + return evmCfgs[0].ChainID.ToInt() +} + +// Deprecated, this is a replacement function for tests for now removed default chain logic func MustGetDefaultChain(t testing.TB, cc evm.LegacyChainContainer) evm.Chain { - chain, err := cc.Default() - require.NoError(t, err) - return chain + if len(cc.Slice()) == 0 { + t.Fatalf("at least one evm chain container must be defined") + } + + return cc.Slice()[0] } type TestConfigs struct { diff --git a/core/services/blockhashstore/delegate_test.go b/core/services/blockhashstore/delegate_test.go index 78242d519d..3060f61787 100644 --- a/core/services/blockhashstore/delegate_test.go +++ b/core/services/blockhashstore/delegate_test.go @@ -89,7 +89,7 @@ func TestDelegate_ServicesForSpec(t *testing.T) { defaultWaitBlocks := (int32)(testData.legacyChains.Slice()[0].Config().EVM().FinalityDepth()) t.Run("happy", func(t *testing.T) { - spec := job.Job{BlockhashStoreSpec: &job.BlockhashStoreSpec{WaitBlocks: defaultWaitBlocks}} + spec := job.Job{BlockhashStoreSpec: &job.BlockhashStoreSpec{WaitBlocks: defaultWaitBlocks, EVMChainID: (*utils.Big)(testutils.FixtureChainID)}} services, err := delegate.ServicesForSpec(spec) require.NoError(t, err) @@ -106,6 +106,7 @@ func TestDelegate_ServicesForSpec(t *testing.T) { CoordinatorV1Address: &coordinatorV1, CoordinatorV2Address: &coordinatorV2, CoordinatorV2PlusAddress: &coordinatorV2Plus, + EVMChainID: (*utils.Big)(testutils.FixtureChainID), }} services, err := delegate.ServicesForSpec(spec) @@ -150,6 +151,7 @@ func TestDelegate_StartStop(t *testing.T) { WaitBlocks: defaultWaitBlocks, PollPeriod: time.Second, RunTimeout: testutils.WaitTimeout(t), + EVMChainID: (*utils.Big)(testutils.FixtureChainID), }} services, err := delegate.ServicesForSpec(spec) diff --git a/core/services/chainlink/application.go b/core/services/chainlink/application.go index 498d355d7f..9d74113050 100644 --- a/core/services/chainlink/application.go +++ b/core/services/chainlink/application.go @@ -737,6 +737,7 @@ func (app *ChainlinkApplication) RunJobV2( "externalJobID": jb.ExternalJobID, "name": jb.Name.ValueOrZero(), "publicKey": jb.VRFSpec.PublicKey[:], + "evmChainID": jb.VRFSpec.EVMChainID.String(), }, "jobRun": map[string]interface{}{ "meta": meta, diff --git a/core/services/chainlink/config_general.go b/core/services/chainlink/config_general.go index 057b7e554e..688215c697 100644 --- a/core/services/chainlink/config_general.go +++ b/core/services/chainlink/config_general.go @@ -3,7 +3,6 @@ package chainlink import ( _ "embed" "fmt" - "math/big" "net/url" "os" "path/filepath" @@ -313,15 +312,6 @@ func (g *generalConfig) EVMRPCEnabled() bool { return false } -func (g *generalConfig) DefaultChainID() *big.Int { - for _, c := range g.c.EVM { - if c.IsEnabled() { - return (*big.Int)(c.ChainID) - } - } - return nil -} - func (g *generalConfig) SolanaEnabled() bool { for _, c := range g.c.Solana { if c.IsEnabled() { diff --git a/core/services/chainlink/config_general_test.go b/core/services/chainlink/config_general_test.go index 8a0f58ecd4..8e95e389ff 100644 --- a/core/services/chainlink/config_general_test.go +++ b/core/services/chainlink/config_general_test.go @@ -24,7 +24,6 @@ func TestTOMLGeneralConfig_Defaults(t *testing.T) { config, err := GeneralConfigOpts{}.New() require.NoError(t, err) assert.Equal(t, (*url.URL)(nil), config.WebServer().BridgeResponseURL()) - assert.Nil(t, config.DefaultChainID()) assert.False(t, config.EVMRPCEnabled()) assert.False(t, config.EVMEnabled()) assert.False(t, config.CosmosEnabled()) diff --git a/core/services/chainlink/mocks/general_config.go b/core/services/chainlink/mocks/general_config.go index d91901fce6..416fbd3375 100644 --- a/core/services/chainlink/mocks/general_config.go +++ b/core/services/chainlink/mocks/general_config.go @@ -3,11 +3,8 @@ package mocks import ( - big "math/big" - - config "github.com/smartcontractkit/chainlink/v2/core/config" - cosmos "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" + config "github.com/smartcontractkit/chainlink/v2/core/config" mock "github.com/stretchr/testify/mock" @@ -147,22 +144,6 @@ func (_m *GeneralConfig) Database() config.Database { return r0 } -// DefaultChainID provides a mock function with given fields: -func (_m *GeneralConfig) DefaultChainID() *big.Int { - ret := _m.Called() - - var r0 *big.Int - if rf, ok := ret.Get(0).(func() *big.Int); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*big.Int) - } - } - - return r0 -} - // EVMConfigs provides a mock function with given fields: func (_m *GeneralConfig) EVMConfigs() toml.EVMConfigs { ret := _m.Called() diff --git a/core/services/chainlink/relayer_chain_interoperators.go b/core/services/chainlink/relayer_chain_interoperators.go index 823d3f88c9..1a0dbadd26 100644 --- a/core/services/chainlink/relayer_chain_interoperators.go +++ b/core/services/chainlink/relayer_chain_interoperators.go @@ -110,23 +110,13 @@ func InitEVM(ctx context.Context, factory RelayerFactory, config EVMFactoryConfi } legacyMap := make(map[string]evm.Chain) - var defaultChain evm.Chain - for id, a := range adapters { // adapter is a service op.srvs = append(op.srvs, a) op.loopRelayers[id] = a legacyMap[id.ChainID] = a.Chain() - if a.Default() { - defaultChain = a.Chain() - } - } op.legacyChains.EVMChains = evm.NewLegacyChains(legacyMap, config.AppConfig.EVMConfigs()) - // TODO BCF-2510 this may not be necessary if EVM is not enabled by default - if defaultChain != nil { - op.legacyChains.EVMChains.SetDefault(defaultChain) - } return nil } } diff --git a/core/services/directrequest/delegate.go b/core/services/directrequest/delegate.go index 4e2ca1e189..56020f7756 100644 --- a/core/services/directrequest/delegate.go +++ b/core/services/directrequest/delegate.go @@ -339,6 +339,7 @@ func (l *listener) handleOracleRequest(request *operator_wrapper.OperatorOracleR ctx, cancel := runCloserChannel.NewCtx() defer cancel() + evmChainID := lb.EVMChainID() vars := pipeline.NewVarsFrom(map[string]interface{}{ "jobSpec": map[string]interface{}{ "databaseID": l.job.ID, @@ -347,6 +348,7 @@ func (l *listener) handleOracleRequest(request *operator_wrapper.OperatorOracleR "pipelineSpec": &pipeline.Spec{ ForwardingAllowed: l.job.ForwardingAllowed, }, + "evmChainID": evmChainID.String(), }, "jobRun": map[string]interface{}{ "meta": meta, diff --git a/core/services/directrequest/delegate_test.go b/core/services/directrequest/delegate_test.go index 0a4334e869..ffd78443cc 100644 --- a/core/services/directrequest/delegate_test.go +++ b/core/services/directrequest/delegate_test.go @@ -57,7 +57,7 @@ func TestDelegate_ServicesForSpec(t *testing.T) { }) t.Run("Spec with DirectRequestSpec", func(t *testing.T) { - spec := job.Job{DirectRequestSpec: &job.DirectRequestSpec{}, PipelineSpec: &pipeline.Spec{}} + spec := job.Job{DirectRequestSpec: &job.DirectRequestSpec{EVMChainID: (*utils.Big)(testutils.FixtureChainID)}, PipelineSpec: &pipeline.Spec{}} services, err := delegate.ServicesForSpec(spec) require.NoError(t, err) assert.Len(t, services, 1) @@ -143,6 +143,7 @@ func TestDelegate_ServicesListenerHandleLog(t *testing.T) { log.On("ReceiptsRoot").Return(common.Hash{}) log.On("TransactionsRoot").Return(common.Hash{}) log.On("StateRoot").Return(common.Hash{}) + log.On("EVMChainID").Return(*big.NewInt(0)) uni.logBroadcaster.On("WasAlreadyConsumed", mock.Anything, mock.Anything).Return(false, nil) logOracleRequest := operator_wrapper.OperatorOracleRequest{ @@ -203,6 +204,7 @@ func TestDelegate_ServicesListenerHandleLog(t *testing.T) { }).Maybe() log.On("DecodedLog").Return(&logOracleRequest).Maybe() log.On("String").Return("") + log.On("EVMChainID").Return(*big.NewInt(0)) uni.logBroadcaster.On("MarkConsumed", mock.Anything, mock.Anything).Return(nil).Maybe() err := uni.service.Start(testutils.Context(t)) @@ -295,6 +297,7 @@ func TestDelegate_ServicesListenerHandleLog(t *testing.T) { runLog.On("ReceiptsRoot").Return(common.Hash{}) runLog.On("TransactionsRoot").Return(common.Hash{}) runLog.On("StateRoot").Return(common.Hash{}) + runLog.On("EVMChainID").Return(*big.NewInt(0)) uni.logBroadcaster.On("WasAlreadyConsumed", mock.Anything, mock.Anything).Return(false, nil) logOracleRequest := operator_wrapper.OperatorOracleRequest{ @@ -364,6 +367,7 @@ func TestDelegate_ServicesListenerHandleLog(t *testing.T) { log.On("ReceiptsRoot").Return(common.Hash{}) log.On("TransactionsRoot").Return(common.Hash{}) log.On("StateRoot").Return(common.Hash{}) + log.On("EVMChainID").Return(*big.NewInt(0)) uni.logBroadcaster.On("WasAlreadyConsumed", mock.Anything, mock.Anything).Return(false, nil) logOracleRequest := operator_wrapper.OperatorOracleRequest{ @@ -456,6 +460,7 @@ func TestDelegate_ServicesListenerHandleLog(t *testing.T) { log.On("ReceiptsRoot").Return(common.Hash{}) log.On("TransactionsRoot").Return(common.Hash{}) log.On("StateRoot").Return(common.Hash{}) + log.On("EVMChainID").Return(*big.NewInt(0)) uni.logBroadcaster.On("WasAlreadyConsumed", mock.Anything, mock.Anything).Return(false, nil) logOracleRequest := operator_wrapper.OperatorOracleRequest{ diff --git a/core/services/feeds/service_test.go b/core/services/feeds/service_test.go index c864b8c192..db6497d11f 100644 --- a/core/services/feeds/service_test.go +++ b/core/services/feeds/service_test.go @@ -73,6 +73,7 @@ type = "offchainreporting" schemaVersion = 1 name = "example OCR1 spec" externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F46" +evmChainID = 0 contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" p2pBootstrapPeers = [ "/dns4/chain.link/tcp/1234/p2p/16Uiu2HAm58SP7UL8zsnpeuwHfytLocaqgnyaYKP8wu7qRdrixLju", diff --git a/core/services/fluxmonitorv2/flux_monitor.go b/core/services/fluxmonitorv2/flux_monitor.go index ad34c84b1d..34ca121e9a 100644 --- a/core/services/fluxmonitorv2/flux_monitor.go +++ b/core/services/fluxmonitorv2/flux_monitor.go @@ -735,6 +735,7 @@ func (fm *FluxMonitor) respondToNewRoundLog(log flux_aggregator_wrapper.FluxAggr "databaseID": fm.jobSpec.ID, "externalJobID": fm.jobSpec.ExternalJobID, "name": fm.jobSpec.Name.ValueOrZero(), + "evmChainID": fm.chainID.String(), }, "jobRun": map[string]interface{}{ "meta": metaDataForBridge, @@ -938,6 +939,7 @@ func (fm *FluxMonitor) pollIfEligible(pollReq PollRequestType, deviationChecker "databaseID": fm.jobSpec.ID, "externalJobID": fm.jobSpec.ExternalJobID, "name": fm.jobSpec.Name.ValueOrZero(), + "evmChainID": fm.chainID.String(), }, "jobRun": map[string]interface{}{ "meta": metaDataForBridge, diff --git a/core/services/fluxmonitorv2/flux_monitor_test.go b/core/services/fluxmonitorv2/flux_monitor_test.go index 923658fef0..5a67c2fa1d 100644 --- a/core/services/fluxmonitorv2/flux_monitor_test.go +++ b/core/services/fluxmonitorv2/flux_monitor_test.go @@ -445,6 +445,7 @@ func TestFluxMonitor_PollIfEligible(t *testing.T) { "databaseID": int32(0), "externalJobID": uuid.UUID{}, "name": "", + "evmChainID": testutils.FixtureChainID.String(), }, }, ), mock.Anything). @@ -1882,6 +1883,7 @@ func TestFluxMonitor_DrumbeatTicker(t *testing.T) { "databaseID": int32(0), "externalJobID": uuid.UUID{}, "name": "", + "evmChainID": testutils.FixtureChainID.String(), }, }, ), mock.Anything). diff --git a/core/services/fluxmonitorv2/integrations_test.go b/core/services/fluxmonitorv2/integrations_test.go index e76d859e81..5b6a94cac5 100644 --- a/core/services/fluxmonitorv2/integrations_test.go +++ b/core/services/fluxmonitorv2/integrations_test.go @@ -644,6 +644,7 @@ type = "fluxmonitor" schemaVersion = 1 name = "example flux monitor spec" contractAddress = "%s" +evmChainID = "%s" threshold = 0.5 absoluteThreshold = 0.0 @@ -661,7 +662,7 @@ ds1 -> ds1_parse """ ` - s = fmt.Sprintf(s, fa.aggregatorContractAddress, pollTimerPeriod, mockServer.URL) + s = fmt.Sprintf(s, fa.aggregatorContractAddress, testutils.SimulatedChainID.String(), pollTimerPeriod, mockServer.URL) // raise flags to disable polling _, err = fa.flagsContract.RaiseFlag(fa.sergey, utils.ZeroAddress) // global kill switch @@ -752,6 +753,7 @@ type = "fluxmonitor" schemaVersion = 1 name = "example flux monitor spec" contractAddress = "%s" +evmChainID = "%s" threshold = 0.5 absoluteThreshold = 0.0 @@ -769,7 +771,7 @@ ds1 -> ds1_parse """ ` - s = fmt.Sprintf(s, fa.aggregatorContractAddress, "1000ms", mockServer.URL) + s = fmt.Sprintf(s, fa.aggregatorContractAddress, testutils.SimulatedChainID.String(), "1000ms", mockServer.URL) // raise flags _, err = fa.flagsContract.RaiseFlag(fa.sergey, utils.ZeroAddress) // global kill switch @@ -862,6 +864,7 @@ type = "fluxmonitor" schemaVersion = 1 name = "example flux monitor spec" contractAddress = "%s" +evmChainID = "%s" threshold = 0.5 absoluteThreshold = 0.01 @@ -879,7 +882,7 @@ ds1 -> ds1_parse """ ` - s := fmt.Sprintf(toml, fa.aggregatorContractAddress, "100ms", mockServer.URL) + s := fmt.Sprintf(toml, fa.aggregatorContractAddress, testutils.SimulatedChainID.String(), "100ms", mockServer.URL) // raise flags _, err = fa.flagsContract.RaiseFlag(fa.sergey, utils.ZeroAddress) // global kill switch @@ -963,6 +966,7 @@ type = "fluxmonitor" schemaVersion = 1 name = "example flux monitor spec" contractAddress = "%s" +evmChainID = "%s" threshold = 0.5 absoluteThreshold = 0.0 @@ -981,7 +985,7 @@ ds1 -> ds1_parse -> ds1_multiply """ ` - s = fmt.Sprintf(s, fa.aggregatorContractAddress, "200ms", mockServer.URL) + s = fmt.Sprintf(s, fa.aggregatorContractAddress, testutils.SimulatedChainID.String(), "200ms", mockServer.URL) requestBody, err := json.Marshal(web.CreateJobRequest{ TOML: string(s), }) diff --git a/core/services/fluxmonitorv2/orm_test.go b/core/services/fluxmonitorv2/orm_test.go index caaea83851..1377737c49 100644 --- a/core/services/fluxmonitorv2/orm_test.go +++ b/core/services/fluxmonitorv2/orm_test.go @@ -23,6 +23,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/pipeline" evmrelay "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm" + "github.com/smartcontractkit/chainlink/v2/core/utils" ) func TestORM_MostRecentFluxMonitorRoundID(t *testing.T) { @@ -161,6 +162,7 @@ func makeJob(t *testing.T) *job.Job { IdleTimerDisabled: false, CreatedAt: time.Now(), UpdatedAt: time.Now(), + EVMChainID: (*utils.Big)(testutils.FixtureChainID), }, } } diff --git a/core/services/job/helpers_test.go b/core/services/job/helpers_test.go index 21f3a8daa9..167ed5297c 100644 --- a/core/services/job/helpers_test.go +++ b/core/services/job/helpers_test.go @@ -35,6 +35,7 @@ const ( type = "offchainreporting" schemaVersion = 1 contractAddress = "%s" +evmChainID = "0" p2pBootstrapPeers = [ "/dns4/chain.link/tcp/1234/p2p/16Uiu2HAm58SP7UL8zsnpeuwHfytLocaqgnyaYKP8wu7qRdrixLju", ] @@ -112,6 +113,7 @@ ds1 -> ds1_parse -> ds1_multiply; transmitterAddress = "%s" keyBundleID = "%s" observationTimeout = "10s" + evmChainID = "0" observationSource = """ ds1 [type=http method=GET url="%s" allowunrestrictednetworkaccess="true" %s]; ds1_parse [type=jsonparse path="USD" lax=true]; @@ -122,6 +124,7 @@ ds1 -> ds1_parse; type = "offchainreporting" schemaVersion = 1 contractAddress = "%s" + evmChainID = "0" p2pBootstrapPeers = [] isBootstrapPeer = true ` @@ -129,6 +132,7 @@ ds1 -> ds1_parse; type = "offchainreporting" schemaVersion = 1 contractAddress = "%s" +evmChainID = "0" p2pPeerID = "%s" p2pBootstrapPeers = [ "/dns4/chain.link/tcp/1234/p2p/16Uiu2HAm58SP7UL8zsnpeuwHfytLocaqgnyaYKP8wu7qRdrixLju", diff --git a/core/services/job/job_orm_test.go b/core/services/job/job_orm_test.go index 4fb8b76790..fb34f92a06 100644 --- a/core/services/job/job_orm_test.go +++ b/core/services/job/job_orm_test.go @@ -16,6 +16,7 @@ import ( "gopkg.in/guregu/null.v4" "github.com/smartcontractkit/chainlink-relay/pkg/types" + "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/assets" @@ -604,6 +605,92 @@ func TestORM_CreateJob_OCRBootstrap(t *testing.T) { cltest.AssertCount(t, db, "jobs", 0) } +func TestORM_CreateJob_EVMChainID_Validation(t *testing.T) { + config := configtest.NewGeneralConfig(t, nil) + db := pgtest.NewSqlxDB(t) + keyStore := cltest.NewKeyStore(t, db, config.Database()) + + lggr := logger.TestLogger(t) + pipelineORM := pipeline.NewORM(db, lggr, config.Database(), config.JobPipeline().MaxSuccessfulRuns()) + bridgesORM := bridges.NewORM(db, lggr, config.Database()) + + relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{DB: db, GeneralConfig: config, KeyStore: keyStore.Eth()}) + legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) + jobORM := NewTestORM(t, db, legacyChains, pipelineORM, bridgesORM, keyStore, config.Database()) + + t.Run("evm chain id validation for ocr works", func(t *testing.T) { + jb := job.Job{ + Type: job.OffchainReporting, + OCROracleSpec: &job.OCROracleSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for direct request works", func(t *testing.T) { + jb := job.Job{ + Type: job.DirectRequest, + DirectRequestSpec: &job.DirectRequestSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for flux monitor works", func(t *testing.T) { + jb := job.Job{ + Type: job.FluxMonitor, + FluxMonitorSpec: &job.FluxMonitorSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for keepers works", func(t *testing.T) { + jb := job.Job{ + Type: job.Keeper, + KeeperSpec: &job.KeeperSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for vrf works", func(t *testing.T) { + jb := job.Job{ + Type: job.VRF, + VRFSpec: &job.VRFSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for block hash store works", func(t *testing.T) { + jb := job.Job{ + Type: job.BlockhashStore, + BlockhashStoreSpec: &job.BlockhashStoreSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for block header feeder works", func(t *testing.T) { + jb := job.Job{ + Type: job.BlockHeaderFeeder, + BlockHeaderFeederSpec: &job.BlockHeaderFeederSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for legacy gas station server spec works", func(t *testing.T) { + jb := job.Job{ + Type: job.LegacyGasStationServer, + LegacyGasStationServerSpec: &job.LegacyGasStationServerSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) + + t.Run("evm chain id validation for legacy gas station sidecar spec works", func(t *testing.T) { + jb := job.Job{ + Type: job.LegacyGasStationSidecar, + LegacyGasStationSidecarSpec: &job.LegacyGasStationSidecarSpec{}, + } + assert.Equal(t, "CreateJobFailed: evm chain id must be defined", jobORM.CreateJob(&jb).Error()) + }) +} + func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { customChainID := utils.NewBig(testutils.NewRandomEVMChainID()) @@ -628,16 +715,15 @@ func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { legacyChains := evmrelay.NewLegacyChainsFromRelayerExtenders(relayExtenders) jobORM := NewTestORM(t, db, legacyChains, pipelineORM, bridgesORM, keyStore, config.Database()) - defaultChainID := config.DefaultChainID() - + // defaultChainID is deprecated + defaultChainID := customChainID _, address := cltest.MustInsertRandomKey(t, keyStore.Eth()) _, bridge := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) _, bridge2 := cltest.MustCreateBridge(t, db, cltest.BridgeOpts{}, config.Database()) - // EVMChainID will default to 0, but we want to override that - // with nil later to represent a job spec with no chain id spec := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ Name: "job1", + EVMChainID: testutils.FixtureChainID.String(), DS1BridgeName: bridge.Name.String(), DS2BridgeName: bridge2.Name.String(), TransmitterAddress: address.Hex(), @@ -646,40 +732,30 @@ func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { jb, err := ocr.ValidatedOracleSpecToml(legacyChains, spec.Toml()) require.NoError(t, err) - // 2nd job with no Chain ID - spec2 := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ - Name: "job2", - DS1BridgeName: bridge.Name.String(), - DS2BridgeName: bridge2.Name.String(), - TransmitterAddress: address.Hex(), - }) - jb2, err := ocr.ValidatedOracleSpecToml(legacyChains, spec2.Toml()) - require.NoError(t, err) - // Default Chain Job externalJobID := uuid.NullUUID{UUID: uuid.New(), Valid: true} - spec3 := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ - Name: "job3", + spec2 := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ + Name: "job2", EVMChainID: defaultChainID.String(), DS1BridgeName: bridge.Name.String(), DS2BridgeName: bridge2.Name.String(), TransmitterAddress: address.Hex(), JobID: externalJobID.UUID.String(), }) - jb3, err := ocr.ValidatedOracleSpecToml(legacyChains, spec3.Toml()) + jb2, err := ocr.ValidatedOracleSpecToml(legacyChains, spec2.Toml()) require.NoError(t, err) // Custom Chain Job externalJobID = uuid.NullUUID{UUID: uuid.New(), Valid: true} - spec4 := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ - Name: "job4", + spec3 := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{ + Name: "job3", EVMChainID: customChainID.String(), DS1BridgeName: bridge.Name.String(), DS2BridgeName: bridge2.Name.String(), TransmitterAddress: address.Hex(), JobID: externalJobID.UUID.String(), }) - jb4, err := ocr.ValidatedOracleSpecToml(legacyChains, spec4.Toml()) + jb3, err := ocr.ValidatedOracleSpecToml(legacyChains, spec3.Toml()) require.NoError(t, err) t.Run("with legacy NULL chain id", func(t *testing.T) { @@ -692,33 +768,24 @@ func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { cltest.AssertCount(t, db, "ocr_oracle_specs", 1) cltest.AssertCount(t, db, "jobs", 1) - jb2.OCROracleSpec.EVMChainID = nil - err = jobORM.CreateJob(&jb2) // try adding job for same contract with no chain id in spec + err = jobORM.CreateJob(&jb2) // try adding job for same contract with default chain id require.Error(t, err) - assert.Equal(t, fmt.Sprintf("CreateJobFailed: a job with contract address %s already exists for chain ID %s", jb2.OCROracleSpec.ContractAddress, defaultChainID.String()), err.Error()) + assert.Equal(t, fmt.Sprintf("CreateJobFailed: a job with contract address %s already exists for chain ID %d", jb2.OCROracleSpec.ContractAddress, jb2.OCROracleSpec.EVMChainID.ToInt()), err.Error()) - err = jobORM.CreateJob(&jb3) // try adding job for same contract with default chain id + err = jobORM.CreateJob(&jb3) // Try adding job with custom chain id require.Error(t, err) assert.Equal(t, fmt.Sprintf("CreateJobFailed: a job with contract address %s already exists for chain ID %d", jb3.OCROracleSpec.ContractAddress, jb3.OCROracleSpec.EVMChainID.ToInt()), err.Error()) - - err = jobORM.CreateJob(&jb4) // Try adding job with custom chain id - require.Error(t, err) - assert.Equal(t, fmt.Sprintf("CreateJobFailed: a job with contract address %s already exists for chain ID %d", jb4.OCROracleSpec.ContractAddress, jb4.OCROracleSpec.EVMChainID.ToInt()), err.Error()) }) require.NoError(t, jobORM.DeleteJob(jb.ID)) t.Run("with a set chain id", func(t *testing.T) { - err = jobORM.CreateJob(&jb4) // Add job with custom chain id + err = jobORM.CreateJob(&jb3) // Add job with custom chain id require.NoError(t, err) cltest.AssertCount(t, db, "ocr_oracle_specs", 1) cltest.AssertCount(t, db, "jobs", 1) - jb.OCROracleSpec.EVMChainID = nil - err = jobORM.CreateJob(&jb) - require.NoError(t, err) // should be able to add same contract address on default chain by omitting chain id - externalJobID = uuid.NullUUID{UUID: uuid.New(), Valid: true} spec3.JobID = externalJobID.UUID.String() jb3a, err := ocr.ValidatedOracleSpecToml(legacyChains, spec3.Toml()) @@ -728,11 +795,11 @@ func TestORM_CreateJob_OCR_DuplicatedContractAddress(t *testing.T) { assert.Equal(t, fmt.Sprintf("CreateJobFailed: a job with contract address %s already exists for chain ID %s", jb3.OCROracleSpec.ContractAddress, defaultChainID.String()), err.Error()) externalJobID = uuid.NullUUID{UUID: uuid.New(), Valid: true} - spec4.JobID = externalJobID.UUID.String() - jb5, err := ocr.ValidatedOracleSpecToml(legacyChains, spec4.Toml()) + spec3.JobID = externalJobID.UUID.String() + jb4, err := ocr.ValidatedOracleSpecToml(legacyChains, spec3.Toml()) require.NoError(t, err) - err = jobORM.CreateJob(&jb5) // Try to add duplicate job with custom id + err = jobORM.CreateJob(&jb4) // Try to add duplicate job with custom id require.Error(t, err) assert.Equal(t, fmt.Sprintf("CreateJobFailed: a job with contract address %s already exists for chain ID %s", jb4.OCROracleSpec.ContractAddress, customChainID), err.Error()) }) diff --git a/core/services/job/orm.go b/core/services/job/orm.go index d53452fa3b..190df2f496 100644 --- a/core/services/job/orm.go +++ b/core/services/job/orm.go @@ -167,6 +167,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { switch jb.Type { case DirectRequest: + if jb.DirectRequestSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO direct_request_specs (contract_address, min_incoming_confirmations, requesters, min_contract_payment, evm_chain_id, created_at, updated_at) VALUES (:contract_address, :min_incoming_confirmations, :requesters, :min_contract_payment, :evm_chain_id, now(), now()) @@ -176,6 +179,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.DirectRequestSpecID = &specID case FluxMonitor: + if jb.FluxMonitorSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO flux_monitor_specs (contract_address, threshold, absolute_threshold, poll_timer_period, poll_timer_disabled, idle_timer_period, idle_timer_disabled, drumbeat_schedule, drumbeat_random_delay, drumbeat_enabled, min_payment, evm_chain_id, created_at, updated_at) @@ -187,6 +193,10 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.FluxMonitorSpecID = &specID case OffchainReporting: + if jb.OCROracleSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } + var specID int32 if jb.OCROracleSpec.EncryptedOCRKeyBundleID != nil { _, err := o.keyStore.OCR().Get(jb.OCROracleSpec.EncryptedOCRKeyBundleID.String()) @@ -201,16 +211,7 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } } - if jb.OCROracleSpec.EVMChainID == nil { - // If unspecified, assume we're creating a job intended to run on default chain id - newChain, err := o.legacyChains.Default() - if err != nil { - return err - } - jb.OCROracleSpec.EVMChainID = utils.NewBig(newChain.ID()) - } newChainID := jb.OCROracleSpec.EVMChainID - existingSpec := new(OCROracleSpec) err := tx.Get(existingSpec, `SELECT * FROM ocr_oracle_specs WHERE contract_address = $1 and (evm_chain_id = $2 or evm_chain_id IS NULL) LIMIT 1;`, jb.OCROracleSpec.ContractAddress, newChainID, @@ -308,6 +309,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.OCR2OracleSpecID = &specID case Keeper: + if jb.KeeperSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO keeper_specs (contract_address, from_address, evm_chain_id, created_at, updated_at) VALUES (:contract_address, :from_address, :evm_chain_id, NOW(), NOW()) @@ -326,6 +330,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.CronSpecID = &specID case VRF: + if jb.VRFSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO vrf_specs ( coordinator_address, public_key, min_incoming_confirmations, @@ -377,6 +384,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } } case BlockhashStore: + if jb.BlockhashStoreSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO blockhash_store_specs (coordinator_v1_address, coordinator_v2_address, coordinator_v2_plus_address, trusted_blockhash_store_address, trusted_blockhash_store_batch_size, wait_blocks, lookback_blocks, blockhash_store_address, poll_period, run_timeout, evm_chain_id, from_addresses, created_at, updated_at) VALUES (:coordinator_v1_address, :coordinator_v2_address, :coordinator_v2_plus_address, :trusted_blockhash_store_address, :trusted_blockhash_store_batch_size, :wait_blocks, :lookback_blocks, :blockhash_store_address, :poll_period, :run_timeout, :evm_chain_id, :from_addresses, NOW(), NOW()) @@ -386,6 +396,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.BlockhashStoreSpecID = &specID case BlockHeaderFeeder: + if jb.BlockHeaderFeederSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO block_header_feeder_specs (coordinator_v1_address, coordinator_v2_address, coordinator_v2_plus_address, wait_blocks, lookback_blocks, blockhash_store_address, batch_blockhash_store_address, poll_period, run_timeout, evm_chain_id, from_addresses, get_blockhashes_batch_size, store_blockhashes_batch_size, created_at, updated_at) VALUES (:coordinator_v1_address, :coordinator_v2_address, :coordinator_v2_plus_address, :wait_blocks, :lookback_blocks, :blockhash_store_address, :batch_blockhash_store_address, :poll_period, :run_timeout, :evm_chain_id, :from_addresses, :get_blockhashes_batch_size, :store_blockhashes_batch_size, NOW(), NOW()) @@ -395,6 +408,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.BlockHeaderFeederSpecID = &specID case LegacyGasStationServer: + if jb.LegacyGasStationServerSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO legacy_gas_station_server_specs (forwarder_address, evm_chain_id, ccip_chain_selector, from_addresses, created_at, updated_at) VALUES (:forwarder_address, :evm_chain_id, :ccip_chain_selector, :from_addresses, NOW(), NOW()) @@ -404,6 +420,9 @@ func (o *orm) CreateJob(jb *Job, qopts ...pg.QOpt) error { } jb.LegacyGasStationServerSpecID = &specID case LegacyGasStationSidecar: + if jb.LegacyGasStationSidecarSpec.EVMChainID == nil { + return errors.New("evm chain id must be defined") + } var specID int32 sql := `INSERT INTO legacy_gas_station_sidecar_specs (forwarder_address, off_ramp_address, lookback_blocks, poll_period, run_timeout, evm_chain_id, ccip_chain_selector, created_at, updated_at) VALUES (:forwarder_address, :off_ramp_address, :lookback_blocks, :poll_period, :run_timeout, :evm_chain_id, :ccip_chain_selector, NOW(), NOW()) diff --git a/core/services/job/runner_integration_test.go b/core/services/job/runner_integration_test.go index 72a20a476e..da670f99a7 100644 --- a/core/services/job/runner_integration_test.go +++ b/core/services/job/runner_integration_test.go @@ -169,6 +169,7 @@ func TestRunner(t *testing.T) { jb := makeOCRJobSpecFromToml(t, fmt.Sprintf(` type = "offchainreporting" schemaVersion = 1 + evmChainID = "0" observationSource = """ ds1 [type=bridge name="%s"]; """ @@ -434,6 +435,7 @@ answer1 [type=median index=0]; schemaVersion = 1 contractAddress = "%s" isBootstrapPeer = false + evmChainID = "0" observationSource = """ ds1 [type=http method=GET url="%s" allowunrestrictednetworkaccess="true" %s]; ds1_parse [type=jsonparse path="USD" lax=true]; @@ -471,6 +473,7 @@ ds1 -> ds1_parse; schemaVersion = 1 contractAddress = "%s" isBootstrapPeer = true + evmChainID = "0" ` s = fmt.Sprintf(s, cltest.NewEIP55Address()) jb, err := ocr.ValidatedOracleSpecToml(legacyChains, s) @@ -509,6 +512,7 @@ ds1 -> ds1_parse; contractAddress = "%s" isBootstrapPeer = false observationTimeout = "15s" + evmChainID = "0" observationSource = """ ds1 [type=http method=GET url="%s" allowunrestrictednetworkaccess="true" %s]; ds1_parse [type=jsonparse path="USD" lax=true]; diff --git a/core/services/keeper/integration_test.go b/core/services/keeper/integration_test.go index cf36628f6a..39431063bc 100644 --- a/core/services/keeper/integration_test.go +++ b/core/services/keeper/integration_test.go @@ -405,6 +405,7 @@ func TestKeeperForwarderEthIntegration(t *testing.T) { c.EVM[0].MinIncomingConfirmations = ptr[uint32](1) // disable reorg protection for this test c.EVM[0].HeadTracker.MaxBufferSize = ptr[uint32](100) // helps prevent missed heads c.EVM[0].Transactions.ForwardersEnabled = ptr(true) // Enable Operator Forwarder flow + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) }) scopedConfig := evmtest.NewChainScopedConfig(t, config) korm := keeper.NewORM(db, logger.TestLogger(t), scopedConfig.Database()) @@ -430,6 +431,7 @@ func TestKeeperForwarderEthIntegration(t *testing.T) { KeeperSpec: &job.KeeperSpec{ FromAddress: nodeAddressEIP55, ContractAddress: regAddrEIP55, + EVMChainID: (*utils.Big)(testutils.SimulatedChainID), }, SchemaVersion: 1, ForwardingAllowed: true, diff --git a/core/services/keeper/upkeep_executer_test.go b/core/services/keeper/upkeep_executer_test.go index 70982d7b7c..702633e1d0 100644 --- a/core/services/keeper/upkeep_executer_test.go +++ b/core/services/keeper/upkeep_executer_test.go @@ -72,7 +72,9 @@ func setup(t *testing.T, estimator gas.EvmFeeEstimator, overrideFn func(c *chain }) db := pgtest.NewSqlxDB(t) keyStore := cltest.NewKeyStore(t, db, cfg.Database()) - ethClient := evmtest.NewEthClientMockWithDefaultChain(t) + ethClient := evmtest.NewEthClientMock(t) + ethClient.On("ConfiguredChainID").Return(cfg.EVMConfigs()[0].ChainID.ToInt()).Maybe() + ethClient.On("IsL2").Return(false).Maybe() ethClient.On("HeadByNumber", mock.Anything, mock.Anything).Maybe().Return(&evmtypes.Head{Number: 1, Hash: utils.NewHash()}, nil) txm := txmmocks.NewMockEvmTxManager(t) relayExtenders := evmtest.NewChainRelayExtenders(t, evmtest.TestChainOpts{TxManager: txm, DB: db, Client: ethClient, KeyStore: keyStore.Eth(), GeneralConfig: cfg, GasEstimator: estimator}) @@ -81,6 +83,7 @@ func setup(t *testing.T, estimator gas.EvmFeeEstimator, overrideFn func(c *chain ch := evmtest.MustGetDefaultChain(t, legacyChains) orm := keeper.NewORM(db, logger.TestLogger(t), ch.Config().Database()) registry, job := cltest.MustInsertKeeperRegistry(t, db, orm, keyStore.Eth(), 0, 1, 20) + lggr := logger.TestLogger(t) executer := keeper.NewUpkeepExecuter(job, orm, jpv2.Pr, ethClient, ch.HeadBroadcaster(), ch.GasEstimator(), lggr, ch.Config().Keeper(), job.KeeperSpec.FromAddress.Address()) upkeep := cltest.MustInsertUpkeepForRegistry(t, db, ch.Config().Database(), registry) @@ -122,7 +125,10 @@ func Test_UpkeepExecuter_PerformsUpkeep_Happy(t *testing.T) { t.Parallel() t.Run("runs upkeep on triggering block number", func(t *testing.T) { - db, config, ethMock, executer, registry, upkeep, job, jpv2, txm, _, _, _ := setup(t, mockEstimator(t), nil) + db, config, ethMock, executer, registry, upkeep, job, jpv2, txm, _, _, _ := setup(t, mockEstimator(t), + func(c *chainlink.Config, s *chainlink.Secrets) { + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) + }) gasLimit := 5_000_000 + config.Keeper().Registry().PerformGasOverhead() @@ -165,6 +171,7 @@ func Test_UpkeepExecuter_PerformsUpkeep_Happy(t *testing.T) { runTest := func(t *testing.T, eip1559 bool) { db, config, ethMock, executer, registry, upkeep, job, jpv2, txm, _, _, _ := setup(t, mockEstimator(t), func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.EIP1559DynamicFees = &eip1559 + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) }) gasLimit := 5_000_000 + config.Keeper().Registry().PerformGasOverhead() @@ -215,10 +222,12 @@ func Test_UpkeepExecuter_PerformsUpkeep_Happy(t *testing.T) { }) t.Run("errors if submission key not found", func(t *testing.T) { - _, _, ethMock, executer, registry, _, job, jpv2, _, keyStore, _, _ := setup(t, mockEstimator(t), nil) + _, _, ethMock, executer, registry, _, job, jpv2, _, keyStore, _, _ := setup(t, mockEstimator(t), func(c *chainlink.Config, s *chainlink.Secrets) { + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) + }) // replace expected key with random one - _, err := keyStore.Eth().Create(&cltest.FixtureChainID) + _, err := keyStore.Eth().Create(testutils.SimulatedChainID) require.NoError(t, err) _, err = keyStore.Eth().Delete(job.KeeperSpec.FromAddress.Hex()) require.NoError(t, err) @@ -265,7 +274,9 @@ func Test_UpkeepExecuter_PerformsUpkeep_Happy(t *testing.T) { }) t.Run("triggers if heads are skipped but later heads arrive within range", func(t *testing.T) { - db, config, ethMock, executer, registry, upkeep, job, jpv2, txm, _, _, _ := setup(t, mockEstimator(t), nil) + db, config, ethMock, executer, registry, upkeep, job, jpv2, txm, _, _, _ := setup(t, mockEstimator(t), func(c *chainlink.Config, s *chainlink.Secrets) { + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) + }) etxs := []cltest.Awaiter{ cltest.NewAwaiter(), @@ -304,7 +315,10 @@ func Test_UpkeepExecuter_PerformsUpkeep_Error(t *testing.T) { g := gomega.NewWithT(t) - db, _, ethMock, executer, registry, _, _, _, _, _, _, _ := setup(t, mockEstimator(t), nil) + db, _, ethMock, executer, registry, _, _, _, _, _, _, _ := setup(t, mockEstimator(t), + func(c *chainlink.Config, s *chainlink.Secrets) { + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) + }) var wasCalled atomic.Bool registryMock := cltest.NewContractMockReceiver(t, ethMock, keeper.Registry1_1ABI, registry.ContractAddress.Address()) diff --git a/core/services/keystore/master.go b/core/services/keystore/master.go index 4a8333d844..ab4c3256c5 100644 --- a/core/services/keystore/master.go +++ b/core/services/keystore/master.go @@ -51,7 +51,6 @@ type Master interface { StarkNet() StarkNet VRF() VRF Unlock(password string) error - Migrate(vrfPassword string, f DefaultEVMChainIDFunc) error IsEmpty() (bool, error) } @@ -151,93 +150,6 @@ func (ks *master) IsEmpty() (bool, error) { return count == 0, nil } -func (ks *master) Migrate(vrfPssword string, f DefaultEVMChainIDFunc) error { - ks.lock.Lock() - defer ks.lock.Unlock() - if ks.isLocked() { - return ErrLocked - } - csaKeys, err := ks.csa.GetV1KeysAsV2() - if err != nil { - return err - } - for _, csaKey := range csaKeys { - if _, exists := ks.keyRing.CSA[csaKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating CSA key %s", csaKey.ID()) - ks.keyRing.CSA[csaKey.ID()] = csaKey - } - ocrKeys, err := ks.ocr.GetV1KeysAsV2() - if err != nil { - return err - } - for _, ocrKey := range ocrKeys { - if _, exists := ks.keyRing.OCR[ocrKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating OCR key %s", ocrKey.ID()) - ks.keyRing.OCR[ocrKey.ID()] = ocrKey - } - p2pKeys, err := ks.p2p.GetV1KeysAsV2() - if err != nil { - return err - } - for _, p2pKey := range p2pKeys { - if _, exists := ks.keyRing.P2P[p2pKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating P2P key %s", p2pKey.ID()) - ks.keyRing.P2P[p2pKey.ID()] = p2pKey - } - vrfKeys, err := ks.vrf.GetV1KeysAsV2(vrfPssword) - if err != nil { - return err - } - for _, vrfKey := range vrfKeys { - if _, exists := ks.keyRing.VRF[vrfKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating VRF key %s", vrfKey.ID()) - ks.keyRing.VRF[vrfKey.ID()] = vrfKey - } - if err = ks.keyManager.save(); err != nil { - return err - } - ethKeys, nonces, fundings, err := ks.eth.getV1KeysAsV2() - if err != nil { - return err - } - if len(ethKeys) > 0 { - chainID, err := f() - if err != nil { - return errors.Wrapf(err, `%d legacy eth keys detected, but no default EVM chain ID was specified - -PLEASE READ THIS ADDITIONAL INFO - -If you are running Chainlink with EVM.Enabled=false and don't care about EVM keys at all, you can run the following SQL to remove any lingering eth keys that may have been autogenerated by an older version of Chainlink, and boot the node again: - -pqsl> TRUNCATE keys; - -WARNING: This will PERMANENTLY AND IRRECOVERABLY delete any legacy eth keys, so please be absolutely sure this is what you want before you run this. Consider taking a database backup first`, len(ethKeys)) - } - for i, ethKey := range ethKeys { - if _, exists := ks.keyRing.Eth[ethKey.ID()]; exists { - continue - } - ks.logger.Debugf("Migrating Eth key %s (and pegging to chain ID %s)", ethKey.ID(), chainID.String()) - // Note that V1 keys that were "funding" will be migrated as "disabled" - if err = ks.eth.addWithNonce(ethKey, chainID, nonces[i], fundings[i]); err != nil { - return err - } - if err = ks.keyManager.save(); err != nil { - return err - } - } - } - return nil -} - type keyManager struct { orm ksORM scryptParams utils.ScryptParams diff --git a/core/services/keystore/mocks/master.go b/core/services/keystore/mocks/master.go index ec55dc2108..e8b4775d66 100644 --- a/core/services/keystore/mocks/master.go +++ b/core/services/keystore/mocks/master.go @@ -116,20 +116,6 @@ func (_m *Master) IsEmpty() (bool, error) { return r0, r1 } -// Migrate provides a mock function with given fields: vrfPassword, f -func (_m *Master) Migrate(vrfPassword string, f keystore.DefaultEVMChainIDFunc) error { - ret := _m.Called(vrfPassword, f) - - var r0 error - if rf, ok := ret.Get(0).(func(string, keystore.DefaultEVMChainIDFunc) error); ok { - r0 = rf(vrfPassword, f) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // OCR provides a mock function with given fields: func (_m *Master) OCR() keystore.OCR { ret := _m.Called() diff --git a/core/services/pipeline/task.estimategas.go b/core/services/pipeline/task.estimategas.go index 967fb7ca03..88c6f6facc 100644 --- a/core/services/pipeline/task.estimategas.go +++ b/core/services/pipeline/task.estimategas.go @@ -47,12 +47,20 @@ func (t *EstimateGasLimitTask) Type() TaskType { return TaskTypeEstimateGasLimit } +func (t *EstimateGasLimitTask) getEvmChainID() string { + if t.EVMChainID == "" { + t.EVMChainID = "$(jobSpec.evmChainID)" + } + return t.EVMChainID +} + func (t *EstimateGasLimitTask) Run(ctx context.Context, lggr logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) { var ( fromAddr AddressParam toAddr AddressParam data BytesParam multiplier DecimalParam + chainID StringParam ) err := multierr.Combine( errors.Wrap(ResolveParam(&fromAddr, From(VarExpr(t.From, vars), utils.ZeroAddress)), "from"), @@ -60,14 +68,15 @@ func (t *EstimateGasLimitTask) Run(ctx context.Context, lggr logger.Logger, vars errors.Wrap(ResolveParam(&data, From(VarExpr(t.Data, vars), NonemptyString(t.Data))), "data"), // Default to 1, i.e. exactly what estimateGas suggests errors.Wrap(ResolveParam(&multiplier, From(VarExpr(t.Multiplier, vars), NonemptyString(t.Multiplier), decimal.New(1, 0))), "multiplier"), + errors.Wrap(ResolveParam(&chainID, From(VarExpr(t.getEvmChainID(), vars), NonemptyString(t.getEvmChainID()), "")), "evmChainID"), ) if err != nil { return Result{Error: err}, runInfo } - chain, err := t.legacyChains.Get(t.EVMChainID) + chain, err := t.legacyChains.Get(string(chainID)) if err != nil { - err = fmt.Errorf("%w: %s: %w", ErrInvalidEVMChainID, t.EVMChainID, err) + err = fmt.Errorf("%w: %s: %w", ErrInvalidEVMChainID, chainID, err) return Result{Error: err}, runInfo } diff --git a/core/services/pipeline/task.eth_call.go b/core/services/pipeline/task.eth_call.go index f3c76d404d..e877e1e90f 100644 --- a/core/services/pipeline/task.eth_call.go +++ b/core/services/pipeline/task.eth_call.go @@ -55,6 +55,13 @@ func (t *ETHCallTask) Type() TaskType { return TaskTypeETHCall } +func (t *ETHCallTask) getEvmChainID() string { + if t.EVMChainID == "" { + t.EVMChainID = "$(jobSpec.evmChainID)" + } + return t.EVMChainID +} + func (t *ETHCallTask) Run(ctx context.Context, lggr logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) { _, err := CheckInputs(inputs, -1, -1, 0) if err != nil { @@ -80,7 +87,7 @@ func (t *ETHCallTask) Run(ctx context.Context, lggr logger.Logger, vars Vars, in errors.Wrap(ResolveParam(&gasPrice, From(VarExpr(t.GasPrice, vars), t.GasPrice)), "gasPrice"), errors.Wrap(ResolveParam(&gasTipCap, From(VarExpr(t.GasTipCap, vars), t.GasTipCap)), "gasTipCap"), errors.Wrap(ResolveParam(&gasFeeCap, From(VarExpr(t.GasFeeCap, vars), t.GasFeeCap)), "gasFeeCap"), - errors.Wrap(ResolveParam(&chainID, From(VarExpr(t.EVMChainID, vars), NonemptyString(t.EVMChainID), "")), "evmChainID"), + errors.Wrap(ResolveParam(&chainID, From(VarExpr(t.getEvmChainID(), vars), NonemptyString(t.getEvmChainID()), "")), "evmChainID"), errors.Wrap(ResolveParam(&gasUnlimited, From(VarExpr(t.GasUnlimited, vars), NonemptyString(t.GasUnlimited), false)), "gasUnlimited"), ) if err != nil { diff --git a/core/services/pipeline/task.eth_call_test.go b/core/services/pipeline/task.eth_call_test.go index b8896488e2..77a10681fb 100644 --- a/core/services/pipeline/task.eth_call_test.go +++ b/core/services/pipeline/task.eth_call_test.go @@ -56,7 +56,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -76,7 +76,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "", "$(foo)", - "", + "0", "$(gasLimit)", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -97,7 +97,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "", "$(foo)", - "", + "0", "", &specGasLimit, pipeline.NewVarsFrom(map[string]interface{}{ @@ -117,7 +117,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -138,7 +138,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "0xThisAintGonnaWork", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -153,7 +153,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbee", "", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -168,7 +168,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -183,7 +183,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ @@ -198,7 +198,7 @@ func TestETHCallTask(t *testing.T) { "0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF", "", "$(foo)", - "", + "0", "", nil, pipeline.NewVarsFrom(map[string]interface{}{ diff --git a/core/services/pipeline/task.eth_tx.go b/core/services/pipeline/task.eth_tx.go index 8761732e4f..d5d2924065 100644 --- a/core/services/pipeline/task.eth_tx.go +++ b/core/services/pipeline/task.eth_tx.go @@ -56,9 +56,16 @@ func (t *ETHTxTask) Type() TaskType { return TaskTypeETHTx } +func (t *ETHTxTask) getEvmChainID() string { + if t.EVMChainID == "" { + t.EVMChainID = "$(jobSpec.evmChainID)" + } + return t.EVMChainID +} + func (t *ETHTxTask) Run(_ context.Context, lggr logger.Logger, vars Vars, inputs []Result) (result Result, runInfo RunInfo) { var chainID StringParam - err := errors.Wrap(ResolveParam(&chainID, From(VarExpr(t.EVMChainID, vars), NonemptyString(t.EVMChainID), "")), "evmChainID") + err := errors.Wrap(ResolveParam(&chainID, From(VarExpr(t.getEvmChainID(), vars), NonemptyString(t.getEvmChainID()), "")), "evmChainID") if err != nil { return Result{Error: err}, runInfo } diff --git a/core/services/pipeline/task.eth_tx_test.go b/core/services/pipeline/task.eth_tx_test.go index d465c16f8f..a280e6f272 100644 --- a/core/services/pipeline/task.eth_tx_test.go +++ b/core/services/pipeline/task.eth_tx_test.go @@ -65,7 +65,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `0`, - "", + "0", `{"CheckerType": "vrf_v2", "VRFCoordinatorAddress": "0x2E396ecbc8223Ebc16EC45136228AE5EDB649943"}`, nil, false, @@ -107,7 +107,7 @@ func TestETHTxTask(t *testing.T) { "$(gasLimit)", `{ "jobID": $(jobID), "requestID": $(requestID), "requestTxHash": $(requestTxHash) }`, `0`, - "", + "0", "", nil, false, @@ -150,7 +150,7 @@ func TestETHTxTask(t *testing.T) { "$(gasLimit)", `{ "jobID": $(jobID), "requestID": $(requestID), "requestTxHash": $(requestTxHash) }`, "$(minConfirmations)", - "", + "0", "", nil, false, @@ -182,7 +182,7 @@ func TestETHTxTask(t *testing.T) { "$(gasLimit)", `$(requestData)`, `0`, - "", + "0", "", nil, false, @@ -227,7 +227,7 @@ func TestETHTxTask(t *testing.T) { "$(gasLimit)", `$(requestData)`, `0`, - "", + "0", "", nil, false, @@ -272,7 +272,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{}`, `0`, - "", + "0", "", nil, false, @@ -302,7 +302,7 @@ func TestETHTxTask(t *testing.T) { "", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `0`, - "", + "0", "", nil, // spec does not override gas limit false, @@ -336,7 +336,7 @@ func TestETHTxTask(t *testing.T) { "", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `0`, - "", + "0", "", &specGasLimit, false, @@ -370,7 +370,7 @@ func TestETHTxTask(t *testing.T) { "$(gasLimit)", `$(requestData)`, `0`, - "", + "0", "", nil, false, @@ -400,7 +400,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `0`, - "", + "0", "", nil, false, @@ -435,7 +435,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8", "foo": "bar" }`, `0`, - "", + "0", "", nil, false, @@ -452,7 +452,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": "asdf", "requestID": 123, "requestTxHash": true }`, `0`, - "", + "0", "", nil, false, @@ -469,7 +469,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `0`, - "", + "0", "", nil, false, @@ -486,7 +486,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `0`, - "", + "0", "", nil, false, @@ -503,7 +503,7 @@ func TestETHTxTask(t *testing.T) { "12345", `{ "jobID": 321, "requestID": "0x5198616554d738d9485d1a7cf53b2f33e09c3bbc8fe9ac0020bd672cd2bc15d2", "requestTxHash": "0xc524fafafcaec40652b1f84fca09c231185437d008d195fccf2f51e64b7062f8" }`, `3`, - "", + "0", "", nil, false, diff --git a/core/services/relay/evm/loop_impl.go b/core/services/relay/evm/loop_impl.go index 87f7aed1a5..8142721ed1 100644 --- a/core/services/relay/evm/loop_impl.go +++ b/core/services/relay/evm/loop_impl.go @@ -2,6 +2,7 @@ package evm import ( "github.com/smartcontractkit/chainlink-relay/pkg/loop" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/services/relay" ) @@ -10,7 +11,6 @@ import ( type LoopRelayAdapter interface { loop.Relayer Chain() evm.Chain - Default() bool } type LoopRelayer struct { loop.Relayer @@ -30,7 +30,3 @@ func NewLoopRelayServerAdapter(r *Relayer, cs EVMChainRelayerExtender) *LoopRela func (la *LoopRelayer) Chain() evm.Chain { return la.ext.Chain() } - -func (la *LoopRelayer) Default() bool { - return la.ext.Default() -} diff --git a/core/services/relay/evm/mocks/loop_relay_adapter.go b/core/services/relay/evm/mocks/loop_relay_adapter.go index 02064c2ea9..11150874b9 100644 --- a/core/services/relay/evm/mocks/loop_relay_adapter.go +++ b/core/services/relay/evm/mocks/loop_relay_adapter.go @@ -47,20 +47,6 @@ func (_m *LoopRelayAdapter) Close() error { return r0 } -// Default provides a mock function with given fields: -func (_m *LoopRelayAdapter) Default() bool { - ret := _m.Called() - - var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - // GetChainStatus provides a mock function with given fields: ctx func (_m *LoopRelayAdapter) GetChainStatus(ctx context.Context) (types.ChainStatus, error) { ret := _m.Called(ctx) diff --git a/core/services/relay/evm/relayer_extender.go b/core/services/relay/evm/relayer_extender.go index 9f19ef1314..592c9bacee 100644 --- a/core/services/relay/evm/relayer_extender.go +++ b/core/services/relay/evm/relayer_extender.go @@ -22,7 +22,6 @@ var ErrNoChains = errors.New("no EVM chains loaded") type EVMChainRelayerExtender interface { relay.RelayerExt Chain() evmchain.Chain - Default() bool } type EVMChainRelayerExtenderSlicer interface { @@ -40,18 +39,10 @@ var _ EVMChainRelayerExtenderSlicer = &ChainRelayerExtenders{} func NewLegacyChainsFromRelayerExtenders(exts EVMChainRelayerExtenderSlicer) *evmchain.LegacyChains { m := make(map[string]evmchain.Chain) - var dflt evmchain.Chain for _, r := range exts.Slice() { m[r.Chain().ID().String()] = r.Chain() - if r.Default() { - dflt = r.Chain() - } - } - l := evmchain.NewLegacyChains(m, exts.AppConfig().EVMConfigs()) - if dflt != nil { - l.SetDefault(dflt) } - return l + return evmchain.NewLegacyChains(m, exts.AppConfig().EVMConfigs()) } func newChainRelayerExtsFromSlice(exts []*ChainRelayerExt, appConfig evm.AppConfig) *ChainRelayerExtenders { @@ -79,8 +70,7 @@ func (c *ChainRelayerExtenders) Len() int { // implements OneChain type ChainRelayerExt struct { - chain evmchain.Chain - isDefault bool + chain evmchain.Chain } var _ EVMChainRelayerExtender = &ChainRelayerExt{} @@ -105,10 +95,6 @@ func (s *ChainRelayerExt) Chain() evmchain.Chain { return s.chain } -func (s *ChainRelayerExt) Default() bool { - return s.isDefault -} - var ErrCorruptEVMChain = errors.New("corrupt evm chain") func (s *ChainRelayerExt) Start(ctx context.Context) error { @@ -151,14 +137,6 @@ func NewChainRelayerExtenders(ctx context.Context, opts evmchain.ChainRelayExten } } - defaultChainID := opts.AppConfig.DefaultChainID() - if defaultChainID == nil && len(enabled) >= 1 { - defaultChainID = enabled[0].ChainID.ToInt() - if len(enabled) > 1 { - opts.Logger.Debugf("Multiple chains present, default chain: %s", defaultChainID.String()) - } - } - var result []*ChainRelayerExt var err error for i := range enabled { @@ -179,8 +157,7 @@ func NewChainRelayerExtenders(ctx context.Context, opts evmchain.ChainRelayExten } s := &ChainRelayerExt{ - chain: chain, - isDefault: (cid == defaultChainID.String()), + chain: chain, } result = append(result, s) } diff --git a/core/services/vrf/delegate_test.go b/core/services/vrf/delegate_test.go index 1541c80a40..ae0accc329 100644 --- a/core/services/vrf/delegate_test.go +++ b/core/services/vrf/delegate_test.go @@ -155,7 +155,7 @@ func setup(t *testing.T) (vrfUniverse, *v1.Listener, job.Job) { logger.TestLogger(t), cfg.Database(), mailMon) - vs := testspecs.GenerateVRFSpec(testspecs.VRFSpecParams{PublicKey: vuni.vrfkey.PublicKey.String()}) + vs := testspecs.GenerateVRFSpec(testspecs.VRFSpecParams{PublicKey: vuni.vrfkey.PublicKey.String(), EVMChainID: testutils.FixtureChainID.String()}) jb, err := vrfcommon.ValidatedVRFSpec(vs.Toml()) require.NoError(t, err) err = vuni.jrm.CreateJob(&jb) diff --git a/core/services/vrf/v1/integration_test.go b/core/services/vrf/v1/integration_test.go index 42b709e298..0a57c72ef1 100644 --- a/core/services/vrf/v1/integration_test.go +++ b/core/services/vrf/v1/integration_test.go @@ -30,6 +30,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/vrf/vrftesthelpers" "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/v2/core/testdata/testspecs" + "github.com/smartcontractkit/chainlink/v2/core/utils" ) func TestIntegration_VRF_JPV2(t *testing.T) { @@ -47,6 +48,7 @@ func TestIntegration_VRF_JPV2(t *testing.T) { t.Run(test.name, func(t *testing.T) { config, _ := heavyweight.FullTestDBV2(t, fmt.Sprintf("vrf_jpv2_%v", test.eip1559), func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.EIP1559DynamicFees = &test.eip1559 + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) }) key1 := cltest.MustGenerateRandomKey(t) key2 := cltest.MustGenerateRandomKey(t) @@ -133,6 +135,7 @@ func TestIntegration_VRF_WithBHS(t *testing.T) { c.Feature.LogPoller = ptr(true) c.EVM[0].FinalityDepth = ptr[uint32](2) c.EVM[0].LogPollInterval = models.MustNewDuration(time.Second) + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) }) key := cltest.MustGenerateRandomKey(t) cu := vrftesthelpers.NewVRFCoordinatorUniverse(t, key) @@ -241,7 +244,9 @@ func createVRFJobRegisterKey(t *testing.T, u vrftesthelpers.CoordinatorUniverse, Name: "vrf-primary", CoordinatorAddress: u.RootContractAddress.String(), MinIncomingConfirmations: incomingConfs, - PublicKey: vrfKey.PublicKey.String()}).Toml() + PublicKey: vrfKey.PublicKey.String(), + EVMChainID: testutils.SimulatedChainID.String(), + }).Toml() jb, err := vrfcommon.ValidatedVRFSpec(s) require.NoError(t, err) assert.Equal(t, expectedOnChainJobID, jb.ExternalIDEncodeStringToTopic().Bytes()) diff --git a/core/services/vrf/v1/listener_v1.go b/core/services/vrf/v1/listener_v1.go index 0fce2ebedd..39aec367b4 100644 --- a/core/services/vrf/v1/listener_v1.go +++ b/core/services/vrf/v1/listener_v1.go @@ -416,6 +416,7 @@ func (lsn *Listener) ProcessRequest(ctx context.Context, req request) bool { "name": lsn.Job.Name.ValueOrZero(), "publicKey": lsn.Job.VRFSpec.PublicKey[:], "from": lsn.fromAddresses(), + "evmChainID": lsn.Job.VRFSpec.EVMChainID.String(), }, "jobRun": map[string]interface{}{ "logBlockHash": req.req.Raw.BlockHash[:], diff --git a/core/services/vrf/v2/integration_helpers_test.go b/core/services/vrf/v2/integration_helpers_test.go index 43ca198334..74d7175e08 100644 --- a/core/services/vrf/v2/integration_helpers_test.go +++ b/core/services/vrf/v2/integration_helpers_test.go @@ -28,6 +28,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest/heavyweight" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" "github.com/smartcontractkit/chainlink/v2/core/services/signatures/secp256k1" @@ -533,6 +534,7 @@ func testSingleConsumerHappyPathBatchFulfillment( })(c, s) c.EVM[0].GasEstimator.LimitDefault = ptr[uint32](5_000_000) c.EVM[0].MinIncomingConfirmations = ptr[uint32](2) + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) }) app := cltest.NewApplicationWithConfigV2AndKeyOnSimulatedBlockchain(t, config, uni.backend, ownerKey, key1) @@ -1616,6 +1618,7 @@ func testMaliciousConsumer( c.EVM[0].GasEstimator.PriceMax = assets.GWei(1) c.EVM[0].GasEstimator.PriceDefault = assets.GWei(1) c.EVM[0].GasEstimator.FeeCapDefault = assets.GWei(1) + c.EVM[0].ChainID = (*utils.Big)(testutils.SimulatedChainID) }) carol := uni.vrfConsumers[0] @@ -1640,6 +1643,7 @@ func testMaliciousConsumer( GasLanePrice: assets.GWei(1), PublicKey: vrfkey.PublicKey.String(), V2: true, + EVMChainID: testutils.SimulatedChainID.String(), }).Toml() jb, err := vrfcommon.ValidatedVRFSpec(s) require.NoError(t, err) @@ -1681,7 +1685,7 @@ func testMaliciousConsumer( }, testutils.WaitTimeout(t), 1*time.Second).Should(gomega.BeTrue()) // The fulfillment tx should succeed - ch, err := app.GetRelayers().LegacyEVMChains().Default() + ch, err := app.GetRelayers().LegacyEVMChains().Get(evmtest.MustGetDefaultChainID(t, config.EVMConfigs()).String()) require.NoError(t, err) r, err := ch.Client().TransactionReceipt(testutils.Context(t), attempts[0].Hash) require.NoError(t, err) diff --git a/core/services/vrf/v2/integration_v2_test.go b/core/services/vrf/v2/integration_v2_test.go index 40622b8459..f405433380 100644 --- a/core/services/vrf/v2/integration_v2_test.go +++ b/core/services/vrf/v2/integration_v2_test.go @@ -554,6 +554,7 @@ func createVRFJobs( V2: true, GasLanePrice: gasLanePrices[i], VRFOwnerAddress: vrfOwnerString, + EVMChainID: testutils.SimulatedChainID.String(), }).Toml() jb, err := vrfcommon.ValidatedVRFSpec(spec) diff --git a/core/services/vrf/v2/listener_v2.go b/core/services/vrf/v2/listener_v2.go index 461840c6f3..2eb10f64c8 100644 --- a/core/services/vrf/v2/listener_v2.go +++ b/core/services/vrf/v2/listener_v2.go @@ -1415,6 +1415,7 @@ func (lsn *listenerV2) simulateFulfillment( "name": lsn.job.Name.ValueOrZero(), "publicKey": lsn.job.VRFSpec.PublicKey[:], "maxGasPrice": maxGasPriceWei.ToInt().String(), + "evmChainID": lsn.job.VRFSpec.EVMChainID.String(), }, "jobRun": map[string]interface{}{ "logBlockHash": req.req.Raw().BlockHash.Bytes(), diff --git a/core/testdata/testspecs/v2_specs.go b/core/testdata/testspecs/v2_specs.go index 4c44f3b9c5..f2669a6fe9 100644 --- a/core/testdata/testspecs/v2_specs.go +++ b/core/testdata/testspecs/v2_specs.go @@ -44,6 +44,7 @@ type = "directrequest" schemaVersion = 1 name = "%s" contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" +evmChainID = "0" observationSource = """ ds1 [type=http method=GET url="http://example.com" allowunrestrictednetworkaccess="true"]; ds1_parse [type=jsonparse path="USD"]; @@ -57,6 +58,7 @@ schemaVersion = 1 name = "example eth request event spec" contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" externalJobID = "123e4567-e89b-12d3-a456-426655440004" +evmChainID = "0" observationSource = """ ds1 [type=http method=GET url="http://example.com" allowunrestrictednetworkaccess="true"]; ds1_parse [type=jsonparse path="USD"]; @@ -72,6 +74,7 @@ minContractPaymentLinkJuels = "1000000000000000000000" name = "example eth request event spec with requesters and min contract payment" contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" externalJobID = "123e4567-e89b-12d3-a456-426655440014" +evmChainID = 0 observationSource = """ ds1 [type=http method=GET url="http://example.com" allowunrestrictednetworkaccess="true"]; ds1_parse [type=jsonparse path="USD"]; @@ -85,6 +88,7 @@ schemaVersion = 1 name = "example flux monitor spec" contractAddress = "0x3cCad4715152693fE3BC4460591e3D3Fbd071b42" externalJobID = "123e4567-e89b-12d3-a456-426655440005" +evmChainID = 0 threshold = 0.5 absoluteThreshold = 0.0 # optional @@ -251,6 +255,7 @@ type VRFSpecParams struct { FromAddresses []string PublicKey string ObservationSource string + EVMChainID string RequestedConfsDelay int RequestTimeout time.Duration V2 bool @@ -353,14 +358,16 @@ vrf [type=vrfv2 estimate_gas [type=estimategaslimit to="%s" multiplier="1.1" - data="$(vrf.output)"] + data="$(vrf.output)" +] simulate [type=ethcall to="%s" gas="$(estimate_gas)" gasPrice="$(jobSpec.maxGasPrice)" extractRevertReason=true contract="%s" - data="$(vrf.output)"] + data="$(vrf.output)" +] decode_log->vrf->estimate_gas->simulate `, coordinatorAddress, coordinatorAddress, coordinatorAddress) } @@ -378,26 +385,32 @@ generate_proof [type=vrfv2plus estimate_gas [type=estimategaslimit to="%s" multiplier="1.1" - data="$(generate_proof.output)"] + data="$(generate_proof.output)" +] simulate_fulfillment [type=ethcall to="%s" gas="$(estimate_gas)" gasPrice="$(jobSpec.maxGasPrice)" extractRevertReason=true contract="%s" - data="$(generate_proof.output)"] + data="$(generate_proof.output)" +] decode_log->generate_proof->estimate_gas->simulate_fulfillment `, coordinatorAddress, coordinatorAddress, coordinatorAddress) } if params.ObservationSource != "" { observationSource = params.ObservationSource } + if params.EVMChainID == "" { + params.EVMChainID = "0" + } template := ` externalJobID = "%s" type = "vrf" schemaVersion = 1 name = "%s" coordinatorAddress = "%s" +evmChainID = "%s" batchCoordinatorAddress = "%s" batchFulfillmentEnabled = %v batchFulfillmentGasMultiplier = %s @@ -414,7 +427,7 @@ observationSource = """ """ ` toml := fmt.Sprintf(template, - jobID, name, coordinatorAddress, batchCoordinatorAddress, + jobID, name, coordinatorAddress, params.EVMChainID, batchCoordinatorAddress, params.BatchFulfillmentEnabled, strconv.FormatFloat(batchFulfillmentGasMultiplier, 'f', 2, 64), confirmations, params.RequestedConfsDelay, requestTimeout.String(), publicKey, chunkSize, params.BackoffInitialDelay.String(), params.BackoffMaxDelay.String(), gasLanePrice.String(), observationSource) @@ -438,6 +451,7 @@ observationSource = """ MinIncomingConfirmations: confirmations, PublicKey: publicKey, ObservationSource: observationSource, + EVMChainID: params.EVMChainID, RequestedConfsDelay: params.RequestedConfsDelay, RequestTimeout: requestTimeout, ChunkSize: chunkSize, @@ -492,7 +506,7 @@ func GenerateOCRSpec(params OCRSpecParams) OCRSpec { if params.DS2BridgeName != "" { ds2BridgeName = params.DS2BridgeName } - // set to empty so it defaults to the default evm chain id + evmChainID := "0" if params.EVMChainID != "" { evmChainID = params.EVMChainID diff --git a/core/testdata/tomlspecs/direct-request-spec-cbor.toml b/core/testdata/tomlspecs/direct-request-spec-cbor.toml index 2a51cefef7..500c4973d8 100644 --- a/core/testdata/tomlspecs/direct-request-spec-cbor.toml +++ b/core/testdata/tomlspecs/direct-request-spec-cbor.toml @@ -3,6 +3,7 @@ schemaVersion = 1 name = "example eth request event spec" contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F90" +evmChainID = 1337 observationSource = """ decode_log [type=ethabidecodelog abi="OracleRequest(bytes32 indexed specId, address requester, bytes32 requestId, uint256 payment, address callbackAddr, bytes4 callbackFunctionId, uint256 cancelExpiration, uint256 dataVersion, bytes data)" diff --git a/core/testdata/tomlspecs/direct-request-spec.toml b/core/testdata/tomlspecs/direct-request-spec.toml index d3c866102b..35c0cc9274 100644 --- a/core/testdata/tomlspecs/direct-request-spec.toml +++ b/core/testdata/tomlspecs/direct-request-spec.toml @@ -1,5 +1,6 @@ type = "directrequest" schemaVersion = 1 +evmChainID = "0" name = "example eth request event spec" contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F47" diff --git a/core/testdata/tomlspecs/multiword-response-spec.toml b/core/testdata/tomlspecs/multiword-response-spec.toml index 825f96946b..31da76b797 100644 --- a/core/testdata/tomlspecs/multiword-response-spec.toml +++ b/core/testdata/tomlspecs/multiword-response-spec.toml @@ -2,6 +2,7 @@ type = "directrequest" schemaVersion = 1 name = "example eth request event spec" contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C" +evmChainID = "1337" externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F47" observationSource = """ decode_log [type=ethabidecodelog diff --git a/core/testdata/tomlspecs/ocr-bootstrap-spec.toml b/core/testdata/tomlspecs/ocr-bootstrap-spec.toml index ce12800f63..9df0a86196 100644 --- a/core/testdata/tomlspecs/ocr-bootstrap-spec.toml +++ b/core/testdata/tomlspecs/ocr-bootstrap-spec.toml @@ -2,6 +2,7 @@ type = "offchainreporting" schemaVersion = 1 contractAddress = "0x27548a32b9aD5D64c5945EaE9Da5337bc3169D15" externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F50" +evmChainID = "0" p2pBootstrapPeers = [ "/dns4/chain.link/tcp/1234/p2p/16Uiu2HAm58SP7UL8zsnpeuwHfytLocaqgnyaYKP8wu7qRdrixLju", ] diff --git a/core/web/common.go b/core/web/common.go index 9586fa798e..ae2158d153 100644 --- a/core/web/common.go +++ b/core/web/common.go @@ -10,6 +10,7 @@ import ( var ( ErrMissingChainID = errors.New("chain id does not match any local chains") + ErrEmptyChainID = errors.New("chainID is empty") ErrInvalidChainID = errors.New("invalid chain id") ErrMultipleChains = errors.New("more than one chain available, you must specify chain id parameter") ) @@ -33,9 +34,5 @@ func getChain(legacyChains evm.LegacyChainContainer, chainIDstr string) (chain e return nil, ErrMultipleChains } - chain, err = legacyChains.Default() - if err != nil { - return nil, err - } - return chain, nil + return nil, ErrEmptyChainID } diff --git a/core/web/eth_keys_controller_test.go b/core/web/eth_keys_controller_test.go index d656d94e6a..104e487b20 100644 --- a/core/web/eth_keys_controller_test.go +++ b/core/web/eth_keys_controller_test.go @@ -228,7 +228,12 @@ func TestETHKeysController_CreateSuccess(t *testing.T) { require.NoError(t, app.Start(testutils.Context(t))) - resp, cleanup := client.Post("/v2/keys/evm", nil) + chainURL := url.URL{Path: "/v2/keys/evm"} + query := chainURL.Query() + query.Set("evmChainID", cltest.FixtureChainID.String()) + chainURL.RawQuery = query.Encode() + + resp, cleanup := client.Post(chainURL.String(), nil) defer cleanup() cltest.AssertServerResponse(t, resp, http.StatusOK) diff --git a/core/web/evm_transfer_controller_test.go b/core/web/evm_transfer_controller_test.go index 8ca3102d7a..70d4c7d5e0 100644 --- a/core/web/evm_transfer_controller_test.go +++ b/core/web/evm_transfer_controller_test.go @@ -16,8 +16,10 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest2 "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/store/models" + "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/web" "github.com/smartcontractkit/chainlink/v2/core/web/presenters" @@ -53,6 +55,7 @@ func TestTransfersController_CreateSuccess_From(t *testing.T) { FromAddress: key.Address, Amount: amount, SkipWaitTxAttempt: true, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs())), } body, err := json.Marshal(&request) @@ -93,6 +96,7 @@ func TestTransfersController_CreateSuccess_From_WEI(t *testing.T) { FromAddress: key.Address, Amount: amount, SkipWaitTxAttempt: true, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs())), } body, err := json.Marshal(&request) @@ -138,6 +142,7 @@ func TestTransfersController_CreateSuccess_From_BalanceMonitorDisabled(t *testin FromAddress: key.Address, Amount: amount, SkipWaitTxAttempt: true, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs())), } body, err := json.Marshal(&request) @@ -167,6 +172,7 @@ func TestTransfersController_TransferZeroAddressError(t *testing.T) { DestinationAddress: common.HexToAddress("0xFA01FA015C8A5332987319823728982379128371"), FromAddress: common.HexToAddress("0x0000000000000000000000000000000000000000"), Amount: amount, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs())), } body, err := json.Marshal(&request) @@ -201,6 +207,7 @@ func TestTransfersController_TransferBalanceToLowError(t *testing.T) { DestinationAddress: common.HexToAddress("0xFA01FA015C8A5332987319823728982379128371"), Amount: amount, AllowHigherAmounts: false, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs())), } body, err := json.Marshal(&request) @@ -238,6 +245,7 @@ func TestTransfersController_TransferBalanceToLowError_ZeroBalance(t *testing.T) DestinationAddress: common.HexToAddress("0xFA01FA015C8A5332987319823728982379128371"), Amount: amount, AllowHigherAmounts: false, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, app.Config.EVMConfigs())), } body, err := json.Marshal(&request) @@ -280,7 +288,7 @@ func TestTransfersController_CreateSuccess_eip1559(t *testing.T) { config := configtest2.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { c.EVM[0].GasEstimator.EIP1559DynamicFees = ptr(true) c.EVM[0].GasEstimator.Mode = ptr("FixedPrice") - + c.EVM[0].ChainID = (*utils.Big)(testutils.FixtureChainID) // NOTE: FallbackPollInterval is used in this test to quickly create TxAttempts // Testing triggers requires committing transactions and does not work with transactional tests c.Database.Listener.FallbackPollInterval = models.MustNewDuration(time.Second) @@ -300,6 +308,7 @@ func TestTransfersController_CreateSuccess_eip1559(t *testing.T) { FromAddress: key.Address, Amount: amount, WaitAttemptTimeout: &timeout, + EVMChainID: utils.NewBig(evmtest.MustGetDefaultChainID(t, config.EVMConfigs())), } body, err := json.Marshal(&request) diff --git a/core/web/jobs_controller_test.go b/core/web/jobs_controller_test.go index b8b68e402d..d6d3f459a8 100644 --- a/core/web/jobs_controller_test.go +++ b/core/web/jobs_controller_test.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strconv" "sync" "testing" @@ -186,7 +187,7 @@ func TestJobController_Create_HappyPath(t *testing.T) { name = "example keeper spec" contractAddress = "0x9E40733cC9df84636505f4e6Db28DCa0dC5D1bba" fromAddress = "0xa8037A20989AFcBC51798de9762b351D63ff462e" - evmChainId = 4 + evmChainID = 0 minIncomingConfigurations = 1 externalJobID = "123e4567-e89b-12d3-a456-426655440002" `, @@ -398,7 +399,12 @@ func TestJobsController_FailToCreate_EmptyJsonAttribute(t *testing.T) { func TestJobsController_Index_HappyPath(t *testing.T) { _, client, ocrJobSpecFromFile, _, ereJobSpecFromFile, _ := setupJobSpecsControllerTestsWithJobs(t) - response, cleanup := client.Get("/v2/jobs") + url := url.URL{Path: "/v2/jobs"} + query := url.Query() + query.Set("evmChainID", cltest.FixtureChainID.String()) + url.RawQuery = query.Encode() + + response, cleanup := client.Get(url.String()) t.Cleanup(cleanup) cltest.AssertServerResponse(t, response, http.StatusOK) @@ -653,7 +659,7 @@ func setupJobSpecsControllerTestsWithJobs(t *testing.T) (*cltest.TestApplication client := app.NewHTTPClient(cltest.APIEmailAdmin) var jb job.Job - ocrspec := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{DS1BridgeName: bridge.Name.String(), DS2BridgeName: bridge2.Name.String()}) + ocrspec := testspecs.GenerateOCRSpec(testspecs.OCRSpecParams{DS1BridgeName: bridge.Name.String(), DS2BridgeName: bridge2.Name.String(), EVMChainID: testutils.FixtureChainID.String()}) err := toml.Unmarshal([]byte(ocrspec.Toml()), &jb) require.NoError(t, err) var ocrSpec job.OCROracleSpec diff --git a/core/web/pipeline_runs_controller_test.go b/core/web/pipeline_runs_controller_test.go index 4af7a76182..4637b1836b 100644 --- a/core/web/pipeline_runs_controller_test.go +++ b/core/web/pipeline_runs_controller_test.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strconv" "strings" "testing" @@ -149,7 +150,12 @@ func TestPipelineRunsController_CreateNoBody_HappyPath(t *testing.T) { func TestPipelineRunsController_Index_GlobalHappyPath(t *testing.T) { client, jobID, runIDs := setupPipelineRunsControllerTests(t) - response, cleanup := client.Get("/v2/pipeline/runs") + url := url.URL{Path: "/v2/pipeline/runs"} + query := url.Query() + query.Set("evmChainID", cltest.FixtureChainID.String()) + url.RawQuery = query.Encode() + + response, cleanup := client.Get(url.String()) defer cleanup() cltest.AssertServerResponse(t, response, http.StatusOK) @@ -266,6 +272,7 @@ func setupPipelineRunsControllerTests(t *testing.T) (cltest.HTTPClientCleaner, i schemaVersion = 1 externalJobID = "0EEC7E1D-D0D2-476C-A1A8-72DFB6633F46" contractAddress = "%s" + evmChainID = "0" p2pBootstrapPeers = [ "/dns4/chain.link/tcp/1234/p2p/16Uiu2HAm58SP7UL8zsnpeuwHfytLocaqgnyaYKP8wu7qRdrixLju", ] diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9b648d9268..aa98a138c8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Removed support for sending telemetry to the deprecated Explorer service. All nodes will have to remove `Explorer` related keys from TOML configuration and env vars. +- Removed default evmChainID logic where evmChainID was implicitly injected into the jobspecs based on node EVM chainID toml configuration. All newly created jobs(that have evmChainID field) will have to explicitly define evmChainID in the jobspec. +- Removed keyset migration that migrated v1 keys to v2 keys. All keys should've been migrated by now, and we don't permit creation of new v1 keys anymore All nodes will have to remove the following secret configurations: * `Explorer.AccessKey` diff --git a/integration-tests/actions/keeper_helpers.go b/integration-tests/actions/keeper_helpers.go index 98c9a51e1c..dfe2acbbed 100644 --- a/integration-tests/actions/keeper_helpers.go +++ b/integration-tests/actions/keeper_helpers.go @@ -27,6 +27,7 @@ func CreateKeeperJobs( chainlinkNodes []*client.ChainlinkK8sClient, keeperRegistry contracts.KeeperRegistry, ocrConfig contracts.OCRv2Config, + evmChainID string, ) { // Send keeper jobs to registry and chainlink nodes primaryNode := chainlinkNodes[0] @@ -49,6 +50,7 @@ func CreateKeeperJobs( Name: fmt.Sprintf("keeper-test-%s", keeperRegistry.Address()), ContractAddress: keeperRegistry.Address(), FromAddress: chainlinkNodeAddress, + EVMChainID: evmChainID, MinIncomingConfirmations: 1, }) require.NoError(t, err, "Creating KeeperV2 Job shouldn't fail") @@ -61,6 +63,7 @@ func CreateKeeperJobsWithKeyIndex( keeperRegistry contracts.KeeperRegistry, keyIndex int, ocrConfig contracts.OCRv2Config, + evmChainID string, ) { // Send keeper jobs to registry and chainlink nodes primaryNode := chainlinkNodes[0] @@ -83,6 +86,7 @@ func CreateKeeperJobsWithKeyIndex( Name: fmt.Sprintf("keeper-test-%s", keeperRegistry.Address()), ContractAddress: keeperRegistry.Address(), FromAddress: chainlinkNodeAddress[keyIndex], + EVMChainID: evmChainID, MinIncomingConfirmations: 1, }) require.NoError(t, err, "Creating KeeperV2 Job shouldn't fail") diff --git a/integration-tests/actions/keeper_helpers_local.go b/integration-tests/actions/keeper_helpers_local.go index 6fc7ef43db..ade1ab7f1a 100644 --- a/integration-tests/actions/keeper_helpers_local.go +++ b/integration-tests/actions/keeper_helpers_local.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/rs/zerolog/log" + "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" ) @@ -12,6 +13,7 @@ func CreateKeeperJobsLocal( chainlinkNodes []*client.ChainlinkClient, keeperRegistry contracts.KeeperRegistry, ocrConfig contracts.OCRv2Config, + evmChainID string, ) ([]*client.Job, error) { // Send keeper jobs to registry and chainlink nodes primaryNode := chainlinkNodes[0] @@ -46,6 +48,7 @@ func CreateKeeperJobsLocal( Name: fmt.Sprintf("keeper-test-%s", keeperRegistry.Address()), ContractAddress: keeperRegistry.Address(), FromAddress: chainlinkNodeAddress, + EVMChainID: evmChainID, MinIncomingConfirmations: 1, }) if err != nil { diff --git a/integration-tests/actions/ocr_helpers.go b/integration-tests/actions/ocr_helpers.go index bff96c7304..edef393027 100644 --- a/integration-tests/actions/ocr_helpers.go +++ b/integration-tests/actions/ocr_helpers.go @@ -186,6 +186,7 @@ func CreateOCRJobs( workerNodes []*client.ChainlinkK8sClient, mockValue int, mockserver *ctfClient.MockserverClient, + evmChainID string, ) error { for _, ocrInstance := range ocrInstances { bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() @@ -196,6 +197,7 @@ func CreateOCRJobs( bootstrapSpec := &client.OCRBootstrapJobSpec{ Name: fmt.Sprintf("bootstrap-%s", uuid.New().String()), ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: bootstrapP2PId, IsBootstrapPeer: true, } @@ -240,6 +242,7 @@ func CreateOCRJobs( bootstrapPeers := []*client.ChainlinkClient{bootstrapNode.ChainlinkClient} ocrSpec := &client.OCRTaskJobSpec{ ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: nodeP2PId, P2PBootstrapPeers: bootstrapPeers, KeyBundleID: nodeOCRKeyId, @@ -264,6 +267,7 @@ func CreateOCRJobsWithForwarder( workerNodes []*client.ChainlinkK8sClient, mockValue int, mockserver *ctfClient.MockserverClient, + evmChainID string, ) { for _, ocrInstance := range ocrInstances { bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() @@ -272,6 +276,7 @@ func CreateOCRJobsWithForwarder( bootstrapSpec := &client.OCRBootstrapJobSpec{ Name: fmt.Sprintf("bootstrap-%s", uuid.New().String()), ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: bootstrapP2PId, IsBootstrapPeer: true, } @@ -302,6 +307,7 @@ func CreateOCRJobsWithForwarder( bootstrapPeers := []*client.ChainlinkClient{bootstrapNode.ChainlinkClient} ocrSpec := &client.OCRTaskJobSpec{ ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: nodeP2PId, P2PBootstrapPeers: bootstrapPeers, KeyBundleID: nodeOCRKeyId, diff --git a/integration-tests/actions/ocr_helpers_local.go b/integration-tests/actions/ocr_helpers_local.go index 13fc01dcea..33d6498b9e 100644 --- a/integration-tests/actions/ocr_helpers_local.go +++ b/integration-tests/actions/ocr_helpers_local.go @@ -2,6 +2,9 @@ package actions import ( "fmt" + "math/big" + "strings" + "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" @@ -9,11 +12,10 @@ import ( "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "golang.org/x/sync/errgroup" + "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" - "golang.org/x/sync/errgroup" - "math/big" - "strings" ) /* @@ -140,6 +142,7 @@ func CreateOCRJobsLocal( workerNodes []*client.ChainlinkClient, mockValue int, mockserver *ctfClient.MockserverClient, + evmChainID string, ) error { for _, ocrInstance := range ocrInstances { bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() @@ -150,6 +153,7 @@ func CreateOCRJobsLocal( bootstrapSpec := &client.OCRBootstrapJobSpec{ Name: fmt.Sprintf("bootstrap-%s", uuid.New().String()), ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: bootstrapP2PId, IsBootstrapPeer: true, } @@ -194,6 +198,7 @@ func CreateOCRJobsLocal( bootstrapPeers := []*client.ChainlinkClient{bootstrapNode} ocrSpec := &client.OCRTaskJobSpec{ ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: nodeP2PId, P2PBootstrapPeers: bootstrapPeers, KeyBundleID: nodeOCRKeyId, @@ -353,6 +358,7 @@ func CreateOCRJobsWithForwarderLocal( workerNodes []*client.ChainlinkClient, mockValue int, mockserver *ctfClient.MockserverClient, + evmChainID string, ) error { for _, ocrInstance := range ocrInstances { bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() @@ -363,6 +369,7 @@ func CreateOCRJobsWithForwarderLocal( bootstrapSpec := &client.OCRBootstrapJobSpec{ Name: fmt.Sprintf("bootstrap-%s", uuid.New().String()), ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: bootstrapP2PId, IsBootstrapPeer: true, } @@ -407,6 +414,7 @@ func CreateOCRJobsWithForwarderLocal( bootstrapPeers := []*client.ChainlinkClient{bootstrapNode} ocrSpec := &client.OCRTaskJobSpec{ ContractAddress: ocrInstance.Address(), + EVMChainID: evmChainID, P2PPeerID: nodeP2PId, P2PBootstrapPeers: bootstrapPeers, KeyBundleID: nodeOCRKeyId, diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index 1e5b845145..d765cafb9e 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -185,7 +185,7 @@ func TestOCRChaos(t *testing.T) { require.NoError(t, err) err = chainClient.WaitForEvents() require.NoError(t, err) - err = actions.CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, ms) + err = actions.CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, ms, chainClient.GetChainID().String()) require.NoError(t, err) chaosApplied := false diff --git a/integration-tests/client/chainlink_models.go b/integration-tests/client/chainlink_models.go index d1b2f8eae9..6013e13e0f 100644 --- a/integration-tests/client/chainlink_models.go +++ b/integration-tests/client/chainlink_models.go @@ -762,6 +762,7 @@ func (d *DirectRequestTxPipelineSpec) String() (string, error) { type DirectRequestJobSpec struct { Name string `toml:"name"` ContractAddress string `toml:"contractAddress"` + EVMChainID string `toml:"evmChainID"` ExternalJobID string `toml:"externalJobID"` MinIncomingConfirmations string `toml:"minIncomingConfirmations"` ObservationSource string `toml:"observationSource"` // List of commands for the Chainlink node @@ -777,6 +778,7 @@ schemaVersion = 1 name = "{{.Name}}" maxTaskDuration = "99999s" contractAddress = "{{.ContractAddress}}" +evmChainID = "{{.EVMChainID}}" externalJobID = "{{.ExternalJobID}}" minIncomingConfirmations = {{.MinIncomingConfirmations}} observationSource = """ @@ -789,6 +791,7 @@ observationSource = """ type FluxMonitorJobSpec struct { Name string `toml:"name"` ContractAddress string `toml:"contractAddress"` // Address of the Flux Monitor script + EVMChainID string `toml:"evmChainID"` // Not optional Precision int `toml:"precision"` // Optional Threshold float32 `toml:"threshold"` // Optional AbsoluteThreshold float32 `toml:"absoluteThreshold"` // Optional @@ -809,6 +812,7 @@ func (f *FluxMonitorJobSpec) String() (string, error) { schemaVersion = 1 name = "{{.Name}}" contractAddress = "{{.ContractAddress}}" +evmChainID = "{{.EVMChainID}}" precision ={{if not .Precision}} 0 {{else}} {{.Precision}} {{end}} threshold ={{if not .Threshold}} 0.5 {{else}} {{.Threshold}} {{end}} absoluteThreshold ={{if not .AbsoluteThreshold}} 0.1 {{else}} {{.AbsoluteThreshold}} {{end}} @@ -832,6 +836,7 @@ type KeeperJobSpec struct { Name string `toml:"name"` ContractAddress string `toml:"contractAddress"` FromAddress string `toml:"fromAddress"` // Hex representation of the from address + EVMChainID string `toml:"evmChainID"` // Not optional MinIncomingConfirmations int `toml:"minIncomingConfirmations"` } @@ -846,6 +851,7 @@ schemaVersion = 1 name = "{{.Name}}" contractAddress = "{{.ContractAddress}}" fromAddress = "{{.FromAddress}}" +evmChainID = "{{.EVMChainID}}" minIncomingConfirmations = {{.MinIncomingConfirmations}} ` return MarshallTemplate(k, "Keeper Job", keeperTemplateString) @@ -860,8 +866,9 @@ type OCRBootstrapJobSpec struct { TrackerPollInterval time.Duration `toml:"contractConfigTrackerPollInterval"` // Optional TrackerSubscribeInterval time.Duration `toml:"contractConfigTrackerSubscribeInterval"` // Optional ContractAddress string `toml:"contractAddress"` // Address of the OCR contract - IsBootstrapPeer bool `toml:"isBootstrapPeer"` // Typically true - P2PPeerID string `toml:"p2pPeerID"` // This node's P2P ID + EVMChainID string `toml:"evmChainID"` + IsBootstrapPeer bool `toml:"isBootstrapPeer"` // Typically true + P2PPeerID string `toml:"p2pPeerID"` // This node's P2P ID } // Type returns the type of the job @@ -876,6 +883,7 @@ contractConfigConfirmations ={{if not .ContractConfirmations}} 3 {{el contractConfigTrackerPollInterval ={{if not .TrackerPollInterval}} "1m" {{else}} {{.TrackerPollInterval}} {{end}} contractConfigTrackerSubscribeInterval ={{if not .TrackerSubscribeInterval}} "2m" {{else}} {{.TrackerSubscribeInterval}} {{end}} contractAddress = "{{.ContractAddress}}" +evmChainID = "{{.EVMChainID}}" p2pBootstrapPeers = [] isBootstrapPeer = {{.IsBootstrapPeer}} p2pPeerID = "{{.P2PPeerID}}"` @@ -892,13 +900,14 @@ type OCRTaskJobSpec struct { TrackerSubscribeInterval time.Duration `toml:"contractConfigTrackerSubscribeInterval"` // Optional ForwardingAllowed bool `toml:"forwardingAllowed"` // Optional, by default false ContractAddress string `toml:"contractAddress"` // Address of the OCR contract - P2PBootstrapPeers []*ChainlinkClient `toml:"p2pBootstrapPeers"` // P2P ID of the bootstrap node - IsBootstrapPeer bool `toml:"isBootstrapPeer"` // Typically false - P2PPeerID string `toml:"p2pPeerID"` // This node's P2P ID - KeyBundleID string `toml:"keyBundleID"` // ID of this node's OCR key bundle - MonitoringEndpoint string `toml:"monitoringEndpoint"` // Typically "chain.link:4321" - TransmitterAddress string `toml:"transmitterAddress"` // ETH address this node will use to transmit its answer - ObservationSource string `toml:"observationSource"` // List of commands for the Chainlink node + EVMChainID string `toml:"evmChainID"` + P2PBootstrapPeers []*ChainlinkClient `toml:"p2pBootstrapPeers"` // P2P ID of the bootstrap node + IsBootstrapPeer bool `toml:"isBootstrapPeer"` // Typically false + P2PPeerID string `toml:"p2pPeerID"` // This node's P2P ID + KeyBundleID string `toml:"keyBundleID"` // ID of this node's OCR key bundle + MonitoringEndpoint string `toml:"monitoringEndpoint"` // Typically "chain.link:4321" + TransmitterAddress string `toml:"transmitterAddress"` // ETH address this node will use to transmit its answer + ObservationSource string `toml:"observationSource"` // List of commands for the Chainlink node } // P2PData holds the remote ip and the peer id and port @@ -939,6 +948,7 @@ func (o *OCRTaskJobSpec) String() (string, error) { TrackerPollInterval time.Duration TrackerSubscribeInterval time.Duration ContractAddress string + EVMChainID string P2PBootstrapPeers []P2PData IsBootstrapPeer bool P2PPeerID string @@ -954,6 +964,7 @@ func (o *OCRTaskJobSpec) String() (string, error) { TrackerPollInterval: o.TrackerPollInterval, TrackerSubscribeInterval: o.TrackerSubscribeInterval, ContractAddress: o.ContractAddress, + EVMChainID: o.EVMChainID, P2PBootstrapPeers: peers, IsBootstrapPeer: o.IsBootstrapPeer, P2PPeerID: o.P2PPeerID, @@ -971,6 +982,7 @@ contractConfigConfirmations ={{if not .ContractConfirmations}} 3 {{el contractConfigTrackerPollInterval ={{if not .TrackerPollInterval}} "1m" {{else}} {{.TrackerPollInterval}} {{end}} contractConfigTrackerSubscribeInterval ={{if not .TrackerSubscribeInterval}} "2m" {{else}} {{.TrackerSubscribeInterval}} {{end}} contractAddress = "{{.ContractAddress}}" +evmChainID = "{{.EVMChainID}}" {{if .P2PBootstrapPeers}} p2pBootstrapPeers = [ {{range $peer := .P2PBootstrapPeers}} @@ -1186,6 +1198,7 @@ type VRFJobSpec struct { Name string `toml:"name"` CoordinatorAddress string `toml:"coordinatorAddress"` // Address of the VRF CoordinatorV2 contract PublicKey string `toml:"publicKey"` // Public key of the proving key + EVMChainID string `toml:"evmChainID"` ExternalJobID string `toml:"externalJobID"` ObservationSource string `toml:"observationSource"` // List of commands for the Chainlink node MinIncomingConfirmations int `toml:"minIncomingConfirmations"` @@ -1203,6 +1216,7 @@ name = "{{.Name}}" coordinatorAddress = "{{.CoordinatorAddress}}" minIncomingConfirmations = {{.MinIncomingConfirmations}} publicKey = "{{.PublicKey}}" +evmChainID = "{{.EVMChainID}}" externalJobID = "{{.ExternalJobID}}" observationSource = """ {{.ObservationSource}} diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index dca84ab09c..a24493a678 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -83,6 +83,7 @@ func TestDirectRequestPerformance(t *testing.T) { Name: "direct_request", MinIncomingConfirmations: "1", ContractAddress: oracle.Address(), + EVMChainID: chainClient.GetChainID().String(), ExternalJobID: jobUUID.String(), ObservationSource: ost, }) diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index bc914c329b..47b2b22e1a 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -100,6 +100,7 @@ func TestFluxPerformance(t *testing.T) { fluxSpec := &client.FluxMonitorJobSpec{ Name: fmt.Sprintf("flux-monitor-%s", adapterUUID), ContractAddress: fluxInstance.Address(), + EVMChainID: chainClient.GetChainID().String(), Threshold: 0, AbsoluteThreshold: 0, PollTimerPeriod: 15 * time.Second, // min 15s diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index 384729dfab..5688a05aa6 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -68,7 +68,7 @@ func TestKeeperPerformance(t *testing.T) { // Not the last node, hence not all nodes started profiling yet. return } - actions.CreateKeeperJobs(t, chainlinkNodes, registry, contracts.OCRv2Config{}) + actions.CreateKeeperJobs(t, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) err := chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") diff --git a/integration-tests/performance/ocr_test.go b/integration-tests/performance/ocr_test.go index d056d58e30..a1f588c441 100644 --- a/integration-tests/performance/ocr_test.go +++ b/integration-tests/performance/ocr_test.go @@ -58,7 +58,7 @@ func TestOCRBasic(t *testing.T) { require.NoError(t, err, "Error waiting for events") profileFunction := func(chainlinkNode *client.ChainlinkClient) { - err = actions.CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, mockServer) + err = actions.CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, mockServer, chainClient.GetChainID().String()) require.NoError(t, err) err = actions.StartNewRound(1, ocrInstances, chainClient) require.NoError(t, err) diff --git a/integration-tests/reorg/reorg_test.go b/integration-tests/reorg/reorg_test.go index c944b7a753..03d179ce26 100644 --- a/integration-tests/reorg/reorg_test.go +++ b/integration-tests/reorg/reorg_test.go @@ -181,6 +181,7 @@ func TestDirectRequestReorg(t *testing.T) { Name: "direct_request", MinIncomingConfirmations: minIncomingConfirmations, ContractAddress: oracle.Address(), + EVMChainID: chainClient.GetChainID().String(), ExternalJobID: jobUUID.String(), ObservationSource: ost, }) diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index c4cd02b857..385ed90034 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -93,6 +93,7 @@ func TestFluxBasic(t *testing.T) { fluxSpec := &client.FluxMonitorJobSpec{ Name: fmt.Sprintf("flux-monitor-%s", adapterUUID), ContractAddress: fluxInstance.Address(), + EVMChainID: env.EVMClient.GetChainID().String(), Threshold: 0, AbsoluteThreshold: 0, PollTimerPeriod: 15 * time.Second, // min 15s diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index e4cf5cb052..2e83a4fe68 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -68,7 +68,7 @@ func TestForwarderOCRBasic(t *testing.T) { ) require.NoError(t, err, "Error deploying OCR contracts") - err = actions.CreateOCRJobsWithForwarderLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client) + err = actions.CreateOCRJobsWithForwarderLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client, env.EVMClient.GetChainID().String()) require.NoError(t, err, "failed to setup forwarder jobs") err = actions.StartNewRound(1, ocrInstances, env.EVMClient) require.NoError(t, err) diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index 35bb632c11..e51631d158 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -14,6 +14,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink/v2/core/store/models" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -100,7 +101,7 @@ func TestKeeperBasicSmoke(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -176,7 +177,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -283,7 +284,7 @@ func TestKeeperSimulation(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -356,7 +357,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -465,7 +466,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -553,7 +554,7 @@ func TestKeeperAddFunds(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -616,7 +617,7 @@ func TestKeeperRemove(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -693,7 +694,7 @@ func TestKeeperPauseRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -753,7 +754,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -772,7 +773,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) // Set the jobs for the second registry - _, err = actions.CreateKeeperJobsLocal(chainlinkNodes, secondRegistry, contracts.OCRv2Config{}) + _, err = actions.CreateKeeperJobsLocal(chainlinkNodes, secondRegistry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -845,7 +846,7 @@ func TestKeeperNodeDown(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - jobs, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + jobs, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -951,7 +952,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -1042,7 +1043,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}) + _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index 50d6abe662..47426b895d 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -43,7 +43,7 @@ func TestOCRBasic(t *testing.T) { err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") - err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client) + err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client, env.EVMClient.GetChainID().String()) require.NoError(t, err) err = actions.StartNewRound(1, ocrInstances, env.EVMClient) diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index cd2a099b14..83160449e5 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -68,6 +68,7 @@ func TestRunLogBasic(t *testing.T) { Name: fmt.Sprintf("direct-request-%s", uuid.NewString()), MinIncomingConfirmations: "1", ContractAddress: oracle.Address(), + EVMChainID: env.EVMClient.GetChainID().String(), ExternalJobID: jobUUID.String(), ObservationSource: ost, }) diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index 0e12b185a6..465b132226 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -66,6 +66,7 @@ func TestVRFBasic(t *testing.T) { MinIncomingConfirmations: 1, PublicKey: pubKeyCompressed, ExternalJobID: jobUUID.String(), + EVMChainID: env.EVMClient.GetChainID().String(), ObservationSource: ost, }) require.NoError(t, err, "Creating VRF Job shouldn't fail") diff --git a/integration-tests/testsetups/keeper_benchmark.go b/integration-tests/testsetups/keeper_benchmark.go index 7e86246726..bdba3a6766 100644 --- a/integration-tests/testsetups/keeper_benchmark.go +++ b/integration-tests/testsetups/keeper_benchmark.go @@ -246,7 +246,7 @@ func (k *KeeperBenchmarkTest) Run(t *testing.T) { // Give time for OCR nodes to bootstrap time.Sleep(1 * time.Minute) } else { - actions.CreateKeeperJobsWithKeyIndex(t, k.chainlinkNodes, k.keeperRegistries[rIndex], txKeyId, ocrConfig) + actions.CreateKeeperJobsWithKeyIndex(t, k.chainlinkNodes, k.keeperRegistries[rIndex], txKeyId, ocrConfig, k.chainClient.GetChainID().String()) } err = k.chainClient.WaitForEvents() require.NoError(t, err, "Error waiting for registry setConfig") diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index 07aa3b2c4e..c0e8452582 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -263,9 +263,9 @@ func (o *OCRSoakTest) Run() { startingValue := 5 if o.OperatorForwarderFlow { - actions.CreateOCRJobsWithForwarder(o.t, o.ocrInstances, o.bootstrapNode, o.workerNodes, startingValue, o.mockServer) + actions.CreateOCRJobsWithForwarder(o.t, o.ocrInstances, o.bootstrapNode, o.workerNodes, startingValue, o.mockServer, o.chainClient.GetChainID().String()) } else { - err := actions.CreateOCRJobs(o.ocrInstances, o.bootstrapNode, o.workerNodes, startingValue, o.mockServer) + err := actions.CreateOCRJobs(o.ocrInstances, o.bootstrapNode, o.workerNodes, startingValue, o.mockServer, o.chainClient.GetChainID().String()) require.NoError(o.t, err, "Error creating OCR jobs") } From 2c1a16479f763c0878858048d8b041c65544ac4f Mon Sep 17 00:00:00 2001 From: Bolek <1416262+bolekk@users.noreply.github.com> Date: Thu, 14 Sep 2023 09:32:18 -0700 Subject: [PATCH 07/26] [Functions] Enforce max expiration length (#10638) --- core/services/s4/errors.go | 13 +++++++------ core/services/s4/storage.go | 11 ++++++++--- core/services/s4/storage_test.go | 19 +++++++++++++++++-- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/core/services/s4/errors.go b/core/services/s4/errors.go index 408903254b..aa447f88f3 100644 --- a/core/services/s4/errors.go +++ b/core/services/s4/errors.go @@ -3,10 +3,11 @@ package s4 import "errors" var ( - ErrNotFound = errors.New("not found") - ErrWrongSignature = errors.New("wrong signature") - ErrSlotIdTooBig = errors.New("slot id is too big") - ErrPayloadTooBig = errors.New("payload is too big") - ErrPastExpiration = errors.New("past expiration") - ErrVersionTooLow = errors.New("version too low") + ErrNotFound = errors.New("not found") + ErrWrongSignature = errors.New("wrong signature") + ErrSlotIdTooBig = errors.New("slot id is too big") + ErrPayloadTooBig = errors.New("payload is too big") + ErrPastExpiration = errors.New("past expiration") + ErrVersionTooLow = errors.New("version too low") + ErrExpirationTooLong = errors.New("expiration too long") ) diff --git a/core/services/s4/storage.go b/core/services/s4/storage.go index d90c7a4ead..2a2a4ffcdd 100644 --- a/core/services/s4/storage.go +++ b/core/services/s4/storage.go @@ -12,8 +12,9 @@ import ( // Constraints specifies the global storage constraints. type Constraints struct { - MaxPayloadSizeBytes uint `json:"maxPayloadSizeBytes"` - MaxSlotsPerUser uint `json:"maxSlotsPerUser"` + MaxPayloadSizeBytes uint `json:"maxPayloadSizeBytes"` + MaxSlotsPerUser uint `json:"maxSlotsPerUser"` + MaxExpirationLengthSec uint64 `json:"maxExpirationLengthSec"` } // Key identifies a versioned user record. @@ -128,9 +129,13 @@ func (s *storage) Put(ctx context.Context, key *Key, record *Record, signature [ if len(record.Payload) > int(s.contraints.MaxPayloadSizeBytes) { return ErrPayloadTooBig } - if s.clock.Now().UnixMilli() > record.Expiration { + now := s.clock.Now().UnixMilli() + if now > record.Expiration { return ErrPastExpiration } + if record.Expiration-now > int64(s.contraints.MaxExpirationLengthSec)*1000 { + return ErrExpirationTooLong + } envelope := NewEnvelopeFromRecord(key, record) signer, err := envelope.GetSignerAddress(signature) diff --git a/core/services/s4/storage_test.go b/core/services/s4/storage_test.go index 1a56e3d571..6c384d493b 100644 --- a/core/services/s4/storage_test.go +++ b/core/services/s4/storage_test.go @@ -17,8 +17,9 @@ import ( var ( constraints = s4.Constraints{ - MaxSlotsPerUser: 5, - MaxPayloadSizeBytes: 32, + MaxSlotsPerUser: 5, + MaxPayloadSizeBytes: 32, + MaxExpirationLengthSec: 3600, } ) @@ -100,6 +101,20 @@ func TestStorage_Errors(t *testing.T) { assert.ErrorIs(t, err, s4.ErrPastExpiration) }) + t.Run("ErrExpirationTooLong", func(t *testing.T) { + key := &s4.Key{ + Address: testutils.NewAddress(), + SlotId: 1, + Version: 0, + } + record := &s4.Record{ + Payload: make([]byte, 10), + Expiration: now.UnixMilli() + 10000000, + } + err := storage.Put(testutils.Context(t), key, record, []byte{}) + assert.ErrorIs(t, err, s4.ErrExpirationTooLong) + }) + t.Run("ErrWrongSignature", func(t *testing.T) { privateKey, address := testutils.NewPrivateKeyAndAddress(t) key := &s4.Key{ From 7400833b052e9a658dc1e1cb2c8d14e85439e24a Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 14 Sep 2023 12:32:38 -0400 Subject: [PATCH 08/26] Adds Log Collection on Failing Test (#10632) * Adds Log Collection on Failing Test * Add file * Try matrix logs * Try with dynamic upload * Debugging artifacts location * If always * More debugs * In progress * Better log writing * New docs --- .github/workflows/integration-tests.yml | 33 +++----- integration-tests/README.md | 14 ++++ integration-tests/docker/test_env/cl_node.go | 4 +- integration-tests/docker/test_env/test_env.go | 81 +++++++++++++++---- integration-tests/smoke/cron_test.go | 2 +- integration-tests/smoke/flux_test.go | 2 +- integration-tests/smoke/forwarder_ocr_test.go | 2 +- .../smoke/forwarders_ocr2_test.go | 2 +- integration-tests/smoke/keeper_test.go | 2 +- integration-tests/smoke/ocr2_test.go | 2 +- integration-tests/smoke/ocr_test.go | 2 +- integration-tests/smoke/runlog_test.go | 2 +- integration-tests/smoke/vrf_test.go | 2 +- integration-tests/smoke/vrfv2_test.go | 2 +- integration-tests/smoke/vrfv2plus_test.go | 3 +- 15 files changed, 107 insertions(+), 48 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 3c58df87e5..43ace19d4c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -88,7 +88,7 @@ jobs: - name: Check if image exists if: needs.changes.outputs.src == 'true' id: check-image - uses: smartcontractkit/chainlink-github-actions/docker/image-exists@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/docker/image-exists@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: repository: chainlink tag: ${{ github.sha }}${{ matrix.image.tag-suffix }} @@ -96,7 +96,7 @@ jobs: AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} - name: Build Image if: steps.check-image.outputs.exists == 'false' && needs.changes.outputs.src == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/build-image@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: cl_repo: smartcontractkit/chainlink cl_ref: ${{ github.sha }} @@ -205,7 +205,7 @@ jobs: ## Run this step when changes that require tests to be run are made - name: Run Tests if: needs.changes.outputs.src == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 env: PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 PYROSCOPE_ENVIRONMENT: ${{ matrix.product.pyroscope_env }} @@ -216,7 +216,7 @@ jobs: cl_repo: ${{ env.CHAINLINK_IMAGE }} cl_image_tag: ${{ github.sha }} aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - artifacts_location: ./integration-tests/smoke/logs + artifacts_location: ./integration-tests/smoke/logs/ publish_check_name: ${{ matrix.product.name }} token: ${{ secrets.GITHUB_TOKEN }} go_mod_path: ./integration-tests/go.mod @@ -312,7 +312,7 @@ jobs: ## Run this step when changes that require tests to be run are made - name: Run Tests if: needs.changes.outputs.src == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 env: PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725 PYROSCOPE_ENVIRONMENT: ${{ matrix.product.pyroscope_env }} @@ -323,7 +323,8 @@ jobs: cl_repo: ${{ env.CHAINLINK_IMAGE }} cl_image_tag: ${{ github.sha }} aws_registries: ${{ secrets.QA_AWS_ACCOUNT_NUMBER }} - artifacts_location: ./integration-tests/smoke/logs + artifacts_name: ${{ matrix.product.name }}-test-logs + artifacts_location: ./integration-tests/smoke/logs/ publish_check_name: ${{ matrix.product.name }} token: ${{ secrets.GITHUB_TOKEN }} go_mod_path: ./integration-tests/go.mod @@ -335,7 +336,7 @@ jobs: ## Run this step when changes that do not need the test to run are made - name: Run Setup if: needs.changes.outputs.src == 'false' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: test_download_vendor_packages_command: cd ./integration-tests && go mod download go_mod_path: ./integration-tests/go.mod @@ -345,14 +346,6 @@ jobs: QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }} QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }} - - name: Upload test log - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 - if: failure() - with: - name: test-log-${{ matrix.product.name }} - path: /tmp/gotest.log - retention-days: 7 - continue-on-error: true - name: Collect Metrics if: always() id: collect-gha-metrics @@ -425,7 +418,7 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Run Setup - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: test_download_vendor_packages_command: | cd ./integration-tests @@ -473,7 +466,7 @@ jobs: run: | echo "Running migration tests from version '${{ steps.get_latest_version.outputs.latest_version }}' to: '${{ github.sha }}'" - name: Run Migration Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: test_command_to_run: make test_need_operator_assets && cd ./integration-tests && go test -timeout 30m -count=1 -json ./migration 2>&1 | tee /tmp/gotest.log | gotestfmt test_download_vendor_packages_command: cd ./integration-tests && go mod download @@ -573,7 +566,7 @@ jobs: steps: - name: Check if image exists id: check-image - uses: smartcontractkit/chainlink-github-actions/docker/image-exists@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/docker/image-exists@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: repository: chainlink-solana-tests tag: ${{ needs.get_solana_sha.outputs.sha }} @@ -716,7 +709,7 @@ jobs: ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Run Tests if: needs.changes.outputs.src == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 with: test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke cl_repo: ${{ env.CHAINLINK_IMAGE }} @@ -778,7 +771,7 @@ jobs: ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }} ## Only run OCR smoke test for now - name: Run Tests - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@00c6214deb10a3f374c6d3430c32c5202015d463 # v2.2.12 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@eccde1970eca69f079d3efb3409938a72ade8497 # v2.2.13 env: PYROSCOPE_SERVER: ${{ secrets.QA_PYROSCOPE_INSTANCE }} PYROSCOPE_ENVIRONMENT: ci-smoke-ocr-evm-${{ matrix.testnet }} # TODO: Only for OCR for now diff --git a/integration-tests/README.md b/integration-tests/README.md index b84a6a2e37..c1393ea9cf 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -16,12 +16,26 @@ If you have previously run these smoke tests using GitHub Actions or some sort o See the [example.env](./example.env) file for environment variables you can set to configure things like network settings, Chainlink version, and log level. Remember to use `source .env` to activate your settings. +## Build + +If you'd like to run the tests on a local build of Chainlink, you can point to your own docker image, or build a fresh one with `make`. + +`make build_docker_image image= tag=` + +e.g. + +`make build_docker_image image=chainlink tag=test-tag` + ## Run `go test ./smoke/_test.go` It's generally recommended to run only one test at a time on a local machine as it needs a lot of docker containers and can peg your resources otherwise. You will see docker containers spin up on your machine for each component of the test where you can inspect logs. +## Analyze + +You can see the results of each test in the terminal with normal `go test` output. If a test fails, logs of each Chainlink container will dump into the `smoke/logs/` folder for later analysis. You can also see these logs in CI uploaded as GitHub artifacts. + ## Running Soak, Performance, Benchmark, and Chaos Tests These tests remain bound to a Kubernetes run environment, and require more complex setup and running instructions not documented here. We endeavor to make these easier to run and configure, but for the time being please seek a member of the QA/Test Tooling team if you want to run these. diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index a3843918f1..49d3cdc369 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -152,8 +152,8 @@ func (n *ClNode) AddMercuryOCRJob(verifierAddr common.Address, fromBlock uint64, } bridges := utils.BuildBridges(eaUrls) - for _, b := range bridges { - err = n.API.MustCreateBridge(&b) + for index := range bridges { + err = n.API.MustCreateBridge(&bridges[index]) if err != nil { return nil, err } diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 33e2baa3b6..7de4064a25 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -1,9 +1,15 @@ package test_env import ( + "context" "encoding/json" "fmt" + "io" "math/big" + "os" + "path/filepath" + "testing" + "time" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" @@ -16,6 +22,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/docker" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" + testUtils "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -210,40 +217,84 @@ func (te *CLClusterTestEnv) Terminate() error { // Cleanup cleans the environment up after it's done being used, mainly for returning funds when on live networks. // Intended to be used as part of t.Cleanup() in tests. -func (te *CLClusterTestEnv) Cleanup() error { - log.Info().Msg("Attempting to return Chainlink node funds to default network wallets") +func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { + l := testUtils.GetTestLogger(t) if te.EVMClient == nil { return errors.New("blockchain client is nil, unable to return funds from chainlink nodes") } if te.CLNodes == nil { return errors.New("chainlink nodes are nil, unable to return funds from chainlink nodes") } + + // Check if we need to return funds if te.EVMClient.NetworkSimulated() { - log.Info().Str("Network Name", te.EVMClient.GetNetworkName()). + l.Info().Str("Network Name", te.EVMClient.GetNetworkName()). Msg("Network is a simulated network. Skipping fund return.") + } else { + l.Info().Msg("Attempting to return Chainlink node funds to default network wallets") + for _, chainlinkNode := range te.CLNodes { + fundedKeys, err := chainlinkNode.API.ExportEVMKeysForChain(te.EVMClient.GetChainID().String()) + if err != nil { + return err + } + for _, key := range fundedKeys { + keyToDecrypt, err := json.Marshal(key) + if err != nil { + return err + } + // This can take up a good bit of RAM and time. When running on the remote-test-runner, this can lead to OOM + // issues. So we avoid running in parallel; slower, but safer. + decryptedKey, err := keystore.DecryptKey(keyToDecrypt, client.ChainlinkKeyPassword) + if err != nil { + return err + } + if err = te.EVMClient.ReturnFunds(decryptedKey.PrivateKey); err != nil { + return err + } + } + } + } + + // TODO: This is an imperfect and temporary solution, see TT-590 for a more sustainable solution + // Collect logs if the test failed + if !t.Failed() { return nil } - for _, chainlinkNode := range te.CLNodes { - fundedKeys, err := chainlinkNode.API.ExportEVMKeysForChain(te.EVMClient.GetChainID().String()) - if err != nil { - return err - } - for _, key := range fundedKeys { - keyToDecrypt, err := json.Marshal(key) + folder := fmt.Sprintf("./logs/%s-%s", t.Name(), time.Now().Format("2006-01-02T15-04-05")) + if err := os.MkdirAll(folder, os.ModePerm); err != nil { + return err + } + + l.Warn().Msg("Test failed, collecting logs") + eg := &errgroup.Group{} + for _, n := range te.CLNodes { + node := n + eg.Go(func() error { + logFileName := filepath.Join(folder, fmt.Sprintf("node-%s.log", node.ContainerName)) + logFile, err := os.OpenFile(logFileName, os.O_CREATE|os.O_WRONLY, 0644) if err != nil { return err } - // This can take up a good bit of RAM and time. When running on the remote-test-runner, this can lead to OOM - // issues. So we avoid running in parallel; slower, but safer. - decryptedKey, err := keystore.DecryptKey(keyToDecrypt, client.ChainlinkKeyPassword) + defer logFile.Close() + logReader, err := node.Container.Logs(context.Background()) if err != nil { return err } - if err = te.EVMClient.ReturnFunds(decryptedKey.PrivateKey); err != nil { + _, err = io.Copy(logFile, logReader) + if err != nil { return err } - } + l.Info().Str("Node", node.ContainerName).Str("File", logFileName).Msg("Wrote Logs") + return nil + }) } + + if err := eg.Wait(); err != nil { + return err + } + + l.Info().Str("Logs Location", folder).Msg("Wrote Logs for Failed Test") + return nil } diff --git a/integration-tests/smoke/cron_test.go b/integration-tests/smoke/cron_test.go index 0285e2d23c..4019b50dfe 100644 --- a/integration-tests/smoke/cron_test.go +++ b/integration-tests/smoke/cron_test.go @@ -25,7 +25,7 @@ func TestCronBasic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index 385ed90034..f9eef6d06a 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -31,7 +31,7 @@ func TestFluxBasic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index 2e83a4fe68..2482532314 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -27,7 +27,7 @@ func TestForwarderOCRBasic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index bf422b30fa..62e8eec591 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -34,7 +34,7 @@ func TestForwarderOCR2Basic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index e51631d158..a2ff098992 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -1112,7 +1112,7 @@ func setupKeeperTest(t *testing.T) ( Build() require.NoError(t, err, "Error deploying test environment") t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index 36d53b4067..fe53d2cb6a 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -43,7 +43,7 @@ func TestOCRv2Basic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index 47426b895d..d8f905480c 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -25,7 +25,7 @@ func TestOCRBasic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index 83160449e5..37fb4a76c5 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -29,7 +29,7 @@ func TestRunLogBasic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index 465b132226..3164fcf232 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -31,7 +31,7 @@ func TestVRFBasic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index 41f9d2ee5e..c34e60fe6b 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -29,7 +29,7 @@ func TestVRFv2Basic(t *testing.T) { Build() require.NoError(t, err) t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) diff --git a/integration-tests/smoke/vrfv2plus_test.go b/integration-tests/smoke/vrfv2plus_test.go index 9b6dc5a862..7fd4a580bc 100644 --- a/integration-tests/smoke/vrfv2plus_test.go +++ b/integration-tests/smoke/vrfv2plus_test.go @@ -27,7 +27,7 @@ func TestVRFv2PlusBilling(t *testing.T) { Build() require.NoError(t, err, "error creating test env") t.Cleanup(func() { - if err := env.Cleanup(); err != nil { + if err := env.Cleanup(t); err != nil { l.Error().Err(err).Msg("Error cleaning up test environment") } }) @@ -109,6 +109,7 @@ func TestVRFv2PlusBilling(t *testing.T) { subNativeTokenBalanceBeforeRequest := subscription.EthBalance jobRunsBeforeTest, err := env.CLNodes[0].API.MustReadRunsByJob(job.Job.Data.ID) + require.NoError(t, err, "error reading job runs") // test and assert err = vrfv2PlusContracts.LoadTestConsumer.RequestRandomness( From 25af2dd79be67ae8f86ce60d675cce81c46c17c0 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 14 Sep 2023 14:01:41 -0400 Subject: [PATCH 09/26] Fix typo (#10649) --- integration-tests/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/README.md b/integration-tests/README.md index c1393ea9cf..c0b673fa92 100644 --- a/integration-tests/README.md +++ b/integration-tests/README.md @@ -4,7 +4,7 @@ Here lives the integration tests for chainlink, utilizing our [chainlink-testing ## NOTE: Move to Testcontainers -If you have previously run these smoke tests using GitHub Actions or some sort of Kubernetes setup, that method is no longer necessary. We have moved the majority of our tests to utilize plain Docker containers (with the help of [Testcontainers](https://golang.testcontainers.org/)). This should make tests faster, more stable, and enable you to run them on your local machine without much hassle. More p +If you have previously run these smoke tests using GitHub Actions or some sort of Kubernetes setup, that method is no longer necessary. We have moved the majority of our tests to utilize plain Docker containers (with the help of [Testcontainers](https://golang.testcontainers.org/)). This should make tests faster, more stable, and enable you to run them on your local machine without much hassle. ## Requirements From 186d1d9c682c972cdd28296abbfbeadb5e83a63e Mon Sep 17 00:00:00 2001 From: Bolek <1416262+bolekk@users.noreply.github.com> Date: Thu, 14 Sep 2023 11:14:02 -0700 Subject: [PATCH 10/26] [Gateway] Use named loggers in all sub-components (#10639) --- core/services/gateway/connectionmanager.go | 2 +- core/services/gateway/connector/connector.go | 2 +- core/services/gateway/handlers/functions/handler.functions.go | 1 + core/services/gateway/handlers/handler.dummy.go | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/services/gateway/connectionmanager.go b/core/services/gateway/connectionmanager.go index 86660f03dc..961212239f 100644 --- a/core/services/gateway/connectionmanager.go +++ b/core/services/gateway/connectionmanager.go @@ -96,7 +96,7 @@ func NewConnectionManager(gwConfig *config.GatewayConfig, clock utils.Clock, lgg codec: codec, nodes: nodes, shutdownCh: make(chan struct{}), - lggr: lggr, + lggr: lggr.Named("DONConnectionManager." + donConfig.DonId), } } connMgr := &connectionManager{ diff --git a/core/services/gateway/connector/connector.go b/core/services/gateway/connector/connector.go index 1cd1995e3a..ca0a45e98c 100644 --- a/core/services/gateway/connector/connector.go +++ b/core/services/gateway/connector/connector.go @@ -85,7 +85,7 @@ func NewGatewayConnector(config *ConnectorConfig, signer Signer, handler Gateway signer: signer, handler: handler, shutdownCh: make(chan struct{}), - lggr: lggr, + lggr: lggr.Named("GatewayConnector"), } gateways := make(map[string]*gatewayState) urlToId := make(map[string]string) diff --git a/core/services/gateway/handlers/functions/handler.functions.go b/core/services/gateway/handlers/functions/handler.functions.go index aee099e6ce..4ef6ab72fb 100644 --- a/core/services/gateway/handlers/functions/handler.functions.go +++ b/core/services/gateway/handlers/functions/handler.functions.go @@ -57,6 +57,7 @@ func NewFunctionsHandlerFromConfig(handlerConfig json.RawMessage, donConfig *con if err != nil { return nil, err } + lggr = lggr.Named("FunctionsHandler:" + donConfig.DonId) var allowlist OnchainAllowlist if cfg.OnchainAllowlist != nil { chain, err2 := legacyChains.Get(cfg.OnchainAllowlistChainID) diff --git a/core/services/gateway/handlers/handler.dummy.go b/core/services/gateway/handlers/handler.dummy.go index 7615c734d8..9cdd086560 100644 --- a/core/services/gateway/handlers/handler.dummy.go +++ b/core/services/gateway/handlers/handler.dummy.go @@ -32,7 +32,7 @@ func NewDummyHandler(donConfig *config.DONConfig, don DON, lggr logger.Logger) ( donConfig: donConfig, don: don, savedCallbacks: make(map[string]*savedCallback), - lggr: lggr, + lggr: lggr.Named("DummyHandler." + donConfig.DonId), }, nil } From 0f6f84b49a9935f7b077e98c34811d4e2ff74b02 Mon Sep 17 00:00:00 2001 From: Bolek <1416262+bolekk@users.noreply.github.com> Date: Thu, 14 Sep 2023 12:48:55 -0700 Subject: [PATCH 11/26] [Gateway] Return 400 HTTP code on handler errors (#10652) Handler errors are user errors (not allowlisted, rate-limited, etc) so we should return a 4XX code. --- core/services/gateway/api/constants.go | 6 +++--- core/services/gateway/gateway.go | 2 +- core/services/gateway/gateway_test.go | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/core/services/gateway/api/constants.go b/core/services/gateway/api/constants.go index 9ab7e0c449..d64f7dded1 100644 --- a/core/services/gateway/api/constants.go +++ b/core/services/gateway/api/constants.go @@ -6,7 +6,7 @@ const ( NoError ErrorCode = iota UserMessageParseError UnsupportedDONIdError - InternalHandlerError + HandlerError RequestTimeoutError NodeReponseEncodingError FatalError @@ -18,7 +18,7 @@ func ToJsonRPCErrorCode(errorCode ErrorCode) int { NoError: 0, UserMessageParseError: -32700, // Parse Error UnsupportedDONIdError: -32602, // Invalid Params - InternalHandlerError: -32000, // Server Error + HandlerError: -32600, // Invalid Request RequestTimeoutError: -32000, // Server Error NodeReponseEncodingError: -32603, // Internal Error FatalError: -32000, // Server Error @@ -37,7 +37,7 @@ func ToHttpErrorCode(errorCode ErrorCode) int { NoError: 200, // OK UserMessageParseError: 400, // Bad Request UnsupportedDONIdError: 400, // Bad Request - InternalHandlerError: 500, // Internal Server Error + HandlerError: 400, // Bad Request RequestTimeoutError: 504, // Gateway Timeout NodeReponseEncodingError: 500, // Internal Server Error FatalError: 500, // Internal Server Error diff --git a/core/services/gateway/gateway.go b/core/services/gateway/gateway.go index d64ee43233..fd158d6e0b 100644 --- a/core/services/gateway/gateway.go +++ b/core/services/gateway/gateway.go @@ -136,7 +136,7 @@ func (g *gateway) ProcessRequest(ctx context.Context, rawRequest []byte) (rawRes responseCh := make(chan handlers.UserCallbackPayload, 1) err = handler.HandleUserMessage(ctx, msg, responseCh) if err != nil { - return newError(g.codec, msg.Body.MessageId, api.InternalHandlerError, err.Error()) + return newError(g.codec, msg.Body.MessageId, api.HandlerError, err.Error()) } // await response var response handlers.UserCallbackPayload diff --git a/core/services/gateway/gateway_test.go b/core/services/gateway/gateway_test.go index a2ee8f7a6c..5fad6315a3 100644 --- a/core/services/gateway/gateway_test.go +++ b/core/services/gateway/gateway_test.go @@ -242,6 +242,6 @@ func TestGateway_ProcessRequest_HandlerError(t *testing.T) { req := newSignedRequest(t, "abcd", "request", "testDON", []byte{}) response, statusCode := gw.ProcessRequest(testutils.Context(t), req) - requireJsonRPCError(t, response, "abcd", -32000, "failure") - require.Equal(t, 500, statusCode) + requireJsonRPCError(t, response, "abcd", -32600, "failure") + require.Equal(t, 400, statusCode) } From 5570d5a558f18aacc5d5e0d511c0235db9bb4925 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Thu, 14 Sep 2023 16:35:40 -0400 Subject: [PATCH 12/26] Allow workflow to be dispatched (#10651) --- .github/workflows/build-publish-develop.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-publish-develop.yml b/.github/workflows/build-publish-develop.yml index 22f9ce81f7..4384956da3 100644 --- a/.github/workflows/build-publish-develop.yml +++ b/.github/workflows/build-publish-develop.yml @@ -1,9 +1,16 @@ -name: 'Push develop to private ECR' +name: "Push develop to private ECR" on: push: branches: - develop + workflow_dispatch: + inputs: + git_ref: + description: "Git ref (commit SHA, branch name, tag name, etc.) to checkout" + required: true +env: + GIT_REF: ${{ github.event.inputs.git_ref || github.ref }} jobs: push-chainlink-develop: @@ -25,7 +32,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 - + with: + ref: ${{ env.GIT_REF }} - name: Build, sign and publish chainlink image uses: ./.github/actions/build-sign-publish-chainlink with: From d407306e50c53c640be73ecc79613f7c5bf538ee Mon Sep 17 00:00:00 2001 From: Tate Date: Thu, 14 Sep 2023 14:48:51 -0600 Subject: [PATCH 13/26] [TT-591] Parallel Test Logging E2E Fixes (#10610) * [TT-591] Fix E2E Test Logging In Parallel Tests * triage why logs are not getting the correct test struct * More logging missing in parallel e2e tests * More improvements to the logging * merge conflict fixes * Cover more missing cases * More and cleanup * Bump ctf and merge conflict fixes --- integration-tests/actions/actions.go | 5 +- .../actions/automation_ocr_helpers.go | 6 +- .../actions/automation_ocr_helpers_local.go | 33 ++--- integration-tests/actions/keeper_helpers.go | 14 +- .../actions/keeper_helpers_local.go | 13 +- integration-tests/actions/ocr2_helpers.go | 4 +- .../ocr2vrf_actions/ocr2vrf_config_helpers.go | 8 +- .../actions/ocr2vrf_actions/ocr2vrf_steps.go | 10 +- integration-tests/actions/ocr_helpers.go | 4 +- .../actions/ocr_helpers_local.go | 5 +- .../actions/operator_forwarder_helpers.go | 8 +- integration-tests/benchmark/keeper_test.go | 9 +- .../chaos/automation_chaos_test.go | 11 +- integration-tests/chaos/ocr2vrf_chaos_test.go | 10 +- integration-tests/chaos/ocr_chaos_test.go | 10 +- integration-tests/client/chainlink.go | 136 +++++++++--------- .../contracts/contract_deployer.go | 34 +++-- .../contracts/contract_loader.go | 22 +-- .../contracts/ethereum_contracts.go | 56 +++++--- .../contracts/ethereum_keeper_contracts.go | 44 +++--- integration-tests/docker/test_env/cl_node.go | 30 +++- integration-tests/docker/test_env/test_env.go | 42 ++++-- .../docker/test_env/test_env_builder.go | 29 +++- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- integration-tests/load/functions/setup.go | 6 +- .../migration/upgrade_version_test.go | 4 +- .../performance/directrequest_test.go | 9 +- integration-tests/performance/flux_test.go | 13 +- integration-tests/performance/keeper_test.go | 10 +- integration-tests/performance/ocr_test.go | 11 +- integration-tests/performance/vrf_test.go | 9 +- .../reorg/automation_reorg_test.go | 10 +- integration-tests/reorg/reorg_test.go | 5 +- integration-tests/smoke/automation_test.go | 28 ++-- integration-tests/smoke/cron_test.go | 5 +- integration-tests/smoke/flux_test.go | 9 +- integration-tests/smoke/forwarder_ocr_test.go | 11 +- .../smoke/forwarders_ocr2_test.go | 11 +- integration-tests/smoke/keeper_test.go | 51 ++++--- integration-tests/smoke/ocr2_test.go | 10 +- integration-tests/smoke/ocr2vrf_test.go | 16 +-- integration-tests/smoke/ocr_test.go | 9 +- integration-tests/smoke/runlog_test.go | 5 +- integration-tests/smoke/vrf_test.go | 5 +- integration-tests/smoke/vrfv2_test.go | 5 +- integration-tests/smoke/vrfv2plus_test.go | 5 +- integration-tests/soak/forwarder_ocr_test.go | 4 +- integration-tests/soak/ocr_test.go | 4 +- integration-tests/testsetups/don_evm_chain.go | 9 +- .../testsetups/keeper_benchmark.go | 15 +- integration-tests/testsetups/ocr.go | 35 +++-- integration-tests/testsetups/vrfv2.go | 4 +- 53 files changed, 498 insertions(+), 369 deletions(-) diff --git a/integration-tests/actions/actions.go b/integration-tests/actions/actions.go index 82187fd0cb..e37c3738ff 100644 --- a/integration-tests/actions/actions.go +++ b/integration-tests/actions/actions.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/testreporters" "github.com/smartcontractkit/chainlink-testing-framework/utils" @@ -251,7 +252,7 @@ func TeardownSuite( failingLogLevel zapcore.Level, // Examines logs after the test, and fails the test if any Chainlink logs are found at or above provided level clients ...blockchain.EVMClient, ) error { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) if err := testreporters.WriteTeardownLogs(t, env, optionalTestReporter, failingLogLevel); err != nil { return errors.Wrap(err, "Error dumping environment logs, leaving environment running for manual retrieval") } @@ -295,7 +296,7 @@ func TeardownRemoteSuite( optionalTestReporter testreporters.TestReporter, // Optionally pass in a test reporter to log further metrics client blockchain.EVMClient, ) error { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var err error if err = testreporters.SendReport(t, namespace, "./", optionalTestReporter); err != nil { l.Warn().Err(err).Msg("Error writing test report") diff --git a/integration-tests/actions/automation_ocr_helpers.go b/integration-tests/actions/automation_ocr_helpers.go index bfea6ec302..fb94d6109b 100644 --- a/integration-tests/actions/automation_ocr_helpers.go +++ b/integration-tests/actions/automation_ocr_helpers.go @@ -13,7 +13,7 @@ import ( "github.com/lib/pq" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -48,7 +48,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndex( deltaStage time.Duration, keyIndex int, ) (contracts.OCRv2Config, error) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndex(chainlinkNodes, keyIndex) if err != nil { return contracts.OCRv2Config{}, err @@ -172,7 +172,7 @@ func CreateOCRKeeperJobs( keyIndex int, registryVersion ethereum.KeeperRegistryVersion, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) bootstrapNode := chainlinkNodes[0] bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() require.NoError(t, err, "Shouldn't fail reading P2P keys from bootstrap node") diff --git a/integration-tests/actions/automation_ocr_helpers_local.go b/integration-tests/actions/automation_ocr_helpers_local.go index dce55e4227..86738b0247 100644 --- a/integration-tests/actions/automation_ocr_helpers_local.go +++ b/integration-tests/actions/automation_ocr_helpers_local.go @@ -4,17 +4,14 @@ package actions import ( "encoding/json" "fmt" - "testing" "time" "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" "github.com/pkg/errors" - "github.com/rs/zerolog/log" - "github.com/stretchr/testify/require" + "github.com/rs/zerolog" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" @@ -30,24 +27,23 @@ import ( ) func BuildAutoOCR2ConfigVarsLocal( - t *testing.T, + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, registryConfig contracts.KeeperRegistrySettings, registrar string, deltaStage time.Duration, ) (contracts.OCRv2Config, error) { - return BuildAutoOCR2ConfigVarsWithKeyIndexLocal(t, chainlinkNodes, registryConfig, registrar, deltaStage, 0) + return BuildAutoOCR2ConfigVarsWithKeyIndexLocal(l, chainlinkNodes, registryConfig, registrar, deltaStage, 0) } func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( - t *testing.T, + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, registryConfig contracts.KeeperRegistrySettings, registrar string, deltaStage time.Duration, keyIndex int, ) (contracts.OCRv2Config, error) { - l := utils.GetTestLogger(t) S, oracleIdentities, err := GetOracleIdentitiesWithKeyIndexLocal(chainlinkNodes, keyIndex) if err != nil { return contracts.OCRv2Config{}, err @@ -136,13 +132,17 @@ func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( var signers []common.Address for _, signer := range signerOnchainPublicKeys { - require.Equal(t, 20, len(signer), "OnChainPublicKey '%v' has wrong length for address", signer) + if len(signer) != 20 { + return contracts.OCRv2Config{}, fmt.Errorf("OnChainPublicKey '%v' has wrong length for address", signer) + } signers = append(signers, common.BytesToAddress(signer)) } var transmitters []common.Address for _, transmitter := range transmitterAccounts { - require.True(t, common.IsHexAddress(string(transmitter)), "TransmitAccount '%s' is not a valid Ethereum address", string(transmitter)) + if !common.IsHexAddress(string(transmitter)) { + return contracts.OCRv2Config{}, fmt.Errorf("TransmitAccount '%s' is not a valid Ethereum address", string(transmitter)) + } transmitters = append(transmitters, common.HexToAddress(string(transmitter))) } @@ -164,6 +164,7 @@ func BuildAutoOCR2ConfigVarsWithKeyIndexLocal( // CreateOCRKeeperJobs bootstraps the first node and to the other nodes sends ocr jobs func CreateOCRKeeperJobsLocal( + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, registryAddr string, chainID int64, @@ -173,7 +174,7 @@ func CreateOCRKeeperJobsLocal( bootstrapNode := chainlinkNodes[0] bootstrapP2PIds, err := bootstrapNode.MustReadP2PKeys() if err != nil { - log.Error().Err(err).Msg("Shouldn't fail reading P2P keys from bootstrap node") + l.Error().Err(err).Msg("Shouldn't fail reading P2P keys from bootstrap node") return err } bootstrapP2PId := bootstrapP2PIds.Data[0].Attributes.PeerID @@ -201,7 +202,7 @@ func CreateOCRKeeperJobsLocal( } _, err = bootstrapNode.MustCreateJob(bootstrapSpec) if err != nil { - log.Error().Err(err).Msg("Shouldn't fail creating bootstrap job on bootstrap node") + l.Error().Err(err).Msg("Shouldn't fail creating bootstrap job on bootstrap node") return err } @@ -209,12 +210,12 @@ func CreateOCRKeeperJobsLocal( for nodeIndex := 1; nodeIndex < len(chainlinkNodes); nodeIndex++ { nodeTransmitterAddress, err := chainlinkNodes[nodeIndex].EthAddresses() if err != nil { - log.Error().Err(err).Msgf("Shouldn't fail getting primary ETH address from OCR node %d", nodeIndex+1) + l.Error().Err(err).Msgf("Shouldn't fail getting primary ETH address from OCR node %d", nodeIndex+1) return err } nodeOCRKeys, err := chainlinkNodes[nodeIndex].MustReadOCR2Keys() if err != nil { - log.Error().Err(err).Msgf("Shouldn't fail getting OCR keys from OCR node %d", nodeIndex+1) + l.Error().Err(err).Msgf("Shouldn't fail getting OCR keys from OCR node %d", nodeIndex+1) return err } var nodeOCRKeyId []string @@ -248,11 +249,11 @@ func CreateOCRKeeperJobsLocal( _, err = chainlinkNodes[nodeIndex].MustCreateJob(&autoOCR2JobSpec) if err != nil { - log.Error().Err(err).Msgf("Shouldn't fail creating OCR Task job on OCR node %d err: %+v", nodeIndex+1, err) + l.Error().Err(err).Msgf("Shouldn't fail creating OCR Task job on OCR node %d err: %+v", nodeIndex+1, err) return err } } - log.Info().Msg("Done creating OCR automation jobs") + l.Info().Msg("Done creating OCR automation jobs") return nil } diff --git a/integration-tests/actions/keeper_helpers.go b/integration-tests/actions/keeper_helpers.go index dfe2acbbed..f824e75019 100644 --- a/integration-tests/actions/keeper_helpers.go +++ b/integration-tests/actions/keeper_helpers.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" @@ -339,7 +339,7 @@ func RegisterUpkeepContracts(t *testing.T, linkToken contracts.LinkToken, linkFu } func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.LinkToken, linkFunds *big.Int, client blockchain.EVMClient, upkeepGasLimit uint32, registry contracts.KeeperRegistry, registrar contracts.KeeperRegistrar, numberOfContracts int, upkeepAddresses []string, checkData [][]byte, isLogTrigger bool) []*big.Int { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) registrationTxHashes := make([]common.Hash, 0) upkeepIds := make([]*big.Int, 0) for contractCount, upkeepAddress := range upkeepAddresses { @@ -398,7 +398,7 @@ func RegisterUpkeepContractsWithCheckData(t *testing.T, linkToken contracts.Link } func DeployKeeperConsumers(t *testing.T, contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, numberOfContracts int, isLogTrigger bool) []contracts.KeeperConsumer { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) keeperConsumerContracts := make([]contracts.KeeperConsumer, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -441,7 +441,7 @@ func DeployKeeperConsumersPerformance( checkGasToBurn, // How much gas should be burned on checkUpkeep() calls performGasToBurn int64, // How much gas should be burned on performUpkeep() calls ) []contracts.KeeperConsumerPerformance { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeeps := make([]contracts.KeeperConsumerPerformance, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -478,7 +478,7 @@ func DeployPerformDataChecker( numberOfContracts int, expectedData []byte, ) []contracts.KeeperPerformDataChecker { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeeps := make([]contracts.KeeperPerformDataChecker, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -510,7 +510,7 @@ func DeployUpkeepCounters( testRange *big.Int, interval *big.Int, ) []contracts.UpkeepCounter { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeepCounters := make([]contracts.UpkeepCounter, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { @@ -543,7 +543,7 @@ func DeployUpkeepPerformCounterRestrictive( testRange *big.Int, averageEligibilityCadence *big.Int, ) []contracts.UpkeepPerformCounterRestrictive { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) upkeepCounters := make([]contracts.UpkeepPerformCounterRestrictive, 0) for contractCount := 0; contractCount < numberOfContracts; contractCount++ { diff --git a/integration-tests/actions/keeper_helpers_local.go b/integration-tests/actions/keeper_helpers_local.go index ade1ab7f1a..d9d15b33a3 100644 --- a/integration-tests/actions/keeper_helpers_local.go +++ b/integration-tests/actions/keeper_helpers_local.go @@ -3,13 +3,14 @@ package actions import ( "fmt" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" ) func CreateKeeperJobsLocal( + l zerolog.Logger, chainlinkNodes []*client.ChainlinkClient, keeperRegistry contracts.KeeperRegistry, ocrConfig contracts.OCRv2Config, @@ -19,12 +20,12 @@ func CreateKeeperJobsLocal( primaryNode := chainlinkNodes[0] primaryNodeAddress, err := primaryNode.PrimaryEthAddress() if err != nil { - log.Error().Err(err).Msg("Reading ETH Keys from Chainlink Client shouldn't fail") + l.Error().Err(err).Msg("Reading ETH Keys from Chainlink Client shouldn't fail") return nil, err } nodeAddresses, err := ChainlinkNodeAddressesLocal(chainlinkNodes) if err != nil { - log.Error().Err(err).Msg("Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") + l.Error().Err(err).Msg("Retrieving on-chain wallet addresses for chainlink nodes shouldn't fail") return nil, err } nodeAddressesStr, payees := make([]string, 0), make([]string, 0) @@ -34,14 +35,14 @@ func CreateKeeperJobsLocal( } err = keeperRegistry.SetKeepers(nodeAddressesStr, payees, ocrConfig) if err != nil { - log.Error().Err(err).Msg("Setting keepers in the registry shouldn't fail") + l.Error().Err(err).Msg("Setting keepers in the registry shouldn't fail") return nil, err } jobs := []*client.Job{} for _, chainlinkNode := range chainlinkNodes { chainlinkNodeAddress, err := chainlinkNode.PrimaryEthAddress() if err != nil { - log.Error().Err(err).Msg("Error retrieving chainlink node address") + l.Error().Err(err).Msg("Error retrieving chainlink node address") return nil, err } job, err := chainlinkNode.MustCreateJob(&client.KeeperJobSpec{ @@ -52,7 +53,7 @@ func CreateKeeperJobsLocal( MinIncomingConfirmations: 1, }) if err != nil { - log.Error().Err(err).Msg("Creating KeeperV2 Job shouldn't fail") + l.Error().Err(err).Msg("Creating KeeperV2 Job shouldn't fail") return nil, err } jobs = append(jobs, job) diff --git a/integration-tests/actions/ocr2_helpers.go b/integration-tests/actions/ocr2_helpers.go index 3c37233a0d..293ea2b73c 100644 --- a/integration-tests/actions/ocr2_helpers.go +++ b/integration-tests/actions/ocr2_helpers.go @@ -10,6 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/lib/pq" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/sync/errgroup" "gopkg.in/guregu/null.v4" @@ -360,13 +361,14 @@ func StartNewOCR2Round( ocrInstances []contracts.OffchainAggregatorV2, client blockchain.EVMClient, timeout time.Duration, + logger zerolog.Logger, ) error { for i := 0; i < len(ocrInstances); i++ { err := ocrInstances[i].RequestNewRound() if err != nil { return fmt.Errorf("requesting new OCR round %d have failed: %w", i+1, err) } - ocrRound := contracts.NewOffchainAggregatorV2RoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), timeout) + ocrRound := contracts.NewOffchainAggregatorV2RoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), timeout, logger) client.AddHeaderEventSubscription(ocrInstances[i].Address(), ocrRound) err = client.WaitForEvents() if err != nil { diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go index 05b983c2f1..ce69396432 100644 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go +++ b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_config_helpers.go @@ -16,7 +16,7 @@ import ( "go.dedis.ch/kyber/v3/group/edwards25519" "gopkg.in/guregu/null.v4" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/services/job" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" @@ -39,7 +39,7 @@ func CreateOCR2VRFJobs( chainID int64, keyIndex int, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) p2pV2Bootstrapper := createBootstrapJob(t, bootstrapNode, OCR2VRFPluginConfig.DKGConfig.DKGContractAddress, chainID) createNonBootstrapJobs(t, nonBootstrapNodes, OCR2VRFPluginConfig, chainID, keyIndex, p2pV2Bootstrapper) @@ -120,7 +120,7 @@ func BuildOCR2DKGConfigVars( t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, ) contracts.OCRv2Config { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var onchainPublicKeys []common.Address for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) @@ -272,7 +272,7 @@ func BuildOCR2VRFConfigVars( t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, ) contracts.OCRv2Config { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var onchainPublicKeys []common.Address for _, onchainPublicKey := range ocr2VRFPluginConfig.OCR2Config.OnchainPublicKeys { onchainPublicKeys = append(onchainPublicKeys, common.HexToAddress(onchainPublicKey)) diff --git a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go index c550fe73a2..c123aaff6a 100644 --- a/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go +++ b/integration-tests/actions/ocr2vrf_actions/ocr2vrf_steps.go @@ -13,7 +13,7 @@ import ( ocr2vrftypes "github.com/smartcontractkit/ocr2vrf/types" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" chainlinkutils "github.com/smartcontractkit/chainlink/v2/core/utils" @@ -25,7 +25,7 @@ import ( ) func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, vrfBeacon contracts.VRFBeacon) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) ocr2VrfConfig := BuildOCR2VRFConfigVars(t, ocr2VRFPluginConfig) l.Debug().Interface("OCR2 VRF Config", ocr2VrfConfig).Msg("OCR2 VRF Config prepared") @@ -45,7 +45,7 @@ func SetAndWaitForVRFBeaconProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OC } func SetAndWaitForDKGProcessToFinish(t *testing.T, ocr2VRFPluginConfig *OCR2VRFPluginConfig, dkg contracts.DKG) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) ocr2DkgConfig := BuildOCR2DKGConfigVars(t, ocr2VRFPluginConfig) // set config for DKG OCR @@ -208,7 +208,7 @@ func RequestAndRedeemRandomness( confirmationDelay *big.Int, randomnessTransmissionEventTimeout time.Duration, ) *big.Int { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) receipt, err := consumer.RequestRandomness( numberOfRandomWordsToRequest, subscriptionID, @@ -244,7 +244,7 @@ func RequestRandomnessFulfillmentAndWaitForFulfilment( confirmationDelay *big.Int, randomnessTransmissionEventTimeout time.Duration, ) *big.Int { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) receipt, err := consumer.RequestRandomnessFulfillment( numberOfRandomWordsToRequest, subscriptionID, diff --git a/integration-tests/actions/ocr_helpers.go b/integration-tests/actions/ocr_helpers.go index edef393027..cfc8cfe589 100644 --- a/integration-tests/actions/ocr_helpers.go +++ b/integration-tests/actions/ocr_helpers.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" "golang.org/x/sync/errgroup" @@ -326,13 +327,14 @@ func StartNewRound( roundNumber int64, ocrInstances []contracts.OffchainAggregator, client blockchain.EVMClient, + logger zerolog.Logger, ) error { for i := 0; i < len(ocrInstances); i++ { err := ocrInstances[i].RequestNewRound() if err != nil { return fmt.Errorf("requesting new OCR round %d have failed: %w", i+1, err) } - ocrRound := contracts.NewOffchainAggregatorRoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), client.GetNetworkConfig().Timeout.Duration) + ocrRound := contracts.NewOffchainAggregatorRoundConfirmer(ocrInstances[i], big.NewInt(roundNumber), client.GetNetworkConfig().Timeout.Duration, logger) client.AddHeaderEventSubscription(ocrInstances[i].Address(), ocrRound) err = client.WaitForEvents() if err != nil { diff --git a/integration-tests/actions/ocr_helpers_local.go b/integration-tests/actions/ocr_helpers_local.go index 33d6498b9e..ae2f3686da 100644 --- a/integration-tests/actions/ocr_helpers_local.go +++ b/integration-tests/actions/ocr_helpers_local.go @@ -9,7 +9,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/google/uuid" "github.com/pkg/errors" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" "golang.org/x/sync/errgroup" @@ -271,13 +271,14 @@ func TrackForwarderLocal( chainClient blockchain.EVMClient, authorizedForwarder common.Address, node *client.ChainlinkClient, + logger zerolog.Logger, ) error { chainID := chainClient.GetChainID() _, _, err := node.TrackForwarder(chainID, authorizedForwarder) if err != nil { return errors.Wrap(err, "failed to track forwarder") } - log.Info().Str("NodeURL", node.Config.URL). + logger.Info().Str("NodeURL", node.Config.URL). Str("ForwarderAddress", authorizedForwarder.Hex()). Str("ChaindID", chainID.String()). Msg("Forwarder tracked") diff --git a/integration-tests/actions/operator_forwarder_helpers.go b/integration-tests/actions/operator_forwarder_helpers.go index 7add64fbe9..37b50c4fa9 100644 --- a/integration-tests/actions/operator_forwarder_helpers.go +++ b/integration-tests/actions/operator_forwarder_helpers.go @@ -12,7 +12,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/operator_factory" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -91,7 +91,7 @@ func ProcessNewEvent( contractABI *abi.ABI, chainClient blockchain.EVMClient, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) errorChan := make(chan error) eventConfirmed := make(chan bool) err := chainClient.ProcessEvent(eventDetails.Name, event, eventConfirmed, errorChan) @@ -138,7 +138,7 @@ func SubscribeOperatorFactoryEvents( chainClient blockchain.EVMClient, operatorFactoryInstance contracts.OperatorFactory, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) contractABI, err := operator_factory.OperatorFactoryMetaData.GetAbi() require.NoError(t, err, "Getting contract abi for OperatorFactory shouldn't fail") latestBlockNum, err := chainClient.LatestBlockNumber(context.Background()) @@ -186,7 +186,7 @@ func TrackForwarder( authorizedForwarder common.Address, node *client.ChainlinkK8sClient, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainID := chainClient.GetChainID() _, _, err := node.TrackForwarder(chainID, authorizedForwarder) require.NoError(t, err, "Forwarder track should be created") diff --git a/integration-tests/benchmark/keeper_test.go b/integration-tests/benchmark/keeper_test.go index fbabfab78c..59406e5158 100644 --- a/integration-tests/benchmark/keeper_test.go +++ b/integration-tests/benchmark/keeper_test.go @@ -18,8 +18,7 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-env/pkg/helm/reorg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -142,7 +141,7 @@ type NetworkConfig struct { } func TestAutomationBenchmark(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, benchmarkNetwork := SetupAutomationBenchmarkEnv(t) if testEnvironment.WillUseRemoteRunner() { return @@ -154,7 +153,7 @@ func TestAutomationBenchmark(t *testing.T) { l.Info().Str("Namespace", testEnvironment.Cfg.Namespace).Msg("Connected to Keepers Benchmark Environment") - chainClient, err := blockchain.NewEVMClient(benchmarkNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(benchmarkNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") registryVersions := addRegistry(RegistryToTest) keeperBenchmarkTest := testsetups.NewKeeperBenchmarkTest( @@ -299,7 +298,7 @@ func getEnv(key, fallback string) string { } func SetupAutomationBenchmarkEnv(t *testing.T) (*environment.Environment, blockchain.EVMNetwork) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testNetwork := networks.SelectedNetwork // Environment currently being used to run benchmark test on blockTime := "1" networkDetailTOML := `MinIncomingConfirmations = 1` diff --git a/integration-tests/chaos/automation_chaos_test.go b/integration-tests/chaos/automation_chaos_test.go index bb7fe1b8f0..1b18b9f6ab 100644 --- a/integration-tests/chaos/automation_chaos_test.go +++ b/integration-tests/chaos/automation_chaos_test.go @@ -18,9 +18,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -109,7 +109,7 @@ const ( func TestAutomationChaos(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testCases := map[string]struct { networkChart environment.ConnectedChart @@ -201,10 +201,11 @@ func TestAutomationChaos(t *testing.T) { err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 2, 5, ChaosGroupMajorityPlus) require.NoError(t, err) - chainClient, err := blockchain.NewEVMClient(network, testEnvironment) + chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") + chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") chainClient.ParallelTransactions(true) diff --git a/integration-tests/chaos/ocr2vrf_chaos_test.go b/integration-tests/chaos/ocr2vrf_chaos_test.go index 91c9084d40..fd51fa55db 100644 --- a/integration-tests/chaos/ocr2vrf_chaos_test.go +++ b/integration-tests/chaos/ocr2vrf_chaos_test.go @@ -16,9 +16,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions" @@ -30,7 +30,7 @@ import ( func TestOCR2VRFChaos(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) loadedNetwork := networks.SelectedNetwork defaultOCR2VRFSettings := map[string]interface{}{ @@ -140,9 +140,9 @@ func TestOCR2VRFChaos(t *testing.T) { err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 3, 5, ChaosGroupMajority) require.NoError(t, err) - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/chaos/ocr_chaos_test.go b/integration-tests/chaos/ocr_chaos_test.go index d765cafb9e..569a0d1b70 100644 --- a/integration-tests/chaos/ocr_chaos_test.go +++ b/integration-tests/chaos/ocr_chaos_test.go @@ -20,9 +20,9 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -59,7 +59,7 @@ func TestMain(m *testing.M) { func TestOCRChaos(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testCases := map[string]struct { networkChart environment.ConnectedChart clChart environment.ConnectedChart @@ -153,9 +153,9 @@ func TestOCRChaos(t *testing.T) { err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 2, 5, ChaosGroupMajorityPlus) require.NoError(t, err) - chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - cd, err := contracts.NewContractDeployer(chainClient) + cd, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) diff --git a/integration-tests/client/chainlink.go b/integration-tests/client/chainlink.go index 7d3bd0284d..8a79cb3ec9 100644 --- a/integration-tests/client/chainlink.go +++ b/integration-tests/client/chainlink.go @@ -9,11 +9,13 @@ import ( "sync" "time" + "os" + "github.com/ethereum/go-ethereum/common" "github.com/go-resty/resty/v2" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "golang.org/x/sync/errgroup" - "os" ) const ( @@ -39,10 +41,11 @@ type ChainlinkClient struct { pageSize int primaryEthAddress string ethAddresses []string + l zerolog.Logger } // NewChainlinkClient creates a new Chainlink model using a provided config -func NewChainlinkClient(c *ChainlinkConfig) (*ChainlinkClient, error) { +func NewChainlinkClient(c *ChainlinkConfig, logger zerolog.Logger) (*ChainlinkClient, error) { rc, err := initRestyClient(c.URL, c.Email, c.Password, c.HTTPTimeout) if err != nil { return nil, err @@ -55,6 +58,7 @@ func NewChainlinkClient(c *ChainlinkConfig) (*ChainlinkClient, error) { Config: c, APIClient: rc, pageSize: 25, + l: logger, }, nil } @@ -92,8 +96,8 @@ func (c *ChainlinkClient) URL() string { // CreateJobRaw creates a Chainlink job based on the provided spec string func (c *ChainlinkClient) CreateJobRaw(spec string) (*Job, *http.Response, error) { job := &Job{} - log.Info().Str("Node URL", c.Config.URL).Msg("Creating Job") - log.Trace().Str("Node URL", c.Config.URL).Str("Job Body", spec).Msg("Creating Job") + c.l.Info().Str("Node URL", c.Config.URL).Msg("Creating Job") + c.l.Trace().Str("Node URL", c.Config.URL).Str("Job Body", spec).Msg("Creating Job") resp, err := c.APIClient.R(). SetBody(&JobForm{ TOML: spec, @@ -123,8 +127,8 @@ func (c *ChainlinkClient) CreateJob(spec JobSpec) (*Job, *http.Response, error) if err != nil { return nil, nil, err } - log.Info().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Msg("Creating Job") - log.Trace().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Str("Spec", specString).Msg("Creating Job") + c.l.Info().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Msg("Creating Job") + c.l.Trace().Str("Node URL", c.Config.URL).Str("Type", spec.Type()).Str("Spec", specString).Msg("Creating Job") resp, err := c.APIClient.R(). SetBody(&JobForm{ TOML: specString, @@ -140,7 +144,7 @@ func (c *ChainlinkClient) CreateJob(spec JobSpec) (*Job, *http.Response, error) // ReadJobs reads all jobs from the Chainlink node func (c *ChainlinkClient) ReadJobs() (*ResponseSlice, *http.Response, error) { specObj := &ResponseSlice{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Getting Jobs") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Getting Jobs") resp, err := c.APIClient.R(). SetResult(&specObj). Get("/v2/jobs") @@ -153,7 +157,7 @@ func (c *ChainlinkClient) ReadJobs() (*ResponseSlice, *http.Response, error) { // ReadJob reads a job with the provided ID from the Chainlink node func (c *ChainlinkClient) ReadJob(id string) (*Response, *http.Response, error) { specObj := &Response{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Job") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Job") resp, err := c.APIClient.R(). SetResult(&specObj). SetPathParams(map[string]string{ @@ -178,7 +182,7 @@ func (c *ChainlinkClient) MustDeleteJob(id string) error { // DeleteJob deletes a job with a provided ID from the Chainlink node func (c *ChainlinkClient) DeleteJob(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Job") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Job") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -194,7 +198,7 @@ func (c *ChainlinkClient) DeleteJob(id string) (*http.Response, error) { func (c *ChainlinkClient) CreateSpec(spec string) (*Spec, *http.Response, error) { s := &Spec{} r := strings.NewReplacer("\n", "", " ", "", "\\", "") // Makes it more compact and readable for logging - log.Info().Str(NodeURL, c.Config.URL).Str("Spec", r.Replace(spec)).Msg("Creating Spec") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Spec", r.Replace(spec)).Msg("Creating Spec") resp, err := c.APIClient.R(). SetBody([]byte(spec)). SetResult(&s). @@ -208,7 +212,7 @@ func (c *ChainlinkClient) CreateSpec(spec string) (*Spec, *http.Response, error) // ReadSpec reads a job spec with the provided ID on the Chainlink node func (c *ChainlinkClient) ReadSpec(id string) (*Response, *http.Response, error) { specObj := &Response{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Spec") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Reading Spec") resp, err := c.APIClient.R(). SetResult(&specObj). SetPathParams(map[string]string{ @@ -234,7 +238,7 @@ func (c *ChainlinkClient) MustReadRunsByJob(jobID string) (*JobRunsResponse, err // ReadRunsByJob reads all runs for a job func (c *ChainlinkClient) ReadRunsByJob(jobID string) (*JobRunsResponse, *http.Response, error) { runsObj := &JobRunsResponse{} - log.Debug().Str(NodeURL, c.Config.URL).Str("JobID", jobID).Msg("Reading runs for a job") + c.l.Debug().Str(NodeURL, c.Config.URL).Str("JobID", jobID).Msg("Reading runs for a job") resp, err := c.APIClient.R(). SetResult(&runsObj). SetPathParams(map[string]string{ @@ -249,7 +253,7 @@ func (c *ChainlinkClient) ReadRunsByJob(jobID string) (*JobRunsResponse, *http.R // DeleteSpec deletes a job spec with the provided ID from the Chainlink node func (c *ChainlinkClient) DeleteSpec(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Spec") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Spec") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -272,7 +276,7 @@ func (c *ChainlinkClient) MustCreateBridge(bta *BridgeTypeAttributes) error { } func (c *ChainlinkClient) CreateBridge(bta *BridgeTypeAttributes) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("Name", bta.Name).Msg("Creating Bridge") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", bta.Name).Msg("Creating Bridge") resp, err := c.APIClient.R(). SetBody(bta). Post("/v2/bridge_types") @@ -285,7 +289,7 @@ func (c *ChainlinkClient) CreateBridge(bta *BridgeTypeAttributes) (*http.Respons // ReadBridge reads a bridge from the Chainlink node based on the provided name func (c *ChainlinkClient) ReadBridge(name string) (*BridgeType, *http.Response, error) { bt := BridgeType{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Reading Bridge") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Reading Bridge") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "name": name, @@ -300,7 +304,7 @@ func (c *ChainlinkClient) ReadBridge(name string) (*BridgeType, *http.Response, // DeleteBridge deletes a bridge on the Chainlink node based on the provided name func (c *ChainlinkClient) DeleteBridge(name string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting Bridge") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting Bridge") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "name": name, @@ -315,7 +319,7 @@ func (c *ChainlinkClient) DeleteBridge(name string) (*http.Response, error) { // CreateOCRKey creates an OCRKey on the Chainlink node func (c *ChainlinkClient) CreateOCRKey() (*OCRKey, *http.Response, error) { ocrKey := &OCRKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR Key") resp, err := c.APIClient.R(). SetResult(ocrKey). Post("/v2/keys/ocr") @@ -329,7 +333,7 @@ func (c *ChainlinkClient) CreateOCRKey() (*OCRKey, *http.Response, error) { // the request is unsuccessful func (c *ChainlinkClient) MustReadOCRKeys() (*OCRKeys, error) { ocrKeys := &OCRKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR Keys") resp, err := c.APIClient.R(). SetResult(ocrKeys). Get("/v2/keys/ocr") @@ -350,7 +354,7 @@ func (c *ChainlinkClient) MustReadOCRKeys() (*OCRKeys, error) { // DeleteOCRKey deletes an OCRKey based on the provided ID func (c *ChainlinkClient) DeleteOCRKey(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -365,7 +369,7 @@ func (c *ChainlinkClient) DeleteOCRKey(id string) (*http.Response, error) { // CreateOCR2Key creates an OCR2Key on the Chainlink node func (c *ChainlinkClient) CreateOCR2Key(chain string) (*OCR2Key, *http.Response, error) { ocr2Key := &OCR2Key{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR2 Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating OCR2 Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -381,7 +385,7 @@ func (c *ChainlinkClient) CreateOCR2Key(chain string) (*OCR2Key, *http.Response, // ReadOCR2Keys reads all OCR2Keys from the Chainlink node func (c *ChainlinkClient) ReadOCR2Keys() (*OCR2Keys, *http.Response, error) { ocr2Keys := &OCR2Keys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") resp, err := c.APIClient.R(). SetResult(ocr2Keys). Get("/v2/keys/ocr2") @@ -391,7 +395,7 @@ func (c *ChainlinkClient) ReadOCR2Keys() (*OCR2Keys, *http.Response, error) { // MustReadOCR2Keys reads all OCR2Keys from the Chainlink node returns err if response not 200 func (c *ChainlinkClient) MustReadOCR2Keys() (*OCR2Keys, error) { ocr2Keys := &OCR2Keys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading OCR2 Keys") resp, err := c.APIClient.R(). SetResult(ocr2Keys). Get("/v2/keys/ocr2") @@ -404,7 +408,7 @@ func (c *ChainlinkClient) MustReadOCR2Keys() (*OCR2Keys, error) { // DeleteOCR2Key deletes an OCR2Key based on the provided ID func (c *ChainlinkClient) DeleteOCR2Key(id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR2 Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting OCR2 Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": id, @@ -419,7 +423,7 @@ func (c *ChainlinkClient) DeleteOCR2Key(id string) (*http.Response, error) { // CreateP2PKey creates an P2PKey on the Chainlink node func (c *ChainlinkClient) CreateP2PKey() (*P2PKey, *http.Response, error) { p2pKey := &P2PKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating P2P Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating P2P Key") resp, err := c.APIClient.R(). SetResult(p2pKey). Post("/v2/keys/p2p") @@ -433,7 +437,7 @@ func (c *ChainlinkClient) CreateP2PKey() (*P2PKey, *http.Response, error) { // the request is unsuccessful func (c *ChainlinkClient) MustReadP2PKeys() (*P2PKeys, error) { p2pKeys := &P2PKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading P2P Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading P2P Keys") resp, err := c.APIClient.R(). SetResult(p2pKeys). Get("/v2/keys/p2p") @@ -443,7 +447,7 @@ func (c *ChainlinkClient) MustReadP2PKeys() (*P2PKeys, error) { err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) if len(p2pKeys.Data) == 0 { err = fmt.Errorf("Found no P2P Keys on the Chainlink node. Node URL: %s", c.Config.URL) - log.Err(err).Msg("Error getting P2P keys") + c.l.Err(err).Msg("Error getting P2P keys") return nil, err } for index := range p2pKeys.Data { @@ -454,7 +458,7 @@ func (c *ChainlinkClient) MustReadP2PKeys() (*P2PKeys, error) { // DeleteP2PKey deletes a P2PKey on the Chainlink node based on the provided ID func (c *ChainlinkClient) DeleteP2PKey(id int) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Int("ID", id).Msg("Deleting P2P Key") + c.l.Info().Str(NodeURL, c.Config.URL).Int("ID", id).Msg("Deleting P2P Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "id": fmt.Sprint(id), @@ -470,7 +474,7 @@ func (c *ChainlinkClient) DeleteP2PKey(id int) (*http.Response, error) { // the request is unsuccessful func (c *ChainlinkClient) MustReadETHKeys() (*ETHKeys, error) { ethKeys := ÐKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading ETH Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading ETH Keys") resp, err := c.APIClient.R(). SetResult(ethKeys). Get("/v2/keys/eth") @@ -479,7 +483,7 @@ func (c *ChainlinkClient) MustReadETHKeys() (*ETHKeys, error) { } err = VerifyStatusCode(resp.StatusCode(), http.StatusOK) if len(ethKeys.Data) == 0 { - log.Warn().Str(NodeURL, c.Config.URL).Msg("Found no ETH Keys on the node") + c.l.Warn().Str(NodeURL, c.Config.URL).Msg("Found no ETH Keys on the node") } return ethKeys, err } @@ -487,7 +491,7 @@ func (c *ChainlinkClient) MustReadETHKeys() (*ETHKeys, error) { // UpdateEthKeyMaxGasPriceGWei updates the maxGasPriceGWei for an eth key func (c *ChainlinkClient) UpdateEthKeyMaxGasPriceGWei(keyId string, gWei int) (*ETHKey, *http.Response, error) { ethKey := ÐKey{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Int("maxGasPriceGWei", gWei).Msg("Update maxGasPriceGWei for eth key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Int("maxGasPriceGWei", gWei).Msg("Update maxGasPriceGWei for eth key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "keyId": keyId, @@ -608,7 +612,7 @@ func (c *ChainlinkClient) ExportEVMKeys() ([]*ExportedEVMKey, error) { exportedKeys = append(exportedKeys, exportedKey) } } - log.Info(). + c.l.Info(). Str(NodeURL, c.Config.URL). Str("Password", ChainlinkKeyPassword). Msg("Exported EVM Keys") @@ -636,7 +640,7 @@ func (c *ChainlinkClient) ExportEVMKeysForChain(chainid string) ([]*ExportedEVMK exportedKeys = append(exportedKeys, exportedKey) } } - log.Info(). + c.l.Info(). Str(NodeURL, c.Config.URL). Str("Password", ChainlinkKeyPassword). Msg("Exported EVM Keys") @@ -646,7 +650,7 @@ func (c *ChainlinkClient) ExportEVMKeysForChain(chainid string) ([]*ExportedEVMK // CreateTxKey creates a tx key on the Chainlink node func (c *ChainlinkClient) CreateTxKey(chain string, chainId string) (*TxKey, *http.Response, error) { txKey := &TxKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating Tx Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating Tx Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -663,7 +667,7 @@ func (c *ChainlinkClient) CreateTxKey(chain string, chainId string) (*TxKey, *ht // ReadTxKeys reads all tx keys from the Chainlink node func (c *ChainlinkClient) ReadTxKeys(chain string) (*TxKeys, *http.Response, error) { txKeys := &TxKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tx Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tx Keys") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -678,7 +682,7 @@ func (c *ChainlinkClient) ReadTxKeys(chain string) (*TxKeys, *http.Response, err // DeleteTxKey deletes an tx key based on the provided ID func (c *ChainlinkClient) DeleteTxKey(chain string, id string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Tx Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", id).Msg("Deleting Tx Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "chain": chain, @@ -695,7 +699,7 @@ func (c *ChainlinkClient) DeleteTxKey(chain string, id string) (*http.Response, // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustReadTransactionAttempts() (*TransactionsData, error) { txsData := &TransactionsData{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transaction Attempts") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transaction Attempts") resp, err := c.APIClient.R(). SetResult(txsData). Get("/v2/tx_attempts") @@ -709,7 +713,7 @@ func (c *ChainlinkClient) MustReadTransactionAttempts() (*TransactionsData, erro // ReadTransactions reads all transactions made by the Chainlink node func (c *ChainlinkClient) ReadTransactions() (*TransactionsData, *http.Response, error) { txsData := &TransactionsData{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transactions") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Transactions") resp, err := c.APIClient.R(). SetResult(txsData). Get("/v2/transactions") @@ -735,7 +739,7 @@ func (c *ChainlinkClient) MustSendNativeToken(amount *big.Int, fromAddress, toAd SetResult(txData). Post("/v2/transfers") - log.Info(). + c.l.Info(). Str(NodeURL, c.Config.URL). Str("From", fromAddress). Str("To", toAddress). @@ -751,7 +755,7 @@ func (c *ChainlinkClient) MustSendNativeToken(amount *big.Int, fromAddress, toAd // ReadVRFKeys reads all VRF keys from the Chainlink node func (c *ChainlinkClient) ReadVRFKeys() (*VRFKeys, *http.Response, error) { vrfKeys := &VRFKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading VRF Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading VRF Keys") resp, err := c.APIClient.R(). SetResult(vrfKeys). Get("/v2/keys/vrf") @@ -759,7 +763,7 @@ func (c *ChainlinkClient) ReadVRFKeys() (*VRFKeys, *http.Response, error) { return nil, nil, err } if len(vrfKeys.Data) == 0 { - log.Warn().Str(NodeURL, c.Config.URL).Msg("Found no VRF Keys on the node") + c.l.Warn().Str(NodeURL, c.Config.URL).Msg("Found no VRF Keys on the node") } return vrfKeys, resp.RawResponse, err } @@ -768,7 +772,7 @@ func (c *ChainlinkClient) ReadVRFKeys() (*VRFKeys, *http.Response, error) { // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustCreateVRFKey() (*VRFKey, error) { vrfKey := &VRFKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating VRF Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating VRF Key") resp, err := c.APIClient.R(). SetResult(vrfKey). Post("/v2/keys/vrf") @@ -781,7 +785,7 @@ func (c *ChainlinkClient) MustCreateVRFKey() (*VRFKey, error) { // ExportVRFKey exports a vrf key by key id func (c *ChainlinkClient) ExportVRFKey(keyId string) (*VRFExportKey, *http.Response, error) { vrfExportKey := &VRFExportKey{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Msg("Exporting VRF Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", keyId).Msg("Exporting VRF Key") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "keyId": keyId, @@ -797,7 +801,7 @@ func (c *ChainlinkClient) ExportVRFKey(keyId string) (*VRFExportKey, *http.Respo // ImportVRFKey import vrf key func (c *ChainlinkClient) ImportVRFKey(vrfExportKey *VRFExportKey) (*VRFKey, *http.Response, error) { vrfKey := &VRFKey{} - log.Info().Str(NodeURL, c.Config.URL).Str("ID", vrfExportKey.VrfKey.Address).Msg("Importing VRF Key") + c.l.Info().Str(NodeURL, c.Config.URL).Str("ID", vrfExportKey.VrfKey.Address).Msg("Importing VRF Key") resp, err := c.APIClient.R(). SetBody(vrfExportKey). SetResult(vrfKey). @@ -812,7 +816,7 @@ func (c *ChainlinkClient) ImportVRFKey(vrfExportKey *VRFExportKey) (*VRFKey, *ht // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustCreateDkgSignKey() (*DKGSignKey, error) { dkgSignKey := &DKGSignKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Sign Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Sign Key") resp, err := c.APIClient.R(). SetResult(dkgSignKey). Post("/v2/keys/dkgsign") @@ -826,7 +830,7 @@ func (c *ChainlinkClient) MustCreateDkgSignKey() (*DKGSignKey, error) { // and returns error if the request is unsuccessful func (c *ChainlinkClient) MustCreateDkgEncryptKey() (*DKGEncryptKey, error) { dkgEncryptKey := &DKGEncryptKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Encrypt Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating DKG Encrypt Key") resp, err := c.APIClient.R(). SetResult(dkgEncryptKey). Post("/v2/keys/dkgencrypt") @@ -839,7 +843,7 @@ func (c *ChainlinkClient) MustCreateDkgEncryptKey() (*DKGEncryptKey, error) { // MustReadDKGSignKeys reads all DKG Sign Keys from the Chainlink node returns err if response not 200 func (c *ChainlinkClient) MustReadDKGSignKeys() (*DKGSignKeys, error) { dkgSignKeys := &DKGSignKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Sign Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Sign Keys") resp, err := c.APIClient.R(). SetResult(dkgSignKeys). Get("/v2/keys/dkgsign") @@ -853,7 +857,7 @@ func (c *ChainlinkClient) MustReadDKGSignKeys() (*DKGSignKeys, error) { // MustReadDKGEncryptKeys reads all DKG Encrypt Keys from the Chainlink node returns err if response not 200 func (c *ChainlinkClient) MustReadDKGEncryptKeys() (*DKGEncryptKeys, error) { dkgEncryptKeys := &DKGEncryptKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Encrypt Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading DKG Encrypt Keys") resp, err := c.APIClient.R(). SetResult(dkgEncryptKeys). Get("/v2/keys/dkgencrypt") @@ -867,7 +871,7 @@ func (c *ChainlinkClient) MustReadDKGEncryptKeys() (*DKGEncryptKeys, error) { // CreateCSAKey creates a CSA key on the Chainlink node, only 1 CSA key per noe func (c *ChainlinkClient) CreateCSAKey() (*CSAKey, *http.Response, error) { csaKey := &CSAKey{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Creating CSA Key") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Creating CSA Key") resp, err := c.APIClient.R(). SetResult(csaKey). Post("/v2/keys/csa") @@ -880,12 +884,12 @@ func (c *ChainlinkClient) CreateCSAKey() (*CSAKey, *http.Response, error) { // ReadCSAKeys reads CSA keys from the Chainlink node func (c *ChainlinkClient) ReadCSAKeys() (*CSAKeys, *http.Response, error) { csaKeys := &CSAKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading CSA Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading CSA Keys") resp, err := c.APIClient.R(). SetResult(csaKeys). Get("/v2/keys/csa") if len(csaKeys.Data) == 0 { - log.Warn().Str(NodeURL, c.Config.URL).Msg("Found no CSA Keys on the node") + c.l.Warn().Str(NodeURL, c.Config.URL).Msg("Found no CSA Keys on the node") } if err != nil { return nil, nil, err @@ -896,7 +900,7 @@ func (c *ChainlinkClient) ReadCSAKeys() (*CSAKeys, *http.Response, error) { // CreateEI creates an EI on the Chainlink node based on the provided attributes and returns the respective secrets func (c *ChainlinkClient) CreateEI(eia *EIAttributes) (*EIKeyCreate, *http.Response, error) { ei := EIKeyCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", eia.Name).Msg("Creating External Initiator") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", eia.Name).Msg("Creating External Initiator") resp, err := c.APIClient.R(). SetBody(eia). SetResult(&ei). @@ -910,7 +914,7 @@ func (c *ChainlinkClient) CreateEI(eia *EIAttributes) (*EIKeyCreate, *http.Respo // ReadEIs reads all of the configured EIs from the Chainlink node func (c *ChainlinkClient) ReadEIs() (*EIKeys, *http.Response, error) { ei := EIKeys{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading EI Keys") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading EI Keys") resp, err := c.APIClient.R(). SetResult(&ei). Get("/v2/external_initiators") @@ -922,7 +926,7 @@ func (c *ChainlinkClient) ReadEIs() (*EIKeys, *http.Response, error) { // DeleteEI deletes an external initiator in the Chainlink node based on the provided name func (c *ChainlinkClient) DeleteEI(name string) (*http.Response, error) { - log.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting EI") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", name).Msg("Deleting EI") resp, err := c.APIClient.R(). SetPathParams(map[string]string{ "name": name, @@ -937,7 +941,7 @@ func (c *ChainlinkClient) DeleteEI(name string) (*http.Response, error) { // CreateCosmosChain creates a cosmos chain func (c *ChainlinkClient) CreateCosmosChain(chain *CosmosChainAttributes) (*CosmosChainCreate, *http.Response, error) { response := CosmosChainCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Cosmos Chain") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Cosmos Chain") resp, err := c.APIClient.R(). SetBody(chain). SetResult(&response). @@ -951,7 +955,7 @@ func (c *ChainlinkClient) CreateCosmosChain(chain *CosmosChainAttributes) (*Cosm // CreateCosmosNode creates a cosmos node func (c *ChainlinkClient) CreateCosmosNode(node *CosmosNodeAttributes) (*CosmosNodeCreate, *http.Response, error) { response := CosmosNodeCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Cosmos Node") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Cosmos Node") resp, err := c.APIClient.R(). SetBody(node). SetResult(&response). @@ -965,7 +969,7 @@ func (c *ChainlinkClient) CreateCosmosNode(node *CosmosNodeAttributes) (*CosmosN // CreateSolanaChain creates a solana chain func (c *ChainlinkClient) CreateSolanaChain(chain *SolanaChainAttributes) (*SolanaChainCreate, *http.Response, error) { response := SolanaChainCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Solana Chain") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating Solana Chain") resp, err := c.APIClient.R(). SetBody(chain). SetResult(&response). @@ -979,7 +983,7 @@ func (c *ChainlinkClient) CreateSolanaChain(chain *SolanaChainAttributes) (*Sola // CreateSolanaNode creates a solana node func (c *ChainlinkClient) CreateSolanaNode(node *SolanaNodeAttributes) (*SolanaNodeCreate, *http.Response, error) { response := SolanaNodeCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Solana Node") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating Solana Node") resp, err := c.APIClient.R(). SetBody(node). SetResult(&response). @@ -993,7 +997,7 @@ func (c *ChainlinkClient) CreateSolanaNode(node *SolanaNodeAttributes) (*SolanaN // CreateStarkNetChain creates a starknet chain func (c *ChainlinkClient) CreateStarkNetChain(chain *StarkNetChainAttributes) (*StarkNetChainCreate, *http.Response, error) { response := StarkNetChainCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating StarkNet Chain") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Chain ID", chain.ChainID).Msg("Creating StarkNet Chain") resp, err := c.APIClient.R(). SetBody(chain). SetResult(&response). @@ -1007,7 +1011,7 @@ func (c *ChainlinkClient) CreateStarkNetChain(chain *StarkNetChainAttributes) (* // CreateStarkNetNode creates a starknet node func (c *ChainlinkClient) CreateStarkNetNode(node *StarkNetNodeAttributes) (*StarkNetNodeCreate, *http.Response, error) { response := StarkNetNodeCreate{} - log.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating StarkNet Node") + c.l.Info().Str(NodeURL, c.Config.URL).Str("Name", node.Name).Msg("Creating StarkNet Node") resp, err := c.APIClient.R(). SetBody(node). SetResult(&response). @@ -1030,14 +1034,14 @@ func (c *ChainlinkClient) Profile(profileTime time.Duration, profileFunction fun profileResults := NewBlankChainlinkProfileResults() profileErrorGroup := new(errgroup.Group) var profileExecutedGroup sync.WaitGroup - log.Info().Int("Seconds to Profile", profileSeconds).Str(NodeURL, c.Config.URL).Msg("Starting Node PPROF session") + c.l.Info().Int("Seconds to Profile", profileSeconds).Str(NodeURL, c.Config.URL).Msg("Starting Node PPROF session") for _, rep := range profileResults.Reports { profileExecutedGroup.Add(1) profileReport := rep // The profile function returns with the profile results after the profile time frame has concluded // e.g. a profile API call of 5 seconds will start profiling, wait for 5 seconds, then send back results profileErrorGroup.Go(func() error { - log.Debug().Str("Type", profileReport.Type).Msg("PROFILING") + c.l.Debug().Str("Type", profileReport.Type).Msg("PROFILING") profileExecutedGroup.Done() resp, err := c.APIClient.R(). SetPathParams(map[string]string{ @@ -1054,7 +1058,7 @@ func (c *ChainlinkClient) Profile(profileTime time.Duration, profileFunction fun if err != nil { return err } - log.Debug().Str("Type", profileReport.Type).Msg("DONE PROFILING") + c.l.Debug().Str("Type", profileReport.Type).Msg("DONE PROFILING") profileReport.Data = resp.Body() return err }) @@ -1070,12 +1074,12 @@ func (c *ChainlinkClient) Profile(profileTime time.Duration, profileFunction fun actualSeconds := int(actualRunTime.Seconds()) if actualSeconds > profileSeconds { - log.Warn(). + c.l.Warn(). Int("Actual Seconds", actualSeconds). Int("Profile Seconds", profileSeconds). Msg("Your profile function took longer than expected to run, increase profileTime") } else if actualSeconds < profileSeconds && actualSeconds > 0 { - log.Warn(). + c.l.Warn(). Int("Actual Seconds", actualSeconds). Int("Profile Seconds", profileSeconds). Msg("Your profile function took shorter than expected to run, you can decrease profileTime") @@ -1174,7 +1178,7 @@ func (c *ChainlinkClient) TrackForwarder(chainID *big.Int, address common.Addres ChainID: chainID.String(), Address: address.Hex(), } - log.Debug().Str(NodeURL, c.Config.URL). + c.l.Debug().Str(NodeURL, c.Config.URL). Str("Forwarder address", (address).Hex()). Str("Chain ID", chainID.String()). Msg("Track forwarder") @@ -1196,7 +1200,7 @@ func (c *ChainlinkClient) TrackForwarder(chainID *big.Int, address common.Addres // GetForwarders get list of tracked forwarders func (c *ChainlinkClient) GetForwarders() (*Forwarders, *http.Response, error) { response := &Forwarders{} - log.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tracked Forwarders") + c.l.Info().Str(NodeURL, c.Config.URL).Msg("Reading Tracked Forwarders") resp, err := c.APIClient.R(). SetResult(response). Get("/v2/nodes/evm/forwarders") diff --git a/integration-tests/contracts/contract_deployer.go b/integration-tests/contracts/contract_deployer.go index 4c4d2b87a8..a3adb6db13 100644 --- a/integration-tests/contracts/contract_deployer.go +++ b/integration-tests/contracts/contract_deployer.go @@ -9,6 +9,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" @@ -116,30 +117,30 @@ type ContractDeployer interface { } // NewContractDeployer returns an instance of a contract deployer based on the client type -func NewContractDeployer(bcClient blockchain.EVMClient) (ContractDeployer, error) { +func NewContractDeployer(bcClient blockchain.EVMClient, logger zerolog.Logger) (ContractDeployer, error) { switch clientImpl := bcClient.Get().(type) { case *blockchain.EthereumClient: - return NewEthereumContractDeployer(clientImpl), nil + return NewEthereumContractDeployer(clientImpl, logger), nil case *blockchain.KlaytnClient: - return &KlaytnContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &KlaytnContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.MetisClient: - return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.ArbitrumClient: - return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &MetisContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.OptimismClient: - return &OptimismContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &OptimismContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.RSKClient: - return &RSKContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &RSKContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.PolygonClient: - return &PolygonContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &PolygonContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.CeloClient: - return &CeloContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &CeloContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.QuorumClient: - return &QuorumContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &QuorumContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.BSCClient: - return &BSCContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &BSCContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil case *blockchain.ScrollClient: - return &ScrollContractDeployer{NewEthereumContractDeployer(clientImpl)}, nil + return &ScrollContractDeployer{NewEthereumContractDeployer(clientImpl, logger)}, nil } return nil, errors.New("unknown blockchain client implementation for contract deployer, register blockchain client in NewContractDeployer") } @@ -147,6 +148,7 @@ func NewContractDeployer(bcClient blockchain.EVMClient) (ContractDeployer, error // EthereumContractDeployer provides the implementations for deploying ETH (EVM) based contracts type EthereumContractDeployer struct { client blockchain.EVMClient + l zerolog.Logger } // KlaytnContractDeployer wraps ethereum contract deployments for Klaytn @@ -195,9 +197,10 @@ type ScrollContractDeployer struct { } // NewEthereumContractDeployer returns an instantiated instance of the ETH contract deployer -func NewEthereumContractDeployer(ethClient blockchain.EVMClient) *EthereumContractDeployer { +func NewEthereumContractDeployer(ethClient blockchain.EVMClient, logger zerolog.Logger) *EthereumContractDeployer { return &EthereumContractDeployer{ client: ethClient, + l: logger, } } @@ -451,6 +454,7 @@ func (e *EthereumContractDeployer) DeployLinkTokenContract() (LinkToken, error) client: e.client, instance: instance.(*link_token_interface.LinkToken), address: *linkTokenAddress, + l: e.l, }, err } @@ -469,6 +473,7 @@ func (e *EthereumContractDeployer) LoadLinkToken(address common.Address) (LinkTo address: address, client: e.client, instance: instance.(*link_token_interface.LinkToken), + l: e.l, }, err } @@ -551,6 +556,7 @@ func (e *EthereumContractDeployer) DeployOffChainAggregator( client: e.client, ocr: instance.(*offchainaggregator.OffchainAggregator), address: address, + l: e.l, }, err } @@ -569,6 +575,7 @@ func (e *EthereumContractDeployer) LoadOffChainAggregator(address *common.Addres address: address, client: e.client, ocr: instance.(*offchainaggregator.OffchainAggregator), + l: e.l, }, err } @@ -1423,5 +1430,6 @@ func (e *EthereumContractDeployer) DeployOffchainAggregatorV2( client: e.client, contract: instance.(*ocr2aggregator.OCR2Aggregator), address: address, + l: e.l, }, err } diff --git a/integration-tests/contracts/contract_loader.go b/integration-tests/contracts/contract_loader.go index 2c079a61b8..a790747e38 100644 --- a/integration-tests/contracts/contract_loader.go +++ b/integration-tests/contracts/contract_loader.go @@ -5,6 +5,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/functions/generated/functions_coordinator" @@ -34,20 +35,20 @@ type ContractLoader interface { } // NewContractLoader returns an instance of a contract Loader based on the client type -func NewContractLoader(bcClient blockchain.EVMClient) (ContractLoader, error) { +func NewContractLoader(bcClient blockchain.EVMClient, logger zerolog.Logger) (ContractLoader, error) { switch clientImpl := bcClient.Get().(type) { case *blockchain.EthereumClient: - return NewEthereumContractLoader(clientImpl), nil + return NewEthereumContractLoader(clientImpl, logger), nil case *blockchain.KlaytnClient: - return &KlaytnContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &KlaytnContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.MetisClient: - return &MetisContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &MetisContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.ArbitrumClient: - return &ArbitrumContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &ArbitrumContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.PolygonClient: - return &PolygonContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &PolygonContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil case *blockchain.OptimismClient: - return &OptimismContractLoader{NewEthereumContractLoader(clientImpl)}, nil + return &OptimismContractLoader{NewEthereumContractLoader(clientImpl, logger)}, nil } return nil, errors.New("unknown blockchain client implementation for contract Loader, register blockchain client in NewContractLoader") } @@ -55,6 +56,7 @@ func NewContractLoader(bcClient blockchain.EVMClient) (ContractLoader, error) { // EthereumContractLoader provides the implementations for deploying ETH (EVM) based contracts type EthereumContractLoader struct { client blockchain.EVMClient + l zerolog.Logger } // KlaytnContractLoader wraps ethereum contract deployments for Klaytn @@ -83,9 +85,10 @@ type OptimismContractLoader struct { } // NewEthereumContractLoader returns an instantiated instance of the ETH contract Loader -func NewEthereumContractLoader(ethClient blockchain.EVMClient) *EthereumContractLoader { +func NewEthereumContractLoader(ethClient blockchain.EVMClient, logger zerolog.Logger) *EthereumContractLoader { return &EthereumContractLoader{ client: ethClient, + l: logger, } } @@ -104,6 +107,7 @@ func (e *EthereumContractLoader) LoadLINKToken(addr string) (LinkToken, error) { client: e.client, instance: instance.(*link_token_interface.LinkToken), address: common.HexToAddress(addr), + l: e.l, }, err } @@ -140,6 +144,7 @@ func (e *EthereumContractLoader) LoadFunctionsRouter(addr string) (FunctionsRout client: e.client, instance: instance.(*functions_router.FunctionsRouter), address: common.HexToAddress(addr), + l: e.l, }, err } @@ -176,6 +181,7 @@ func (e *EthereumContractLoader) LoadOperatorContract(address common.Address) (O address: address, client: e.client, operator: instance.(*operator_wrapper.Operator), + l: e.l, }, err } diff --git a/integration-tests/contracts/ethereum_contracts.go b/integration-tests/contracts/ethereum_contracts.go index 763faecace..d11eefecd4 100644 --- a/integration-tests/contracts/ethereum_contracts.go +++ b/integration-tests/contracts/ethereum_contracts.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" @@ -1115,6 +1116,7 @@ type FluxAggregatorRoundConfirmer struct { context context.Context cancel context.CancelFunc complete bool + l zerolog.Logger } // NewFluxAggregatorRoundConfirmer provides a new instance of a FluxAggregatorRoundConfirmer @@ -1122,6 +1124,7 @@ func NewFluxAggregatorRoundConfirmer( contract FluxAggregator, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *FluxAggregatorRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &FluxAggregatorRoundConfirmer{ @@ -1130,6 +1133,7 @@ func NewFluxAggregatorRoundConfirmer( doneChan: make(chan struct{}), context: ctx, cancel: ctxCancel, + l: logger, } } @@ -1149,11 +1153,11 @@ func (f *FluxAggregatorRoundConfirmer) ReceiveHeader(header blockchain.NodeHeade "Header Number": header.Number.Uint64(), } if lr.Cmp(f.roundID) >= 0 { - log.Info().Fields(logFields).Msg("FluxAggregator round completed") + f.l.Info().Fields(logFields).Msg("FluxAggregator round completed") f.complete = true f.doneChan <- struct{}{} } else { - log.Debug().Fields(logFields).Msg("Waiting for FluxAggregator round") + f.l.Debug().Fields(logFields).Msg("Waiting for FluxAggregator round") } return nil } @@ -1181,6 +1185,7 @@ type EthereumLinkToken struct { client blockchain.EVMClient instance *link_token_interface.LinkToken address common.Address + l zerolog.Logger } // Fund the LINK Token contract with ETH to distribute the token @@ -1222,7 +1227,7 @@ func (l *EthereumLinkToken) Approve(to string, amount *big.Int) error { if err != nil { return err } - log.Info(). + l.l.Info(). Str("From", l.client.GetDefaultWallet().Address()). Str("To", to). Str("Amount", amount.String()). @@ -1240,7 +1245,7 @@ func (l *EthereumLinkToken) Transfer(to string, amount *big.Int) error { if err != nil { return err } - log.Info(). + l.l.Info(). Str("From", l.client.GetDefaultWallet().Address()). Str("To", to). Str("Amount", amount.String()). @@ -1262,7 +1267,7 @@ func (l *EthereumLinkToken) TransferAndCall(to string, amount *big.Int, data []b if err != nil { return nil, err } - log.Info(). + l.l.Info(). Str("From", l.client.GetDefaultWallet().Address()). Str("To", to). Str("Amount", amount.String()). @@ -1277,6 +1282,7 @@ type EthereumOffchainAggregator struct { client blockchain.EVMClient ocr *offchainaggregator.OffchainAggregator address *common.Address + l zerolog.Logger } // Fund sends specified currencies to the contract @@ -1322,7 +1328,7 @@ func (o *EthereumOffchainAggregator) SetPayees( payeesAddr = append(payeesAddr, common.HexToAddress(p)) } - log.Info(). + o.l.Info(). Str("Transmitters", fmt.Sprintf("%v", transmitters)). Str("Payees", fmt.Sprintf("%v", payees)). Str("OCR Address", o.Address()). @@ -1430,7 +1436,7 @@ func (o *EthereumOffchainAggregator) RequestNewRound() error { if err != nil { return err } - log.Info().Str("Contract Address", o.address.Hex()).Msg("New OCR round requested") + o.l.Info().Str("Contract Address", o.address.Hex()).Msg("New OCR round requested") return o.client.ProcessTransaction(tx) } @@ -1512,6 +1518,7 @@ type RunlogRoundConfirmer struct { doneChan chan struct{} context context.Context cancel context.CancelFunc + l zerolog.Logger } // NewRunlogRoundConfirmer provides a new instance of a RunlogRoundConfirmer @@ -1519,6 +1526,7 @@ func NewRunlogRoundConfirmer( contract APIConsumer, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *RunlogRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &RunlogRoundConfirmer{ @@ -1527,6 +1535,7 @@ func NewRunlogRoundConfirmer( doneChan: make(chan struct{}), context: ctx, cancel: ctxCancel, + l: logger, } } @@ -1542,10 +1551,10 @@ func (o *RunlogRoundConfirmer) ReceiveHeader(_ blockchain.NodeHeader) error { "Waiting for Round": o.roundID.Int64(), } if currentRoundID.Cmp(o.roundID) >= 0 { - log.Info().Fields(logFields).Msg("Runlog round completed") + o.l.Info().Fields(logFields).Msg("Runlog round completed") o.doneChan <- struct{}{} } else { - log.Debug().Fields(logFields).Msg("Waiting for Runlog round") + o.l.Debug().Fields(logFields).Msg("Waiting for Runlog round") } return nil } @@ -1572,6 +1581,7 @@ type OffchainAggregatorRoundConfirmer struct { cancel context.CancelFunc blocksSinceAnswer uint complete bool + l zerolog.Logger } // NewOffchainAggregatorRoundConfirmer provides a new instance of a OffchainAggregatorRoundConfirmer @@ -1579,6 +1589,7 @@ func NewOffchainAggregatorRoundConfirmer( contract OffchainAggregator, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *OffchainAggregatorRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &OffchainAggregatorRoundConfirmer{ @@ -1588,6 +1599,7 @@ func NewOffchainAggregatorRoundConfirmer( context: ctx, cancel: ctxCancel, complete: false, + l: logger, } } @@ -1609,11 +1621,11 @@ func (o *OffchainAggregatorRoundConfirmer) ReceiveHeader(_ blockchain.NodeHeader "Waiting for Round": o.roundID.Int64(), } if currRound.Cmp(o.roundID) >= 0 { - log.Info().Fields(logFields).Msg("OCR round completed") + o.l.Info().Fields(logFields).Msg("OCR round completed") o.doneChan <- struct{}{} o.complete = true } else { - log.Debug().Fields(logFields).Msg("Waiting on OCR Round") + o.l.Debug().Fields(logFields).Msg("Waiting on OCR Round") } return nil } @@ -1646,6 +1658,7 @@ type OffchainAggregatorV2RoundConfirmer struct { cancel context.CancelFunc blocksSinceAnswer uint complete bool + l zerolog.Logger } // NewOffchainAggregatorRoundConfirmer provides a new instance of a OffchainAggregatorRoundConfirmer @@ -1653,6 +1666,7 @@ func NewOffchainAggregatorV2RoundConfirmer( contract OffchainAggregatorV2, roundID *big.Int, timeout time.Duration, + logger zerolog.Logger, ) *OffchainAggregatorV2RoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &OffchainAggregatorV2RoundConfirmer{ @@ -1662,6 +1676,7 @@ func NewOffchainAggregatorV2RoundConfirmer( context: ctx, cancel: ctxCancel, complete: false, + l: logger, } } @@ -1683,11 +1698,11 @@ func (o *OffchainAggregatorV2RoundConfirmer) ReceiveHeader(_ blockchain.NodeHead "Waiting for Round": o.roundID.Int64(), } if currRound.Cmp(o.roundID) >= 0 { - log.Info().Fields(logFields).Msg("OCR round completed") + o.l.Info().Fields(logFields).Msg("OCR round completed") o.doneChan <- struct{}{} o.complete = true } else { - log.Debug().Fields(logFields).Msg("Waiting on OCR Round") + o.l.Debug().Fields(logFields).Msg("Waiting on OCR Round") } return nil } @@ -1815,6 +1830,7 @@ type EthereumOperator struct { address common.Address client blockchain.EVMClient operator *operator_wrapper.Operator + l zerolog.Logger } func (e *EthereumOperator) Address() string { @@ -1826,7 +1842,7 @@ func (e *EthereumOperator) AcceptAuthorizedReceivers(forwarders []common.Address if err != nil { return err } - log.Info(). + e.l.Info(). Str("ForwardersAddresses", fmt.Sprint(forwarders)). Str("EoaAddresses", fmt.Sprint(eoa)). Msg("Accepting Authorized Receivers") @@ -1923,6 +1939,7 @@ type EthereumOffchainAggregatorV2 struct { address *common.Address client blockchain.EVMClient contract *ocr2aggregator.OCR2Aggregator + l zerolog.Logger } // OCRv2Config represents the config for the OCRv2 contract @@ -2008,7 +2025,7 @@ func (e *EthereumOffchainAggregatorV2) SetPayees(transmitters, payees []string) if err != nil { return err } - log.Info(). + e.l.Info(). Str("Transmitters", fmt.Sprintf("%v", transmitters)). Str("Payees", fmt.Sprintf("%v", payees)). Str("OCRv2 Address", e.Address()). @@ -2034,7 +2051,7 @@ func (e *EthereumOffchainAggregatorV2) SetConfig(ocrConfig *OCRv2Config) error { if err != nil { return err } - log.Info(). + e.l.Info(). Str("Address", e.Address()). Interface("Signers", ocrConfig.Signers). Interface("Transmitters", ocrConfig.Transmitters). @@ -2091,6 +2108,7 @@ type EthereumFunctionsRouter struct { address common.Address client blockchain.EVMClient instance *functions_router.FunctionsRouter + l zerolog.Logger } func (e *EthereumFunctionsRouter) Address() string { @@ -2114,7 +2132,7 @@ func (e *EthereumFunctionsRouter) CreateSubscriptionWithConsumer(consumer string return 0, err } for _, l := range r.Logs { - log.Info().Interface("Log", common.Bytes2Hex(l.Data)).Send() + e.l.Info().Interface("Log", common.Bytes2Hex(l.Data)).Send() } topicsMap := map[string]interface{}{} @@ -2123,14 +2141,14 @@ func (e *EthereumFunctionsRouter) CreateSubscriptionWithConsumer(consumer string return 0, err } for _, ev := range fabi.Events { - log.Info().Str("EventName", ev.Name).Send() + e.l.Info().Str("EventName", ev.Name).Send() } topicOneInputs := abi.Arguments{fabi.Events["SubscriptionCreated"].Inputs[0]} topicOneHash := []common.Hash{r.Logs[0].Topics[1:][0]} if err := abi.ParseTopicsIntoMap(topicsMap, topicOneInputs, topicOneHash); err != nil { return 0, errors.Wrap(err, "failed to decode topic value") } - log.Info().Interface("NewTopicsDecoded", topicsMap).Send() + e.l.Info().Interface("NewTopicsDecoded", topicsMap).Send() if topicsMap["subscriptionId"] == 0 { return 0, errors.New("failed to decode subscription ID after creation") } diff --git a/integration-tests/contracts/ethereum_keeper_contracts.go b/integration-tests/contracts/ethereum_keeper_contracts.go index 67d2696058..afb6550bd2 100644 --- a/integration-tests/contracts/ethereum_keeper_contracts.go +++ b/integration-tests/contracts/ethereum_keeper_contracts.go @@ -15,7 +15,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" - "github.com/rs/zerolog/log" + "github.com/rs/zerolog" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" goabi "github.com/umbracle/ethgo/abi" @@ -204,6 +204,7 @@ type EthereumKeeperRegistry struct { registry2_0 *keeper_registry_wrapper2_0.KeeperRegistry registry2_1 *i_keeper_registry_master_wrapper_2_1.IKeeperRegistryMaster address *common.Address + l zerolog.Logger } func (v *EthereumKeeperRegistry) Address() string { @@ -777,7 +778,7 @@ func (v *EthereumKeeperRegistry) CancelUpkeep(id *big.Int) error { } } - log.Info(). + v.l.Info(). Str("Upkeep ID", strconv.FormatInt(id.Int64(), 10)). Str("From", v.client.GetDefaultWallet().Address()). Str("TX Hash", tx.Hash().String()). @@ -1132,6 +1133,7 @@ type KeeperConsumerRoundConfirmer struct { doneChan chan struct{} context context.Context cancel context.CancelFunc + l zerolog.Logger } // NewKeeperConsumerRoundConfirmer provides a new instance of a KeeperConsumerRoundConfirmer @@ -1139,6 +1141,7 @@ func NewKeeperConsumerRoundConfirmer( contract KeeperConsumer, counterValue int, timeout time.Duration, + logger zerolog.Logger, ) *KeeperConsumerRoundConfirmer { ctx, ctxCancel := context.WithTimeout(context.Background(), timeout) return &KeeperConsumerRoundConfirmer{ @@ -1147,6 +1150,7 @@ func NewKeeperConsumerRoundConfirmer( doneChan: make(chan struct{}), context: ctx, cancel: ctxCancel, + l: logger, } } @@ -1156,7 +1160,7 @@ func (o *KeeperConsumerRoundConfirmer) ReceiveHeader(_ blockchain.NodeHeader) er if err != nil { return err } - l := log.Info(). + l := o.l.Info(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps", upkeeps.Int64()). Int("Required upkeeps", o.upkeepsValue) @@ -1200,6 +1204,7 @@ type KeeperConsumerPerformanceRoundConfirmer struct { metricsReporter *testreporters.KeeperBlockTimeTestReporter // Testreporter to track results complete bool + l zerolog.Logger } // NewKeeperConsumerPerformanceRoundConfirmer provides a new instance of a KeeperConsumerPerformanceRoundConfirmer @@ -1209,6 +1214,7 @@ func NewKeeperConsumerPerformanceRoundConfirmer( expectedBlockCadence int64, // Expected to upkeep every 5/10/20 blocks, for example blockRange int64, metricsReporter *testreporters.KeeperBlockTimeTestReporter, + logger zerolog.Logger, ) *KeeperConsumerPerformanceRoundConfirmer { ctx, cancelFunc := context.WithCancel(context.Background()) return &KeeperConsumerPerformanceRoundConfirmer{ @@ -1226,6 +1232,7 @@ func NewKeeperConsumerPerformanceRoundConfirmer( metricsReporter: metricsReporter, complete: false, lastBlockNum: 0, + l: logger, } } @@ -1248,22 +1255,22 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b return err } if isEligible { - log.Trace(). + o.l.Trace(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Msg("Upkeep Now Eligible") } if upkeepCount.Int64() >= o.expectedUpkeepCount { // Upkeep was successful if o.blocksSinceSuccessfulUpkeep < o.blockCadence { // If there's an early upkeep, that's weird - log.Error(). + o.l.Error(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). Int64("Actual Cadence", o.blocksSinceSuccessfulUpkeep). - Err(errors.New("Found an early Upkeep")) - return fmt.Errorf("Found an early Upkeep on contract %s", o.instance.Address()) + Err(errors.New("found an early Upkeep")) + return fmt.Errorf("found an early Upkeep on contract %s", o.instance.Address()) } else if o.blocksSinceSuccessfulUpkeep == o.blockCadence { // Perfectly timed upkeep - log.Info(). + o.l.Info(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). @@ -1271,7 +1278,7 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b Msg("Successful Upkeep on Expected Cadence") o.totalSuccessfulUpkeeps++ } else { // Late upkeep - log.Warn(). + o.l.Warn(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). @@ -1286,7 +1293,7 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b if o.blocksSinceSubscription > o.blockRange { if o.blocksSinceSuccessfulUpkeep > o.blockCadence { - log.Warn(). + o.l.Warn(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Expected Cadence", o.blockCadence). @@ -1296,7 +1303,7 @@ func (o *KeeperConsumerPerformanceRoundConfirmer) ReceiveHeader(receivedHeader b Msg("Finished Watching for Upkeeps While Waiting on a Late Upkeep") o.allMissedUpkeeps = append(o.allMissedUpkeeps, o.blocksSinceSuccessfulUpkeep-o.blockCadence) } else { - log.Info(). + o.l.Info(). Str("Contract Address", o.instance.Address()). Int64("Upkeeps Performed", upkeepCount.Int64()). Int64("Total Blocks Watched", o.blocksSinceSubscription). @@ -1365,6 +1372,7 @@ type KeeperConsumerBenchmarkRoundConfirmer struct { upkeepCount int64 // The count of upkeeps done so far allCheckDelays []int64 // Tracks the amount of blocks missed before an upkeep since it became eligible complete bool + l zerolog.Logger } // NewKeeperConsumerBenchmarkRoundConfirmer provides a new instance of a KeeperConsumerBenchmarkRoundConfirmer @@ -1378,6 +1386,7 @@ func NewKeeperConsumerBenchmarkRoundConfirmer( metricsReporter *testreporters.KeeperBenchmarkTestReporter, upkeepIndex int64, firstEligibleuffer int64, + logger zerolog.Logger, ) *KeeperConsumerBenchmarkRoundConfirmer { ctx, cancelFunc := context.WithCancel(context.Background()) return &KeeperConsumerBenchmarkRoundConfirmer{ @@ -1399,6 +1408,7 @@ func NewKeeperConsumerBenchmarkRoundConfirmer( upkeepIndex: upkeepIndex, firstBlockNum: 0, firstEligibleuffer: firstEligibleuffer, + l: logger, } } @@ -1423,7 +1433,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo if upkeepCount.Int64() != o.upkeepCount+1 { return errors.New("upkeep count increased by more than 1 in a single block") } - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1433,7 +1443,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo Msg("Upkeep Performed") if o.blocksSinceEligible > o.upkeepSLA { - log.Warn(). + o.l.Warn(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1456,7 +1466,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo if o.blocksSinceEligible == 0 { // First time this upkeep became eligible o.countEligible++ - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1469,7 +1479,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo if o.blocksSinceSubscription >= o.blockRange || int64(o.lastBlockNum-o.firstBlockNum) >= o.blockRange { if o.blocksSinceEligible > 0 { if o.blocksSinceEligible > o.upkeepSLA { - log.Warn(). + o.l.Warn(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1478,7 +1488,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo Msg("Upkeep remained eligible at end of test and missed SLA") o.countMissed++ } else { - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). @@ -1490,7 +1500,7 @@ func (o *KeeperConsumerBenchmarkRoundConfirmer) ReceiveHeader(receivedHeader blo o.allCheckDelays = append(o.allCheckDelays, o.blocksSinceEligible) } - log.Info(). + o.l.Info(). Uint64("Block_Number", receivedHeader.Number.Uint64()). Str("Upkeep_ID", o.upkeepID.String()). Str("Contract_Address", o.instance.Address()). diff --git a/integration-tests/docker/test_env/cl_node.go b/integration-tests/docker/test_env/cl_node.go index 49d3cdc369..e4182ca4c3 100644 --- a/integration-tests/docker/test_env/cl_node.go +++ b/integration-tests/docker/test_env/cl_node.go @@ -10,6 +10,7 @@ import ( "os" "strings" "sync" + "testing" "time" "github.com/ethereum/go-ethereum" @@ -17,6 +18,7 @@ import ( "github.com/google/uuid" "github.com/pelletier/go-toml/v2" "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" tc "github.com/testcontainers/testcontainers-go" tcwait "github.com/testcontainers/testcontainers-go/wait" @@ -24,6 +26,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/docker" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/chaintype" @@ -49,6 +52,8 @@ type ClNode struct { lw *logwatch.LogWatch ContainerImage string ContainerVersion string + t *testing.T + l zerolog.Logger } type ClNodeOption = func(c *ClNode) @@ -88,6 +93,7 @@ func NewClNode(networks []string, nodeConfig *chainlink.Config, opts ...ClNodeOp }, NodeConfig: nodeConfig, PostgresDb: pgDb, + l: log.Logger, } for _, opt := range opts { opt(n) @@ -95,6 +101,13 @@ func NewClNode(networks []string, nodeConfig *chainlink.Config, opts ...ClNodeOp return n } +func (n *ClNode) WithTestLogger(t *testing.T) *ClNode { + n.l = logging.GetTestLogger(t) + n.t = t + n.PostgresDb.WithTestLogger(t) + return n +} + // Restart restarts only CL node, DB container is reused func (n *ClNode) Restart(cfg *chainlink.Config) error { if err := n.Container.Terminate(context.Background()); err != nil { @@ -238,10 +251,19 @@ func (n *ClNode) StartContainer() error { if err != nil { return err } - container, err := docker.StartContainerWithRetry(tc.GenericContainerRequest{ + + l := tc.Logger + if n.t != nil { + l = logging.CustomT{ + T: n.t, + L: n.l, + } + } + container, err := docker.StartContainerWithRetry(n.l, tc.GenericContainerRequest{ ContainerRequest: *cReq, Started: true, Reuse: true, + Logger: l, }) if err != nil { return errors.Wrap(err, ErrStartCLNodeContainer) @@ -259,7 +281,7 @@ func (n *ClNode) StartContainer() error { if err != nil { return err } - log.Info().Str("containerName", n.ContainerName). + n.l.Info().Str("containerName", n.ContainerName). Str("clEndpoint", clEndpoint). Str("clInternalIP", ip). Msg("Started Chainlink Node container") @@ -268,11 +290,11 @@ func (n *ClNode) StartContainer() error { Email: "local@local.com", Password: "localdevpassword", InternalIP: ip, - }) + }, + n.l) if err != nil { return errors.Wrap(err, ErrConnectNodeClient) } - clClient.Config.InternalIP = n.ContainerName n.Container = container n.API = clClient diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 7de4064a25..8c4faadbd2 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -14,6 +14,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" tc "github.com/testcontainers/testcontainers-go" "golang.org/x/sync/errgroup" @@ -21,8 +22,8 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/docker" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" - testUtils "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -48,11 +49,13 @@ type CLClusterTestEnv struct { EVMClient blockchain.EVMClient ContractDeployer contracts.ContractDeployer ContractLoader contracts.ContractLoader + l zerolog.Logger + t *testing.T } func NewTestEnv() (*CLClusterTestEnv, error) { utils.SetupCoreDockerEnvLogger() - network, err := docker.CreateNetwork() + network, err := docker.CreateNetwork(log.Logger) if err != nil { return nil, err } @@ -61,22 +64,32 @@ func NewTestEnv() (*CLClusterTestEnv, error) { Network: network, Geth: test_env.NewGeth(networks), MockServer: test_env.NewMockServer(networks), + l: log.Logger, }, nil } -func NewTestEnvFromCfg(cfg *TestEnvConfig) (*CLClusterTestEnv, error) { +func (te *CLClusterTestEnv) WithTestLogger(t *testing.T) *CLClusterTestEnv { + te.t = t + te.l = logging.GetTestLogger(t) + te.Geth.WithTestLogger(t) + te.MockServer.WithTestLogger(t) + return te +} + +func NewTestEnvFromCfg(l zerolog.Logger, cfg *TestEnvConfig) (*CLClusterTestEnv, error) { utils.SetupCoreDockerEnvLogger() - network, err := docker.CreateNetwork() + network, err := docker.CreateNetwork(log.Logger) if err != nil { return nil, err } networks := []string{network.Name} - log.Info().Interface("Cfg", cfg).Send() + l.Info().Interface("Cfg", cfg).Send() return &CLClusterTestEnv{ Cfg: cfg, Network: network, Geth: test_env.NewGeth(networks, test_env.WithContainerName(cfg.Geth.ContainerName)), MockServer: test_env.NewMockServer(networks, test_env.WithContainerName(cfg.MockServer.ContainerName)), + l: log.Logger, }, nil } @@ -88,6 +101,11 @@ func (te *CLClusterTestEnv) WithPrivateChain(evmNetworks []blockchain.EVMNetwork var chains []test_env.PrivateChain for _, evmNetwork := range evmNetworks { n := evmNetwork + pgc := test_env.NewPrivateGethChain(&n, []string{te.Network.Name}) + if te.t != nil { + pgc.GetPrimaryNode().WithTestLogger(te.t) + } + chains = append(chains, pgc) var privateChain test_env.PrivateChain switch n.SimulationType { case "besu": @@ -153,6 +171,9 @@ func (te *CLClusterTestEnv) StartClNodes(nodeConfig *chainlink.Config, count int WithNodeContainerName(nodeContainerName), WithDbContainerName(dbContainerName), ) + if te.t != nil { + n.WithTestLogger(te.t) + } err := n.StartContainer() if err != nil { return err @@ -218,7 +239,6 @@ func (te *CLClusterTestEnv) Terminate() error { // Cleanup cleans the environment up after it's done being used, mainly for returning funds when on live networks. // Intended to be used as part of t.Cleanup() in tests. func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { - l := testUtils.GetTestLogger(t) if te.EVMClient == nil { return errors.New("blockchain client is nil, unable to return funds from chainlink nodes") } @@ -228,10 +248,10 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { // Check if we need to return funds if te.EVMClient.NetworkSimulated() { - l.Info().Str("Network Name", te.EVMClient.GetNetworkName()). + te.l.Info().Str("Network Name", te.EVMClient.GetNetworkName()). Msg("Network is a simulated network. Skipping fund return.") } else { - l.Info().Msg("Attempting to return Chainlink node funds to default network wallets") + te.l.Info().Msg("Attempting to return Chainlink node funds to default network wallets") for _, chainlinkNode := range te.CLNodes { fundedKeys, err := chainlinkNode.API.ExportEVMKeysForChain(te.EVMClient.GetChainID().String()) if err != nil { @@ -266,7 +286,7 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { return err } - l.Warn().Msg("Test failed, collecting logs") + te.l.Warn().Msg("Test failed, collecting logs") eg := &errgroup.Group{} for _, n := range te.CLNodes { node := n @@ -285,7 +305,7 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { if err != nil { return err } - l.Info().Str("Node", node.ContainerName).Str("File", logFileName).Msg("Wrote Logs") + te.l.Info().Str("Node", node.ContainerName).Str("File", logFileName).Msg("Wrote Logs") return nil }) } @@ -294,7 +314,7 @@ func (te *CLClusterTestEnv) Cleanup(t *testing.T) error { return err } - l.Info().Str("Logs Location", folder).Msg("Wrote Logs for Failed Test") + te.l.Info().Str("Logs Location", folder).Msg("Wrote Logs for Failed Test") return nil } diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index f08c024d16..f3944b0ba9 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -4,16 +4,18 @@ import ( "fmt" "math/big" "os" + "testing" "github.com/pkg/errors" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" - "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" - "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" @@ -30,6 +32,8 @@ type CLTestEnvBuilder struct { externalAdapterCount int customNodeCsaKeys []string defaultNodeCsaKeys []string + l zerolog.Logger + t *testing.T /* funding */ ETHFunds *big.Float @@ -38,9 +42,16 @@ type CLTestEnvBuilder struct { func NewCLTestEnvBuilder() *CLTestEnvBuilder { return &CLTestEnvBuilder{ externalAdapterCount: 1, + l: log.Logger, } } +func (b *CLTestEnvBuilder) WithTestLogger(t *testing.T) *CLTestEnvBuilder { + b.t = t + b.l = logging.GetTestLogger(t) + return b +} + func (b *CLTestEnvBuilder) WithLogWatcher() *CLTestEnvBuilder { b.hasLogWatch = true return b @@ -96,7 +107,7 @@ func (b *CLTestEnvBuilder) Build() (*CLClusterTestEnv, error) { } func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, error) { - log.Info(). + b.l.Info(). Bool("hasGeth", b.hasGeth). Bool("hasMockServer", b.hasMockServer). Int("externalAdapterCount", b.externalAdapterCount). @@ -108,7 +119,7 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e var te *CLClusterTestEnv var err error if cfg != nil { - te, err = NewTestEnvFromCfg(cfg) + te, err = NewTestEnvFromCfg(b.l, cfg) if err != nil { return nil, err } @@ -119,6 +130,10 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e } } + if b.t != nil { + te.WithTestLogger(b.t) + } + if b.hasLogWatch { te.LogWatch, err = logwatch.NewLogWatch(nil, nil) if err != nil { @@ -172,20 +187,20 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e } - bc, err := blockchain.NewEVMClientFromNetwork(networkConfig) + bc, err := blockchain.NewEVMClientFromNetwork(networkConfig, b.l) if err != nil { return nil, err } te.EVMClient = bc - cd, err := contracts.NewContractDeployer(bc) + cd, err := contracts.NewContractDeployer(bc, b.l) if err != nil { return nil, err } te.ContractDeployer = cd - cl, err := contracts.NewContractLoader(bc) + cl, err := contracts.NewContractLoader(bc, b.l) if err != nil { return nil, err } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 1ae49de72d..9edf6d72be 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -20,7 +20,7 @@ require ( github.com/rs/zerolog v1.30.0 github.com/slack-go/slack v0.12.2 github.com/smartcontractkit/chainlink-env v0.36.0 - github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913144245-620fbcd69dfb + github.com/smartcontractkit/chainlink-testing-framework v1.17.0 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 github.com/smartcontractkit/libocr v0.0.0-20230816220705-665e93233ae5 github.com/smartcontractkit/ocr2keepers v0.7.23 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 73c77682f3..55686ce2ef 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2258,8 +2258,8 @@ github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97ac github.com/smartcontractkit/chainlink-solana v1.0.3-0.20230831134610-680240b97aca/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913144245-620fbcd69dfb h1:ZLBIvWgoB4Op24yNYJ87qGI9yd6B/6WM+uYs3Vj1Hww= -github.com/smartcontractkit/chainlink-testing-framework v1.16.9-0.20230913144245-620fbcd69dfb/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= +github.com/smartcontractkit/chainlink-testing-framework v1.17.0 h1:JcJwfawW7jfLBG+By5hGTVcNgKQ7bJCqvN9TEF3qBis= +github.com/smartcontractkit/chainlink-testing-framework v1.17.0/go.mod h1:Ry6fRPr8TwrIsYVNEF1pguAgzE3QW1s54tbLWnFtfI4= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472 h1:x3kNwgFlDmbE/n0gTSRMt9GBDfsfGrs4X9b9arPZtFI= github.com/smartcontractkit/go-plugin v0.0.0-20230605132010-0f4d515d1472/go.mod h1:6/1TEzT0eQznvI/gV2CM29DLSkAK/e58mUWKVsPaph0= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= diff --git a/integration-tests/load/functions/setup.go b/integration-tests/load/functions/setup.go index 60986595b9..5d44cbc698 100644 --- a/integration-tests/load/functions/setup.go +++ b/integration-tests/load/functions/setup.go @@ -50,16 +50,16 @@ type S4SecretsCfg struct { } func SetupLocalLoadTestEnv(cfg *PerformanceConfig) (*FunctionsTest, error) { - bc, err := blockchain.NewEVMClientFromNetwork(networks.SelectedNetwork) + bc, err := blockchain.NewEVMClientFromNetwork(networks.SelectedNetwork, log.Logger) if err != nil { return nil, err } - cd, err := contracts.NewContractDeployer(bc) + cd, err := contracts.NewContractDeployer(bc, log.Logger) if err != nil { return nil, err } - cl, err := contracts.NewContractLoader(bc) + cl, err := contracts.NewContractLoader(bc, log.Logger) if err != nil { return nil, err } diff --git a/integration-tests/migration/upgrade_version_test.go b/integration-tests/migration/upgrade_version_test.go index 1f90bd123e..d1d79de5ee 100644 --- a/integration-tests/migration/upgrade_version_test.go +++ b/integration-tests/migration/upgrade_version_test.go @@ -6,13 +6,15 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" "os" + + "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" ) func TestVersionUpgrade(t *testing.T) { t.Parallel() env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithCLNodes(1). Build() diff --git a/integration-tests/performance/directrequest_test.go b/integration-tests/performance/directrequest_test.go index a24493a678..98c03c2bb9 100644 --- a/integration-tests/performance/directrequest_test.go +++ b/integration-tests/performance/directrequest_test.go @@ -18,8 +18,7 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -31,15 +30,15 @@ import ( ) func TestDirectRequestPerformance(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment := setupDirectRequestTest(t) if testEnvironment.WillUseRemoteRunner() { return } - chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/performance/flux_test.go b/integration-tests/performance/flux_test.go index 47b2b22e1a..2c33096a35 100644 --- a/integration-tests/performance/flux_test.go +++ b/integration-tests/performance/flux_test.go @@ -19,8 +19,7 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -30,15 +29,15 @@ import ( ) func TestFluxPerformance(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupFluxTest(t) if testEnvironment.WillUseRemoteRunner() { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") @@ -117,7 +116,7 @@ func TestFluxPerformance(t *testing.T) { return } fluxRoundTimeout := 2 * time.Minute - fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout) + fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout, l) chainClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = chainClient.WaitForEvents() require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") @@ -135,7 +134,7 @@ func TestFluxPerformance(t *testing.T) { require.Equal(t, int64(3), data.AllocatedFunds.Int64(), "Expected allocated funds to be %d, but found %d", int64(3), data.AllocatedFunds.Int64()) - fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout) + fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout, l) chainClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = mockServer.SetValuePath(adapterPath, 1e10) require.NoError(t, err, "Setting value path in mock server shouldn't fail") diff --git a/integration-tests/performance/keeper_test.go b/integration-tests/performance/keeper_test.go index 5688a05aa6..7ab0f53d0d 100644 --- a/integration-tests/performance/keeper_test.go +++ b/integration-tests/performance/keeper_test.go @@ -18,8 +18,7 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver" mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -45,7 +44,7 @@ var keeperDefaultRegistryConfig = contracts.KeeperRegistrySettings{ } func TestKeeperPerformance(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, chainClient, chainlinkNodes, contractDeployer, linkToken := setupKeeperTest(t, "basic-smoke") if testEnvironment.WillUseRemoteRunner() { return @@ -174,9 +173,10 @@ PerformGasOverhead = 150_000` return testEnvironment, nil, nil, nil, nil } - chainClient, err := blockchain.NewEVMClient(network, testEnvironment) + l := logging.GetTestLogger(t) + chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/performance/ocr_test.go b/integration-tests/performance/ocr_test.go index a1f588c441..d3d2904965 100644 --- a/integration-tests/performance/ocr_test.go +++ b/integration-tests/performance/ocr_test.go @@ -17,6 +17,7 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" @@ -32,10 +33,10 @@ func TestOCRBasic(t *testing.T) { if testEnvironment.WillUseRemoteRunner() { return } - - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + l := logging.GetTestLogger(t) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) @@ -60,7 +61,7 @@ func TestOCRBasic(t *testing.T) { profileFunction := func(chainlinkNode *client.ChainlinkClient) { err = actions.CreateOCRJobs(ocrInstances, bootstrapNode, workerNodes, 5, mockServer, chainClient.GetChainID().String()) require.NoError(t, err) - err = actions.StartNewRound(1, ocrInstances, chainClient) + err = actions.StartNewRound(1, ocrInstances, chainClient, l) require.NoError(t, err) answer, err := ocrInstances[0].GetLatestAnswer(context.Background()) @@ -69,7 +70,7 @@ func TestOCRBasic(t *testing.T) { err = mockServer.SetValuePath("ocr", 10) require.NoError(t, err) - err = actions.StartNewRound(2, ocrInstances, chainClient) + err = actions.StartNewRound(2, ocrInstances, chainClient, l) require.NoError(t, err) answer, err = ocrInstances[0].GetLatestAnswer(context.Background()) diff --git a/integration-tests/performance/vrf_test.go b/integration-tests/performance/vrf_test.go index 59eb5e3980..af3a3ecba8 100644 --- a/integration-tests/performance/vrf_test.go +++ b/integration-tests/performance/vrf_test.go @@ -16,8 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" "github.com/smartcontractkit/chainlink/integration-tests/actions" @@ -28,15 +27,15 @@ import ( func TestVRFBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupVRFTest(t) if testEnvironment.WillUseRemoteRunner() { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Connecting client shouldn't fail") - cd, err := contracts.NewContractDeployer(chainClient) + cd, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Deploying contracts shouldn't fail") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") diff --git a/integration-tests/reorg/automation_reorg_test.go b/integration-tests/reorg/automation_reorg_test.go index f3d3ed9369..ab439e59f2 100644 --- a/integration-tests/reorg/automation_reorg_test.go +++ b/integration-tests/reorg/automation_reorg_test.go @@ -17,9 +17,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" "github.com/smartcontractkit/chainlink-env/pkg/helm/reorg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -124,7 +124,7 @@ const ( * normal pace after the event. */ func TestAutomationReorg(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) network := networks.SelectedNetwork cd, err := chainlink.NewDeployment(numberOfNodes, defaultAutomationSettings) @@ -147,9 +147,9 @@ func TestAutomationReorg(t *testing.T) { return } - chainClient, err := blockchain.NewEVMClient(network, testEnvironment) + chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/reorg/reorg_test.go b/integration-tests/reorg/reorg_test.go index 03d179ce26..5666d8c754 100644 --- a/integration-tests/reorg/reorg_test.go +++ b/integration-tests/reorg/reorg_test.go @@ -91,6 +91,7 @@ func CleanupReorgTest( func TestDirectRequestReorg(t *testing.T) { logging.Init() + l := logging.GetTestLogger(t) testEnvironment := environment.New(&environment.Config{ TTL: 1 * time.Hour, Test: t, @@ -131,9 +132,9 @@ func TestDirectRequestReorg(t *testing.T) { err = testEnvironment.AddHelmCharts(chainlinkDeployment).Run() require.NoError(t, err, "Error adding to test environment") - chainClient, err := blockchain.NewEVMClient(networkSettings, testEnvironment) + chainClient, err := blockchain.NewEVMClient(networkSettings, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - cd, err := contracts.NewContractDeployer(chainClient) + cd, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/smoke/automation_test.go b/integration-tests/smoke/automation_test.go index 63d52d326b..76ee75b21b 100644 --- a/integration-tests/smoke/automation_test.go +++ b/integration-tests/smoke/automation_test.go @@ -13,17 +13,15 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-env/logging" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/chainlink/integration-tests/contracts/ethereum" - "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" "github.com/smartcontractkit/chainlink/integration-tests/types/config/node" it_utils "github.com/smartcontractkit/chainlink/integration-tests/utils" @@ -98,7 +96,7 @@ func SetupAutomationBasic(t *testing.T, nodeUpgrade bool) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) var ( upgradeImage string @@ -214,7 +212,7 @@ func SetupAutomationBasic(t *testing.T, nodeUpgrade bool) { func TestSetUpkeepTriggerConfig(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "set-trigger-config", ethereum.RegistryVersion_2_1, defaultOCRRegistryConfig, false, @@ -440,7 +438,7 @@ func TestAutomationPauseUnPause(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "pause-unpause", registryVersion, defaultOCRRegistryConfig, false, ) @@ -523,7 +521,7 @@ func TestAutomationRegisterUpkeep(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "register-upkeep", registryVersion, defaultOCRRegistryConfig, false, ) @@ -652,7 +650,7 @@ func TestAutomationKeeperNodesDown(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "keeper-nodes-down", registryVersion, defaultOCRRegistryConfig, false, ) @@ -801,7 +799,7 @@ func TestAutomationCheckPerformGasLimit(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "gas-limit", registryVersion, defaultOCRRegistryConfig, false, ) @@ -882,7 +880,7 @@ func TestAutomationCheckPerformGasLimit(t *testing.T) { highCheckGasLimit := automationDefaultRegistryConfig highCheckGasLimit.CheckGasLimit = uint32(5000000) highCheckGasLimit.RegistryVersion = registryVersion - ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(t, nodesWithoutBootstrap, highCheckGasLimit, registrar.Address(), 30*time.Second) + ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(l, nodesWithoutBootstrap, highCheckGasLimit, registrar.Address(), 30*time.Second) require.NoError(t, err, "Error building OCR config") err = registry.SetConfig(highCheckGasLimit, ocrConfig) @@ -914,7 +912,7 @@ func TestUpdateCheckData(t *testing.T) { registryVersion := rv t.Run(name, func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, _, contractDeployer, linkToken, registry, registrar, _ := setupAutomationTestDocker( t, "update-check-data", registryVersion, defaultOCRRegistryConfig, false, ) @@ -990,6 +988,7 @@ func setupAutomationTestDocker( contracts.KeeperRegistrar, *test_env.CLClusterTestEnv, ) { + l := logging.GetTestLogger(t) // Add registry version to config registryConfig.RegistryVersion = registryVersion network := networks.SelectedNetwork @@ -1008,6 +1007,7 @@ func setupAutomationTestDocker( // launch the environment env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(5). @@ -1040,9 +1040,9 @@ func setupAutomationTestDocker( err = linkToken.Transfer(registry.Address(), big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(int64(defaultAmountOfUpkeeps)))) require.NoError(t, err, "Funding keeper registry contract shouldn't fail") - err = actions.CreateOCRKeeperJobsLocal(nodeClients, registry.Address(), network.ChainID, 0, registryVersion) + err = actions.CreateOCRKeeperJobsLocal(l, nodeClients, registry.Address(), network.ChainID, 0, registryVersion) require.NoError(t, err, "Error creating OCR Keeper Jobs") - ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(t, workerNodes, registryConfig, registrar.Address(), 30*time.Second) + ocrConfig, err := actions.BuildAutoOCR2ConfigVarsLocal(l, workerNodes, registryConfig, registrar.Address(), 30*time.Second) require.NoError(t, err, "Error building OCR config vars") err = registry.SetConfig(automationDefaultRegistryConfig, ocrConfig) require.NoError(t, err, "Registry config should be set successfully") diff --git a/integration-tests/smoke/cron_test.go b/integration-tests/smoke/cron_test.go index 4019b50dfe..717ff8db1e 100644 --- a/integration-tests/smoke/cron_test.go +++ b/integration-tests/smoke/cron_test.go @@ -8,7 +8,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -16,9 +16,10 @@ import ( func TestCronBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/flux_test.go b/integration-tests/smoke/flux_test.go index f9eef6d06a..ed907e9e46 100644 --- a/integration-tests/smoke/flux_test.go +++ b/integration-tests/smoke/flux_test.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -22,9 +22,10 @@ import ( func TestFluxBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(3). @@ -106,7 +107,7 @@ func TestFluxBasic(t *testing.T) { // initial value set is performed before jobs creation fluxRoundTimeout := 1 * time.Minute - fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout) + fluxRound := contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(1), fluxRoundTimeout, l) env.EVMClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Waiting for event subscriptions in nodes shouldn't fail") @@ -123,7 +124,7 @@ func TestFluxBasic(t *testing.T) { require.Equal(t, int64(3), data.AllocatedFunds.Int64(), "Expected allocated funds to be %d, but found %d", int64(3), data.AllocatedFunds.Int64()) - fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout) + fluxRound = contracts.NewFluxAggregatorRoundConfirmer(fluxInstance, big.NewInt(2), fluxRoundTimeout, l) env.EVMClient.AddHeaderEventSubscription(fluxInstance.Address(), fluxRound) err = env.MockServer.Client.SetValuePath(adapterPath, 1e10) require.NoError(t, err, "Setting value path in mock server shouldn't fail") diff --git a/integration-tests/smoke/forwarder_ocr_test.go b/integration-tests/smoke/forwarder_ocr_test.go index 2482532314..f0d20e5245 100644 --- a/integration-tests/smoke/forwarder_ocr_test.go +++ b/integration-tests/smoke/forwarder_ocr_test.go @@ -8,7 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -16,9 +16,10 @@ import ( func TestForwarderOCRBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithForwarders(). @@ -54,7 +55,7 @@ func TestForwarderOCRBasic(t *testing.T) { t, operators[i], authorizedForwarders[i], []common.Address{workerNodeAddresses[i]}, env.EVMClient, env.ContractLoader, ) require.NoError(t, err, "Accepting Authorize Receivers on Operator shouldn't fail") - err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i]) + err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i], l) require.NoError(t, err) err = env.EVMClient.WaitForEvents() } @@ -70,7 +71,7 @@ func TestForwarderOCRBasic(t *testing.T) { err = actions.CreateOCRJobsWithForwarderLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client, env.EVMClient.GetChainID().String()) require.NoError(t, err, "failed to setup forwarder jobs") - err = actions.StartNewRound(1, ocrInstances, env.EVMClient) + err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l) require.NoError(t, err) err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") @@ -82,7 +83,7 @@ func TestForwarderOCRBasic(t *testing.T) { err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockServer.Client) require.NoError(t, err) - err = actions.StartNewRound(2, ocrInstances, env.EVMClient) + err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l) require.NoError(t, err) err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") diff --git a/integration-tests/smoke/forwarders_ocr2_test.go b/integration-tests/smoke/forwarders_ocr2_test.go index 62e8eec591..2f7c4fa21d 100644 --- a/integration-tests/smoke/forwarders_ocr2_test.go +++ b/integration-tests/smoke/forwarders_ocr2_test.go @@ -10,7 +10,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -19,9 +19,10 @@ import ( func TestForwarderOCR2Basic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), @@ -60,7 +61,7 @@ func TestForwarderOCR2Basic(t *testing.T) { for i := range workerNodes { actions.AcceptAuthorizedReceiversOperator(t, operators[i], authorizedForwarders[i], []common.Address{workerNodeAddresses[i]}, env.EVMClient, env.ContractLoader) require.NoError(t, err, "Accepting Authorized Receivers on Operator shouldn't fail") - err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i]) + err = actions.TrackForwarderLocal(env.EVMClient, authorizedForwarders[i], workerNodes[i], l) require.NoError(t, err, "failed to track forwarders") err = env.EVMClient.WaitForEvents() require.NoError(t, err, "Error waiting for events") @@ -89,7 +90,7 @@ func TestForwarderOCR2Basic(t *testing.T) { err = actions.ConfigureOCRv2AggregatorContracts(env.EVMClient, ocrv2Config, ocrInstances) require.NoError(t, err, "Error configuring OCRv2 aggregator contracts") - err = actions.StartNewOCR2Round(1, ocrInstances, env.EVMClient, time.Minute*10) + err = actions.StartNewOCR2Round(1, ocrInstances, env.EVMClient, time.Minute*10, l) require.NoError(t, err) answer, err := ocrInstances[0].GetLatestAnswer(context.Background()) @@ -100,7 +101,7 @@ func TestForwarderOCR2Basic(t *testing.T) { ocrRoundVal := (5 + i) % 10 err = env.MockServer.Client.SetValuePath("ocr2", ocrRoundVal) require.NoError(t, err) - err = actions.StartNewOCR2Round(int64(i), ocrInstances, env.EVMClient, time.Minute*10) + err = actions.StartNewOCR2Round(int64(i), ocrInstances, env.EVMClient, time.Minute*10, l) require.NoError(t, err) answer, err = ocrInstances[0].GetLatestAnswer(context.Background()) diff --git a/integration-tests/smoke/keeper_test.go b/integration-tests/smoke/keeper_test.go index a2ff098992..0e4cb7ce04 100644 --- a/integration-tests/smoke/keeper_test.go +++ b/integration-tests/smoke/keeper_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/v2/core/store/models" @@ -86,7 +86,7 @@ func TestKeeperBasicSmoke(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -101,7 +101,7 @@ func TestKeeperBasicSmoke(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -162,7 +162,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -177,7 +177,7 @@ func TestKeeperBlockCountPerTurn(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -266,6 +266,7 @@ func TestKeeperSimulation(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts( t, @@ -284,7 +285,7 @@ func TestKeeperSimulation(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -338,7 +339,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts( t, @@ -357,7 +358,7 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -451,7 +452,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, registrar, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -466,7 +467,7 @@ func TestKeeperRegisterUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -540,6 +541,7 @@ func TestKeeperAddFunds(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -554,7 +556,7 @@ func TestKeeperAddFunds(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -602,7 +604,7 @@ func TestKeeperRemove(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -617,7 +619,7 @@ func TestKeeperRemove(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -680,6 +682,7 @@ func TestKeeperPauseRegistry(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -694,7 +697,7 @@ func TestKeeperPauseRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -740,6 +743,7 @@ func TestKeeperPauseRegistry(t *testing.T) { func TestKeeperMigrateRegistry(t *testing.T) { t.Parallel() + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -754,7 +758,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -773,7 +777,7 @@ func TestKeeperMigrateRegistry(t *testing.T) { ) // Set the jobs for the second registry - _, err = actions.CreateKeeperJobsLocal(chainlinkNodes, secondRegistry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err = actions.CreateKeeperJobsLocal(l, chainlinkNodes, secondRegistry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -831,7 +835,7 @@ func TestKeeperNodeDown(t *testing.T) { registryVersion := rv t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -846,7 +850,7 @@ func TestKeeperNodeDown(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - jobs, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + jobs, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -937,7 +941,7 @@ type nodeAndJob struct { func TestKeeperPauseUnPauseUpkeep(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts( t, @@ -952,7 +956,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -1027,7 +1031,7 @@ func TestKeeperPauseUnPauseUpkeep(t *testing.T) { func TestKeeperUpdateCheckData(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t) registry, _, performDataChecker, upkeepIDs := actions.DeployPerformDataCheckerContracts( t, @@ -1043,7 +1047,7 @@ func TestKeeperUpdateCheckData(t *testing.T) { ) gom := gomega.NewGomegaWithT(t) - _, err := actions.CreateKeeperJobsLocal(chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) + _, err := actions.CreateKeeperJobsLocal(l, chainlinkNodes, registry, contracts.OCRv2Config{}, chainClient.GetChainID().String()) require.NoError(t, err, "Error creating keeper jobs") err = chainClient.WaitForEvents() require.NoError(t, err, "Error creating keeper jobs") @@ -1101,9 +1105,10 @@ func setupKeeperTest(t *testing.T) ( clNodeConfig.Keeper.TurnLookBack = &turnLookBack clNodeConfig.Keeper.Registry.SyncInterval = &syncInterval clNodeConfig.Keeper.Registry.PerformGasOverhead = &performGasOverhead - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(5). diff --git a/integration-tests/smoke/ocr2_test.go b/integration-tests/smoke/ocr2_test.go index fe53d2cb6a..db11f187f5 100644 --- a/integration-tests/smoke/ocr2_test.go +++ b/integration-tests/smoke/ocr2_test.go @@ -16,9 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver" mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -29,9 +28,10 @@ import ( // Tests a basic OCRv2 median feed func TestOCRv2Basic(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(), @@ -81,7 +81,7 @@ func TestOCRv2Basic(t *testing.T) { err = actions.ConfigureOCRv2AggregatorContracts(env.EVMClient, ocrv2Config, aggregatorContracts) require.NoError(t, err, "Error configuring OCRv2 aggregator contracts") - err = actions.StartNewOCR2Round(1, aggregatorContracts, env.EVMClient, time.Minute*5) + err = actions.StartNewOCR2Round(1, aggregatorContracts, env.EVMClient, time.Minute*5, l) require.NoError(t, err, "Error starting new OCR2 round") roundData, err := aggregatorContracts[0].GetRound(context.Background(), big.NewInt(1)) require.NoError(t, err, "Getting latest answer from OCR contract shouldn't fail") @@ -92,7 +92,7 @@ func TestOCRv2Basic(t *testing.T) { err = env.MockServer.Client.SetValuePath("ocr2", 10) require.NoError(t, err) - err = actions.StartNewOCR2Round(2, aggregatorContracts, env.EVMClient, time.Minute*5) + err = actions.StartNewOCR2Round(2, aggregatorContracts, env.EVMClient, time.Minute*5, l) require.NoError(t, err) roundData, err = aggregatorContracts[0].GetRound(context.Background(), big.NewInt(2)) diff --git a/integration-tests/smoke/ocr2vrf_test.go b/integration-tests/smoke/ocr2vrf_test.go index 50a21b81d8..c9f689ca7a 100644 --- a/integration-tests/smoke/ocr2vrf_test.go +++ b/integration-tests/smoke/ocr2vrf_test.go @@ -13,9 +13,9 @@ import ( "github.com/smartcontractkit/chainlink-env/pkg/helm/chainlink" eth "github.com/smartcontractkit/chainlink-env/pkg/helm/ethereum" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" - "github.com/smartcontractkit/chainlink-testing-framework/utils" - + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/ocr2vrf_actions" @@ -28,15 +28,15 @@ import ( func TestOCR2VRFRedeemModel(t *testing.T) { t.Parallel() t.Skip("VRFv3 is on pause, skipping") - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) if testEnvironment.WillUseRemoteRunner() { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") @@ -90,15 +90,15 @@ func TestOCR2VRFRedeemModel(t *testing.T) { func TestOCR2VRFFulfillmentModel(t *testing.T) { t.Parallel() t.Skip("VRFv3 is on pause, skipping") - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) testEnvironment, testNetwork := setupOCR2VRFEnvironment(t) if testEnvironment.WillUseRemoteRunner() { return } - chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment) + chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l) require.NoError(t, err, "Error connecting to blockchain") - contractDeployer, err := contracts.NewContractDeployer(chainClient) + contractDeployer, err := contracts.NewContractDeployer(chainClient, l) require.NoError(t, err, "Error building contract deployer") chainlinkNodes, err := client.ConnectChainlinkNodes(testEnvironment) require.NoError(t, err, "Error connecting to Chainlink nodes") diff --git a/integration-tests/smoke/ocr_test.go b/integration-tests/smoke/ocr_test.go index d8f905480c..56d045fa09 100644 --- a/integration-tests/smoke/ocr_test.go +++ b/integration-tests/smoke/ocr_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -15,9 +15,10 @@ import ( func TestOCRBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(6). @@ -46,7 +47,7 @@ func TestOCRBasic(t *testing.T) { err = actions.CreateOCRJobsLocal(ocrInstances, bootstrapNode, workerNodes, 5, env.MockServer.Client, env.EVMClient.GetChainID().String()) require.NoError(t, err) - err = actions.StartNewRound(1, ocrInstances, env.EVMClient) + err = actions.StartNewRound(1, ocrInstances, env.EVMClient, l) require.NoError(t, err) answer, err := ocrInstances[0].GetLatestAnswer(context.Background()) @@ -55,7 +56,7 @@ func TestOCRBasic(t *testing.T) { err = actions.SetAllAdapterResponsesToTheSameValueLocal(10, ocrInstances, workerNodes, env.MockServer.Client) require.NoError(t, err) - err = actions.StartNewRound(2, ocrInstances, env.EVMClient) + err = actions.StartNewRound(2, ocrInstances, env.EVMClient, l) require.NoError(t, err) answer, err = ocrInstances[0].GetLatestAnswer(context.Background()) diff --git a/integration-tests/smoke/runlog_test.go b/integration-tests/smoke/runlog_test.go index 37fb4a76c5..0bfc41eca7 100644 --- a/integration-tests/smoke/runlog_test.go +++ b/integration-tests/smoke/runlog_test.go @@ -11,7 +11,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/docker/test_env" @@ -19,9 +19,10 @@ import ( func TestRunLogBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/vrf_test.go b/integration-tests/smoke/vrf_test.go index 3164fcf232..47f8cd8e30 100644 --- a/integration-tests/smoke/vrf_test.go +++ b/integration-tests/smoke/vrf_test.go @@ -11,7 +11,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv1" @@ -21,9 +21,10 @@ import ( func TestVRFBasic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithMockServer(1). WithCLNodes(1). diff --git a/integration-tests/smoke/vrfv2_test.go b/integration-tests/smoke/vrfv2_test.go index c34e60fe6b..18e9efeae4 100644 --- a/integration-tests/smoke/vrfv2_test.go +++ b/integration-tests/smoke/vrfv2_test.go @@ -9,7 +9,7 @@ import ( "github.com/onsi/gomega" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2_actions" @@ -20,9 +20,10 @@ import ( func TestVRFv2Basic(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithCLNodes(1). WithFunding(vrfConst.ChainlinkNodeFundingAmountEth). diff --git a/integration-tests/smoke/vrfv2plus_test.go b/integration-tests/smoke/vrfv2plus_test.go index 7fd4a580bc..bec31c5681 100644 --- a/integration-tests/smoke/vrfv2plus_test.go +++ b/integration-tests/smoke/vrfv2plus_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/actions/vrfv2plus" @@ -18,9 +18,10 @@ import ( func TestVRFv2PlusBilling(t *testing.T) { t.Parallel() - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) env, err := test_env.NewCLTestEnvBuilder(). + WithTestLogger(t). WithGeth(). WithCLNodes(1). WithFunding(vrfv2plus_constants.ChainlinkNodeFundingAmountEth). diff --git a/integration-tests/soak/forwarder_ocr_test.go b/integration-tests/soak/forwarder_ocr_test.go index e8bcea0f5b..bc02f36789 100644 --- a/integration-tests/soak/forwarder_ocr_test.go +++ b/integration-tests/soak/forwarder_ocr_test.go @@ -5,14 +5,14 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/testsetups" ) func TestForwarderOCRSoak(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Use this variable to pass in any custom EVM specific TOML values to your Chainlink nodes customNetworkTOML := `[EVM.Transactions] ForwardersEnabled = true` diff --git a/integration-tests/soak/ocr_test.go b/integration-tests/soak/ocr_test.go index c0fd0a4525..b2375f13ac 100644 --- a/integration-tests/soak/ocr_test.go +++ b/integration-tests/soak/ocr_test.go @@ -5,14 +5,14 @@ import ( "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/actions" "github.com/smartcontractkit/chainlink/integration-tests/testsetups" ) func TestOCRSoak(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Use this variable to pass in any custom EVM specific TOML values to your Chainlink nodes customNetworkTOML := `` // Uncomment below for debugging TOML issues on the node diff --git a/integration-tests/testsetups/don_evm_chain.go b/integration-tests/testsetups/don_evm_chain.go index a9e69b32f4..545d951580 100644 --- a/integration-tests/testsetups/don_evm_chain.go +++ b/integration-tests/testsetups/don_evm_chain.go @@ -3,6 +3,7 @@ package testsetups import ( "testing" + "github.com/rs/zerolog" "github.com/stretchr/testify/require" e "github.com/smartcontractkit/chainlink-env/environment" @@ -25,6 +26,7 @@ type DonChain struct { LinkTokenContract contracts.LinkToken ChainlinkNodes []*client.ChainlinkK8sClient Mockserver *ctfClient.MockserverClient + l zerolog.Logger } type DonChainConfig struct { @@ -35,10 +37,11 @@ type DonChainConfig struct { ChainlinkValues map[string]interface{} } -func NewDonChain(conf *DonChainConfig) *DonChain { +func NewDonChain(conf *DonChainConfig, logger zerolog.Logger) *DonChain { return &DonChain{ conf: conf, EVMNetwork: conf.EVMNetwork, + l: logger, } } @@ -59,10 +62,10 @@ func (s *DonChain) Deploy() { func (s *DonChain) initializeClients() { var err error network := *s.conf.EVMNetwork - s.EVMClient, err = blockchain.NewEVMClient(network, s.conf.Env) + s.EVMClient, err = blockchain.NewEVMClient(network, s.conf.Env, s.l) require.NoError(s.conf.T, err, "Connecting to blockchain nodes shouldn't fail") - s.ContractDeployer, err = contracts.NewContractDeployer(s.EVMClient) + s.ContractDeployer, err = contracts.NewContractDeployer(s.EVMClient, s.l) require.NoError(s.conf.T, err) s.ChainlinkNodes, err = client.ConnectChainlinkNodes(s.conf.Env) diff --git a/integration-tests/testsetups/keeper_benchmark.go b/integration-tests/testsetups/keeper_benchmark.go index bdba3a6766..ba0cc23b23 100644 --- a/integration-tests/testsetups/keeper_benchmark.go +++ b/integration-tests/testsetups/keeper_benchmark.go @@ -19,8 +19,8 @@ import ( "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" + "github.com/smartcontractkit/chainlink-testing-framework/logging" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/utils" iregistry21 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/i_keeper_registry_master_wrapper_2_1" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper1_1" @@ -100,7 +100,7 @@ func NewKeeperBenchmarkTest(inputs KeeperBenchmarkTestInputs) *KeeperBenchmarkTe // Setup prepares contracts for the test func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) startTime := time.Now() k.TestReporter.Summary.StartTime = startTime.UnixMilli() k.ensureInputValues(t) @@ -116,7 +116,7 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) var err error // Connect to networks and prepare for contract deployment - k.contractDeployer, err = contracts.NewContractDeployer(k.chainClient) + k.contractDeployer, err = contracts.NewContractDeployer(k.chainClient, l) require.NoError(t, err, "Building a new contract deployer shouldn't fail") k.chainlinkNodes, err = client.ConnectChainlinkNodes(k.env) require.NoError(t, err, "Connecting to chainlink nodes shouldn't fail") @@ -202,7 +202,7 @@ func (k *KeeperBenchmarkTest) Setup(t *testing.T, env *environment.Environment) // Run runs the keeper benchmark test func (k *KeeperBenchmarkTest) Run(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) u := k.Inputs.Upkeeps k.TestReporter.Summary.Load.TotalCheckGasPerBlock = int64(u.NumberOfUpkeeps) * u.CheckGasToBurn k.TestReporter.Summary.Load.TotalPerformGasPerBlock = int64((float64(u.NumberOfUpkeeps) / @@ -264,6 +264,7 @@ func (k *KeeperBenchmarkTest) Run(t *testing.T) { &k.TestReporter, int64(index), inputs.Upkeeps.FirstEligibleBuffer, + l, ), ) } @@ -323,7 +324,7 @@ func (k *KeeperBenchmarkTest) subscribeToUpkeepPerformedEvent( metricsReporter *testreporters.KeeperBenchmarkTestReporter, rIndex int, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) contractABI, err := keeper_registry_wrapper1_1.KeeperRegistryMetaData.GetAbi() require.NoError(t, err, "Error getting ABI") switch k.Inputs.RegistryVersions[rIndex] { @@ -476,7 +477,7 @@ func (k *KeeperBenchmarkTest) DeployBenchmarkKeeperContracts( t *testing.T, index int, ) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) registryVersion := k.Inputs.RegistryVersions[index] k.Inputs.KeeperRegistrySettings.RegistryVersion = registryVersion upkeep := k.Inputs.Upkeeps @@ -587,7 +588,7 @@ func DeployKeeperConsumersBenchmark( contractDeployer contracts.ContractDeployer, client blockchain.EVMClient, ) contracts.AutomationConsumerBenchmark { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) // Deploy consumer keeperConsumerInstance, err := contractDeployer.DeployKeeperConsumerBenchmark() diff --git a/integration-tests/testsetups/ocr.go b/integration-tests/testsetups/ocr.go index c0e8452582..5f12995cc0 100644 --- a/integration-tests/testsetups/ocr.go +++ b/integration-tests/testsetups/ocr.go @@ -22,7 +22,6 @@ import ( "github.com/kelseyhightower/envconfig" "github.com/pelletier/go-toml/v2" "github.com/rs/zerolog" - "github.com/rs/zerolog/log" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-env/environment" @@ -32,8 +31,8 @@ import ( mockservercfg "github.com/smartcontractkit/chainlink-env/pkg/helm/mockserver-cfg" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ctfClient "github.com/smartcontractkit/chainlink-testing-framework/client" + "github.com/smartcontractkit/chainlink-testing-framework/logging" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/libocr/gethwrappers/offchainaggregator" "github.com/smartcontractkit/chainlink-testing-framework/networks" @@ -115,7 +114,7 @@ func NewOCRSoakTest(t *testing.T, forwarderFlow bool) (*OCRSoakTest, error) { t: t, startTime: time.Now(), timeLeft: testInputs.TestDuration, - log: utils.GetTestLogger(t), + log: logging.GetTestLogger(t), ocrRoundStates: make([]*testreporters.OCRRoundState, 0), ocrInstanceMap: make(map[string]contracts.OffchainAggregator), } @@ -165,7 +164,7 @@ func (o *OCRSoakTest) LoadEnvironment(chainlinkURLs []string, chainURL, mockServ network = networks.SelectedNetwork err error ) - o.chainClient, err = blockchain.ConnectEVMClient(network) + o.chainClient, err = blockchain.ConnectEVMClient(network, o.log) require.NoError(o.t, err, "Error connecting to EVM client") chainlinkNodes, err := client.ConnectChainlinkNodeURLs(chainlinkURLs) require.NoError(o.t, err, "Error connecting to chainlink nodes") @@ -187,9 +186,9 @@ func (o *OCRSoakTest) Setup() { // Environment currently being used to soak test on // Make connections to soak test resources - o.chainClient, err = blockchain.NewEVMClient(network, o.testEnvironment) + o.chainClient, err = blockchain.NewEVMClient(network, o.testEnvironment, o.log) require.NoError(o.t, err, "Error creating EVM client") - contractDeployer, err := contracts.NewContractDeployer(o.chainClient) + contractDeployer, err := contracts.NewContractDeployer(o.chainClient, o.log) require.NoError(o.t, err, "Unable to create contract deployer") require.NotNil(o.t, contractDeployer, "Contract deployer shouldn't be nil") nodes, err := client.ConnectChainlinkNodes(o.testEnvironment) @@ -207,7 +206,7 @@ func (o *OCRSoakTest) Setup() { require.NoError(o.t, err, "Error funding Chainlink nodes") if o.OperatorForwarderFlow { - contractLoader, err := contracts.NewContractLoader(o.chainClient) + contractLoader, err := contracts.NewContractLoader(o.chainClient, o.log) require.NoError(o.t, err, "Loading contracts shouldn't fail") operators, authorizedForwarders, _ := actions.DeployForwarderContracts( @@ -385,11 +384,11 @@ func (o *OCRSoakTest) LoadState() error { o.startingBlockNum = testState.StartingBlockNum network := networks.SelectedNetwork - o.chainClient, err = blockchain.ConnectEVMClient(network) + o.chainClient, err = blockchain.ConnectEVMClient(network, o.log) if err != nil { return err } - contractDeployer, err := contracts.NewContractDeployer(o.chainClient) + contractDeployer, err := contracts.NewContractDeployer(o.chainClient, o.log) if err != nil { return err } @@ -424,7 +423,7 @@ func (o *OCRSoakTest) Resume() { StartTime: time.Now(), Message: "Test Resumed", }) - log.Info(). + o.log.Info(). Str("Total Duration", o.Inputs.TestDuration.String()). Str("Time Left", o.timeLeft.String()). Msg("Resuming OCR Soak Test") @@ -447,7 +446,7 @@ func (o *OCRSoakTest) Resume() { o.log.Info().Msg("Test Complete, collecting on-chain events") err = o.collectEvents() - log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") + o.log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) } @@ -485,7 +484,7 @@ func (o *OCRSoakTest) testLoop(testDuration time.Duration, newValue int) { if err := o.SaveState(); err != nil { o.log.Error().Err(err).Msg("Error saving state") } - log.Warn().Str("Time Taken", time.Since(saveStart).String()).Msg("Saved state") + o.log.Warn().Str("Time Taken", time.Since(saveStart).String()).Msg("Saved state") os.Exit(2) // Exit with code 2 to indicate test was interrupted, not just a normal failure case <-endTest: return @@ -526,7 +525,7 @@ func (o *OCRSoakTest) complete() { err := o.collectEvents() if err != nil { - log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") + o.log.Error().Err(err).Interface("Query", o.filterQuery).Msg("Error collecting on-chain events, expect malformed report") } o.TestReporter.RecordEvents(o.ocrRoundStates, o.testIssues) } @@ -544,7 +543,7 @@ func (o *OCRSoakTest) setFilterQuery() { Topics: [][]common.Hash{{contractABI.Events["AnswerUpdated"].ID}}, FromBlock: big.NewInt(0).SetUint64(o.startingBlockNum), } - log.Debug(). + o.log.Debug(). Interface("Addresses", ocrAddresses). Str("Topic", contractABI.Events["AnswerUpdated"].ID.Hex()). Uint64("Starting Block", o.startingBlockNum). @@ -569,7 +568,7 @@ func (o *OCRSoakTest) observeOCREvents() error { case event := <-eventLogs: answerUpdated, err := o.ocrInstances[0].ParseEventAnswerUpdated(event) if err != nil { - log.Warn(). + o.log.Warn(). Err(err). Str("Address", event.Address.Hex()). Uint64("Block Number", event.BlockNumber). @@ -634,18 +633,18 @@ func (o *OCRSoakTest) collectEvents() error { // We must retrieve the events, use exponential backoff for timeout to retry timeout := time.Second * 15 - log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") + o.log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") ctx, cancel := context.WithTimeout(context.Background(), timeout) contractEvents, err := o.chainClient.FilterLogs(ctx, o.filterQuery) cancel() for err != nil { - log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") + o.log.Info().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Retrieving on-chain events") ctx, cancel := context.WithTimeout(context.Background(), timeout) contractEvents, err = o.chainClient.FilterLogs(ctx, o.filterQuery) cancel() if err != nil { - log.Warn().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Error collecting on-chain events, trying again") + o.log.Warn().Interface("Filter Query", o.filterQuery).Str("Timeout", timeout.String()).Msg("Error collecting on-chain events, trying again") timeout *= 2 } } diff --git a/integration-tests/testsetups/vrfv2.go b/integration-tests/testsetups/vrfv2.go index 7afe9cf2cc..cfa26e8f27 100644 --- a/integration-tests/testsetups/vrfv2.go +++ b/integration-tests/testsetups/vrfv2.go @@ -16,8 +16,8 @@ import ( "github.com/smartcontractkit/chainlink-env/environment" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" + "github.com/smartcontractkit/chainlink-testing-framework/logging" reportModel "github.com/smartcontractkit/chainlink-testing-framework/testreporters" - "github.com/smartcontractkit/chainlink-testing-framework/utils" "github.com/smartcontractkit/chainlink/integration-tests/client" "github.com/smartcontractkit/chainlink/integration-tests/contracts" @@ -80,7 +80,7 @@ func (v *VRFV2SoakTest) Setup(t *testing.T, env *environment.Environment) { // Run starts the VRFV2 soak test func (v *VRFV2SoakTest) Run(t *testing.T) { - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) l.Info(). Str("Test Duration", v.Inputs.TestDuration.Truncate(time.Second).String()). Int("Max number of requests per minute wanted", v.Inputs.RequestsPerMinute). From 04665a75691eeed532de82bb1a3953becb14e96b Mon Sep 17 00:00:00 2001 From: Austin Born Date: Thu, 14 Sep 2023 16:05:29 -0700 Subject: [PATCH 14/26] Update setConfigFromSource to force config count (#10472) * Update setConfigFromSource to force config count * Test fixes + wrappers * Removed foundry from commit * lint, wrappers, gas * Revert changed files outside of llo-feeds --------- Co-authored-by: Michael Fletcher Co-authored-by: Michael Fletcher <36506122+Fletch153@users.noreply.github.com> --- .../gas-snapshots/llo-feeds.gas-snapshot | 44 +++++++++---------- contracts/src/v0.8/llo-feeds/Verifier.sol | 8 +++- .../v0.8/llo-feeds/interfaces/IVerifier.sol | 2 + .../llo-feeds/test/mocks/ErroredVerifier.sol | 1 + .../VerifierSetConfigFromSourceTest.t.sol | 5 +++ .../errored_verifier/errored_verifier.go | 18 ++++---- .../llo-feeds/generated/verifier/verifier.go | 18 ++++---- ...rapper-dependency-versions-do-not-edit.txt | 4 +- 8 files changed, 57 insertions(+), 43 deletions(-) diff --git a/contracts/gas-snapshots/llo-feeds.gas-snapshot b/contracts/gas-snapshots/llo-feeds.gas-snapshot index 4cc6be66be..fc8b0937d1 100644 --- a/contracts/gas-snapshots/llo-feeds.gas-snapshot +++ b/contracts/gas-snapshots/llo-feeds.gas-snapshot @@ -168,9 +168,9 @@ RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsToDifferentSet() (g RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsToDifferentSetWithInvalidWeights() (gas: 259546) RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsUpdateAndRemoveExistingForLargerSet() (gas: 251938) RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsUpdateAndRemoveExistingForSmallerSet() (gas: 250223) -VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyRemovesAMiddleDigest() (gas: 24155) -VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyRemovesTheFirstDigest() (gas: 24122) -VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyUnsetsDigestsInSequence() (gas: 44043) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyRemovesAMiddleDigest() (gas: 24177) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyRemovesTheFirstDigest() (gas: 24144) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyUnsetsDigestsInSequence() (gas: 44109) VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_revertsIfCalledByNonOwner() (gas: 15016) VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_revertsIfRemovingAnEmptyDigest() (gas: 10907) VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_revertsIfRemovingAnNonExistentDigest() (gas: 13381) @@ -191,8 +191,8 @@ VerifierBulkVerifyBillingReport:test_verifyWithBulkLink() (gas: 578193) VerifierBulkVerifyBillingReport:test_verifyWithBulkNative() (gas: 581776) VerifierBulkVerifyBillingReport:test_verifyWithBulkNativeUnwrapped() (gas: 589250) VerifierBulkVerifyBillingReport:test_verifyWithBulkNativeUnwrappedReturnsChange() (gas: 596277) -VerifierConstructorTest:test_revertsIfInitializedWithEmptyVerifierProxy() (gas: 59939) -VerifierConstructorTest:test_setsTheCorrectProperties() (gas: 1788491) +VerifierConstructorTest:test_revertsIfInitializedWithEmptyVerifierProxy() (gas: 59967) +VerifierConstructorTest:test_setsTheCorrectProperties() (gas: 1815769) VerifierDeactivateFeedWithVerifyTest:test_currentReportAllowsVerification() (gas: 192062) VerifierDeactivateFeedWithVerifyTest:test_currentReportFailsVerification() (gas: 111727) VerifierDeactivateFeedWithVerifyTest:test_previousReportAllowsVerification() (gas: 99613) @@ -202,7 +202,7 @@ VerifierProxyAccessControlledVerificationTest:test_revertsIfNoAccess() (gas: 107 VerifierProxyConstructorTest:test_correctlySetsTheCorrectAccessControllerInterface() (gas: 1439877) VerifierProxyConstructorTest:test_correctlySetsTheOwner() (gas: 1419891) VerifierProxyConstructorTest:test_correctlySetsVersion() (gas: 6873) -VerifierProxyInitializeVerifierTest:test_revertsIfDigestAlreadySet() (gas: 54085) +VerifierProxyInitializeVerifierTest:test_revertsIfDigestAlreadySet() (gas: 54107) VerifierProxyInitializeVerifierTest:test_revertsIfNotCorrectVerifier() (gas: 13572) VerifierProxyInitializeVerifierTest:test_revertsIfNotOwner() (gas: 17179) VerifierProxyInitializeVerifierTest:test_revertsIfVerifierAlreadyInitialized() (gas: 42069) @@ -210,7 +210,7 @@ VerifierProxyInitializeVerifierTest:test_revertsIfZeroAddress() (gas: 10970) VerifierProxyInitializeVerifierTest:test_setFeeManagerWhichDoesntHonourIERC165Interface() (gas: 13815) VerifierProxyInitializeVerifierTest:test_setFeeManagerWhichDoesntHonourInterface() (gas: 16301) VerifierProxyInitializeVerifierTest:test_setFeeManagerZeroAddress() (gas: 10947) -VerifierProxyInitializeVerifierTest:test_updatesVerifierIfVerifier() (gas: 53315) +VerifierProxyInitializeVerifierTest:test_updatesVerifierIfVerifier() (gas: 53337) VerifierProxySetAccessControllerTest:test_emitsTheCorrectEvent() (gas: 35384) VerifierProxySetAccessControllerTest:test_revertsIfCalledByNonOwner() (gas: 15105) VerifierProxySetAccessControllerTest:test_successfullySetsNewAccessController() (gas: 32120) @@ -221,20 +221,20 @@ VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest:test_correctlyUnsetsVeri VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest:test_emitsAnEventAfterUnsettingVerifier() (gas: 17965) VerifierProxyVerifyTest:test_proxiesToTheCorrectVerifier() (gas: 198420) VerifierProxyVerifyTest:test_revertsIfNoVerifierConfigured() (gas: 114671) -VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlySetsConfigWhenDigestsAreRemoved() (gas: 538582) -VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlyUpdatesDigestsOnMultipleVerifiersInTheProxy() (gas: 964048) -VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlyUpdatesTheDigestInTheProxy() (gas: 520140) -VerifierSetConfigFromSourceTest:test_revertsIfCalledByNonOwner() (gas: 183115) -VerifierSetConfigTest:test_correctlyUpdatesTheConfig() (gas: 1057669) -VerifierSetConfigTest:test_revertsIfCalledByNonOwner() (gas: 182962) -VerifierSetConfigTest:test_revertsIfDuplicateSigners() (gas: 251529) -VerifierSetConfigTest:test_revertsIfFaultToleranceIsZero() (gas: 176521) -VerifierSetConfigTest:test_revertsIfNotEnoughSigners() (gas: 15813) -VerifierSetConfigTest:test_revertsIfSetWithTooManySigners() (gas: 22191) -VerifierSetConfigTest:test_revertsIfSignerContainsZeroAddress() (gas: 228002) -VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlySetsConfigWhenDigestsAreRemoved() (gas: 538369) -VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlyUpdatesDigestsOnMultipleVerifiersInTheProxy() (gas: 963617) -VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlyUpdatesTheDigestInTheProxy() (gas: 519921) +VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlySetsConfigWhenDigestsAreRemoved() (gas: 538873) +VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlyUpdatesDigestsOnMultipleVerifiersInTheProxy() (gas: 964634) +VerifierSetConfigFromSourceMultipleDigestsTest:test_correctlyUpdatesTheDigestInTheProxy() (gas: 520434) +VerifierSetConfigFromSourceTest:test_revertsIfCalledByNonOwner() (gas: 183215) +VerifierSetConfigTest:test_correctlyUpdatesTheConfig() (gas: 1057922) +VerifierSetConfigTest:test_revertsIfCalledByNonOwner() (gas: 182984) +VerifierSetConfigTest:test_revertsIfDuplicateSigners() (gas: 251559) +VerifierSetConfigTest:test_revertsIfFaultToleranceIsZero() (gas: 176543) +VerifierSetConfigTest:test_revertsIfNotEnoughSigners() (gas: 15835) +VerifierSetConfigTest:test_revertsIfSetWithTooManySigners() (gas: 22213) +VerifierSetConfigTest:test_revertsIfSignerContainsZeroAddress() (gas: 228032) +VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlySetsConfigWhenDigestsAreRemoved() (gas: 538622) +VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlyUpdatesDigestsOnMultipleVerifiersInTheProxy() (gas: 964123) +VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlyUpdatesTheDigestInTheProxy() (gas: 520174) VerifierSupportsInterfaceTest:test_falseIfIsNotCorrectInterface() (gas: 5590) VerifierSupportsInterfaceTest:test_trueIfIsCorrectInterface() (gas: 5633) VerifierTestBillingReport:test_verifyWithLink() (gas: 278565) @@ -258,7 +258,7 @@ VerifierVerifySingleConfigDigestTest:test_setsTheCorrectEpoch() (gas: 194270) Verifier_accessControlledVerify:testVerifyWithAccessControl_gas() (gas: 208853) Verifier_bulkVerifyWithFee:testBulkVerifyProxyWithLinkFeeSuccess_gas() (gas: 540715) Verifier_bulkVerifyWithFee:testBulkVerifyProxyWithNativeFeeSuccess_gas() (gas: 564087) -Verifier_setConfig:testSetConfigSuccess_gas() (gas: 922428) +Verifier_setConfig:testSetConfigSuccess_gas() (gas: 922659) Verifier_verify:testVerifyProxySuccess_gas() (gas: 195542) Verifier_verify:testVerifySuccess_gas() (gas: 186725) Verifier_verifyWithFee:testVerifyProxyWithLinkFeeSuccess_gas() (gas: 242514) diff --git a/contracts/src/v0.8/llo-feeds/Verifier.sol b/contracts/src/v0.8/llo-feeds/Verifier.sol index 0461cae818..7b9a6d9832 100644 --- a/contracts/src/v0.8/llo-feeds/Verifier.sol +++ b/contracts/src/v0.8/llo-feeds/Verifier.sol @@ -323,6 +323,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { feedId, block.chainid, address(this), + 0, // 0 defaults to feedConfig.configCount + 1 signers, offchainTransmitters, f, @@ -338,6 +339,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { bytes32 feedId, uint256 sourceChainId, address sourceAddress, + uint32 newConfigCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f, @@ -350,6 +352,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { feedId, sourceChainId, sourceAddress, + newConfigCount, signers, offchainTransmitters, f, @@ -364,6 +367,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { /// @param feedId Feed ID to set config for /// @param sourceChainId Chain ID of source config /// @param sourceAddress Address of source config Verifier + /// @param newConfigCount Optional param to force the new config count /// @param signers addresses with which oracles sign the reports /// @param offchainTransmitters CSA key for the ith Oracle /// @param f number of faulty oracles the system can tolerate @@ -375,6 +379,7 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { bytes32 feedId, uint256 sourceChainId, address sourceAddress, + uint32 newConfigCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f, @@ -386,7 +391,8 @@ contract Verifier is IVerifier, ConfirmedOwner, TypeAndVersionInterface { VerifierState storage feedVerifierState = s_feedVerifierStates[feedId]; // Increment the number of times a config has been set first - feedVerifierState.configCount++; + if (newConfigCount > 0) feedVerifierState.configCount = newConfigCount; + else feedVerifierState.configCount++; bytes32 configDigest = _configDigestFromConfigData( feedId, diff --git a/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol b/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol index 6610957d98..7617d9a5c3 100644 --- a/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/interfaces/IVerifier.sol @@ -45,6 +45,7 @@ interface IVerifier is IERC165 { * @param feedId Feed ID to set config for * @param sourceChainId Chain ID of source config * @param sourceAddress Address of source config Verifier + * @param newConfigCount Param to force the new config count * @param signers addresses with which oracles sign the reports * @param offchainTransmitters CSA key for the ith Oracle * @param f number of faulty oracles the system can tolerate @@ -57,6 +58,7 @@ interface IVerifier is IERC165 { bytes32 feedId, uint256 sourceChainId, address sourceAddress, + uint32 newConfigCount, address[] memory signers, bytes32[] memory offchainTransmitters, uint8 f, diff --git a/contracts/src/v0.8/llo-feeds/test/mocks/ErroredVerifier.sol b/contracts/src/v0.8/llo-feeds/test/mocks/ErroredVerifier.sol index 23ef7c8580..a0a404d88d 100644 --- a/contracts/src/v0.8/llo-feeds/test/mocks/ErroredVerifier.sol +++ b/contracts/src/v0.8/llo-feeds/test/mocks/ErroredVerifier.sol @@ -46,6 +46,7 @@ contract ErroredVerifier is IVerifier { bytes32, uint256, address, + uint32, address[] memory, bytes32[] memory, uint8, diff --git a/contracts/src/v0.8/llo-feeds/test/verifier/VerifierSetConfigFromSourceTest.t.sol b/contracts/src/v0.8/llo-feeds/test/verifier/VerifierSetConfigFromSourceTest.t.sol index 2ba2529416..57c98622f5 100644 --- a/contracts/src/v0.8/llo-feeds/test/verifier/VerifierSetConfigFromSourceTest.t.sol +++ b/contracts/src/v0.8/llo-feeds/test/verifier/VerifierSetConfigFromSourceTest.t.sol @@ -20,6 +20,7 @@ contract VerifierSetConfigFromSourceTest is BaseTest { FEED_ID, 12345, address(12345), + 0, _getSignerAddresses(signers), s_offchaintransmitters, FAULT_TOLERANCE, @@ -39,6 +40,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC FEED_ID, 12345, address(12345), + 0, _getSignerAddresses(newSigners), s_offchaintransmitters, 4, @@ -60,6 +62,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC FEED_ID_2, 12345, address(12345), + 0, _getSignerAddresses(newSigners), s_offchaintransmitters, 4, @@ -77,6 +80,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC FEED_ID_3, 12345, address(12345), + 0, _getSignerAddresses(newSigners), s_offchaintransmitters, 4, @@ -100,6 +104,7 @@ contract VerifierSetConfigFromSourceMultipleDigestsTest is BaseTestWithMultipleC FEED_ID, 12345, address(s_verifier), + 0, _getSignerAddresses(newSigners), s_offchaintransmitters, 4, diff --git a/core/gethwrappers/llo-feeds/generated/errored_verifier/errored_verifier.go b/core/gethwrappers/llo-feeds/generated/errored_verifier/errored_verifier.go index 4c7056982e..846ebb197b 100644 --- a/core/gethwrappers/llo-feeds/generated/errored_verifier/errored_verifier.go +++ b/core/gethwrappers/llo-feeds/generated/errored_verifier/errored_verifier.go @@ -34,8 +34,8 @@ type CommonAddressAndWeight struct { } var ErroredVerifierMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"activateConfig\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"activateFeed\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deactivateConfig\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deactivateFeed\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestConfigDetails\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestConfigDigestAndEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"name\":\"setConfigFromSource\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610c00806100206000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063b70d929d11610076578063e84f128e1161005b578063e84f128e146101d1578063f010722114610207578063f84cf58e1461021a57600080fd5b8063b70d929d14610188578063ded6307c146101be57600080fd5b80633dd86430116100a75780633dd864301461014d578063564a0a7a1461016257806394d959801461017557600080fd5b806301ffc9a7146100c35780633d3ac1b51461012d575b600080fd5b6101186100d136600461059a565b7fffffffff00000000000000000000000000000000000000000000000000000000167f3d3ac1b5000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b61014061013b366004610741565b610228565b604051610124919061078f565b61016061015b3660046107fb565b610292565b005b6101606101703660046107fb565b6102f4565b610160610183366004610814565b610356565b61019b6101963660046107fb565b6103b8565b604080519315158452602084019290925263ffffffff1690820152606001610124565b6101606101cc366004610814565b610447565b6101e46101df3660046107fb565b6104a9565b6040805163ffffffff948516815293909216602084015290820152606001610124565b6101606102153660046109dd565b610538565b610160610215366004610ada565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4661696c656420746f207665726966790000000000000000000000000000000060448201526060906064015b60405180910390fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4661696c656420746f20616374697661746520666565640000000000000000006044820152606401610289565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4661696c656420746f20646561637469766174652066656564000000000000006044820152606401610289565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4661696c656420746f206465616374697661746520636f6e66696700000000006044820152606401610289565b60008060006040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610289906020808252602c908201527f4661696c656420746f20676574206c617465737420636f6e666967206469676560408201527f737420616e642065706f63680000000000000000000000000000000000000000606082015260800190565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4661696c656420746f20616374697661746520636f6e666967000000000000006044820152606401610289565b60008060006040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102899060208082526023908201527f4661696c656420746f20676574206c617465737420636f6e666967206465746160408201527f696c730000000000000000000000000000000000000000000000000000000000606082015260800190565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4661696c656420746f2073657420636f6e6669670000000000000000000000006044820152606401610289565b6000602082840312156105ac57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105dc57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610635576106356105e3565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610682576106826105e3565b604052919050565b600082601f83011261069b57600080fd5b813567ffffffffffffffff8111156106b5576106b56105e3565b6106e660207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161063b565b8181528460208386010111156106fb57600080fd5b816020850160208301376000918101602001919091529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461073c57600080fd5b919050565b6000806040838503121561075457600080fd5b823567ffffffffffffffff81111561076b57600080fd5b6107778582860161068a565b92505061078660208401610718565b90509250929050565b600060208083528351808285015260005b818110156107bc578581018301518582016040015282016107a0565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b60006020828403121561080d57600080fd5b5035919050565b6000806040838503121561082757600080fd5b50508035926020909101359150565b600067ffffffffffffffff821115610850576108506105e3565b5060051b60200190565b600082601f83011261086b57600080fd5b8135602061088061087b83610836565b61063b565b82815260059290921b8401810191818101908684111561089f57600080fd5b8286015b848110156108c1576108b481610718565b83529183019183016108a3565b509695505050505050565b600082601f8301126108dd57600080fd5b813560206108ed61087b83610836565b82815260059290921b8401810191818101908684111561090c57600080fd5b8286015b848110156108c15780358352918301918301610910565b803560ff8116811461073c57600080fd5b803567ffffffffffffffff8116811461073c57600080fd5b600082601f83011261096157600080fd5b8135602061097161087b83610836565b82815260069290921b8401810191818101908684111561099057600080fd5b8286015b848110156108c157604081890312156109ad5760008081fd5b6109b5610612565b6109be82610718565b81526109cb858301610938565b81860152835291830191604001610994565b600080600080600080600080610100898b0312156109fa57600080fd5b88359750602089013567ffffffffffffffff80821115610a1957600080fd5b610a258c838d0161085a565b985060408b0135915080821115610a3b57600080fd5b610a478c838d016108cc565b9750610a5560608c01610927565b965060808b0135915080821115610a6b57600080fd5b610a778c838d0161068a565b9550610a8560a08c01610938565b945060c08b0135915080821115610a9b57600080fd5b610aa78c838d0161068a565b935060e08b0135915080821115610abd57600080fd5b50610aca8b828c01610950565b9150509295985092959890939650565b6000806000806000806000806000806101408b8d031215610afa57600080fd5b8a35995060208b01359850610b1160408c01610718565b975060608b013567ffffffffffffffff80821115610b2e57600080fd5b610b3a8e838f0161085a565b985060808d0135915080821115610b5057600080fd5b610b5c8e838f016108cc565b9750610b6a60a08e01610927565b965060c08d0135915080821115610b8057600080fd5b610b8c8e838f0161068a565b9550610b9a60e08e01610938565b94506101008d0135915080821115610bb157600080fd5b610bbd8e838f0161068a565b93506101208d0135915080821115610bd457600080fd5b50610be18d828e01610950565b9150509295989b9194979a509295985056fea164736f6c6343000810000a", + ABI: "[{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"activateConfig\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"activateFeed\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deactivateConfig\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"deactivateFeed\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestConfigDetails\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"latestConfigDigestAndEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"\",\"type\":\"uint32\"},{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"\",\"type\":\"tuple[]\"}],\"name\":\"setConfigFromSource\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", + Bin: "0x608060405234801561001057600080fd5b50610c2e806100206000396000f3fe608060405234801561001057600080fd5b50600436106100be5760003560e01c8063b70d929d11610076578063e7db9c2a1161005b578063e7db9c2a146101d1578063e84f128e146101e4578063f01072211461021a57600080fd5b8063b70d929d14610188578063ded6307c146101be57600080fd5b80633dd86430116100a75780633dd864301461014d578063564a0a7a1461016257806394d959801461017557600080fd5b806301ffc9a7146100c35780633d3ac1b51461012d575b600080fd5b6101186100d136600461059a565b7fffffffff00000000000000000000000000000000000000000000000000000000167f3d3ac1b5000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b61014061013b366004610741565b610228565b604051610124919061078f565b61016061015b3660046107fb565b610292565b005b6101606101703660046107fb565b6102f4565b610160610183366004610814565b610356565b61019b6101963660046107fb565b6103b8565b604080519315158452602084019290925263ffffffff1690820152606001610124565b6101606101cc366004610814565b610447565b6101606101df3660046109f1565b6104a9565b6101f76101f23660046107fb565b61050b565b6040805163ffffffff948516815293909216602084015290820152606001610124565b6101606101df366004610b24565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4661696c656420746f207665726966790000000000000000000000000000000060448201526060906064015b60405180910390fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4661696c656420746f20616374697661746520666565640000000000000000006044820152606401610289565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4661696c656420746f20646561637469766174652066656564000000000000006044820152606401610289565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4661696c656420746f206465616374697661746520636f6e66696700000000006044820152606401610289565b60008060006040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610289906020808252602c908201527f4661696c656420746f20676574206c617465737420636f6e666967206469676560408201527f737420616e642065706f63680000000000000000000000000000000000000000606082015260800190565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4661696c656420746f20616374697661746520636f6e666967000000000000006044820152606401610289565b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4661696c656420746f2073657420636f6e6669670000000000000000000000006044820152606401610289565b60008060006040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102899060208082526023908201527f4661696c656420746f20676574206c617465737420636f6e666967206465746160408201527f696c730000000000000000000000000000000000000000000000000000000000606082015260800190565b6000602082840312156105ac57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146105dc57600080fd5b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715610635576106356105e3565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715610682576106826105e3565b604052919050565b600082601f83011261069b57600080fd5b813567ffffffffffffffff8111156106b5576106b56105e3565b6106e660207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161063b565b8181528460208386010111156106fb57600080fd5b816020850160208301376000918101602001919091529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461073c57600080fd5b919050565b6000806040838503121561075457600080fd5b823567ffffffffffffffff81111561076b57600080fd5b6107778582860161068a565b92505061078660208401610718565b90509250929050565b600060208083528351808285015260005b818110156107bc578581018301518582016040015282016107a0565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b60006020828403121561080d57600080fd5b5035919050565b6000806040838503121561082757600080fd5b50508035926020909101359150565b803563ffffffff8116811461073c57600080fd5b600067ffffffffffffffff821115610864576108646105e3565b5060051b60200190565b600082601f83011261087f57600080fd5b8135602061089461088f8361084a565b61063b565b82815260059290921b840181019181810190868411156108b357600080fd5b8286015b848110156108d5576108c881610718565b83529183019183016108b7565b509695505050505050565b600082601f8301126108f157600080fd5b8135602061090161088f8361084a565b82815260059290921b8401810191818101908684111561092057600080fd5b8286015b848110156108d55780358352918301918301610924565b803560ff8116811461073c57600080fd5b803567ffffffffffffffff8116811461073c57600080fd5b600082601f83011261097557600080fd5b8135602061098561088f8361084a565b82815260069290921b840181019181810190868411156109a457600080fd5b8286015b848110156108d557604081890312156109c15760008081fd5b6109c9610612565b6109d282610718565b81526109df85830161094c565b818601528352918301916040016109a8565b60008060008060008060008060008060006101608c8e031215610a1357600080fd5b8b359a5060208c01359950610a2a60408d01610718565b9850610a3860608d01610836565b975067ffffffffffffffff8060808e01351115610a5457600080fd5b610a648e60808f01358f0161086e565b97508060a08e01351115610a7757600080fd5b610a878e60a08f01358f016108e0565b9650610a9560c08e0161093b565b95508060e08e01351115610aa857600080fd5b610ab88e60e08f01358f0161068a565b9450610ac76101008e0161094c565b9350806101208e01351115610adb57600080fd5b610aec8e6101208f01358f0161068a565b9250806101408e01351115610b0057600080fd5b50610b128d6101408e01358e01610964565b90509295989b509295989b9093969950565b600080600080600080600080610100898b031215610b4157600080fd5b88359750602089013567ffffffffffffffff80821115610b6057600080fd5b610b6c8c838d0161086e565b985060408b0135915080821115610b8257600080fd5b610b8e8c838d016108e0565b9750610b9c60608c0161093b565b965060808b0135915080821115610bb257600080fd5b610bbe8c838d0161068a565b9550610bcc60a08c0161094c565b945060c08b0135915080821115610be257600080fd5b610bee8c838d0161068a565b935060e08b0135915080821115610c0457600080fd5b50610c118b828c01610964565b915050929598509295989093965056fea164736f6c6343000810000a", } var ErroredVerifierABI = ErroredVerifierMetaData.ABI @@ -322,9 +322,9 @@ func (_ErroredVerifier *ErroredVerifierCallerSession) SetConfig(arg0 [32]byte, a return _ErroredVerifier.Contract.SetConfig(&_ErroredVerifier.CallOpts, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } -func (_ErroredVerifier *ErroredVerifierCaller) SetConfigFromSource(opts *bind.CallOpts, arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 []common.Address, arg4 [][32]byte, arg5 uint8, arg6 []byte, arg7 uint64, arg8 []byte, arg9 []CommonAddressAndWeight) error { +func (_ErroredVerifier *ErroredVerifierCaller) SetConfigFromSource(opts *bind.CallOpts, arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 uint32, arg4 []common.Address, arg5 [][32]byte, arg6 uint8, arg7 []byte, arg8 uint64, arg9 []byte, arg10 []CommonAddressAndWeight) error { var out []interface{} - err := _ErroredVerifier.contract.Call(opts, &out, "setConfigFromSource", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) + err := _ErroredVerifier.contract.Call(opts, &out, "setConfigFromSource", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) if err != nil { return err @@ -334,12 +334,12 @@ func (_ErroredVerifier *ErroredVerifierCaller) SetConfigFromSource(opts *bind.Ca } -func (_ErroredVerifier *ErroredVerifierSession) SetConfigFromSource(arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 []common.Address, arg4 [][32]byte, arg5 uint8, arg6 []byte, arg7 uint64, arg8 []byte, arg9 []CommonAddressAndWeight) error { - return _ErroredVerifier.Contract.SetConfigFromSource(&_ErroredVerifier.CallOpts, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (_ErroredVerifier *ErroredVerifierSession) SetConfigFromSource(arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 uint32, arg4 []common.Address, arg5 [][32]byte, arg6 uint8, arg7 []byte, arg8 uint64, arg9 []byte, arg10 []CommonAddressAndWeight) error { + return _ErroredVerifier.Contract.SetConfigFromSource(&_ErroredVerifier.CallOpts, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) } -func (_ErroredVerifier *ErroredVerifierCallerSession) SetConfigFromSource(arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 []common.Address, arg4 [][32]byte, arg5 uint8, arg6 []byte, arg7 uint64, arg8 []byte, arg9 []CommonAddressAndWeight) error { - return _ErroredVerifier.Contract.SetConfigFromSource(&_ErroredVerifier.CallOpts, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) +func (_ErroredVerifier *ErroredVerifierCallerSession) SetConfigFromSource(arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 uint32, arg4 []common.Address, arg5 [][32]byte, arg6 uint8, arg7 []byte, arg8 uint64, arg9 []byte, arg10 []CommonAddressAndWeight) error { + return _ErroredVerifier.Contract.SetConfigFromSource(&_ErroredVerifier.CallOpts, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) } func (_ErroredVerifier *ErroredVerifierCaller) SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) { @@ -405,7 +405,7 @@ type ErroredVerifierInterface interface { SetConfig(opts *bind.CallOpts, arg0 [32]byte, arg1 []common.Address, arg2 [][32]byte, arg3 uint8, arg4 []byte, arg5 uint64, arg6 []byte, arg7 []CommonAddressAndWeight) error - SetConfigFromSource(opts *bind.CallOpts, arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 []common.Address, arg4 [][32]byte, arg5 uint8, arg6 []byte, arg7 uint64, arg8 []byte, arg9 []CommonAddressAndWeight) error + SetConfigFromSource(opts *bind.CallOpts, arg0 [32]byte, arg1 *big.Int, arg2 common.Address, arg3 uint32, arg4 []common.Address, arg5 [][32]byte, arg6 uint8, arg7 []byte, arg8 uint64, arg9 []byte, arg10 []CommonAddressAndWeight) error SupportsInterface(opts *bind.CallOpts, interfaceId [4]byte) (bool, error) diff --git a/core/gethwrappers/llo-feeds/generated/verifier/verifier.go b/core/gethwrappers/llo-feeds/generated/verifier/verifier.go index c8e4121405..c85952efdb 100644 --- a/core/gethwrappers/llo-feeds/generated/verifier/verifier.go +++ b/core/gethwrappers/llo-feeds/generated/verifier/verifier.go @@ -36,8 +36,8 @@ type CommonAddressAndWeight struct { } var VerifierMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"verifierProxyAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BadVerification\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"CannotDeactivateLatestConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DigestEmpty\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"DigestInactive\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"DigestNotSet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSigners\",\"type\":\"uint256\"}],\"name\":\"ExcessSigners\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FaultToleranceMustBePositive\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FeedIdEmpty\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"InactiveFeed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedNumSigners\",\"type\":\"uint256\"}],\"name\":\"IncorrectSignatureCount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minSigners\",\"type\":\"uint256\"}],\"name\":\"InsufficientSigners\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"InvalidFeed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rsLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ssLength\",\"type\":\"uint256\"}],\"name\":\"MismatchedSignatures\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonUniqueSignatures\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"ConfigActivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"ConfigDeactivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"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\":\"bytes32[]\",\"name\":\"offchainTransmitters\",\"type\":\"bytes32[]\"},{\"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\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"FeedActivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"FeedDeactivated\",\"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\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"name\":\"ReportVerified\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"activateConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"activateFeed\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"deactivateConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"deactivateFeed\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"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\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"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\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"offchainTransmitters\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"recipientAddressesAndWeights\",\"type\":\"tuple[]\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"sourceChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sourceAddress\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"offchainTransmitters\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"recipientAddressesAndWeights\",\"type\":\"tuple[]\"}],\"name\":\"setConfigFromSource\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isVerifier\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signedReport\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"verifierResponse\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60a06040523480156200001157600080fd5b5060405162002373380380620023738339810160408190526200003491620001a6565b33806000816200008b5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000be57620000be81620000fb565b5050506001600160a01b038116620000e95760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0316608052620001d8565b336001600160a01b03821603620001555760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000082565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600060208284031215620001b957600080fd5b81516001600160a01b0381168114620001d157600080fd5b9392505050565b608051612178620001fb6000396000818161033b01526112cf01526121786000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806394d959801161008c578063e84f128e11610066578063e84f128e1461028b578063f0107221146102e8578063f2fde38b146102fb578063f84cf58e1461030e57600080fd5b806394d9598014610206578063b70d929d14610219578063ded6307c1461027857600080fd5b80633dd86430116100c85780633dd86430146101ae578063564a0a7a146101c357806379ba5097146101d65780638da5cb5b146101de57600080fd5b806301ffc9a7146100ef578063181f5a77146101595780633d3ac1b51461019b575b600080fd5b6101446100fd366004611580565b7fffffffff00000000000000000000000000000000000000000000000000000000167f3d3ac1b5000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b60408051808201909152600e81527f566572696669657220312e312e3000000000000000000000000000000000000060208201525b604051610150919061162d565b61018e6101a9366004611669565b610321565b6101c16101bc3660046116ea565b6104bb565b005b6101c16101d13660046116ea565b61056d565b6101c161062e565b60005460405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610150565b6101c1610214366004611703565b61072b565b6102556102273660046116ea565b6000908152600260205260408120600181015490549192909168010000000000000000900463ffffffff1690565b604080519315158452602084019290925263ffffffff1690820152606001610150565b6101c1610286366004611703565b61088c565b6102c56102993660046116ea565b6000908152600260205260409020805460019091015463ffffffff808316936401000000009093041691565b6040805163ffffffff948516815293909216602084015290820152606001610150565b6101c16102f6366004611a24565b61099d565b6101c1610309366004611b21565b610aab565b6101c161031c366004611b3c565b610abf565b60603373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610392576040517fef67f5d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080806103a4888a018a611c55565b945094509450945094506000846103ba90611d30565b60008181526002602052604090208054919250906c01000000000000000000000000900460ff1615610420576040517f36dbe748000000000000000000000000000000000000000000000000000000008152600481018390526024015b60405180910390fd5b86516000818152600283016020526040902061043f8483898985610b89565b6104498984610c85565b8751602089012061045e818b8a8a8a87610ced565b60405173ffffffffffffffffffffffffffffffffffffffff8d16815285907f58ca9502e98a536e06e72d680fcc251e5d10b72291a281665a2c2dc0ac30fcc59060200160405180910390a250969c9b505050505050505050505050565b6104c3610f69565b60008181526002602052604081208054909163ffffffff9091169003610518576040517fa25b0b9600000000000000000000000000000000000000000000000000000000815260048101839052602401610417565b80547fffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffff16815560405182907ff438564f793525caa89c6e3a26d41e16aa39d1e589747595751e3f3df75cb2b490600090a25050565b610575610f69565b60008181526002602052604081208054909163ffffffff90911690036105ca576040517fa25b0b9600000000000000000000000000000000000000000000000000000000815260048101839052602401610417565b80547fffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffff166c0100000000000000000000000017815560405182907ffc4f79b8c65b6be1773063461984c0974400d1e99654c79477a092ace83fd06190600090a25050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146106af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e6572000000000000000000006044820152606401610417565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b610733610f69565b600082815260026020526040902081610778576040517fe332262700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260028201602052604081205460ff1690036107ce576040517f8bca63110000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610417565b80600101548203610815576040517fa403c0160000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610417565b60008281526002820160205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555183907f0e173bea63a8c59ec70bf87043f2a729693790183f16a1a54b705de9e989cc4c9061087f9085815260200190565b60405180910390a2505050565b610894610f69565b6000828152600260205260409020816108d9576040517fe332262700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260028201602052604081205460ff16900361092f576040517f8bca63110000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610417565b60008281526002820160205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555183907f54f8872b9b94ebea6577f33576d55847bd8ea22641ccc886b965f6e50bfe77469061087f9085815260200190565b86518560ff16806000036109dd576040517f0743bae600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601f821115610a22576040517f61750f4000000000000000000000000000000000000000000000000000000000815260048101839052601f6024820152604401610417565b610a2d816003611dd3565b8211610a855781610a3f826003611dd3565b610a4a906001611e10565b6040517f9dd9e6d800000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610417565b610a8d610f69565b610a9f8a46308c8c8c8c8c8c8c610fec565b50505050505050505050565b610ab3610f69565b610abc816113dd565b50565b86518560ff1680600003610aff576040517f0743bae600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601f821115610b44576040517f61750f4000000000000000000000000000000000000000000000000000000000815260048101839052601f6024820152604401610417565b610b4f816003611dd3565b8211610b615781610a3f826003611dd3565b610b69610f69565b610b7b8c8c8c8c8c8c8c8c8c8c610fec565b505050505050505050505050565b8054600090610b9c9060ff166001611e29565b8254909150610100900460ff16610be9576040517ffc10a2830000000000000000000000000000000000000000000000000000000081526004810187905260248101869052604401610417565b8060ff16845114610c355783516040517f5348a282000000000000000000000000000000000000000000000000000000008152600481019190915260ff82166024820152604401610417565b8251845114610c7d57835183516040517ff0d3140800000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610417565b505050505050565b6020820151815463ffffffff600883901c81169168010000000000000000900416811115610ce75782547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff166801000000000000000063ffffffff8316021783555b50505050565b60008686604051602001610d02929190611e42565b6040516020818303038152906040528051906020012090506000610d36604080518082019091526000808252602082015290565b8651600090815b81811015610f0157600186898360208110610d5a57610d5a611d75565b610d6791901a601b611e29565b8c8481518110610d7957610d79611d75565b60200260200101518c8581518110610d9357610d93611d75565b602002602001015160405160008152602001604052604051610dd1949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610df3573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081015173ffffffffffffffffffffffffffffffffffffffff811660009081526001808d01602090815291859020848601909552845460ff808216865293995093955090850192610100900490911690811115610e7857610e78611e7e565b6001811115610e8957610e89611e7e565b9052509350600184602001516001811115610ea657610ea6611e7e565b14610edd576040517f4df18f0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836000015160080260ff166001901b8501945080610efa90611ead565b9050610d3d565b50837e01010101010101010101010101010101010101010101010101010101010101851614610f5c576040517f4df18f0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610fea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610417565b565b60008a81526002602052604081208054909163ffffffff90911690829061101283611ee5565b82546101009290920a63ffffffff81810219909316918316021790915582546000925061104b918e918e918e91168d8d8d8d8d8d6114d2565b6000818152600284016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660ff8b16176101001790559091505b89518160ff16101561128c5760008a8260ff16815181106110b1576110b1611d75565b60200260200101519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611121576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806000858152600287016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452600190810190925290912054610100900460ff169081111561117457611174611e7e565b14801591506111af576040517ff67bc7c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915260ff8416815260208101600190526000858152600287016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684526001908101835292208351815460ff9091167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00821681178355928501519193919284927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000909216179061010090849081111561127157611271611e7e565b021790555090505050508061128590611f08565b905061108e565b5060018201546040517fb011b24700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163b011b24791611307919085908890600401611f27565b600060405180830381600087803b15801561132157600080fd5b505af1158015611335573d6000803e3d6000fd5b505083546040518f93507fa23a88453230b183877098801ff5a8f771a120e2573eea559ce6c4c2e305a4da925061138e9163ffffffff6401000000008204811692879291909116908f908f908f908f908f908f90612028565b60405180910390a281547fffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffff1664010000000063ffffffff43160217825560019091015550505050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff82160361145c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610417565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6000808b8b8b8b8b8b8b8b8b8b6040516020016114f89a999897969594939291906120be565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e06000000000000000000000000000000000000000000000000000000000000179150509a9950505050505050505050565b60006020828403121561159257600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146115c257600080fd5b9392505050565b6000815180845260005b818110156115ef576020818501810151868301820152016115d3565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b6020815260006115c260208301846115c9565b803573ffffffffffffffffffffffffffffffffffffffff8116811461166457600080fd5b919050565b60008060006040848603121561167e57600080fd5b833567ffffffffffffffff8082111561169657600080fd5b818601915086601f8301126116aa57600080fd5b8135818111156116b957600080fd5b8760208285010111156116cb57600080fd5b6020928301955093506116e19186019050611640565b90509250925092565b6000602082840312156116fc57600080fd5b5035919050565b6000806040838503121561171657600080fd5b50508035926020909101359150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff8111828210171561177757611777611725565b60405290565b6040516060810167ffffffffffffffff8111828210171561177757611777611725565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156117e7576117e7611725565b604052919050565b600067ffffffffffffffff82111561180957611809611725565b5060051b60200190565b600082601f83011261182457600080fd5b81356020611839611834836117ef565b6117a0565b82815260059290921b8401810191818101908684111561185857600080fd5b8286015b8481101561187a5761186d81611640565b835291830191830161185c565b509695505050505050565b600082601f83011261189657600080fd5b813560206118a6611834836117ef565b82815260059290921b840181019181810190868411156118c557600080fd5b8286015b8481101561187a57803583529183019183016118c9565b803560ff8116811461166457600080fd5b600082601f83011261190257600080fd5b813567ffffffffffffffff81111561191c5761191c611725565b61194d60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016117a0565b81815284602083860101111561196257600080fd5b816020850160208301376000918101602001919091529392505050565b803567ffffffffffffffff8116811461166457600080fd5b600082601f8301126119a857600080fd5b813560206119b8611834836117ef565b82815260069290921b840181019181810190868411156119d757600080fd5b8286015b8481101561187a57604081890312156119f45760008081fd5b6119fc611754565b611a0582611640565b8152611a1285830161197f565b818601528352918301916040016119db565b600080600080600080600080610100898b031215611a4157600080fd5b88359750602089013567ffffffffffffffff80821115611a6057600080fd5b611a6c8c838d01611813565b985060408b0135915080821115611a8257600080fd5b611a8e8c838d01611885565b9750611a9c60608c016118e0565b965060808b0135915080821115611ab257600080fd5b611abe8c838d016118f1565b9550611acc60a08c0161197f565b945060c08b0135915080821115611ae257600080fd5b611aee8c838d016118f1565b935060e08b0135915080821115611b0457600080fd5b50611b118b828c01611997565b9150509295985092959890939650565b600060208284031215611b3357600080fd5b6115c282611640565b6000806000806000806000806000806101408b8d031215611b5c57600080fd5b8a35995060208b01359850611b7360408c01611640565b975060608b013567ffffffffffffffff80821115611b9057600080fd5b611b9c8e838f01611813565b985060808d0135915080821115611bb257600080fd5b611bbe8e838f01611885565b9750611bcc60a08e016118e0565b965060c08d0135915080821115611be257600080fd5b611bee8e838f016118f1565b9550611bfc60e08e0161197f565b94506101008d0135915080821115611c1357600080fd5b611c1f8e838f016118f1565b93506101208d0135915080821115611c3657600080fd5b50611c438d828e01611997565b9150509295989b9194979a5092959850565b600080600080600060e08688031215611c6d57600080fd5b86601f870112611c7c57600080fd5b611c8461177d565b806060880189811115611c9657600080fd5b885b81811015611cb0578035845260209384019301611c98565b5090965035905067ffffffffffffffff80821115611ccd57600080fd5b611cd989838a016118f1565b95506080880135915080821115611cef57600080fd5b611cfb89838a01611885565b945060a0880135915080821115611d1157600080fd5b50611d1e88828901611885565b9598949750929560c001359392505050565b80516020808301519190811015611d6f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e0b57611e0b611da4565b500290565b80820180821115611e2357611e23611da4565b92915050565b60ff8181168382160190811115611e2357611e23611da4565b828152600060208083018460005b6003811015611e6d57815183529183019190830190600101611e50565b505050506080820190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611ede57611ede611da4565b5060010190565b600063ffffffff808316818103611efe57611efe611da4565b6001019392505050565b600060ff821660ff8103611f1e57611f1e611da4565b60010192915050565b600060608201858352602085818501526040606081860152828651808552608087019150838801945060005b81811015611f98578551805173ffffffffffffffffffffffffffffffffffffffff16845285015167ffffffffffffffff16858401529484019491830191600101611f53565b50909998505050505050505050565b600081518084526020808501945080840160005b83811015611fed57815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101611fbb565b509495945050505050565b600081518084526020808501945080840160005b83811015611fed5781518752958201959082019060010161200c565b600061012063ffffffff808d1684528b6020850152808b166040850152508060608401526120588184018a611fa7565b9050828103608084015261206c8189611ff8565b905060ff871660a084015282810360c084015261208981876115c9565b905067ffffffffffffffff851660e08401528281036101008401526120ae81856115c9565b9c9b505050505050505050505050565b60006101408c83528b602084015273ffffffffffffffffffffffffffffffffffffffff8b16604084015267ffffffffffffffff808b16606085015281608085015261210b8285018b611fa7565b915083820360a085015261211f828a611ff8565b915060ff881660c085015283820360e085015261213c82886115c9565b908616610100850152838103610120850152905061215a81856115c9565b9d9c5050505050505050505050505056fea164736f6c6343000810000a", + ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"verifierProxyAddr\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"AccessForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"BadVerification\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"CannotDeactivateLatestConfig\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"DigestEmpty\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"DigestInactive\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"DigestNotSet\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxSigners\",\"type\":\"uint256\"}],\"name\":\"ExcessSigners\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FaultToleranceMustBePositive\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"FeedIdEmpty\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"InactiveFeed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expectedNumSigners\",\"type\":\"uint256\"}],\"name\":\"IncorrectSignatureCount\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"numSigners\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"minSigners\",\"type\":\"uint256\"}],\"name\":\"InsufficientSigners\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"InvalidFeed\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"rsLength\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"ssLength\",\"type\":\"uint256\"}],\"name\":\"MismatchedSignatures\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonUniqueSignatures\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"ConfigActivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"ConfigDeactivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"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\":\"bytes32[]\",\"name\":\"offchainTransmitters\",\"type\":\"bytes32[]\"},{\"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\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"FeedActivated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"FeedDeactivated\",\"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\":true,\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"requester\",\"type\":\"address\"}],\"name\":\"ReportVerified\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"activateConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"activateFeed\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"configDigest\",\"type\":\"bytes32\"}],\"name\":\"deactivateConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"name\":\"deactivateFeed\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"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\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"}],\"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\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"offchainTransmitters\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"recipientAddressesAndWeights\",\"type\":\"tuple[]\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"feedId\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"sourceChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"sourceAddress\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"newConfigCount\",\"type\":\"uint32\"},{\"internalType\":\"address[]\",\"name\":\"signers\",\"type\":\"address[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"offchainTransmitters\",\"type\":\"bytes32[]\"},{\"internalType\":\"uint8\",\"name\":\"f\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"onchainConfig\",\"type\":\"bytes\"},{\"internalType\":\"uint64\",\"name\":\"offchainConfigVersion\",\"type\":\"uint64\"},{\"internalType\":\"bytes\",\"name\":\"offchainConfig\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"weight\",\"type\":\"uint64\"}],\"internalType\":\"structCommon.AddressAndWeight[]\",\"name\":\"recipientAddressesAndWeights\",\"type\":\"tuple[]\"}],\"name\":\"setConfigFromSource\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isVerifier\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"typeAndVersion\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"signedReport\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"verify\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"verifierResponse\",\"type\":\"bytes\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", + Bin: "0x60a06040523480156200001157600080fd5b50604051620023fb380380620023fb8339810160408190526200003491620001a6565b33806000816200008b5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000be57620000be81620000fb565b5050506001600160a01b038116620000e95760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0316608052620001d8565b336001600160a01b03821603620001555760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000082565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b600060208284031215620001b957600080fd5b81516001600160a01b0381168114620001d157600080fd5b9392505050565b608051612200620001fb6000396000818161033b015261131501526122006000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806394d959801161008c578063e7db9c2a11610066578063e7db9c2a1461028b578063e84f128e1461029e578063f0107221146102fb578063f2fde38b1461030e57600080fd5b806394d9598014610206578063b70d929d14610219578063ded6307c1461027857600080fd5b80633dd86430116100c85780633dd86430146101ae578063564a0a7a146101c357806379ba5097146101d65780638da5cb5b146101de57600080fd5b806301ffc9a7146100ef578063181f5a77146101595780633d3ac1b51461019b575b600080fd5b6101446100fd3660046115da565b7fffffffff00000000000000000000000000000000000000000000000000000000167f3d3ac1b5000000000000000000000000000000000000000000000000000000001490565b60405190151581526020015b60405180910390f35b60408051808201909152600e81527f566572696669657220312e312e3000000000000000000000000000000000000060208201525b6040516101509190611687565b61018e6101a93660046116c3565b610321565b6101c16101bc366004611744565b6104bb565b005b6101c16101d1366004611744565b61056d565b6101c161062e565b60005460405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610150565b6101c161021436600461175d565b61072b565b610255610227366004611744565b6000908152600260205260408120600181015490549192909168010000000000000000900463ffffffff1690565b604080519315158452602084019290925263ffffffff1690820152606001610150565b6101c161028636600461175d565b61088c565b6101c1610299366004611a92565b61099d565b6102d86102ac366004611744565b6000908152600260205260409020805460019091015463ffffffff808316936401000000009093041691565b6040805163ffffffff948516815293909216602084015290820152606001610150565b6101c1610309366004611bc5565b610aaf565b6101c161031c366004611cc2565b610b79565b60603373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610392576040517fef67f5d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080806103a4888a018a611cdd565b945094509450945094506000846103ba90611db8565b60008181526002602052604090208054919250906c01000000000000000000000000900460ff1615610420576040517f36dbe748000000000000000000000000000000000000000000000000000000008152600481018390526024015b60405180910390fd5b86516000818152600283016020526040902061043f8483898985610b8d565b6104498984610c89565b8751602089012061045e818b8a8a8a87610cf1565b60405173ffffffffffffffffffffffffffffffffffffffff8d16815285907f58ca9502e98a536e06e72d680fcc251e5d10b72291a281665a2c2dc0ac30fcc59060200160405180910390a250969c9b505050505050505050505050565b6104c3610f6d565b60008181526002602052604081208054909163ffffffff9091169003610518576040517fa25b0b9600000000000000000000000000000000000000000000000000000000815260048101839052602401610417565b80547fffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffff16815560405182907ff438564f793525caa89c6e3a26d41e16aa39d1e589747595751e3f3df75cb2b490600090a25050565b610575610f6d565b60008181526002602052604081208054909163ffffffff90911690036105ca576040517fa25b0b9600000000000000000000000000000000000000000000000000000000815260048101839052602401610417565b80547fffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffff166c0100000000000000000000000017815560405182907ffc4f79b8c65b6be1773063461984c0974400d1e99654c79477a092ace83fd06190600090a25050565b60015473ffffffffffffffffffffffffffffffffffffffff1633146106af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e6572000000000000000000006044820152606401610417565b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b610733610f6d565b600082815260026020526040902081610778576040517fe332262700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260028201602052604081205460ff1690036107ce576040517f8bca63110000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610417565b80600101548203610815576040517fa403c0160000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610417565b60008281526002820160205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff1690555183907f0e173bea63a8c59ec70bf87043f2a729693790183f16a1a54b705de9e989cc4c9061087f9085815260200190565b60405180910390a2505050565b610894610f6d565b6000828152600260205260409020816108d9576040517fe332262700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600082815260028201602052604081205460ff16900361092f576040517f8bca63110000000000000000000000000000000000000000000000000000000081526004810184905260248101839052604401610417565b60008281526002820160205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555183907f54f8872b9b94ebea6577f33576d55847bd8ea22641ccc886b965f6e50bfe77469061087f9085815260200190565b86518560ff16806000036109dd576040517f0743bae600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601f821115610a22576040517f61750f4000000000000000000000000000000000000000000000000000000000815260048101839052601f6024820152604401610417565b610a2d816003611e5b565b8211610a855781610a3f826003611e5b565b610a4a906001611e98565b6040517f9dd9e6d800000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610417565b610a8d610f6d565b610aa08d8d8d8d8d8d8d8d8d8d8d610ff0565b50505050505050505050505050565b86518560ff1680600003610aef576040517f0743bae600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b601f821115610b34576040517f61750f4000000000000000000000000000000000000000000000000000000000815260048101839052601f6024820152604401610417565b610b3f816003611e5b565b8211610b515781610a3f826003611e5b565b610b59610f6d565b610b6d8a463060008d8d8d8d8d8d8d610ff0565b50505050505050505050565b610b81610f6d565b610b8a81611437565b50565b8054600090610ba09060ff166001611eb1565b8254909150610100900460ff16610bed576040517ffc10a2830000000000000000000000000000000000000000000000000000000081526004810187905260248101869052604401610417565b8060ff16845114610c395783516040517f5348a282000000000000000000000000000000000000000000000000000000008152600481019190915260ff82166024820152604401610417565b8251845114610c8157835183516040517ff0d3140800000000000000000000000000000000000000000000000000000000815260048101929092526024820152604401610417565b505050505050565b6020820151815463ffffffff600883901c81169168010000000000000000900416811115610ceb5782547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff166801000000000000000063ffffffff8316021783555b50505050565b60008686604051602001610d06929190611eca565b6040516020818303038152906040528051906020012090506000610d3a604080518082019091526000808252602082015290565b8651600090815b81811015610f0557600186898360208110610d5e57610d5e611dfd565b610d6b91901a601b611eb1565b8c8481518110610d7d57610d7d611dfd565b60200260200101518c8581518110610d9757610d97611dfd565b602002602001015160405160008152602001604052604051610dd5949392919093845260ff9290921660208401526040830152606082015260800190565b6020604051602081039080840390855afa158015610df7573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081015173ffffffffffffffffffffffffffffffffffffffff811660009081526001808d01602090815291859020848601909552845460ff808216865293995093955090850192610100900490911690811115610e7c57610e7c611f06565b6001811115610e8d57610e8d611f06565b9052509350600184602001516001811115610eaa57610eaa611f06565b14610ee1576040517f4df18f0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836000015160080260ff166001901b8501945080610efe90611f35565b9050610d41565b50837e01010101010101010101010101010101010101010101010101010101010101851614610f60576040517f4df18f0700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610fee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e6572000000000000000000006044820152606401610417565b565b60008b815260026020526040902063ffffffff89161561103d5780547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000001663ffffffff8a16178155611071565b805463ffffffff1681600061105183611f6d565b91906101000a81548163ffffffff021916908363ffffffff160217905550505b8054600090611091908e908e908e9063ffffffff168d8d8d8d8d8d61152c565b6000818152600284016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00001660ff8b16176101001790559091505b89518160ff1610156112d25760008a8260ff16815181106110f7576110f7611dfd565b60200260200101519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603611167576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000806000858152600287016020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168452600190810190925290912054610100900460ff16908111156111ba576111ba611f06565b14801591506111f5576040517ff67bc7c400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805180820190915260ff8416815260208101600190526000858152600287016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684526001908101835292208351815460ff9091167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00821681178355928501519193919284927fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff000090921617906101009084908111156112b7576112b7611f06565b02179055509050505050806112cb90611f90565b90506110d4565b5060018201546040517fb011b24700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163b011b2479161134d919085908890600401611faf565b600060405180830381600087803b15801561136757600080fd5b505af115801561137b573d6000803e3d6000fd5b505050508c7fa23a88453230b183877098801ff5a8f771a120e2573eea559ce6c4c2e305a4da8360000160049054906101000a900463ffffffff16838560000160009054906101000a900463ffffffff168d8d8d8d8d8d6040516113e7999897969594939291906120b0565b60405180910390a281547fffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffff1664010000000063ffffffff4316021782556001909101555050505050505050505050565b3373ffffffffffffffffffffffffffffffffffffffff8216036114b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c660000000000000000006044820152606401610417565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6000808b8b8b8b8b8b8b8b8b8b6040516020016115529a99989796959493929190612146565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167e06000000000000000000000000000000000000000000000000000000000000179150509a9950505050505050505050565b6000602082840312156115ec57600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461161c57600080fd5b9392505050565b6000815180845260005b818110156116495760208185018101518683018201520161162d565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061161c6020830184611623565b803573ffffffffffffffffffffffffffffffffffffffff811681146116be57600080fd5b919050565b6000806000604084860312156116d857600080fd5b833567ffffffffffffffff808211156116f057600080fd5b818601915086601f83011261170457600080fd5b81358181111561171357600080fd5b87602082850101111561172557600080fd5b60209283019550935061173b918601905061169a565b90509250925092565b60006020828403121561175657600080fd5b5035919050565b6000806040838503121561177057600080fd5b50508035926020909101359150565b803563ffffffff811681146116be57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff811182821017156117e5576117e5611793565b60405290565b6040516060810167ffffffffffffffff811182821017156117e5576117e5611793565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561185557611855611793565b604052919050565b600067ffffffffffffffff82111561187757611877611793565b5060051b60200190565b600082601f83011261189257600080fd5b813560206118a76118a28361185d565b61180e565b82815260059290921b840181019181810190868411156118c657600080fd5b8286015b848110156118e8576118db8161169a565b83529183019183016118ca565b509695505050505050565b600082601f83011261190457600080fd5b813560206119146118a28361185d565b82815260059290921b8401810191818101908684111561193357600080fd5b8286015b848110156118e85780358352918301918301611937565b803560ff811681146116be57600080fd5b600082601f83011261197057600080fd5b813567ffffffffffffffff81111561198a5761198a611793565b6119bb60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161180e565b8181528460208386010111156119d057600080fd5b816020850160208301376000918101602001919091529392505050565b803567ffffffffffffffff811681146116be57600080fd5b600082601f830112611a1657600080fd5b81356020611a266118a28361185d565b82815260069290921b84018101918181019086841115611a4557600080fd5b8286015b848110156118e85760408189031215611a625760008081fd5b611a6a6117c2565b611a738261169a565b8152611a808583016119ed565b81860152835291830191604001611a49565b60008060008060008060008060008060006101608c8e031215611ab457600080fd5b8b359a5060208c01359950611acb60408d0161169a565b9850611ad960608d0161177f565b975067ffffffffffffffff8060808e01351115611af557600080fd5b611b058e60808f01358f01611881565b97508060a08e01351115611b1857600080fd5b611b288e60a08f01358f016118f3565b9650611b3660c08e0161194e565b95508060e08e01351115611b4957600080fd5b611b598e60e08f01358f0161195f565b9450611b686101008e016119ed565b9350806101208e01351115611b7c57600080fd5b611b8d8e6101208f01358f0161195f565b9250806101408e01351115611ba157600080fd5b50611bb38d6101408e01358e01611a05565b90509295989b509295989b9093969950565b600080600080600080600080610100898b031215611be257600080fd5b88359750602089013567ffffffffffffffff80821115611c0157600080fd5b611c0d8c838d01611881565b985060408b0135915080821115611c2357600080fd5b611c2f8c838d016118f3565b9750611c3d60608c0161194e565b965060808b0135915080821115611c5357600080fd5b611c5f8c838d0161195f565b9550611c6d60a08c016119ed565b945060c08b0135915080821115611c8357600080fd5b611c8f8c838d0161195f565b935060e08b0135915080821115611ca557600080fd5b50611cb28b828c01611a05565b9150509295985092959890939650565b600060208284031215611cd457600080fd5b61161c8261169a565b600080600080600060e08688031215611cf557600080fd5b86601f870112611d0457600080fd5b611d0c6117eb565b806060880189811115611d1e57600080fd5b885b81811015611d38578035845260209384019301611d20565b5090965035905067ffffffffffffffff80821115611d5557600080fd5b611d6189838a0161195f565b95506080880135915080821115611d7757600080fd5b611d8389838a016118f3565b945060a0880135915080821115611d9957600080fd5b50611da6888289016118f3565b9598949750929560c001359392505050565b80516020808301519190811015611df7577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8160200360031b1b821691505b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611e9357611e93611e2c565b500290565b80820180821115611eab57611eab611e2c565b92915050565b60ff8181168382160190811115611eab57611eab611e2c565b828152600060208083018460005b6003811015611ef557815183529183019190830190600101611ed8565b505050506080820190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611f6657611f66611e2c565b5060010190565b600063ffffffff808316818103611f8657611f86611e2c565b6001019392505050565b600060ff821660ff8103611fa657611fa6611e2c565b60010192915050565b600060608201858352602085818501526040606081860152828651808552608087019150838801945060005b81811015612020578551805173ffffffffffffffffffffffffffffffffffffffff16845285015167ffffffffffffffff16858401529484019491830191600101611fdb565b50909998505050505050505050565b600081518084526020808501945080840160005b8381101561207557815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101612043565b509495945050505050565b600081518084526020808501945080840160005b8381101561207557815187529582019590820190600101612094565b600061012063ffffffff808d1684528b6020850152808b166040850152508060608401526120e08184018a61202f565b905082810360808401526120f48189612080565b905060ff871660a084015282810360c08401526121118187611623565b905067ffffffffffffffff851660e08401528281036101008401526121368185611623565b9c9b505050505050505050505050565b60006101408c83528b602084015273ffffffffffffffffffffffffffffffffffffffff8b16604084015267ffffffffffffffff808b1660608501528160808501526121938285018b61202f565b915083820360a08501526121a7828a612080565b915060ff881660c085015283820360e08501526121c48288611623565b90861661010085015283810361012085015290506121e28185611623565b9d9c5050505050505050505050505056fea164736f6c6343000810000a", } var VerifierABI = VerifierMetaData.ABI @@ -376,16 +376,16 @@ func (_Verifier *VerifierTransactorSession) SetConfig(feedId [32]byte, signers [ return _Verifier.Contract.SetConfig(&_Verifier.TransactOpts, feedId, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) } -func (_Verifier *VerifierTransactor) SetConfigFromSource(opts *bind.TransactOpts, feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) { - return _Verifier.contract.Transact(opts, "setConfigFromSource", feedId, sourceChainId, sourceAddress, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) +func (_Verifier *VerifierTransactor) SetConfigFromSource(opts *bind.TransactOpts, feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, newConfigCount uint32, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) { + return _Verifier.contract.Transact(opts, "setConfigFromSource", feedId, sourceChainId, sourceAddress, newConfigCount, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) } -func (_Verifier *VerifierSession) SetConfigFromSource(feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) { - return _Verifier.Contract.SetConfigFromSource(&_Verifier.TransactOpts, feedId, sourceChainId, sourceAddress, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) +func (_Verifier *VerifierSession) SetConfigFromSource(feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, newConfigCount uint32, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) { + return _Verifier.Contract.SetConfigFromSource(&_Verifier.TransactOpts, feedId, sourceChainId, sourceAddress, newConfigCount, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) } -func (_Verifier *VerifierTransactorSession) SetConfigFromSource(feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) { - return _Verifier.Contract.SetConfigFromSource(&_Verifier.TransactOpts, feedId, sourceChainId, sourceAddress, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) +func (_Verifier *VerifierTransactorSession) SetConfigFromSource(feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, newConfigCount uint32, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) { + return _Verifier.Contract.SetConfigFromSource(&_Verifier.TransactOpts, feedId, sourceChainId, sourceAddress, newConfigCount, signers, offchainTransmitters, f, onchainConfig, offchainConfigVersion, offchainConfig, recipientAddressesAndWeights) } func (_Verifier *VerifierTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { @@ -1556,7 +1556,7 @@ type VerifierInterface interface { SetConfig(opts *bind.TransactOpts, feedId [32]byte, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) - SetConfigFromSource(opts *bind.TransactOpts, feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) + SetConfigFromSource(opts *bind.TransactOpts, feedId [32]byte, sourceChainId *big.Int, sourceAddress common.Address, newConfigCount uint32, signers []common.Address, offchainTransmitters [][32]byte, f uint8, onchainConfig []byte, offchainConfigVersion uint64, offchainConfig []byte, recipientAddressesAndWeights []CommonAddressAndWeight) (*types.Transaction, error) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) diff --git a/core/gethwrappers/llo-feeds/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/llo-feeds/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 47444d741d..2d83bfd786 100644 --- a/core/gethwrappers/llo-feeds/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/llo-feeds/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -1,9 +1,9 @@ GETH_VERSION: 1.12.0 -errored_verifier: ../../../contracts/solc/v0.8.16/ErroredVerifier.abi ../../../contracts/solc/v0.8.16/ErroredVerifier.bin a1b88979c6b0b210677346df554ffc33992d6ebe24be5a244475bfb4d153155e +errored_verifier: ../../../contracts/solc/v0.8.16/ErroredVerifier.abi ../../../contracts/solc/v0.8.16/ErroredVerifier.bin 510d18a58bfda646be35e46491baf73041eb333a349615465b20e2b5b41c5f73 exposed_verifier: ../../../contracts/solc/v0.8.16/ExposedVerifier.abi ../../../contracts/solc/v0.8.16/ExposedVerifier.bin 6932cea8f2738e874d3ec9e1a4231d2421704030c071d9e15dd2f7f08482c246 fee_manager: ../../../contracts/solc/v0.8.16/FeeManager.abi ../../../contracts/solc/v0.8.16/FeeManager.bin 630d7dfa814579001a359e26d99ff9c1f76a6a6480b0140da91b9f20cc1ab8df llo_feeds: ../../../contracts/solc/v0.8.16/FeeManager.abi ../../../contracts/solc/v0.8.16/FeeManager.bin cb71e018f67e49d7bc0e194c822204dfd59f79ff42e4fc8fd8ab63f3acd71361 llo_feeds_test: ../../../contracts/solc/v0.8.16/ExposedVerifier.abi ../../../contracts/solc/v0.8.16/ExposedVerifier.bin 6932cea8f2738e874d3ec9e1a4231d2421704030c071d9e15dd2f7f08482c246 reward_manager: ../../../contracts/solc/v0.8.16/RewardManager.abi ../../../contracts/solc/v0.8.16/RewardManager.bin ec52c851ffe7ed00e05a68dbb363b2e01d38088ac829988b611653b30d10ec97 -verifier: ../../../contracts/solc/v0.8.16/Verifier.abi ../../../contracts/solc/v0.8.16/Verifier.bin 8f841ddd5e616fc1a8d6ac3d27ea9a383d958055237c90ecaf980f5cb3421e49 +verifier: ../../../contracts/solc/v0.8.16/Verifier.abi ../../../contracts/solc/v0.8.16/Verifier.bin 135206eccb805c267392c398df385aa51b22db4d4c59fa1f31f0e5b0a607c812 verifier_proxy: ../../../contracts/solc/v0.8.16/VerifierProxy.abi ../../../contracts/solc/v0.8.16/VerifierProxy.bin 92ad0416e999e9d55e4f00a8b7df616bb69ae27ce52994a6061598e95364d2cc From eccbeefc1ccca9503c943473a887fe999003ebf6 Mon Sep 17 00:00:00 2001 From: Cedric Date: Fri, 15 Sep 2023 10:51:51 +0100 Subject: [PATCH 15/26] [chore] Fix false positive when running tests in the root-level directory (#10648) --- tools/flakeytests/runner.go | 11 +++----- tools/flakeytests/runner_test.go | 43 ++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/tools/flakeytests/runner.go b/tools/flakeytests/runner.go index 28522b2aa7..ab8f2c6222 100644 --- a/tools/flakeytests/runner.go +++ b/tools/flakeytests/runner.go @@ -45,8 +45,9 @@ func NewRunner(readers []io.Reader, reporter reporter, numReruns int) *Runner { } func runGoTest(pkg string, tests []string, numReruns int, w io.Writer) error { + pkg = strings.Replace(pkg, "github.com/smartcontractkit/chainlink/v2", "", -1) testFilter := strings.Join(tests, "|") - cmd := exec.Command("./tools/bin/go_core_tests", fmt.Sprintf("./%s", pkg)) //#nosec + cmd := exec.Command("./tools/bin/go_core_tests", fmt.Sprintf(".%s", pkg)) //#nosec cmd.Env = append(os.Environ(), fmt.Sprintf("TEST_FLAGS=-count %d -run %s", numReruns, testFilter)) cmd.Stdout = io.MultiWriter(os.Stdout, w) cmd.Stderr = io.MultiWriter(os.Stderr, w) @@ -65,13 +66,7 @@ type TestEvent struct { func newEvent(b []byte) (*TestEvent, error) { e := &TestEvent{} err := json.Unmarshal(b, e) - if err != nil { - return nil, err - } - - e.Package = strings.Replace(e.Package, "github.com/smartcontractkit/chainlink/v2/", "", -1) - return e, nil - + return e, err } func parseOutput(readers ...io.Reader) (map[string]map[string]int, error) { diff --git a/tools/flakeytests/runner_test.go b/tools/flakeytests/runner_test.go index 6c1d106876..7def5092b0 100644 --- a/tools/flakeytests/runner_test.go +++ b/tools/flakeytests/runner_test.go @@ -31,8 +31,8 @@ func TestParser(t *testing.T) { require.NoError(t, err) assert.Len(t, ts, 1) - assert.Len(t, ts["core/assets"], 1) - assert.Equal(t, ts["core/assets"]["TestLink"], 1) + assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"], 1) + assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"], 1) } func TestParser_SkipsNonJSON(t *testing.T) { @@ -46,8 +46,8 @@ func TestParser_SkipsNonJSON(t *testing.T) { require.NoError(t, err) assert.Len(t, ts, 1) - assert.Len(t, ts["core/assets"], 1) - assert.Equal(t, ts["core/assets"]["TestLink"], 1) + assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"], 1) + assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestLink"], 1) } func TestParser_PanicDueToLogging(t *testing.T) { @@ -60,8 +60,8 @@ func TestParser_PanicDueToLogging(t *testing.T) { require.NoError(t, err) assert.Len(t, ts, 1) - assert.Len(t, ts["core/assets"], 1) - assert.Equal(t, ts["core/assets"]["TestAssets_LinkScanValue"], 1) + assert.Len(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"], 1) + assert.Equal(t, ts["github.com/smartcontractkit/chainlink/v2/core/assets"]["TestAssets_LinkScanValue"], 1) } func TestParser_SuccessfulOutput(t *testing.T) { @@ -105,7 +105,7 @@ func TestRunner_WithFlake(t *testing.T) { err := r.Run() require.NoError(t, err) assert.Len(t, m.entries, 1) - assert.Equal(t, m.entries["core/assets"], []string{"TestLink"}) + assert.Equal(t, m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"], []string{"TestLink"}) } func TestRunner_WithFailedPackage(t *testing.T) { @@ -130,7 +130,7 @@ func TestRunner_WithFailedPackage(t *testing.T) { err := r.Run() require.NoError(t, err) assert.Len(t, m.entries, 1) - assert.Equal(t, m.entries["core/assets"], []string{"TestLink"}) + assert.Equal(t, m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"], []string{"TestLink"}) } func TestRunner_AllFailures(t *testing.T) { @@ -178,7 +178,28 @@ func TestRunner_RerunSuccessful(t *testing.T) { err := r.Run() require.NoError(t, err) - assert.Equal(t, m.entries["core/assets"], []string{"TestLink"}) + assert.Equal(t, m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"], []string{"TestLink"}) +} + +func TestRunner_RootLevelTest(t *testing.T) { + output := `{"Time":"2023-09-07T15:39:46.378315+01:00","Action":"fail","Package":"github.com/smartcontractkit/chainlink/v2/","Test":"TestConfigDocs","Elapsed":0}` + + rerunOutput := `` + m := newMockReporter() + r := &Runner{ + numReruns: 2, + readers: []io.Reader{strings.NewReader(output)}, + runTestFn: func(pkg string, testNames []string, numReruns int, w io.Writer) error { + _, err := w.Write([]byte(rerunOutput)) + return err + }, + parse: parseOutput, + reporter: m, + } + + err := r.Run() + require.NoError(t, err) + assert.Equal(t, m.entries["github.com/smartcontractkit/chainlink/v2/"], []string{"TestConfigDocs"}) } type exitError struct{} @@ -208,7 +229,7 @@ func TestRunner_RerunFailsWithNonzeroExitCode(t *testing.T) { err := r.Run() require.NoError(t, err) - assert.Equal(t, m.entries["core/assets"], []string{"TestLink"}) + assert.Equal(t, m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"], []string{"TestLink"}) } func TestRunner_RerunWithNonZeroExitCodeDoesntStopCommand(t *testing.T) { @@ -251,5 +272,5 @@ func TestRunner_RerunWithNonZeroExitCodeDoesntStopCommand(t *testing.T) { require.NoError(t, err) calls := index assert.Equal(t, 2, calls) - assert.Equal(t, m.entries["core/assets"], []string{"TestLink"}) + assert.Equal(t, m.entries["github.com/smartcontractkit/chainlink/v2/core/assets"], []string{"TestLink"}) } From a97547d103aebc2ad0b923b2c8d6ec970d096410 Mon Sep 17 00:00:00 2001 From: Sebastian Wojas Date: Fri, 15 Sep 2023 15:37:59 +0200 Subject: [PATCH 16/26] Update delete-deployments.yml (#10662) --- .github/workflows/delete-deployments.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/delete-deployments.yml b/.github/workflows/delete-deployments.yml index 87cba36c08..83a4ba8dfc 100644 --- a/.github/workflows/delete-deployments.yml +++ b/.github/workflows/delete-deployments.yml @@ -1,4 +1,4 @@ -name: Deployments +name: Cleanup integration deployments on: workflow_dispatch: schedule: @@ -13,7 +13,7 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 - - name: 🧼 Clean up Environment + - name: Clean up integration environment uses: ./.github/actions/delete-deployments with: environment: integration From 05f95581a6f38bca98501c5190c9b174fdb0ad4a Mon Sep 17 00:00:00 2001 From: ferglor <19188060+ferglor@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:32:48 +0100 Subject: [PATCH 17/26] Read the length of pending records while locked (#10661) --- .../ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go b/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go index cd12321237..34bd6822d6 100644 --- a/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go +++ b/core/services/ocr2/plugins/ocr2keeper/evm21/upkeepstate/store.go @@ -132,9 +132,8 @@ func (u *upkeepStateStore) Start(pctx context.Context) error { } func (u *upkeepStateStore) flush(ctx context.Context) { - cloneRecords := make([]persistedStateRecord, len(u.pendingRecords)) - u.mu.Lock() + cloneRecords := make([]persistedStateRecord, len(u.pendingRecords)) copy(cloneRecords, u.pendingRecords) u.pendingRecords = []persistedStateRecord{} u.mu.Unlock() From 5036be4a1c953e81b92685eb47423b92248f28b5 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 15 Sep 2023 12:04:57 -0400 Subject: [PATCH 18/26] Add more logging on mercury server price query errors (#10644) --- core/services/relay/evm/mercury/v2/data_source.go | 2 ++ core/services/relay/evm/mercury/v3/data_source.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/core/services/relay/evm/mercury/v2/data_source.go b/core/services/relay/evm/mercury/v2/data_source.go index 25fe279dd4..632278a3c5 100644 --- a/core/services/relay/evm/mercury/v2/data_source.go +++ b/core/services/relay/evm/mercury/v2/data_source.go @@ -123,6 +123,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam obs.LinkPrice.Val = relaymercuryv2.MissingPrice } else if obs.LinkPrice.Err != nil { mercurytypes.PriceFeedErrorCount.WithLabelValues(ds.linkFeedID.String()).Inc() + ds.lggr.Errorw("Mercury server returned error querying LINK price feed", "err", obs.LinkPrice.Err, "linkFeedID", ds.linkFeedID) } }() } @@ -140,6 +141,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam obs.NativePrice.Val = relaymercuryv2.MissingPrice } else if obs.NativePrice.Err != nil { mercurytypes.PriceFeedErrorCount.WithLabelValues(ds.nativeFeedID.String()).Inc() + ds.lggr.Errorw("Mercury server returned error querying native price feed", "err", obs.NativePrice.Err, "nativeFeedID", ds.nativeFeedID) } }() } diff --git a/core/services/relay/evm/mercury/v3/data_source.go b/core/services/relay/evm/mercury/v3/data_source.go index d325f70a00..8d3895cd62 100644 --- a/core/services/relay/evm/mercury/v3/data_source.go +++ b/core/services/relay/evm/mercury/v3/data_source.go @@ -126,6 +126,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam obs.LinkPrice.Val = relaymercuryv3.MissingPrice } else if obs.LinkPrice.Err != nil { mercurytypes.PriceFeedErrorCount.WithLabelValues(ds.linkFeedID.String()).Inc() + ds.lggr.Errorw("Mercury server returned error querying LINK price feed", "err", obs.LinkPrice.Err, "linkFeedID", ds.linkFeedID) } }() } @@ -143,6 +144,7 @@ func (ds *datasource) Observe(ctx context.Context, repts ocrtypes.ReportTimestam obs.NativePrice.Val = relaymercuryv3.MissingPrice } else if obs.NativePrice.Err != nil { mercurytypes.PriceFeedErrorCount.WithLabelValues(ds.nativeFeedID.String()).Inc() + ds.lggr.Errorw("Mercury server returned error querying native price feed", "err", obs.NativePrice.Err, "nativeFeedID", ds.nativeFeedID) } }() } From 9f19654c086e8e92720d935d217536c8a5600c08 Mon Sep 17 00:00:00 2001 From: Morgan Kuphal <87319522+KuphJr@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:13:50 -0500 Subject: [PATCH 19/26] Prefix contract dir names which start w/ a digit (#10655) * Prefix contract dir names which start w/ a digit In order for typechain to work correctly, contract directory names cannot start with a digit. https://chainlink-core.slack.com/archives/C0239N5T3B9/p1694452156859999?thread_ts=1693412728.225189&cid=C0239N5T3B9 * Update wrapper generation * Update native_solc_compile_all_functions * Update generated-wrapper-dependency-versions-do-not-edit.txt --- .../generate-automation-master-interface.ts | 2 +- .../native_solc_compile_all_automation | 30 +++++++++---------- .../scripts/native_solc_compile_all_functions | 30 +++++++++---------- .../native_solc_compile_all_transmission | 6 ++-- .../AutomationRegistryInterface1_2.sol | 0 .../KeeperRegistryInterface1_2.sol | 0 .../AutomationRegistryInterface1_3.sol | 0 .../AutomationRegistryInterface2_0.sol | 0 .../{2_1 => v2_1}/IKeeperRegistryMaster.sol | 0 .../{1_2 => v1_2}/KeeperRegistrar1_2.sol | 2 +- .../{1_2 => v1_2}/KeeperRegistry1_2.sol | 2 +- ...rRegistryCheckUpkeepGasUsageWrapper1_2.sol | 2 +- .../{1_3 => v1_3}/KeeperRegistry1_3.sol | 2 +- .../{1_3 => v1_3}/KeeperRegistryBase1_3.sol | 4 +-- .../{1_3 => v1_3}/KeeperRegistryLogic1_3.sol | 0 .../{2_0 => v2_0}/KeeperRegistrar2_0.sol | 2 +- .../{2_0 => v2_0}/KeeperRegistry2_0.sol | 2 +- .../{2_0 => v2_0}/KeeperRegistryBase2_0.sol | 4 +-- .../{2_0 => v2_0}/KeeperRegistryLogic2_0.sol | 0 .../{2_0 => v2_0}/UpkeepTranscoder3_0.sol | 6 ++-- .../{2_1 => v2_1}/AutomationForwarder.sol | 0 .../AutomationForwarderLogic.sol | 0 .../{2_1 => v2_1}/AutomationRegistrar2_1.sol | 2 +- .../{2_1 => v2_1}/AutomationUtils2_1.sol | 0 .../{2_1 => v2_1}/KeeperRegistry2_1.sol | 0 .../{2_1 => v2_1}/KeeperRegistryBase2_1.sol | 2 +- .../{2_1 => v2_1}/KeeperRegistryLogicA2_1.sol | 0 .../{2_1 => v2_1}/KeeperRegistryLogicB2_1.sol | 0 .../src/v0.8/automation/{2_1 => v2_1}/LICENSE | 0 .../v0.8/automation/{2_1 => v2_1}/README.md | 0 .../{2_1 => v2_1}/UpkeepTranscoder4_0.sol | 2 +- .../test/AutomationForwarder.t.sol | 2 +- .../{2_1 => v2_1}/test/BaseTest.t.sol | 0 .../{2_1 => v2_1}/test/StructFactory.sol | 0 .../{4337 => ERC-4337}/Paymaster.sol | 0 .../transmission/{4337 => ERC-4337}/SCA.sol | 0 .../{4337 => ERC-4337}/SCALibrary.sol | 0 .../SmartContractAccountFactory.sol | 0 .../SmartContractAccountHelper.sol | 6 ++-- .../dev/{0_0_0 => v0_0_0}/Functions.sol | 0 .../FunctionsBillingRegistry.sol | 0 .../dev/{0_0_0 => v0_0_0}/FunctionsClient.sol | 0 .../dev/{0_0_0 => v0_0_0}/FunctionsOracle.sol | 0 .../AuthorizedOriginReceiver.sol | 0 .../AuthorizedOriginReceiverUpgradeable.sol | 0 .../accessControl/AuthorizedReceiver.sol | 0 .../ConfirmedOwnerUpgradeable.sol | 0 .../interfaces/IAuthorizedOriginReceiver.sol | 0 .../interfaces/IAuthorizedReceiver.sol | 0 .../example/FunctionsClientExample.sol | 0 .../interfaces/IFunctionsBillingRegistry.sol | 0 .../interfaces/IFunctionsClient.sol | 0 .../interfaces/IFunctionsOracle.sol | 0 .../{0_0_0 => v0_0_0}/ocr/OCR2Abstract.sol | 0 .../dev/{0_0_0 => v0_0_0}/ocr/OCR2Base.sol | 0 .../ocr/OCR2BaseUpgradeable.sol | 0 .../dev/{0_0_0 => v0_0_0}/ocr/README.md | 0 .../{1_0_0 => v1_0_0}/FunctionsBilling.sol | 0 .../dev/{1_0_0 => v1_0_0}/FunctionsClient.sol | 0 .../FunctionsCoordinator.sol | 0 .../dev/{1_0_0 => v1_0_0}/FunctionsRouter.sol | 0 .../FunctionsSubscriptions.sol | 0 .../dev/{1_0_0 => v1_0_0}/Routable.sol | 0 .../accessControl/TermsOfServiceAllowList.sol | 0 .../interfaces/ITermsOfServiceAllowList.sol | 0 .../example/FunctionsClientExample.sol | 0 .../interfaces/IFunctionsBilling.sol | 0 .../interfaces/IFunctionsClient.sol | 0 .../interfaces/IFunctionsCoordinator.sol | 0 .../interfaces/IFunctionsRouter.sol | 0 .../interfaces/IFunctionsSubscriptions.sol | 0 .../interfaces/IOwnableFunctionsRouter.sol | 0 .../libraries/FunctionsRequest.sol | 0 .../libraries/FunctionsResponse.sol | 0 .../mocks/FunctionsV1EventsMock.sol | 0 .../{1_0_0 => v1_0_0}/ocr/OCR2Abstract.sol | 0 .../dev/{1_0_0 => v1_0_0}/ocr/OCR2Base.sol | 0 .../tests/{0_0_0 => v0_0_0}/BaseTest.t.sol | 0 .../{0_0_0 => v0_0_0}/FunctionsOracle.t.sol | 2 +- .../AuthorizedOriginReceiverTestHelper.sol | 2 +- .../AuthorizedReceiverTestHelper.sol | 2 +- .../FunctionsBillingRegistryWithInit.sol | 2 +- .../testhelpers/FunctionsClientTestHelper.sol | 2 +- .../testhelpers/FunctionsOracleHelper.sol | 0 .../FunctionsOracleMigrationHelper.sol | 0 .../FunctionsOracleOriginalHelper.sol | 0 .../FunctionsOracleUpgradeableHelper.sol | 2 +- .../testhelpers/FunctionsOracleWithInit.sol | 2 +- .../testhelpers/FunctionsTestHelper.sol | 2 +- .../AuthorizedOriginReceiverInterface.sol | 0 .../AuthorizedOriginReceiverUpgradeable.sol | 0 .../testhelpers/mocks/AuthorizedReceiver.sol | 0 .../mocks/AuthorizedReceiverInterface.sol | 0 .../mocks/ConfirmedOwnerUpgradeable.sol | 0 .../FunctionsBillingRegistryInterface.sol | 0 .../FunctionsBillingRegistryMigration.sol | 0 .../FunctionsBillingRegistryOriginal.sol | 0 .../mocks/FunctionsClientInterface.sol | 0 .../mocks/FunctionsOracleInterface.sol | 0 .../mocks/FunctionsOracleMigration.sol | 0 .../mocks/FunctionsOracleOriginal.sol | 0 .../testhelpers/mocks/OCR2Abstract.sol | 0 .../testhelpers/mocks/OCR2BaseUpgradeable.sol | 0 .../tests/{1_0_0 => v1_0_0}/BaseTest.t.sol | 0 .../{1_0_0 => v1_0_0}/FunctionsClient.t.sol | 0 .../FunctionsCoordinator.t.sol | 6 ++-- .../{1_0_0 => v1_0_0}/FunctionsRequest.t.sol | 0 .../{1_0_0 => v1_0_0}/FunctionsRouter.t.sol | 12 ++++---- .../FunctionsSubscriptions.t.sol | 6 ++-- .../FunctionsTermsOfServiceAllowList.t.sol | 2 +- .../tests/{1_0_0 => v1_0_0}/OCR2.t.sol | 0 .../tests/{1_0_0 => v1_0_0}/README.md | 2 +- .../tests/{1_0_0 => v1_0_0}/Setup.t.sol | 8 ++--- .../testhelpers/FunctionsClientTestHelper.sol | 8 ++--- .../FunctionsClientUpgradeHelper.sol | 4 +-- .../FunctionsClientWithEmptyCallback.sol | 4 +-- .../FunctionsCoordinatorTestHelper.sol | 4 +-- .../testhelpers/FunctionsLoadTestClient.sol | 4 +-- .../testhelpers/FunctionsTestHelper.sol | 2 +- .../v0.8/functions/{1_0_0 => v1_0_0}/.gitkeep | 0 .../optimism/OptimismCrossDomainForwarder.sol | 2 +- .../optimism/OptimismCrossDomainGovernor.sol | 2 +- .../src/v0.8/tests/VerifiableLoadBase.sol | 6 ++-- .../messaging/iOVM_CrossDomainMessenger.sol | 0 .../L2/predeploys/OVM_GasPriceOracle.sol | 0 .../L2/predeploys/OVM_GasPriceOracle.sol | 0 .../automation/IKeeperRegistryMaster.test.ts | 2 +- .../v0.8/dev/AuthorizedOriginReceiver.test.ts | 2 +- .../test/v0.8/dev/AuthorizedReceiver.test.ts | 2 +- .../transmission/EIP_712_1014_4337.t.sol | 8 ++--- .../test/v0.8/functions/v0/Functions.test.ts | 2 +- .../v0/FunctionsBillingRegistry.test.ts | 6 ++-- ...unctionsBillingRegistryUpgradeable.test.ts | 10 +++---- .../v0.8/functions/v0/FunctionsClient.test.ts | 6 ++-- .../v0.8/functions/v0/FunctionsOracle.test.ts | 6 ++-- .../v0/FunctionsOracleUpgradeable.test.ts | 10 +++---- contracts/test/v0.8/functions/v0/Gas.test.ts | 6 ++-- .../test/v0.8/functions/v1/Functions.test.ts | 2 +- .../v0.8/functions/v1/FunctionsClient.test.ts | 2 +- contracts/test/v0.8/functions/v1/utils.ts | 10 +++---- ...rapper-dependency-versions-do-not-edit.txt | 30 +++++++++---------- core/gethwrappers/functions/go_generate.go | 26 ++++++++-------- core/gethwrappers/go_generate.go | 4 +-- integration-tests/load/functions/README.md | 2 +- 144 files changed, 166 insertions(+), 166 deletions(-) rename contracts/src/v0.8/automation/interfaces/{1_2 => v1_2}/AutomationRegistryInterface1_2.sol (100%) rename contracts/src/v0.8/automation/interfaces/{1_2 => v1_2}/KeeperRegistryInterface1_2.sol (100%) rename contracts/src/v0.8/automation/interfaces/{1_3 => v1_3}/AutomationRegistryInterface1_3.sol (100%) rename contracts/src/v0.8/automation/interfaces/{2_0 => v2_0}/AutomationRegistryInterface2_0.sol (100%) rename contracts/src/v0.8/automation/interfaces/{2_1 => v2_1}/IKeeperRegistryMaster.sol (100%) rename contracts/src/v0.8/automation/{1_2 => v1_2}/KeeperRegistrar1_2.sol (99%) rename contracts/src/v0.8/automation/{1_2 => v1_2}/KeeperRegistry1_2.sol (99%) rename contracts/src/v0.8/automation/{1_2 => v1_2}/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol (97%) rename contracts/src/v0.8/automation/{1_3 => v1_3}/KeeperRegistry1_3.sol (99%) rename contracts/src/v0.8/automation/{1_3 => v1_3}/KeeperRegistryBase1_3.sol (98%) rename contracts/src/v0.8/automation/{1_3 => v1_3}/KeeperRegistryLogic1_3.sol (100%) rename contracts/src/v0.8/automation/{2_0 => v2_0}/KeeperRegistrar2_0.sol (99%) rename contracts/src/v0.8/automation/{2_0 => v2_0}/KeeperRegistry2_0.sol (99%) rename contracts/src/v0.8/automation/{2_0 => v2_0}/KeeperRegistryBase2_0.sol (99%) rename contracts/src/v0.8/automation/{2_0 => v2_0}/KeeperRegistryLogic2_0.sol (100%) rename contracts/src/v0.8/automation/{2_0 => v2_0}/UpkeepTranscoder3_0.sol (94%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/AutomationForwarder.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/AutomationForwarderLogic.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/AutomationRegistrar2_1.sol (99%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/AutomationUtils2_1.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/KeeperRegistry2_1.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/KeeperRegistryBase2_1.sol (99%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/KeeperRegistryLogicA2_1.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/KeeperRegistryLogicB2_1.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/LICENSE (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/README.md (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/UpkeepTranscoder4_0.sol (99%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/test/AutomationForwarder.t.sol (97%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/test/BaseTest.t.sol (100%) rename contracts/src/v0.8/automation/{2_1 => v2_1}/test/StructFactory.sol (100%) rename contracts/src/v0.8/dev/transmission/{4337 => ERC-4337}/Paymaster.sol (100%) rename contracts/src/v0.8/dev/transmission/{4337 => ERC-4337}/SCA.sol (100%) rename contracts/src/v0.8/dev/transmission/{4337 => ERC-4337}/SCALibrary.sol (100%) rename contracts/src/v0.8/dev/transmission/{4337 => ERC-4337}/SmartContractAccountFactory.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/Functions.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/FunctionsBillingRegistry.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/FunctionsClient.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/FunctionsOracle.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/accessControl/AuthorizedOriginReceiver.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/accessControl/AuthorizedOriginReceiverUpgradeable.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/accessControl/AuthorizedReceiver.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/accessControl/ConfirmedOwnerUpgradeable.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/accessControl/interfaces/IAuthorizedOriginReceiver.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/accessControl/interfaces/IAuthorizedReceiver.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/example/FunctionsClientExample.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/interfaces/IFunctionsBillingRegistry.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/interfaces/IFunctionsClient.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/interfaces/IFunctionsOracle.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/ocr/OCR2Abstract.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/ocr/OCR2Base.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/ocr/OCR2BaseUpgradeable.sol (100%) rename contracts/src/v0.8/functions/dev/{0_0_0 => v0_0_0}/ocr/README.md (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/FunctionsBilling.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/FunctionsClient.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/FunctionsCoordinator.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/FunctionsRouter.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/FunctionsSubscriptions.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/Routable.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/accessControl/TermsOfServiceAllowList.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/accessControl/interfaces/ITermsOfServiceAllowList.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/example/FunctionsClientExample.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/interfaces/IFunctionsBilling.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/interfaces/IFunctionsClient.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/interfaces/IFunctionsCoordinator.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/interfaces/IFunctionsRouter.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/interfaces/IFunctionsSubscriptions.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/interfaces/IOwnableFunctionsRouter.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/libraries/FunctionsRequest.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/libraries/FunctionsResponse.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/mocks/FunctionsV1EventsMock.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/ocr/OCR2Abstract.sol (100%) rename contracts/src/v0.8/functions/dev/{1_0_0 => v1_0_0}/ocr/OCR2Base.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/BaseTest.t.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/FunctionsOracle.t.sol (97%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/AuthorizedOriginReceiverTestHelper.sol (87%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/AuthorizedReceiverTestHelper.sol (88%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsBillingRegistryWithInit.sol (72%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsClientTestHelper.sol (95%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsOracleHelper.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsOracleMigrationHelper.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsOracleOriginalHelper.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsOracleUpgradeableHelper.sol (91%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsOracleWithInit.sol (67%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/FunctionsTestHelper.sol (95%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/AuthorizedOriginReceiverInterface.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/AuthorizedOriginReceiverUpgradeable.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/AuthorizedReceiver.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/AuthorizedReceiverInterface.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/ConfirmedOwnerUpgradeable.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsBillingRegistryInterface.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsBillingRegistryMigration.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsClientInterface.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsOracleInterface.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsOracleMigration.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/FunctionsOracleOriginal.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/OCR2Abstract.sol (100%) rename contracts/src/v0.8/functions/tests/{0_0_0 => v0_0_0}/testhelpers/mocks/OCR2BaseUpgradeable.sol (100%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/BaseTest.t.sol (100%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/FunctionsClient.t.sol (100%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/FunctionsCoordinator.t.sol (96%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/FunctionsRequest.t.sol (100%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/FunctionsRouter.t.sol (99%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/FunctionsSubscriptions.t.sol (99%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/FunctionsTermsOfServiceAllowList.t.sol (99%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/OCR2.t.sol (100%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/README.md (84%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/Setup.t.sol (97%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/testhelpers/FunctionsClientTestHelper.sol (90%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/testhelpers/FunctionsClientUpgradeHelper.sol (97%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/testhelpers/FunctionsClientWithEmptyCallback.sol (87%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/testhelpers/FunctionsCoordinatorTestHelper.sol (85%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/testhelpers/FunctionsLoadTestClient.sol (96%) rename contracts/src/v0.8/functions/tests/{1_0_0 => v1_0_0}/testhelpers/FunctionsTestHelper.sol (94%) rename contracts/src/v0.8/functions/{1_0_0 => v1_0_0}/.gitkeep (100%) rename contracts/src/v0.8/vendor/@eth-optimism/contracts/{0.4.7 => v0.4.7}/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol (100%) rename contracts/src/v0.8/vendor/@eth-optimism/contracts/{0.8.6 => v0.8.6}/contracts/L2/predeploys/OVM_GasPriceOracle.sol (100%) rename contracts/src/v0.8/vendor/@eth-optimism/contracts/{0.8.9 => v0.8.9}/contracts/L2/predeploys/OVM_GasPriceOracle.sol (100%) diff --git a/contracts/scripts/generate-automation-master-interface.ts b/contracts/scripts/generate-automation-master-interface.ts index 821b0caac6..5b71c99bc7 100644 --- a/contracts/scripts/generate-automation-master-interface.ts +++ b/contracts/scripts/generate-automation-master-interface.ts @@ -9,7 +9,7 @@ import { utils } from 'ethers' import fs from 'fs' import { exec } from 'child_process' -const dest = 'src/v0.8/automation/interfaces/2_1' +const dest = 'src/v0.8/automation/interfaces/v2_1' const srcDest = `${dest}/IKeeperRegistryMaster.sol` const tmpDest = `${dest}/tmp.txt` diff --git a/contracts/scripts/native_solc_compile_all_automation b/contracts/scripts/native_solc_compile_all_automation index c38f4c2e3d..005570f4c1 100755 --- a/contracts/scripts/native_solc_compile_all_automation +++ b/contracts/scripts/native_solc_compile_all_automation @@ -27,14 +27,14 @@ compileContract () { } compileContract automation/upkeeps/CronUpkeepFactory.sol -compileContract automation/1_2/KeeperRegistrar1_2.sol -compileContract automation/1_2/KeeperRegistry1_2.sol -compileContract automation/1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol -compileContract automation/1_3/KeeperRegistry1_3.sol -compileContract automation/1_3/KeeperRegistryLogic1_3.sol -compileContract automation/2_0/KeeperRegistrar2_0.sol -compileContract automation/2_0/KeeperRegistry2_0.sol -compileContract automation/2_0/KeeperRegistryLogic2_0.sol +compileContract automation/v1_2/KeeperRegistrar1_2.sol +compileContract automation/v1_2/KeeperRegistry1_2.sol +compileContract automation/v1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol +compileContract automation/v1_3/KeeperRegistry1_3.sol +compileContract automation/v1_3/KeeperRegistryLogic1_3.sol +compileContract automation/v2_0/KeeperRegistrar2_0.sol +compileContract automation/v2_0/KeeperRegistry2_0.sol +compileContract automation/v2_0/KeeperRegistryLogic2_0.sol compileContract automation/UpkeepTranscoder.sol compileContract automation/mocks/MockAggregatorProxy.sol compileContract automation/testhelpers/LogUpkeepCounter.sol @@ -52,14 +52,14 @@ solc-select use $SOLC_VERSION export SOLC_VERSION=$SOLC_VERSION # v0.8.16 -compileContract automation/2_1/AutomationRegistrar2_1.sol -compileContract automation/2_1/KeeperRegistry2_1.sol -compileContract automation/2_1/KeeperRegistryLogicA2_1.sol -compileContract automation/2_1/KeeperRegistryLogicB2_1.sol -compileContract automation/interfaces/2_1/IKeeperRegistryMaster.sol +compileContract automation/v2_1/AutomationRegistrar2_1.sol +compileContract automation/v2_1/KeeperRegistry2_1.sol +compileContract automation/v2_1/KeeperRegistryLogicA2_1.sol +compileContract automation/v2_1/KeeperRegistryLogicB2_1.sol +compileContract automation/interfaces/v2_1/IKeeperRegistryMaster.sol compileContract automation/interfaces/ILogAutomation.sol -compileContract automation/2_1/AutomationUtils2_1.sol -compileContract automation/2_1/AutomationForwarderLogic.sol +compileContract automation/v2_1/AutomationUtils2_1.sol +compileContract automation/v2_1/AutomationForwarderLogic.sol compileContract automation/testhelpers/LogTriggeredStreamsLookup.sol compileContract automation/testhelpers/DummyProtocol.sol compileContract automation/interfaces/StreamsLookupCompatibleInterface.sol diff --git a/contracts/scripts/native_solc_compile_all_functions b/contracts/scripts/native_solc_compile_all_functions index 1b5d553794..99ded8afbb 100755 --- a/contracts/scripts/native_solc_compile_all_functions +++ b/contracts/scripts/native_solc_compile_all_functions @@ -31,15 +31,15 @@ compileContract () { # Version 0 (Testnet Beta) ########################## -compileContract 0_0_0 dev/0_0_0/Functions.sol -compileContract 0_0_0 dev/0_0_0/FunctionsBillingRegistry.sol -compileContract 0_0_0 dev/0_0_0/FunctionsClient.sol -compileContract 0_0_0 dev/0_0_0/FunctionsOracle.sol -compileContract 0_0_0 dev/0_0_0/example/FunctionsClientExample.sol +compileContract v0_0_0 dev/v0_0_0/Functions.sol +compileContract v0_0_0 dev/v0_0_0/FunctionsBillingRegistry.sol +compileContract v0_0_0 dev/v0_0_0/FunctionsClient.sol +compileContract v0_0_0 dev/v0_0_0/FunctionsOracle.sol +compileContract v0_0_0 dev/v0_0_0/example/FunctionsClientExample.sol # Test helpers -compileContract 0_0_0 tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol -compileContract 0_0_0 tests/0_0_0/testhelpers/FunctionsOracleWithInit.sol +compileContract v0_0_0 tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol +compileContract v0_0_0 tests/v0_0_0/testhelpers/FunctionsOracleWithInit.sol ############################ # Version 1 (Mainnet Preview) @@ -50,15 +50,15 @@ solc-select install $SOLC_VERSION solc-select use $SOLC_VERSION export SOLC_VERSION=$SOLC_VERSION -compileContract 1_0_0 dev/1_0_0/libraries/FunctionsRequest.sol -compileContract 1_0_0 dev/1_0_0/FunctionsRouter.sol -compileContract 1_0_0 dev/1_0_0/FunctionsCoordinator.sol -compileContract 1_0_0 dev/1_0_0/accessControl/TermsOfServiceAllowList.sol -compileContract 1_0_0 dev/1_0_0/example/FunctionsClientExample.sol +compileContract v1_0_0 dev/v1_0_0/libraries/FunctionsRequest.sol +compileContract v1_0_0 dev/v1_0_0/FunctionsRouter.sol +compileContract v1_0_0 dev/v1_0_0/FunctionsCoordinator.sol +compileContract v1_0_0 dev/v1_0_0/accessControl/TermsOfServiceAllowList.sol +compileContract v1_0_0 dev/v1_0_0/example/FunctionsClientExample.sol # Test helpers -compileContract 1_0_0 tests/1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol -compileContract 1_0_0 tests/1_0_0/testhelpers/FunctionsLoadTestClient.sol +compileContract v1_0_0 tests/v1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol +compileContract v1_0_0 tests/v1_0_0/testhelpers/FunctionsLoadTestClient.sol # Mocks -compileContract 1_0_0 dev/1_0_0/mocks/FunctionsV1EventsMock.sol +compileContract v1_0_0 dev/v1_0_0/mocks/FunctionsV1EventsMock.sol diff --git a/contracts/scripts/native_solc_compile_all_transmission b/contracts/scripts/native_solc_compile_all_transmission index 6537757f42..6bd237f4a7 100755 --- a/contracts/scripts/native_solc_compile_all_transmission +++ b/contracts/scripts/native_solc_compile_all_transmission @@ -25,9 +25,9 @@ compileContract () { } # Contracts -compileContract dev/transmission/4337/SCA.sol -compileContract dev/transmission/4337/Paymaster.sol -compileContract dev/transmission/4337/SmartContractAccountFactory.sol +compileContract dev/transmission/ERC-4337/SCA.sol +compileContract dev/transmission/ERC-4337/Paymaster.sol +compileContract dev/transmission/ERC-4337/SmartContractAccountFactory.sol # Testhelpers compileContract dev/transmission/testhelpers/SmartContractAccountHelper.sol diff --git a/contracts/src/v0.8/automation/interfaces/1_2/AutomationRegistryInterface1_2.sol b/contracts/src/v0.8/automation/interfaces/v1_2/AutomationRegistryInterface1_2.sol similarity index 100% rename from contracts/src/v0.8/automation/interfaces/1_2/AutomationRegistryInterface1_2.sol rename to contracts/src/v0.8/automation/interfaces/v1_2/AutomationRegistryInterface1_2.sol diff --git a/contracts/src/v0.8/automation/interfaces/1_2/KeeperRegistryInterface1_2.sol b/contracts/src/v0.8/automation/interfaces/v1_2/KeeperRegistryInterface1_2.sol similarity index 100% rename from contracts/src/v0.8/automation/interfaces/1_2/KeeperRegistryInterface1_2.sol rename to contracts/src/v0.8/automation/interfaces/v1_2/KeeperRegistryInterface1_2.sol diff --git a/contracts/src/v0.8/automation/interfaces/1_3/AutomationRegistryInterface1_3.sol b/contracts/src/v0.8/automation/interfaces/v1_3/AutomationRegistryInterface1_3.sol similarity index 100% rename from contracts/src/v0.8/automation/interfaces/1_3/AutomationRegistryInterface1_3.sol rename to contracts/src/v0.8/automation/interfaces/v1_3/AutomationRegistryInterface1_3.sol diff --git a/contracts/src/v0.8/automation/interfaces/2_0/AutomationRegistryInterface2_0.sol b/contracts/src/v0.8/automation/interfaces/v2_0/AutomationRegistryInterface2_0.sol similarity index 100% rename from contracts/src/v0.8/automation/interfaces/2_0/AutomationRegistryInterface2_0.sol rename to contracts/src/v0.8/automation/interfaces/v2_0/AutomationRegistryInterface2_0.sol diff --git a/contracts/src/v0.8/automation/interfaces/2_1/IKeeperRegistryMaster.sol b/contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol similarity index 100% rename from contracts/src/v0.8/automation/interfaces/2_1/IKeeperRegistryMaster.sol rename to contracts/src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol diff --git a/contracts/src/v0.8/automation/1_2/KeeperRegistrar1_2.sol b/contracts/src/v0.8/automation/v1_2/KeeperRegistrar1_2.sol similarity index 99% rename from contracts/src/v0.8/automation/1_2/KeeperRegistrar1_2.sol rename to contracts/src/v0.8/automation/v1_2/KeeperRegistrar1_2.sol index e3e10de131..f455d56f17 100644 --- a/contracts/src/v0.8/automation/1_2/KeeperRegistrar1_2.sol +++ b/contracts/src/v0.8/automation/v1_2/KeeperRegistrar1_2.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; -import "../interfaces/1_2/KeeperRegistryInterface1_2.sol"; +import "../interfaces/v1_2/KeeperRegistryInterface1_2.sol"; import "../../interfaces/TypeAndVersionInterface.sol"; import "../../shared/interfaces/LinkTokenInterface.sol"; import "../../shared/access/ConfirmedOwner.sol"; diff --git a/contracts/src/v0.8/automation/1_2/KeeperRegistry1_2.sol b/contracts/src/v0.8/automation/v1_2/KeeperRegistry1_2.sol similarity index 99% rename from contracts/src/v0.8/automation/1_2/KeeperRegistry1_2.sol rename to contracts/src/v0.8/automation/v1_2/KeeperRegistry1_2.sol index 70bd176f82..262b8357f7 100644 --- a/contracts/src/v0.8/automation/1_2/KeeperRegistry1_2.sol +++ b/contracts/src/v0.8/automation/v1_2/KeeperRegistry1_2.sol @@ -9,7 +9,7 @@ import "../KeeperBase.sol"; import "../../interfaces/TypeAndVersionInterface.sol"; import "../../interfaces/AggregatorV3Interface.sol"; import "../interfaces/KeeperCompatibleInterface.sol"; -import "../interfaces/1_2/KeeperRegistryInterface1_2.sol"; +import "../interfaces/v1_2/KeeperRegistryInterface1_2.sol"; import "../interfaces/MigratableKeeperRegistryInterface.sol"; import "../interfaces/UpkeepTranscoderInterface.sol"; import "../../shared/interfaces/IERC677Receiver.sol"; diff --git a/contracts/src/v0.8/automation/1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol b/contracts/src/v0.8/automation/v1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol similarity index 97% rename from contracts/src/v0.8/automation/1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol rename to contracts/src/v0.8/automation/v1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol index dd6c83565b..253a421a5a 100644 --- a/contracts/src/v0.8/automation/1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol +++ b/contracts/src/v0.8/automation/v1_2/KeeperRegistryCheckUpkeepGasUsageWrapper1_2.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity 0.8.6; -import {AutomationRegistryExecutableInterface} from "../interfaces/1_2/AutomationRegistryInterface1_2.sol"; +import {AutomationRegistryExecutableInterface} from "../interfaces/v1_2/AutomationRegistryInterface1_2.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; /** diff --git a/contracts/src/v0.8/automation/1_3/KeeperRegistry1_3.sol b/contracts/src/v0.8/automation/v1_3/KeeperRegistry1_3.sol similarity index 99% rename from contracts/src/v0.8/automation/1_3/KeeperRegistry1_3.sol rename to contracts/src/v0.8/automation/v1_3/KeeperRegistry1_3.sol index 7f75ae87af..c40f79f85b 100644 --- a/contracts/src/v0.8/automation/1_3/KeeperRegistry1_3.sol +++ b/contracts/src/v0.8/automation/v1_3/KeeperRegistry1_3.sol @@ -6,7 +6,7 @@ import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./KeeperRegistryBase1_3.sol"; import "./KeeperRegistryLogic1_3.sol"; -import {AutomationRegistryExecutableInterface} from "../interfaces/1_3/AutomationRegistryInterface1_3.sol"; +import {AutomationRegistryExecutableInterface} from "../interfaces/v1_3/AutomationRegistryInterface1_3.sol"; import "../interfaces/MigratableKeeperRegistryInterface.sol"; import "../../interfaces/TypeAndVersionInterface.sol"; import "../../shared/interfaces/IERC677Receiver.sol"; diff --git a/contracts/src/v0.8/automation/1_3/KeeperRegistryBase1_3.sol b/contracts/src/v0.8/automation/v1_3/KeeperRegistryBase1_3.sol similarity index 98% rename from contracts/src/v0.8/automation/1_3/KeeperRegistryBase1_3.sol rename to contracts/src/v0.8/automation/v1_3/KeeperRegistryBase1_3.sol index 2f5156ee08..d63f6f40e8 100644 --- a/contracts/src/v0.8/automation/1_3/KeeperRegistryBase1_3.sol +++ b/contracts/src/v0.8/automation/v1_3/KeeperRegistryBase1_3.sol @@ -4,9 +4,9 @@ import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import "../../vendor/@eth-optimism/contracts/0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import "../../vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; import "../ExecutionPrevention.sol"; -import {Config, State, Upkeep} from "../interfaces/1_3/AutomationRegistryInterface1_3.sol"; +import {Config, State, Upkeep} from "../interfaces/v1_3/AutomationRegistryInterface1_3.sol"; import "../../shared/access/ConfirmedOwner.sol"; import "../../interfaces/AggregatorV3Interface.sol"; import "../../shared/interfaces/LinkTokenInterface.sol"; diff --git a/contracts/src/v0.8/automation/1_3/KeeperRegistryLogic1_3.sol b/contracts/src/v0.8/automation/v1_3/KeeperRegistryLogic1_3.sol similarity index 100% rename from contracts/src/v0.8/automation/1_3/KeeperRegistryLogic1_3.sol rename to contracts/src/v0.8/automation/v1_3/KeeperRegistryLogic1_3.sol diff --git a/contracts/src/v0.8/automation/2_0/KeeperRegistrar2_0.sol b/contracts/src/v0.8/automation/v2_0/KeeperRegistrar2_0.sol similarity index 99% rename from contracts/src/v0.8/automation/2_0/KeeperRegistrar2_0.sol rename to contracts/src/v0.8/automation/v2_0/KeeperRegistrar2_0.sol index 15cba57e7b..c1b7e45b85 100644 --- a/contracts/src/v0.8/automation/2_0/KeeperRegistrar2_0.sol +++ b/contracts/src/v0.8/automation/v2_0/KeeperRegistrar2_0.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.6; import "../../shared/interfaces/LinkTokenInterface.sol"; -import "../interfaces/2_0/AutomationRegistryInterface2_0.sol"; +import "../interfaces/v2_0/AutomationRegistryInterface2_0.sol"; import "../../interfaces/TypeAndVersionInterface.sol"; import "../../shared/access/ConfirmedOwner.sol"; import "../../shared/interfaces/IERC677Receiver.sol"; diff --git a/contracts/src/v0.8/automation/2_0/KeeperRegistry2_0.sol b/contracts/src/v0.8/automation/v2_0/KeeperRegistry2_0.sol similarity index 99% rename from contracts/src/v0.8/automation/2_0/KeeperRegistry2_0.sol rename to contracts/src/v0.8/automation/v2_0/KeeperRegistry2_0.sol index bc928bd429..34781f1825 100644 --- a/contracts/src/v0.8/automation/2_0/KeeperRegistry2_0.sol +++ b/contracts/src/v0.8/automation/v2_0/KeeperRegistry2_0.sol @@ -5,7 +5,7 @@ import "../../vendor/openzeppelin-solidity/v4.7.3/contracts/proxy/Proxy.sol"; import "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; import "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; import "./KeeperRegistryBase2_0.sol"; -import {AutomationRegistryExecutableInterface, UpkeepInfo} from "../interfaces/2_0/AutomationRegistryInterface2_0.sol"; +import {AutomationRegistryExecutableInterface, UpkeepInfo} from "../interfaces/v2_0/AutomationRegistryInterface2_0.sol"; import "../interfaces/MigratableKeeperRegistryInterface.sol"; import "../interfaces/MigratableKeeperRegistryInterfaceV2.sol"; import "../../shared/interfaces/IERC677Receiver.sol"; diff --git a/contracts/src/v0.8/automation/2_0/KeeperRegistryBase2_0.sol b/contracts/src/v0.8/automation/v2_0/KeeperRegistryBase2_0.sol similarity index 99% rename from contracts/src/v0.8/automation/2_0/KeeperRegistryBase2_0.sol rename to contracts/src/v0.8/automation/v2_0/KeeperRegistryBase2_0.sol index 74a13d7110..c1e9a279f8 100644 --- a/contracts/src/v0.8/automation/2_0/KeeperRegistryBase2_0.sol +++ b/contracts/src/v0.8/automation/v2_0/KeeperRegistryBase2_0.sol @@ -3,10 +3,10 @@ pragma solidity 0.8.6; import "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; import "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import "../../vendor/@eth-optimism/contracts/0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol"; +import "../../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 "../ExecutionPrevention.sol"; -import {OnchainConfig, State, UpkeepFailureReason} from "../interfaces/2_0/AutomationRegistryInterface2_0.sol"; +import {OnchainConfig, State, UpkeepFailureReason} from "../interfaces/v2_0/AutomationRegistryInterface2_0.sol"; import "../../shared/access/ConfirmedOwner.sol"; import "../../interfaces/AggregatorV3Interface.sol"; import "../../shared/interfaces/LinkTokenInterface.sol"; diff --git a/contracts/src/v0.8/automation/2_0/KeeperRegistryLogic2_0.sol b/contracts/src/v0.8/automation/v2_0/KeeperRegistryLogic2_0.sol similarity index 100% rename from contracts/src/v0.8/automation/2_0/KeeperRegistryLogic2_0.sol rename to contracts/src/v0.8/automation/v2_0/KeeperRegistryLogic2_0.sol diff --git a/contracts/src/v0.8/automation/2_0/UpkeepTranscoder3_0.sol b/contracts/src/v0.8/automation/v2_0/UpkeepTranscoder3_0.sol similarity index 94% rename from contracts/src/v0.8/automation/2_0/UpkeepTranscoder3_0.sol rename to contracts/src/v0.8/automation/v2_0/UpkeepTranscoder3_0.sol index 618f97db8f..0a56f209cc 100644 --- a/contracts/src/v0.8/automation/2_0/UpkeepTranscoder3_0.sol +++ b/contracts/src/v0.8/automation/v2_0/UpkeepTranscoder3_0.sol @@ -4,9 +4,9 @@ pragma solidity 0.8.6; import "../../automation/interfaces/UpkeepTranscoderInterface.sol"; import "../../interfaces/TypeAndVersionInterface.sol"; -import {Upkeep as UpkeepV1} from "../../automation/1_2/KeeperRegistry1_2.sol"; -import {Upkeep as UpkeepV2} from "../../automation/1_3/KeeperRegistryBase1_3.sol"; -import {Upkeep as UpkeepV3} from "../../automation/2_0/KeeperRegistryBase2_0.sol"; +import {Upkeep as UpkeepV1} from "../../automation/v1_2/KeeperRegistry1_2.sol"; +import {Upkeep as UpkeepV2} from "../../automation/v1_3/KeeperRegistryBase1_3.sol"; +import {Upkeep as UpkeepV3} from "../../automation/v2_0/KeeperRegistryBase2_0.sol"; import "../../automation/UpkeepFormat.sol"; /** diff --git a/contracts/src/v0.8/automation/2_1/AutomationForwarder.sol b/contracts/src/v0.8/automation/v2_1/AutomationForwarder.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/AutomationForwarder.sol rename to contracts/src/v0.8/automation/v2_1/AutomationForwarder.sol diff --git a/contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol b/contracts/src/v0.8/automation/v2_1/AutomationForwarderLogic.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/AutomationForwarderLogic.sol rename to contracts/src/v0.8/automation/v2_1/AutomationForwarderLogic.sol diff --git a/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol b/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol similarity index 99% rename from contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol rename to contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol index b2679b3c15..407dda2414 100644 --- a/contracts/src/v0.8/automation/2_1/AutomationRegistrar2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/AutomationRegistrar2_1.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.16; import {LinkTokenInterface} from "../../shared/interfaces/LinkTokenInterface.sol"; -import {IKeeperRegistryMaster} from "../interfaces/2_1/IKeeperRegistryMaster.sol"; +import {IKeeperRegistryMaster} from "../interfaces/v2_1/IKeeperRegistryMaster.sol"; import {TypeAndVersionInterface} from "../../interfaces/TypeAndVersionInterface.sol"; import {ConfirmedOwner} from "../../shared/access/ConfirmedOwner.sol"; import {IERC677Receiver} from "../../shared/interfaces/IERC677Receiver.sol"; diff --git a/contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol b/contracts/src/v0.8/automation/v2_1/AutomationUtils2_1.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/AutomationUtils2_1.sol rename to contracts/src/v0.8/automation/v2_1/AutomationUtils2_1.sol diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistry2_1.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/KeeperRegistry2_1.sol rename to contracts/src/v0.8/automation/v2_1/KeeperRegistry2_1.sol diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol similarity index 99% rename from contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol rename to contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol index 2d48671e3e..86942f3108 100644 --- a/contracts/src/v0.8/automation/2_1/KeeperRegistryBase2_1.sol +++ b/contracts/src/v0.8/automation/v2_1/KeeperRegistryBase2_1.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.16; import {EnumerableSet} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; import {Address} from "../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; import {ArbGasInfo} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbGasInfo.sol"; -import {OVM_GasPriceOracle} from "../../vendor/@eth-optimism/contracts/0.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 {ExecutionPrevention} from "../ExecutionPrevention.sol"; import {ArbSys} from "../../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; import {StreamsLookupCompatibleInterface} from "../interfaces/StreamsLookupCompatibleInterface.sol"; diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/KeeperRegistryLogicA2_1.sol rename to contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicA2_1.sol diff --git a/contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol b/contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/KeeperRegistryLogicB2_1.sol rename to contracts/src/v0.8/automation/v2_1/KeeperRegistryLogicB2_1.sol diff --git a/contracts/src/v0.8/automation/2_1/LICENSE b/contracts/src/v0.8/automation/v2_1/LICENSE similarity index 100% rename from contracts/src/v0.8/automation/2_1/LICENSE rename to contracts/src/v0.8/automation/v2_1/LICENSE diff --git a/contracts/src/v0.8/automation/2_1/README.md b/contracts/src/v0.8/automation/v2_1/README.md similarity index 100% rename from contracts/src/v0.8/automation/2_1/README.md rename to contracts/src/v0.8/automation/v2_1/README.md diff --git a/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol b/contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol similarity index 99% rename from contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol rename to contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol index 7e304b42ba..727a3dd33a 100644 --- a/contracts/src/v0.8/automation/2_1/UpkeepTranscoder4_0.sol +++ b/contracts/src/v0.8/automation/v2_1/UpkeepTranscoder4_0.sol @@ -6,7 +6,7 @@ import {UpkeepTranscoderInterfaceV2} from "../interfaces/UpkeepTranscoderInterfa import {TypeAndVersionInterface} from "../../interfaces/TypeAndVersionInterface.sol"; import {KeeperRegistryBase2_1 as R21} from "./KeeperRegistryBase2_1.sol"; import {IAutomationForwarder} from "../interfaces/IAutomationForwarder.sol"; -import {AutomationRegistryBaseInterface, UpkeepInfo} from "../interfaces/2_0/AutomationRegistryInterface2_0.sol"; +import {AutomationRegistryBaseInterface, UpkeepInfo} from "../interfaces/v2_0/AutomationRegistryInterface2_0.sol"; enum RegistryVersion { V12, diff --git a/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol b/contracts/src/v0.8/automation/v2_1/test/AutomationForwarder.t.sol similarity index 97% rename from contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol rename to contracts/src/v0.8/automation/v2_1/test/AutomationForwarder.t.sol index ef0b829b73..078d22d6c9 100644 --- a/contracts/src/v0.8/automation/2_1/test/AutomationForwarder.t.sol +++ b/contracts/src/v0.8/automation/v2_1/test/AutomationForwarder.t.sol @@ -10,7 +10,7 @@ import {UpkeepCounter} from "../../testhelpers/UpkeepCounter.sol"; import {BaseTest} from "./BaseTest.t.sol"; // in contracts directory, run -// forge test --match-path src/v0.8/automation/2_1/test/AutomationForwarder.t.sol +// forge test --match-path src/v0.8/automation/v2_1/test/AutomationForwarder.t.sol contract AutomationForwarderSetUp is BaseTest { IAutomationForwarder internal forwarder; diff --git a/contracts/src/v0.8/automation/2_1/test/BaseTest.t.sol b/contracts/src/v0.8/automation/v2_1/test/BaseTest.t.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/test/BaseTest.t.sol rename to contracts/src/v0.8/automation/v2_1/test/BaseTest.t.sol diff --git a/contracts/src/v0.8/automation/2_1/test/StructFactory.sol b/contracts/src/v0.8/automation/v2_1/test/StructFactory.sol similarity index 100% rename from contracts/src/v0.8/automation/2_1/test/StructFactory.sol rename to contracts/src/v0.8/automation/v2_1/test/StructFactory.sol diff --git a/contracts/src/v0.8/dev/transmission/4337/Paymaster.sol b/contracts/src/v0.8/dev/transmission/ERC-4337/Paymaster.sol similarity index 100% rename from contracts/src/v0.8/dev/transmission/4337/Paymaster.sol rename to contracts/src/v0.8/dev/transmission/ERC-4337/Paymaster.sol diff --git a/contracts/src/v0.8/dev/transmission/4337/SCA.sol b/contracts/src/v0.8/dev/transmission/ERC-4337/SCA.sol similarity index 100% rename from contracts/src/v0.8/dev/transmission/4337/SCA.sol rename to contracts/src/v0.8/dev/transmission/ERC-4337/SCA.sol diff --git a/contracts/src/v0.8/dev/transmission/4337/SCALibrary.sol b/contracts/src/v0.8/dev/transmission/ERC-4337/SCALibrary.sol similarity index 100% rename from contracts/src/v0.8/dev/transmission/4337/SCALibrary.sol rename to contracts/src/v0.8/dev/transmission/ERC-4337/SCALibrary.sol diff --git a/contracts/src/v0.8/dev/transmission/4337/SmartContractAccountFactory.sol b/contracts/src/v0.8/dev/transmission/ERC-4337/SmartContractAccountFactory.sol similarity index 100% rename from contracts/src/v0.8/dev/transmission/4337/SmartContractAccountFactory.sol rename to contracts/src/v0.8/dev/transmission/ERC-4337/SmartContractAccountFactory.sol diff --git a/contracts/src/v0.8/dev/transmission/testhelpers/SmartContractAccountHelper.sol b/contracts/src/v0.8/dev/transmission/testhelpers/SmartContractAccountHelper.sol index d11d2b55de..108cd5477a 100644 --- a/contracts/src/v0.8/dev/transmission/testhelpers/SmartContractAccountHelper.sol +++ b/contracts/src/v0.8/dev/transmission/testhelpers/SmartContractAccountHelper.sol @@ -1,6 +1,6 @@ -import "../4337/SCA.sol"; -import "../4337/SmartContractAccountFactory.sol"; -import "../4337/SCALibrary.sol"; +import "../ERC-4337/SCA.sol"; +import "../ERC-4337/SmartContractAccountFactory.sol"; +import "../ERC-4337/SCALibrary.sol"; pragma solidity ^0.8.15; diff --git a/contracts/src/v0.8/functions/dev/0_0_0/Functions.sol b/contracts/src/v0.8/functions/dev/v0_0_0/Functions.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/Functions.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/Functions.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/FunctionsBillingRegistry.sol b/contracts/src/v0.8/functions/dev/v0_0_0/FunctionsBillingRegistry.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/FunctionsBillingRegistry.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/FunctionsBillingRegistry.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/FunctionsClient.sol b/contracts/src/v0.8/functions/dev/v0_0_0/FunctionsClient.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/FunctionsClient.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/FunctionsClient.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/FunctionsOracle.sol b/contracts/src/v0.8/functions/dev/v0_0_0/FunctionsOracle.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/FunctionsOracle.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/FunctionsOracle.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/accessControl/AuthorizedOriginReceiver.sol b/contracts/src/v0.8/functions/dev/v0_0_0/accessControl/AuthorizedOriginReceiver.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/accessControl/AuthorizedOriginReceiver.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/accessControl/AuthorizedOriginReceiver.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/accessControl/AuthorizedOriginReceiverUpgradeable.sol b/contracts/src/v0.8/functions/dev/v0_0_0/accessControl/AuthorizedOriginReceiverUpgradeable.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/accessControl/AuthorizedOriginReceiverUpgradeable.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/accessControl/AuthorizedOriginReceiverUpgradeable.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/accessControl/AuthorizedReceiver.sol b/contracts/src/v0.8/functions/dev/v0_0_0/accessControl/AuthorizedReceiver.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/accessControl/AuthorizedReceiver.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/accessControl/AuthorizedReceiver.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/accessControl/ConfirmedOwnerUpgradeable.sol b/contracts/src/v0.8/functions/dev/v0_0_0/accessControl/ConfirmedOwnerUpgradeable.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/accessControl/ConfirmedOwnerUpgradeable.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/accessControl/ConfirmedOwnerUpgradeable.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/accessControl/interfaces/IAuthorizedOriginReceiver.sol b/contracts/src/v0.8/functions/dev/v0_0_0/accessControl/interfaces/IAuthorizedOriginReceiver.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/accessControl/interfaces/IAuthorizedOriginReceiver.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/accessControl/interfaces/IAuthorizedOriginReceiver.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/accessControl/interfaces/IAuthorizedReceiver.sol b/contracts/src/v0.8/functions/dev/v0_0_0/accessControl/interfaces/IAuthorizedReceiver.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/accessControl/interfaces/IAuthorizedReceiver.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/accessControl/interfaces/IAuthorizedReceiver.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/example/FunctionsClientExample.sol b/contracts/src/v0.8/functions/dev/v0_0_0/example/FunctionsClientExample.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/example/FunctionsClientExample.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/example/FunctionsClientExample.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/interfaces/IFunctionsBillingRegistry.sol b/contracts/src/v0.8/functions/dev/v0_0_0/interfaces/IFunctionsBillingRegistry.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/interfaces/IFunctionsBillingRegistry.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/interfaces/IFunctionsBillingRegistry.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/interfaces/IFunctionsClient.sol b/contracts/src/v0.8/functions/dev/v0_0_0/interfaces/IFunctionsClient.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/interfaces/IFunctionsClient.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/interfaces/IFunctionsClient.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/interfaces/IFunctionsOracle.sol b/contracts/src/v0.8/functions/dev/v0_0_0/interfaces/IFunctionsOracle.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/interfaces/IFunctionsOracle.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/interfaces/IFunctionsOracle.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/ocr/OCR2Abstract.sol b/contracts/src/v0.8/functions/dev/v0_0_0/ocr/OCR2Abstract.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/ocr/OCR2Abstract.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/ocr/OCR2Abstract.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/dev/v0_0_0/ocr/OCR2Base.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/ocr/OCR2Base.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/ocr/OCR2Base.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/ocr/OCR2BaseUpgradeable.sol b/contracts/src/v0.8/functions/dev/v0_0_0/ocr/OCR2BaseUpgradeable.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/ocr/OCR2BaseUpgradeable.sol rename to contracts/src/v0.8/functions/dev/v0_0_0/ocr/OCR2BaseUpgradeable.sol diff --git a/contracts/src/v0.8/functions/dev/0_0_0/ocr/README.md b/contracts/src/v0.8/functions/dev/v0_0_0/ocr/README.md similarity index 100% rename from contracts/src/v0.8/functions/dev/0_0_0/ocr/README.md rename to contracts/src/v0.8/functions/dev/v0_0_0/ocr/README.md diff --git a/contracts/src/v0.8/functions/dev/1_0_0/FunctionsBilling.sol b/contracts/src/v0.8/functions/dev/v1_0_0/FunctionsBilling.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/FunctionsBilling.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/FunctionsBilling.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/FunctionsClient.sol b/contracts/src/v0.8/functions/dev/v1_0_0/FunctionsClient.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/FunctionsClient.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/FunctionsClient.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/FunctionsCoordinator.sol b/contracts/src/v0.8/functions/dev/v1_0_0/FunctionsCoordinator.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/FunctionsCoordinator.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/FunctionsCoordinator.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/FunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_0_0/FunctionsRouter.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/FunctionsRouter.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/FunctionsRouter.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/FunctionsSubscriptions.sol b/contracts/src/v0.8/functions/dev/v1_0_0/FunctionsSubscriptions.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/FunctionsSubscriptions.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/FunctionsSubscriptions.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/Routable.sol b/contracts/src/v0.8/functions/dev/v1_0_0/Routable.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/Routable.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/Routable.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/accessControl/TermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/dev/v1_0_0/accessControl/TermsOfServiceAllowList.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/accessControl/TermsOfServiceAllowList.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/accessControl/TermsOfServiceAllowList.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol b/contracts/src/v0.8/functions/dev/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/example/FunctionsClientExample.sol b/contracts/src/v0.8/functions/dev/v1_0_0/example/FunctionsClientExample.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/example/FunctionsClientExample.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/example/FunctionsClientExample.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsBilling.sol b/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsBilling.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsBilling.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsBilling.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsClient.sol b/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsClient.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsClient.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsClient.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsCoordinator.sol b/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsCoordinator.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsCoordinator.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsCoordinator.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsRouter.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsRouter.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsRouter.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsSubscriptions.sol b/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsSubscriptions.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/interfaces/IFunctionsSubscriptions.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IFunctionsSubscriptions.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/interfaces/IOwnableFunctionsRouter.sol b/contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IOwnableFunctionsRouter.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/interfaces/IOwnableFunctionsRouter.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/interfaces/IOwnableFunctionsRouter.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/libraries/FunctionsRequest.sol b/contracts/src/v0.8/functions/dev/v1_0_0/libraries/FunctionsRequest.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/libraries/FunctionsRequest.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/libraries/FunctionsRequest.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/libraries/FunctionsResponse.sol b/contracts/src/v0.8/functions/dev/v1_0_0/libraries/FunctionsResponse.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/libraries/FunctionsResponse.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/libraries/FunctionsResponse.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/mocks/FunctionsV1EventsMock.sol b/contracts/src/v0.8/functions/dev/v1_0_0/mocks/FunctionsV1EventsMock.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/mocks/FunctionsV1EventsMock.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/mocks/FunctionsV1EventsMock.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/ocr/OCR2Abstract.sol b/contracts/src/v0.8/functions/dev/v1_0_0/ocr/OCR2Abstract.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/ocr/OCR2Abstract.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/ocr/OCR2Abstract.sol diff --git a/contracts/src/v0.8/functions/dev/1_0_0/ocr/OCR2Base.sol b/contracts/src/v0.8/functions/dev/v1_0_0/ocr/OCR2Base.sol similarity index 100% rename from contracts/src/v0.8/functions/dev/1_0_0/ocr/OCR2Base.sol rename to contracts/src/v0.8/functions/dev/v1_0_0/ocr/OCR2Base.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/BaseTest.t.sol b/contracts/src/v0.8/functions/tests/v0_0_0/BaseTest.t.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/BaseTest.t.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/BaseTest.t.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/FunctionsOracle.t.sol b/contracts/src/v0.8/functions/tests/v0_0_0/FunctionsOracle.t.sol similarity index 97% rename from contracts/src/v0.8/functions/tests/0_0_0/FunctionsOracle.t.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/FunctionsOracle.t.sol index cf1880d851..ab175c3c45 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/FunctionsOracle.t.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/FunctionsOracle.t.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.6; import {BaseTest} from "./BaseTest.t.sol"; import {FunctionsOracle, FunctionsOracleWithInit} from "./testhelpers/FunctionsOracleWithInit.sol"; import {FunctionsBillingRegistryWithInit} from "./testhelpers/FunctionsBillingRegistryWithInit.sol"; -import {ConfirmedOwnerUpgradeable} from "../../dev/0_0_0/accessControl/ConfirmedOwnerUpgradeable.sol"; +import {ConfirmedOwnerUpgradeable} from "../../dev/v0_0_0/accessControl/ConfirmedOwnerUpgradeable.sol"; // import {LinkToken} from "../../../../src/v0.4/LinkToken.sol"; // import {MockV3Aggregator} from "../../../../src/v0.7/tests/MockV3Aggregator.sol"; diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol similarity index 87% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol index 6411a08631..0c592ae81c 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "../../../dev/0_0_0/accessControl/AuthorizedOriginReceiver.sol"; +import "../../../dev/v0_0_0/accessControl/AuthorizedOriginReceiver.sol"; contract AuthorizedOriginReceiverTestHelper is AuthorizedOriginReceiver { bool private s_canSetAuthorizedSenders = true; diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol similarity index 88% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol index f5b881b38b..ee541013f4 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; -import "../../../dev/0_0_0/accessControl/AuthorizedReceiver.sol"; +import "../../../dev/v0_0_0/accessControl/AuthorizedReceiver.sol"; contract AuthorizedReceiverTestHelper is AuthorizedReceiver { bool private s_canSetAuthorizedSenders = true; diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol similarity index 72% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol index ffbc0ae703..0ace817fa5 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsBillingRegistry} from "../../../dev/0_0_0/FunctionsBillingRegistry.sol"; +import {FunctionsBillingRegistry} from "../../../dev/v0_0_0/FunctionsBillingRegistry.sol"; contract FunctionsBillingRegistryWithInit is FunctionsBillingRegistry { constructor(address link, address linkEthFeed, address oracle) { diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol similarity index 95% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol index 78c1107a0b..89366510da 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsClient, Functions} from "../../../dev/0_0_0/FunctionsClient.sol"; +import {FunctionsClient, Functions} from "../../../dev/v0_0_0/FunctionsClient.sol"; contract FunctionsClientTestHelper is FunctionsClient { using Functions for Functions.Request; diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleMigrationHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleMigrationHelper.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleMigrationHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleMigrationHelper.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleOriginalHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleOriginalHelper.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleOriginalHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleOriginalHelper.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol similarity index 91% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol index 66404faedf..d11d22372d 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsOracle} from "../../../dev/0_0_0/FunctionsOracle.sol"; +import {FunctionsOracle} from "../../../dev/v0_0_0/FunctionsOracle.sol"; contract FunctionsOracleUpgradeableHelper is FunctionsOracle { function callValidateReport(bytes calldata report) external pure returns (bool isValid) { diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleWithInit.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleWithInit.sol similarity index 67% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleWithInit.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleWithInit.sol index 1ef0107de8..c5b913e9e9 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleWithInit.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleWithInit.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsOracle} from "../../../dev/0_0_0/FunctionsOracle.sol"; +import {FunctionsOracle} from "../../../dev/v0_0_0/FunctionsOracle.sol"; contract FunctionsOracleWithInit is FunctionsOracle { constructor() { diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsTestHelper.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsTestHelper.sol similarity index 95% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsTestHelper.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsTestHelper.sol index c4ba893bd1..5c942936d4 100644 --- a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsTestHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {Functions} from "../../../dev/0_0_0/Functions.sol"; +import {Functions} from "../../../dev/v0_0_0/Functions.sol"; contract FunctionsTestHelper { using Functions for Functions.Request; diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedOriginReceiverInterface.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedOriginReceiverInterface.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedOriginReceiverInterface.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedOriginReceiverInterface.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedOriginReceiverUpgradeable.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedOriginReceiverUpgradeable.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedOriginReceiverUpgradeable.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedOriginReceiverUpgradeable.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedReceiver.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedReceiver.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedReceiver.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedReceiver.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedReceiverInterface.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedReceiverInterface.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/AuthorizedReceiverInterface.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/AuthorizedReceiverInterface.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/ConfirmedOwnerUpgradeable.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/ConfirmedOwnerUpgradeable.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/ConfirmedOwnerUpgradeable.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/ConfirmedOwnerUpgradeable.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryInterface.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryInterface.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryInterface.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryInterface.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryMigration.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryMigration.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryMigration.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryMigration.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsClientInterface.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsClientInterface.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsClientInterface.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsClientInterface.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsOracleInterface.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsOracleInterface.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsOracleInterface.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsOracleInterface.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsOracleMigration.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsOracleMigration.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsOracleMigration.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsOracleMigration.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsOracleOriginal.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsOracleOriginal.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsOracleOriginal.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsOracleOriginal.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/OCR2Abstract.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/OCR2Abstract.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/OCR2Abstract.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/OCR2Abstract.sol diff --git a/contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/OCR2BaseUpgradeable.sol b/contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/OCR2BaseUpgradeable.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/0_0_0/testhelpers/mocks/OCR2BaseUpgradeable.sol rename to contracts/src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/OCR2BaseUpgradeable.sol diff --git a/contracts/src/v0.8/functions/tests/1_0_0/BaseTest.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/BaseTest.t.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/1_0_0/BaseTest.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/BaseTest.t.sol diff --git a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsClient.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsClient.t.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/1_0_0/FunctionsClient.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/FunctionsClient.t.sol diff --git a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsCoordinator.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsCoordinator.t.sol similarity index 96% rename from contracts/src/v0.8/functions/tests/1_0_0/FunctionsCoordinator.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/FunctionsCoordinator.t.sol index cf3a86cce4..2773baa47a 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsCoordinator.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsCoordinator.t.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsCoordinator} from "../../dev/1_0_0/FunctionsCoordinator.sol"; -import {FunctionsBilling} from "../../dev/1_0_0/FunctionsBilling.sol"; -import {FunctionsRequest} from "../../dev/1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsCoordinator} from "../../dev/v1_0_0/FunctionsCoordinator.sol"; +import {FunctionsBilling} from "../../dev/v1_0_0/FunctionsBilling.sol"; +import {FunctionsRequest} from "../../dev/v1_0_0/libraries/FunctionsRequest.sol"; import {FunctionsSubscriptionSetup, FunctionsMultipleFulfillmentsSetup} from "./Setup.t.sol"; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsRequest.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsRequest.t.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/1_0_0/FunctionsRequest.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/FunctionsRequest.t.sol diff --git a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsRouter.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsRouter.t.sol similarity index 99% rename from contracts/src/v0.8/functions/tests/1_0_0/FunctionsRouter.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/FunctionsRouter.t.sol index 4d6e5a1fe0..e4bf442ec1 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsRouter.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsRouter.t.sol @@ -1,12 +1,12 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsRouter} from "../../dev/1_0_0/FunctionsRouter.sol"; -import {FunctionsSubscriptions} from "../../dev/1_0_0/FunctionsSubscriptions.sol"; -import {FunctionsCoordinator} from "../../dev/1_0_0/FunctionsCoordinator.sol"; -import {FunctionsBilling} from "../../dev/1_0_0/FunctionsBilling.sol"; -import {FunctionsRequest} from "../../dev/1_0_0/libraries/FunctionsRequest.sol"; -import {FunctionsResponse} from "../../dev/1_0_0/libraries/FunctionsResponse.sol"; +import {FunctionsRouter} from "../../dev/v1_0_0/FunctionsRouter.sol"; +import {FunctionsSubscriptions} from "../../dev/v1_0_0/FunctionsSubscriptions.sol"; +import {FunctionsCoordinator} from "../../dev/v1_0_0/FunctionsCoordinator.sol"; +import {FunctionsBilling} from "../../dev/v1_0_0/FunctionsBilling.sol"; +import {FunctionsRequest} from "../../dev/v1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsResponse} from "../../dev/v1_0_0/libraries/FunctionsResponse.sol"; import {FunctionsCoordinatorTestHelper} from "./testhelpers/FunctionsCoordinatorTestHelper.sol"; import {FunctionsClientTestHelper} from "./testhelpers/FunctionsClientTestHelper.sol"; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsSubscriptions.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsSubscriptions.t.sol similarity index 99% rename from contracts/src/v0.8/functions/tests/1_0_0/FunctionsSubscriptions.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/FunctionsSubscriptions.t.sol index 928ede95bf..26dd7af20f 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsSubscriptions.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsSubscriptions.t.sol @@ -2,9 +2,9 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {FunctionsRouter} from "../../dev/1_0_0/FunctionsRouter.sol"; -import {FunctionsSubscriptions} from "../../dev/1_0_0/FunctionsSubscriptions.sol"; -import {FunctionsResponse} from "../../dev/1_0_0/libraries/FunctionsResponse.sol"; +import {FunctionsRouter} from "../../dev/v1_0_0/FunctionsRouter.sol"; +import {FunctionsSubscriptions} from "../../dev/v1_0_0/FunctionsSubscriptions.sol"; +import {FunctionsResponse} from "../../dev/v1_0_0/libraries/FunctionsResponse.sol"; import {IERC20} from "../../../vendor/openzeppelin-solidity/v4.8.0/contracts/token/ERC20/IERC20.sol"; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsTermsOfServiceAllowList.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsTermsOfServiceAllowList.t.sol similarity index 99% rename from contracts/src/v0.8/functions/tests/1_0_0/FunctionsTermsOfServiceAllowList.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/FunctionsTermsOfServiceAllowList.t.sol index d4a18e207b..d8f03ba3eb 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/FunctionsTermsOfServiceAllowList.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/FunctionsTermsOfServiceAllowList.t.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {TermsOfServiceAllowList} from "../../dev/1_0_0/accessControl/TermsOfServiceAllowList.sol"; +import {TermsOfServiceAllowList} from "../../dev/v1_0_0/accessControl/TermsOfServiceAllowList.sol"; import {FunctionsClientTestHelper} from "./testhelpers/FunctionsClientTestHelper.sol"; import {FunctionsRoutesSetup, FunctionsOwnerAcceptTermsOfServiceSetup} from "./Setup.t.sol"; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/OCR2.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/OCR2.t.sol similarity index 100% rename from contracts/src/v0.8/functions/tests/1_0_0/OCR2.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/OCR2.t.sol diff --git a/contracts/src/v0.8/functions/tests/1_0_0/README.md b/contracts/src/v0.8/functions/tests/v1_0_0/README.md similarity index 84% rename from contracts/src/v0.8/functions/tests/1_0_0/README.md rename to contracts/src/v0.8/functions/tests/v1_0_0/README.md index bbbf33dbe9..42aa6ed2b7 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/README.md +++ b/contracts/src/v0.8/functions/tests/v1_0_0/README.md @@ -12,7 +12,7 @@ forge test -vv To run a specific file use: ``` -forge test -vv --mp src/v0.8/functions/tests/1_0_0/[File Name].t.sol +forge test -vv --mp src/v0.8/functions/tests/v1_0_0/[File Name].t.sol ``` To see coverage: diff --git a/contracts/src/v0.8/functions/tests/1_0_0/Setup.t.sol b/contracts/src/v0.8/functions/tests/v1_0_0/Setup.t.sol similarity index 97% rename from contracts/src/v0.8/functions/tests/1_0_0/Setup.t.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/Setup.t.sol index 7a911c3bd6..1578834499 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/Setup.t.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/Setup.t.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.19; import {BaseTest} from "./BaseTest.t.sol"; -import {FunctionsRouter} from "../../dev/1_0_0/FunctionsRouter.sol"; +import {FunctionsRouter} from "../../dev/v1_0_0/FunctionsRouter.sol"; import {FunctionsCoordinatorTestHelper} from "./testhelpers/FunctionsCoordinatorTestHelper.sol"; -import {FunctionsBilling} from "../../dev/1_0_0/FunctionsBilling.sol"; -import {FunctionsResponse} from "../../dev/1_0_0/libraries/FunctionsResponse.sol"; +import {FunctionsBilling} from "../../dev/v1_0_0/FunctionsBilling.sol"; +import {FunctionsResponse} from "../../dev/v1_0_0/libraries/FunctionsResponse.sol"; import {MockV3Aggregator} from "../../../tests/MockV3Aggregator.sol"; -import {TermsOfServiceAllowList} from "../../dev/1_0_0/accessControl/TermsOfServiceAllowList.sol"; +import {TermsOfServiceAllowList} from "../../dev/v1_0_0/accessControl/TermsOfServiceAllowList.sol"; import {FunctionsClientUpgradeHelper} from "./testhelpers/FunctionsClientUpgradeHelper.sol"; import {MockLinkToken} from "../../../mocks/MockLinkToken.sol"; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientTestHelper.sol b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientTestHelper.sol similarity index 90% rename from contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientTestHelper.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientTestHelper.sol index 92255e0b57..987bf3e48a 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientTestHelper.sol @@ -1,11 +1,11 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {ITermsOfServiceAllowList} from "../../../dev/1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol"; -import {IFunctionsSubscriptions} from "../../../dev/1_0_0/interfaces/IFunctionsSubscriptions.sol"; +import {ITermsOfServiceAllowList} from "../../../dev/v1_0_0/accessControl/interfaces/ITermsOfServiceAllowList.sol"; +import {IFunctionsSubscriptions} from "../../../dev/v1_0_0/interfaces/IFunctionsSubscriptions.sol"; -import {FunctionsRequest} from "../../../dev/1_0_0/libraries/FunctionsRequest.sol"; -import {FunctionsClient} from "../../../dev/1_0_0/FunctionsClient.sol"; +import {FunctionsRequest} from "../../../dev/v1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsClient} from "../../../dev/v1_0_0/FunctionsClient.sol"; contract FunctionsClientTestHelper is FunctionsClient { using FunctionsRequest for FunctionsRequest.Request; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientUpgradeHelper.sol b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientUpgradeHelper.sol similarity index 97% rename from contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientUpgradeHelper.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientUpgradeHelper.sol index 816ec27e06..e04ead8ad8 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientUpgradeHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientUpgradeHelper.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsRequest} from "../../../dev/1_0_0/libraries/FunctionsRequest.sol"; -import {FunctionsClient} from "../../../dev/1_0_0/FunctionsClient.sol"; +import {FunctionsRequest} from "../../../dev/v1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsClient} from "../../../dev/v1_0_0/FunctionsClient.sol"; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; contract FunctionsClientUpgradeHelper is FunctionsClient, ConfirmedOwner { diff --git a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol similarity index 87% rename from contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol index 4878290b6e..5feede895f 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsRequest} from "../../../dev/1_0_0/libraries/FunctionsRequest.sol"; -import {FunctionsClient} from "../../../dev/1_0_0/FunctionsClient.sol"; +import {FunctionsRequest} from "../../../dev/v1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsClient} from "../../../dev/v1_0_0/FunctionsClient.sol"; contract FunctionsClientWithEmptyCallback is FunctionsClient { using FunctionsRequest for FunctionsRequest.Request; diff --git a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol similarity index 85% rename from contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol index c612f47644..bf55258fbd 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol @@ -1,8 +1,8 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsCoordinator} from "../../../dev/1_0_0/FunctionsCoordinator.sol"; -import {FunctionsBilling} from "../../../dev/1_0_0/FunctionsBilling.sol"; +import {FunctionsCoordinator} from "../../../dev/v1_0_0/FunctionsCoordinator.sol"; +import {FunctionsBilling} from "../../../dev/v1_0_0/FunctionsBilling.sol"; contract FunctionsCoordinatorTestHelper is FunctionsCoordinator { constructor( diff --git a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsLoadTestClient.sol b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsLoadTestClient.sol similarity index 96% rename from contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsLoadTestClient.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsLoadTestClient.sol index 7327dc26f7..c31962ba1f 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsLoadTestClient.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsLoadTestClient.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.19; -import {FunctionsClient} from "../../../dev/1_0_0/FunctionsClient.sol"; +import {FunctionsClient} from "../../../dev/v1_0_0/FunctionsClient.sol"; import {ConfirmedOwner} from "../../../../shared/access/ConfirmedOwner.sol"; -import {FunctionsRequest} from "../../../dev/1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsRequest} from "../../../dev/v1_0_0/libraries/FunctionsRequest.sol"; /** * @title Chainlink Functions load test client implementation diff --git a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsTestHelper.sol b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsTestHelper.sol similarity index 94% rename from contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsTestHelper.sol rename to contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsTestHelper.sol index 73f10071db..9ab5386dda 100644 --- a/contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsTestHelper.sol +++ b/contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsTestHelper.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.6; -import {FunctionsRequest} from "../../../dev/1_0_0/libraries/FunctionsRequest.sol"; +import {FunctionsRequest} from "../../../dev/v1_0_0/libraries/FunctionsRequest.sol"; contract FunctionsTestHelper { using FunctionsRequest for FunctionsRequest.Request; diff --git a/contracts/src/v0.8/functions/1_0_0/.gitkeep b/contracts/src/v0.8/functions/v1_0_0/.gitkeep similarity index 100% rename from contracts/src/v0.8/functions/1_0_0/.gitkeep rename to contracts/src/v0.8/functions/v1_0_0/.gitkeep diff --git a/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainForwarder.sol b/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainForwarder.sol index 0eac2e12af..1d7c211bba 100644 --- a/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainForwarder.sol +++ b/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainForwarder.sol @@ -5,7 +5,7 @@ import "../../../interfaces/TypeAndVersionInterface.sol"; /* ./dev dependencies - to be moved from ./dev after audit */ import "../CrossDomainForwarder.sol"; -import "../../../vendor/@eth-optimism/contracts/0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; +import "../../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; import "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; /** diff --git a/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainGovernor.sol b/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainGovernor.sol index a7fe176c3f..bd1b0b9e88 100644 --- a/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainGovernor.sol +++ b/contracts/src/v0.8/l2ep/dev/optimism/OptimismCrossDomainGovernor.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import "../interfaces/DelegateForwarderInterface.sol"; -import "../../../vendor/@eth-optimism/contracts/0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; +import "../../../vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol"; import "../../../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/Address.sol"; import "./OptimismCrossDomainForwarder.sol"; diff --git a/contracts/src/v0.8/tests/VerifiableLoadBase.sol b/contracts/src/v0.8/tests/VerifiableLoadBase.sol index 69ebb90cc2..1b51ed303a 100644 --- a/contracts/src/v0.8/tests/VerifiableLoadBase.sol +++ b/contracts/src/v0.8/tests/VerifiableLoadBase.sol @@ -2,10 +2,10 @@ pragma solidity ^0.8.16; import "../vendor/openzeppelin-solidity/v4.7.3/contracts/utils/structs/EnumerableSet.sol"; -import "../automation/interfaces/2_1/IKeeperRegistryMaster.sol"; +import "../automation/interfaces/v2_1/IKeeperRegistryMaster.sol"; import {ArbSys} from "../vendor/@arbitrum/nitro-contracts/src/precompiles/ArbSys.sol"; -import "../automation/2_1/AutomationRegistrar2_1.sol"; -import {LogTriggerConfig} from "../automation/2_1/AutomationUtils2_1.sol"; +import "../automation/v2_1/AutomationRegistrar2_1.sol"; +import {LogTriggerConfig} from "../automation/v2_1/AutomationUtils2_1.sol"; abstract contract VerifiableLoadBase is ConfirmedOwner { error IndexOutOfRange(); diff --git a/contracts/src/v0.8/vendor/@eth-optimism/contracts/0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol b/contracts/src/v0.8/vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol similarity index 100% rename from contracts/src/v0.8/vendor/@eth-optimism/contracts/0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol rename to contracts/src/v0.8/vendor/@eth-optimism/contracts/v0.4.7/contracts/optimistic-ethereum/iOVM/bridge/messaging/iOVM_CrossDomainMessenger.sol diff --git a/contracts/src/v0.8/vendor/@eth-optimism/contracts/0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol b/contracts/src/v0.8/vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol similarity index 100% rename from contracts/src/v0.8/vendor/@eth-optimism/contracts/0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol rename to contracts/src/v0.8/vendor/@eth-optimism/contracts/v0.8.6/contracts/L2/predeploys/OVM_GasPriceOracle.sol diff --git a/contracts/src/v0.8/vendor/@eth-optimism/contracts/0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol b/contracts/src/v0.8/vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol similarity index 100% rename from contracts/src/v0.8/vendor/@eth-optimism/contracts/0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol rename to contracts/src/v0.8/vendor/@eth-optimism/contracts/v0.8.9/contracts/L2/predeploys/OVM_GasPriceOracle.sol diff --git a/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts b/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts index b29b8add1c..bd4b24e54c 100644 --- a/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts +++ b/contracts/test/v0.8/automation/IKeeperRegistryMaster.test.ts @@ -87,7 +87,7 @@ describe('IKeeperRegistryMaster', () => { const checksum = ethers.utils.id(compositeABIs.join('')) const knownChecksum = fs .readFileSync( - 'src/v0.8/automation/interfaces/2_1/IKeeperRegistryMaster.sol', + 'src/v0.8/automation/interfaces/v2_1/IKeeperRegistryMaster.sol', ) .toString() .slice(17, 83) // checksum located at top of file diff --git a/contracts/test/v0.8/dev/AuthorizedOriginReceiver.test.ts b/contracts/test/v0.8/dev/AuthorizedOriginReceiver.test.ts index 007986810c..dc6406422d 100644 --- a/contracts/test/v0.8/dev/AuthorizedOriginReceiver.test.ts +++ b/contracts/test/v0.8/dev/AuthorizedOriginReceiver.test.ts @@ -10,7 +10,7 @@ before(async () => { roles = (await getUsers()).roles authorizedOriginReceiverFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol:AuthorizedOriginReceiverTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedOriginReceiverTestHelper.sol:AuthorizedOriginReceiverTestHelper', roles.defaultAccount, ) }) diff --git a/contracts/test/v0.8/dev/AuthorizedReceiver.test.ts b/contracts/test/v0.8/dev/AuthorizedReceiver.test.ts index 578c719200..ca9951e688 100644 --- a/contracts/test/v0.8/dev/AuthorizedReceiver.test.ts +++ b/contracts/test/v0.8/dev/AuthorizedReceiver.test.ts @@ -10,7 +10,7 @@ before(async () => { roles = (await getUsers()).roles authorizedReceiverFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol:AuthorizedReceiverTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/AuthorizedReceiverTestHelper.sol:AuthorizedReceiverTestHelper', roles.defaultAccount, ) }) diff --git a/contracts/test/v0.8/foundry/transmission/EIP_712_1014_4337.t.sol b/contracts/test/v0.8/foundry/transmission/EIP_712_1014_4337.t.sol index 3040fda97d..acdc677364 100644 --- a/contracts/test/v0.8/foundry/transmission/EIP_712_1014_4337.t.sol +++ b/contracts/test/v0.8/foundry/transmission/EIP_712_1014_4337.t.sol @@ -1,15 +1,15 @@ pragma solidity ^0.8.15; import "../BaseTest.t.sol"; -import "../../../../src/v0.8/dev/transmission/4337/SmartContractAccountFactory.sol"; +import "../../../../src/v0.8/dev/transmission/ERC-4337/SmartContractAccountFactory.sol"; import "../../../../src/v0.8/dev/transmission/testhelpers/SmartContractAccountHelper.sol"; -import "../../../../src/v0.8/dev/transmission/4337/SCA.sol"; +import "../../../../src/v0.8/dev/transmission/ERC-4337/SCA.sol"; import "../../../../src/v0.8/dev/transmission/testhelpers/Greeter.sol"; -import "../../../../src/v0.8/dev/transmission/4337/Paymaster.sol"; +import "../../../../src/v0.8/dev/transmission/ERC-4337/Paymaster.sol"; import "../../../../src/v0.8/vendor/entrypoint/interfaces/UserOperation.sol"; import "../../../../src/v0.8/vendor/entrypoint/core/EntryPoint.sol"; import "../../../../src/v0.8/vendor/entrypoint/interfaces/IEntryPoint.sol"; -import "../../../../src/v0.8/dev/transmission/4337/SCALibrary.sol"; +import "../../../../src/v0.8/dev/transmission/ERC-4337/SCALibrary.sol"; import "../../../../src/v0.8/mocks/MockLinkToken.sol"; import "../../../../src/v0.8/shared/interfaces/LinkTokenInterface.sol"; import "../../../../src/v0.8/mocks/VRFCoordinatorMock.sol"; diff --git a/contracts/test/v0.8/functions/v0/Functions.test.ts b/contracts/test/v0.8/functions/v0/Functions.test.ts index 0a4296c763..242e5d57aa 100644 --- a/contracts/test/v0.8/functions/v0/Functions.test.ts +++ b/contracts/test/v0.8/functions/v0/Functions.test.ts @@ -17,7 +17,7 @@ let roles: Roles before(async () => { roles = (await getUsers()).roles concreteFunctionsTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsTestHelper.sol:FunctionsTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsTestHelper.sol:FunctionsTestHelper', roles.defaultAccount, ) }) diff --git a/contracts/test/v0.8/functions/v0/FunctionsBillingRegistry.test.ts b/contracts/test/v0.8/functions/v0/FunctionsBillingRegistry.test.ts index b9110aea61..95160689d2 100644 --- a/contracts/test/v0.8/functions/v0/FunctionsBillingRegistry.test.ts +++ b/contracts/test/v0.8/functions/v0/FunctionsBillingRegistry.test.ts @@ -54,17 +54,17 @@ before(async () => { roles = (await getUsers()).roles functionsOracleFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', roles.defaultAccount, ) clientTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.consumer, ) functionsBillingRegistryFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', roles.consumer, ) diff --git a/contracts/test/v0.8/functions/v0/FunctionsBillingRegistryUpgradeable.test.ts b/contracts/test/v0.8/functions/v0/FunctionsBillingRegistryUpgradeable.test.ts index 04a7db0b2c..5de9986452 100644 --- a/contracts/test/v0.8/functions/v0/FunctionsBillingRegistryUpgradeable.test.ts +++ b/contracts/test/v0.8/functions/v0/FunctionsBillingRegistryUpgradeable.test.ts @@ -53,17 +53,17 @@ before(async () => { roles = (await getUsers()).roles functionsOracleFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', roles.defaultAccount, ) clientTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.consumer, ) functionsBillingRegistryFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol:FunctionsBillingRegistryOriginal', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryOriginal.sol:FunctionsBillingRegistryOriginal', roles.consumer, ) @@ -223,7 +223,7 @@ describe('FunctionsRegistryUpgradeable', () => { it('can be upgraded to a new implementation', async () => { const upgradedRegistry = await migrateAndCheck( - 'src/v0.8/functions/tests/0_0_0/testhelpers/mocks/FunctionsBillingRegistryMigration.sol:FunctionsBillingRegistryMigration', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/mocks/FunctionsBillingRegistryMigration.sol:FunctionsBillingRegistryMigration', ) // Check that upgrade was successful @@ -242,7 +242,7 @@ describe('FunctionsRegistryUpgradeable', () => { it('can be upgraded to the latest implementation', async () => { await migrateAndCheck( - 'src/v0.8/functions/dev/0_0_0/FunctionsBillingRegistry.sol:FunctionsBillingRegistry', + 'src/v0.8/functions/dev/v0_0_0/FunctionsBillingRegistry.sol:FunctionsBillingRegistry', ) }) }) diff --git a/contracts/test/v0.8/functions/v0/FunctionsClient.test.ts b/contracts/test/v0.8/functions/v0/FunctionsClient.test.ts index 4a474aadef..94b06d8b37 100644 --- a/contracts/test/v0.8/functions/v0/FunctionsClient.test.ts +++ b/contracts/test/v0.8/functions/v0/FunctionsClient.test.ts @@ -34,16 +34,16 @@ before(async () => { roles = (await getUsers()).roles concreteFunctionsClientFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.defaultAccount, ) functionsOracleFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', roles.defaultAccount, ) functionsBillingRegistryFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', roles.defaultAccount, ) diff --git a/contracts/test/v0.8/functions/v0/FunctionsOracle.test.ts b/contracts/test/v0.8/functions/v0/FunctionsOracle.test.ts index 921c60bfc8..397cc3b397 100644 --- a/contracts/test/v0.8/functions/v0/FunctionsOracle.test.ts +++ b/contracts/test/v0.8/functions/v0/FunctionsOracle.test.ts @@ -28,17 +28,17 @@ before(async () => { roles = (await getUsers()).roles functionsOracleFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', roles.defaultAccount, ) clientTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.consumer, ) functionsBillingRegistryFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', roles.defaultAccount, ) diff --git a/contracts/test/v0.8/functions/v0/FunctionsOracleUpgradeable.test.ts b/contracts/test/v0.8/functions/v0/FunctionsOracleUpgradeable.test.ts index f127692373..fe2dfdc9c3 100644 --- a/contracts/test/v0.8/functions/v0/FunctionsOracleUpgradeable.test.ts +++ b/contracts/test/v0.8/functions/v0/FunctionsOracleUpgradeable.test.ts @@ -44,17 +44,17 @@ before(async () => { roles = (await getUsers()).roles functionsOracleOriginalFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleOriginalHelper.sol:FunctionsOracleOriginalHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleOriginalHelper.sol:FunctionsOracleOriginalHelper', roles.defaultAccount, ) clientTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.consumer, ) functionsBillingRegistryFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', roles.defaultAccount, ) @@ -221,7 +221,7 @@ describe('FunctionsOracleUpgradeable', () => { it('can be upgraded to a new implementation', async () => { const upgradedOracle = await migrateAndCheck( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleMigrationHelper.sol:FunctionsOracleMigrationHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleMigrationHelper.sol:FunctionsOracleMigrationHelper', ) // Check that upgrade was successful @@ -240,7 +240,7 @@ describe('FunctionsOracleUpgradeable', () => { it('can be upgraded to the latest implementation', async () => { await migrateAndCheck( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol:FunctionsOracleUpgradeableHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleUpgradeableHelper.sol:FunctionsOracleUpgradeableHelper', ) }) }) diff --git a/contracts/test/v0.8/functions/v0/Gas.test.ts b/contracts/test/v0.8/functions/v0/Gas.test.ts index c84e017972..affa8052b9 100644 --- a/contracts/test/v0.8/functions/v0/Gas.test.ts +++ b/contracts/test/v0.8/functions/v0/Gas.test.ts @@ -28,16 +28,16 @@ before(async () => { roles = (await getUsers()).roles concreteFunctionsClientFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.defaultAccount, ) functionsOracleFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsOracleHelper.sol:FunctionsOracleHelper', roles.defaultAccount, ) functionsBillingRegistryFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', + 'src/v0.8/functions/tests/v0_0_0/testhelpers/FunctionsBillingRegistryWithInit.sol:FunctionsBillingRegistryWithInit', roles.defaultAccount, ) diff --git a/contracts/test/v0.8/functions/v1/Functions.test.ts b/contracts/test/v0.8/functions/v1/Functions.test.ts index 981b322707..4de281c0b7 100644 --- a/contracts/test/v0.8/functions/v1/Functions.test.ts +++ b/contracts/test/v0.8/functions/v1/Functions.test.ts @@ -17,7 +17,7 @@ let roles: Roles before(async () => { roles = (await getUsers()).roles concreteFunctionsTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsTestHelper.sol:FunctionsTestHelper', + 'src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsTestHelper.sol:FunctionsTestHelper', roles.defaultAccount, ) }) diff --git a/contracts/test/v0.8/functions/v1/FunctionsClient.test.ts b/contracts/test/v0.8/functions/v1/FunctionsClient.test.ts index ccb059a5a3..dad78769b7 100644 --- a/contracts/test/v0.8/functions/v1/FunctionsClient.test.ts +++ b/contracts/test/v0.8/functions/v1/FunctionsClient.test.ts @@ -178,7 +178,7 @@ describe('Faulty Functions Client', () => { it('can complete requests with an empty callback', async () => { const clientWithEmptyCallbackTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol:FunctionsClientWithEmptyCallback', + 'src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientWithEmptyCallback.sol:FunctionsClientWithEmptyCallback', roles.consumer, ) diff --git a/contracts/test/v0.8/functions/v1/utils.ts b/contracts/test/v0.8/functions/v1/utils.ts index 0973a5cd84..98f6143dee 100644 --- a/contracts/test/v0.8/functions/v1/utils.ts +++ b/contracts/test/v0.8/functions/v1/utils.ts @@ -52,7 +52,7 @@ export const encodeReport = async ( offchainMetadata: string, ) => { const functionsResponse = await ethers.getContractFactory( - 'src/v0.8/functions/dev/1_0_0/FunctionsCoordinator.sol:FunctionsCoordinator', + 'src/v0.8/functions/dev/v1_0_0/FunctionsCoordinator.sol:FunctionsCoordinator', ) const onchainMetadataBytes = functionsResponse.interface._abiCoder.encode( [ @@ -130,19 +130,19 @@ export async function setupRolesAndFactories(): Promise<{ }> { const roles = (await getUsers()).roles const functionsRouterFactory = await ethers.getContractFactory( - 'src/v0.8/functions/dev/1_0_0/FunctionsRouter.sol:FunctionsRouter', + 'src/v0.8/functions/dev/v1_0_0/FunctionsRouter.sol:FunctionsRouter', roles.defaultAccount, ) const functionsCoordinatorFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol:FunctionsCoordinatorTestHelper', + 'src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsCoordinatorTestHelper.sol:FunctionsCoordinatorTestHelper', roles.defaultAccount, ) const accessControlFactory = await ethers.getContractFactory( - 'src/v0.8/functions/dev/1_0_0/accessControl/TermsOfServiceAllowList.sol:TermsOfServiceAllowList', + 'src/v0.8/functions/dev/v1_0_0/accessControl/TermsOfServiceAllowList.sol:TermsOfServiceAllowList', roles.defaultAccount, ) const clientTestHelperFactory = await ethers.getContractFactory( - 'src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', + 'src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsClientTestHelper.sol:FunctionsClientTestHelper', roles.consumer, ) const linkTokenFactory = await ethers.getContractFactory( diff --git a/core/gethwrappers/functions/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/functions/generation/generated-wrapper-dependency-versions-do-not-edit.txt index 07a431d993..6b77b889e3 100644 --- a/core/gethwrappers/functions/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ b/core/gethwrappers/functions/generation/generated-wrapper-dependency-versions-do-not-edit.txt @@ -1,16 +1,16 @@ GETH_VERSION: 1.12.0 -functions: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRequest.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRequest.bin 3c972870b0afeb6d73a29ebb182f24956a2cebb127b21c4f867d1ecf19a762db -functions_allow_list: ../../../contracts/solc/v0.8.19/functions/1_0_0/TermsOfServiceAllowList.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/TermsOfServiceAllowList.bin b2697ad4dfece903a1d34028826a017fa445eb3cd984006f1734fa9d47836ca0 -functions_billing_registry_events_mock: ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistryEventsMock.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistryEventsMock.bin 50deeb883bd9c3729702be335c0388f9d8553bab4be5e26ecacac496a89e2b77 -functions_client: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClient.bin 2368f537a04489c720a46733f8596c4fc88a31062ecfa966d05f25dd98608aca -functions_client_example: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClientExample.bin abf32e69f268f40e8530eb8d8e96bf310b798a4c0049a58022d9d2fb527b601b -functions_coordinator: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsCoordinator.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsCoordinator.bin 21bd322caf977c4802d2c17419b57487cca438c7c5fafc52a9a9e1c9f4a72289 -functions_load_test_client: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsLoadTestClient.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsLoadTestClient.bin c8dbbd5ebb34435800d6674700068837c3a252db60046a14b0e61e829db517de -functions_oracle_events_mock: ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracleEventsMock.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracleEventsMock.bin 3ca70f966f8fe751987f0ccb50bebb6aa5be77e4a9f835d1ae99e0e9bfb7d52c -functions_router: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRouter.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRouter.bin 9dedd3a36043605fd9bedf821e7ec5b4281a5c7ae2e4a1955f37aff8ba13519f -functions_v1_events_mock: ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsV1EventsMock.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsV1EventsMock.bin 0f0ba42e0cc33c7abc8b8fd4fdfce903748a169886dd5f16cfdd56e75bcf708d -ocr2dr: ../../../contracts/solc/v0.8.6/functions/0_0_0/Functions.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/Functions.bin d9a794b33f47cc57563d216f7cf3a612309fc3062356a27e30005cf1d59e449d -ocr2dr_client: ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClient.bin 84aa63f9dbc5c7eac240db699b09e613ca4c6cd56dab10bdc25b02461b717e21 -ocr2dr_client_example: ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClientExample.bin a978d9b52a5a2da19eef0975979de256e62980a0cfb3084fe6d66a351b4ef534 -ocr2dr_oracle: ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracleWithInit.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracleWithInit.bin b9084b34b0ee2e89adc72f068a868f0f22e361c96677fe20e44801e84bbd0c18 -ocr2dr_registry: ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistryWithInit.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistryWithInit.bin be588d5036cbeb8d67bbc124fefbdc6fd354802a30b8e87093b2b94a6549741b +functions: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRequest.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRequest.bin 3c972870b0afeb6d73a29ebb182f24956a2cebb127b21c4f867d1ecf19a762db +functions_allow_list: ../../../contracts/solc/v0.8.19/functions/v1_0_0/TermsOfServiceAllowList.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/TermsOfServiceAllowList.bin b2697ad4dfece903a1d34028826a017fa445eb3cd984006f1734fa9d47836ca0 +functions_billing_registry_events_mock: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryEventsMock.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryEventsMock.bin 50deeb883bd9c3729702be335c0388f9d8553bab4be5e26ecacac496a89e2b77 +functions_client: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClient.bin 2368f537a04489c720a46733f8596c4fc88a31062ecfa966d05f25dd98608aca +functions_client_example: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClientExample.bin abf32e69f268f40e8530eb8d8e96bf310b798a4c0049a58022d9d2fb527b601b +functions_coordinator: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsCoordinator.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsCoordinator.bin 21bd322caf977c4802d2c17419b57487cca438c7c5fafc52a9a9e1c9f4a72289 +functions_load_test_client: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsLoadTestClient.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsLoadTestClient.bin c8dbbd5ebb34435800d6674700068837c3a252db60046a14b0e61e829db517de +functions_oracle_events_mock: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracleEventsMock.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracleEventsMock.bin 3ca70f966f8fe751987f0ccb50bebb6aa5be77e4a9f835d1ae99e0e9bfb7d52c +functions_router: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRouter.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRouter.bin 9dedd3a36043605fd9bedf821e7ec5b4281a5c7ae2e4a1955f37aff8ba13519f +functions_v1_events_mock: ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsV1EventsMock.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsV1EventsMock.bin 0f0ba42e0cc33c7abc8b8fd4fdfce903748a169886dd5f16cfdd56e75bcf708d +ocr2dr: ../../../contracts/solc/v0.8.6/functions/v0_0_0/Functions.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/Functions.bin d9a794b33f47cc57563d216f7cf3a612309fc3062356a27e30005cf1d59e449d +ocr2dr_client: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClient.bin 84aa63f9dbc5c7eac240db699b09e613ca4c6cd56dab10bdc25b02461b717e21 +ocr2dr_client_example: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClientExample.bin a978d9b52a5a2da19eef0975979de256e62980a0cfb3084fe6d66a351b4ef534 +ocr2dr_oracle: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracleWithInit.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracleWithInit.bin b9084b34b0ee2e89adc72f068a868f0f22e361c96677fe20e44801e84bbd0c18 +ocr2dr_registry: ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryWithInit.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryWithInit.bin be588d5036cbeb8d67bbc124fefbdc6fd354802a30b8e87093b2b94a6549741b diff --git a/core/gethwrappers/functions/go_generate.go b/core/gethwrappers/functions/go_generate.go index 61acffe57c..2cb6c4ffae 100644 --- a/core/gethwrappers/functions/go_generate.go +++ b/core/gethwrappers/functions/go_generate.go @@ -5,18 +5,18 @@ package gethwrappers // Chainlink Functions (OCR2DR) // Version 0 (Testnet Beta) -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/0_0_0/Functions.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/Functions.bin OCR2DR ocr2dr -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClient.bin OCR2DRClient ocr2dr_client -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsClientExample.bin OCR2DRClientExample ocr2dr_client_example -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracleWithInit.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracleWithInit.bin OCR2DROracle ocr2dr_oracle -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistryWithInit.abi ../../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistryWithInit.bin OCR2DRRegistry ocr2dr_registry +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/v0_0_0/Functions.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/Functions.bin OCR2DR ocr2dr +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClient.bin OCR2DRClient ocr2dr_client +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsClientExample.bin OCR2DRClientExample ocr2dr_client_example +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracleWithInit.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracleWithInit.bin OCR2DROracle ocr2dr_oracle +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryWithInit.abi ../../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistryWithInit.bin OCR2DRRegistry ocr2dr_registry // Version 1 (Mainnet Preview) -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRequest.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRequest.bin Functions functions -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClient.bin FunctionsClient functions_client -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsClientExample.bin FunctionsClientExample functions_client_example -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsLoadTestClient.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsLoadTestClient.bin FunctionsLoadTestClient functions_load_test_client -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsCoordinator.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsCoordinator.bin FunctionsCoordinator functions_coordinator -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRouter.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsRouter.bin FunctionsRouter functions_router -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/TermsOfServiceAllowList.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/TermsOfServiceAllowList.bin TermsOfServiceAllowList functions_allow_list -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsV1EventsMock.abi ../../../contracts/solc/v0.8.19/functions/1_0_0/FunctionsV1EventsMock.bin FunctionsV1EventsMock functions_v1_events_mock +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRequest.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRequest.bin Functions functions +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClient.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClient.bin FunctionsClient functions_client +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClientExample.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsClientExample.bin FunctionsClientExample functions_client_example +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsLoadTestClient.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsLoadTestClient.bin FunctionsLoadTestClient functions_load_test_client +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsCoordinator.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsCoordinator.bin FunctionsCoordinator functions_coordinator +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRouter.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsRouter.bin FunctionsRouter functions_router +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/TermsOfServiceAllowList.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/TermsOfServiceAllowList.bin TermsOfServiceAllowList functions_allow_list +//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsV1EventsMock.abi ../../../contracts/solc/v0.8.19/functions/v1_0_0/FunctionsV1EventsMock.bin FunctionsV1EventsMock functions_v1_events_mock diff --git a/core/gethwrappers/go_generate.go b/core/gethwrappers/go_generate.go index 6471b2a263..3e394097b8 100644 --- a/core/gethwrappers/go_generate.go +++ b/core/gethwrappers/go_generate.go @@ -147,8 +147,8 @@ package gethwrappers // 2. Generate events mock .sol files based on ABI of compiled contracts. // 3. Compile events mock contracts. ./generation/compile_event_mock_contract.sh calls contracts/scripts/native_solc_compile_all_events_mock to compile events mock contracts. // 4. Generate wrappers for events mock contracts. -//go:generate go run ./generation/generate_events_mock/create_events_mock_contract.go ../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsOracle.abi ../../contracts/src/v0.8/mocks/FunctionsOracleEventsMock.sol FunctionsOracleEventsMock -//go:generate go run ./generation/generate_events_mock/create_events_mock_contract.go ../../contracts/solc/v0.8.6/functions/0_0_0/FunctionsBillingRegistry.abi ../../contracts/src/v0.8/mocks/FunctionsBillingRegistryEventsMock.sol FunctionsBillingRegistryEventsMock +//go:generate go run ./generation/generate_events_mock/create_events_mock_contract.go ../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsOracle.abi ../../contracts/src/v0.8/mocks/FunctionsOracleEventsMock.sol FunctionsOracleEventsMock +//go:generate go run ./generation/generate_events_mock/create_events_mock_contract.go ../../contracts/solc/v0.8.6/functions/v0_0_0/FunctionsBillingRegistry.abi ../../contracts/src/v0.8/mocks/FunctionsBillingRegistryEventsMock.sol FunctionsBillingRegistryEventsMock //go:generate ./generation/compile_event_mock_contract.sh //go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/FunctionsOracleEventsMock.abi ../../contracts/solc/v0.8.6/FunctionsOracleEventsMock.bin FunctionsOracleEventsMock functions_oracle_events_mock //go:generate go run ./generation/generate/wrap.go ../../contracts/solc/v0.8.6/FunctionsBillingRegistryEventsMock.abi ../../contracts/solc/v0.8.6/FunctionsBillingRegistryEventsMock.bin FunctionsBillingRegistryEventsMock functions_billing_registry_events_mock diff --git a/integration-tests/load/functions/README.md b/integration-tests/load/functions/README.md index d9eb9cc1ef..65a87b897a 100644 --- a/integration-tests/load/functions/README.md +++ b/integration-tests/load/functions/README.md @@ -18,7 +18,7 @@ All tests are split by network and in 3 groups: - Secrets decoding payload only - Realistic payload with args/http/secrets -Load test client is [here](../../../contracts/src/v0.8/functions/tests/1_0_0/testhelpers/FunctionsLoadTestClient.sol) +Load test client is [here](../../../contracts/src/v0.8/functions/tests/v1_0_0/testhelpers/FunctionsLoadTestClient.sol) Load is controlled with 2 params: - RPS From 0659b05d713900e8424a3d4fb457742917c66da0 Mon Sep 17 00:00:00 2001 From: Bolek <1416262+bolekk@users.noreply.github.com> Date: Fri, 15 Sep 2023 10:27:35 -0700 Subject: [PATCH 20/26] [Gateway] Basic prom counters (#10659) 1. Successful heartbeats to monitor connected nodes 2. All requests by response code 3. Functions-specific methods with success/failure counters --- core/services/gateway/api/constants.go | 21 ++++++ core/services/gateway/connectionmanager.go | 8 +++ core/services/gateway/gateway.go | 11 +++ .../handlers/functions/handler.functions.go | 68 ++++++++++++++++--- 4 files changed, 100 insertions(+), 8 deletions(-) diff --git a/core/services/gateway/api/constants.go b/core/services/gateway/api/constants.go index d64f7dded1..c028e259e2 100644 --- a/core/services/gateway/api/constants.go +++ b/core/services/gateway/api/constants.go @@ -12,6 +12,27 @@ const ( FatalError ) +func (e ErrorCode) String() string { + switch e { + case NoError: + return "NoError" + case UserMessageParseError: + return "UserMessageParseError" + case UnsupportedDONIdError: + return "UnsupportedDONIdError" + case HandlerError: + return "HandlerError" + case RequestTimeoutError: + return "RequestTimeoutError" + case NodeReponseEncodingError: + return "NodeReponseEncodingError" + case FatalError: + return "FatalError" + default: + return "UnknownError" + } +} + // See https://www.jsonrpc.org/specification#error_object func ToJsonRPCErrorCode(errorCode ErrorCode) int { gatewayErrorToJsonRPCError := map[ErrorCode]int{ diff --git a/core/services/gateway/connectionmanager.go b/core/services/gateway/connectionmanager.go index 961212239f..4d89ec6726 100644 --- a/core/services/gateway/connectionmanager.go +++ b/core/services/gateway/connectionmanager.go @@ -11,6 +11,8 @@ import ( "time" "github.com/gorilla/websocket" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" "go.uber.org/multierr" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -23,6 +25,11 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) +var promHeartbeatsSent = promauto.NewGaugeVec(prometheus.GaugeOpts{ + Name: "gateway_heartbeats_sent", + Help: "Metric to track the number of successful node heartbeates per DON", +}, []string{"don_id"}) + // ConnectionManager holds all connections between Gateway and Nodes. type ConnectionManager interface { job.ServiceCtx @@ -300,6 +307,7 @@ func (m *donConnectionManager) heartbeatLoop(intervalSec uint32) { errorCount++ } } + promHeartbeatsSent.WithLabelValues(m.donConfig.DonId).Set(float64(len(m.nodes) - errorCount)) m.lggr.Infow("sent heartbeat to nodes", "donID", m.donConfig.DonId, "errCount", errorCount) } } diff --git a/core/services/gateway/gateway.go b/core/services/gateway/gateway.go index fd158d6e0b..b97bed71ee 100644 --- a/core/services/gateway/gateway.go +++ b/core/services/gateway/gateway.go @@ -10,6 +10,9 @@ import ( "github.com/ethereum/go-ethereum/common" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" + "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/api" "github.com/smartcontractkit/chainlink/v2/core/services/gateway/config" @@ -19,6 +22,11 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) +var promRequest = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "gateway_request", + Help: "Metric to track received requests and response codes", +}, []string{"response_code"}) + type Gateway interface { job.ServiceCtx gw_net.HTTPRequestHandler @@ -154,6 +162,7 @@ func (g *gateway) ProcessRequest(ctx context.Context, rawRequest []byte) (rawRes if err != nil { return newError(g.codec, msg.Body.MessageId, api.NodeReponseEncodingError, "") } + promRequest.WithLabelValues(api.NoError.String()).Inc() return rawResponse, api.ToHttpErrorCode(api.NoError) } @@ -161,8 +170,10 @@ func newError(codec api.Codec, id string, errCode api.ErrorCode, errMsg string) rawResponse, err := codec.EncodeNewErrorResponse(id, api.ToJsonRPCErrorCode(errCode), errMsg, nil) if err != nil { // we're not even able to encode a valid JSON response + promRequest.WithLabelValues(api.FatalError.String()).Inc() return []byte("fatal error"), api.ToHttpErrorCode(api.FatalError) } + promRequest.WithLabelValues(errCode.String()).Inc() return rawResponse, api.ToHttpErrorCode(errCode) } diff --git a/core/services/gateway/handlers/functions/handler.functions.go b/core/services/gateway/handlers/functions/handler.functions.go index 4ef6ab72fb..61590327e3 100644 --- a/core/services/gateway/handlers/functions/handler.functions.go +++ b/core/services/gateway/handlers/functions/handler.functions.go @@ -7,6 +7,8 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promauto" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -17,6 +19,37 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) +var ( + ErrNotAllowlisted = errors.New("sender not allowlisted") + ErrRateLimited = errors.New("rate-limited") + ErrUnsupportedMethod = errors.New("unsupported method") + + promHandlerError = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "gateway_functions_handler_error", + Help: "Metric to track functions handler errors", + }, []string{"don_id", "error"}) + + promSecretsSetSuccess = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "gateway_functions_secrets_set_success", + Help: "Metric to track successful secrets_set calls", + }, []string{"don_id"}) + + promSecretsSetFailure = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "gateway_functions_secrets_set_failure", + Help: "Metric to track failed secrets_set calls", + }, []string{"don_id"}) + + promSecretsListSuccess = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "gateway_functions_secrets_list_success", + Help: "Metric to track successful secrets_list calls", + }, []string{"don_id"}) + + promSecretsListFailure = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "gateway_functions_secrets_list_failure", + Help: "Metric to track failed secrets_list calls", + }, []string{"don_id"}) +) + type FunctionsHandlerConfig struct { OnchainAllowlistChainID string `json:"onchainAllowlistChainId"` // Not specifying OnchainAllowlist config disables allowlist checks @@ -112,18 +145,21 @@ func (h *functionsHandler) HandleUserMessage(ctx context.Context, msg *api.Messa sender := common.HexToAddress(msg.Body.Sender) if h.allowlist != nil && !h.allowlist.Allow(sender) { h.lggr.Debugw("received a message from a non-allowlisted address", "sender", msg.Body.Sender) - return errors.New("sender not allowlisted") + promHandlerError.WithLabelValues(h.donConfig.DonId, ErrNotAllowlisted.Error()).Inc() + return ErrNotAllowlisted } if h.userRateLimiter != nil && !h.userRateLimiter.Allow(msg.Body.Sender) { - h.lggr.Debug("rate-limited", "sender", msg.Body.Sender) - return errors.New("rate-limited") + h.lggr.Debugw("rate-limited", "sender", msg.Body.Sender) + promHandlerError.WithLabelValues(h.donConfig.DonId, ErrRateLimited.Error()).Inc() + return ErrRateLimited } switch msg.Body.Method { case MethodSecretsSet, MethodSecretsList: return h.handleSecretsRequest(ctx, msg, callbackCh) default: - h.lggr.Debug("unsupported method", "method", msg.Body.Method) - return errors.New("unsupported method") + h.lggr.Debugw("unsupported method", "method", msg.Body.Method) + promHandlerError.WithLabelValues(h.donConfig.DonId, ErrUnsupportedMethod.Error()).Inc() + return ErrUnsupportedMethod } } @@ -132,6 +168,7 @@ func (h *functionsHandler) handleSecretsRequest(ctx context.Context, msg *api.Me err := h.pendingRequests.NewRequest(msg, callbackCh, &PendingSecretsRequest{request: msg, responses: make(map[string]*api.Message)}) if err != nil { h.lggr.Warnw("handleSecretsRequest: error adding new request", "sender", msg.Body.Sender, "err", err) + promHandlerError.WithLabelValues(h.donConfig.DonId, err.Error()).Inc() return err } // Send to all nodes. @@ -147,15 +184,15 @@ func (h *functionsHandler) handleSecretsRequest(ctx context.Context, msg *api.Me func (h *functionsHandler) HandleNodeMessage(ctx context.Context, msg *api.Message, nodeAddr string) error { h.lggr.Debugw("HandleNodeMessage: processing message", "nodeAddr", nodeAddr, "receiver", msg.Body.Receiver, "id", msg.Body.MessageId) if h.nodeRateLimiter != nil && !h.nodeRateLimiter.Allow(nodeAddr) { - h.lggr.Debug("rate-limited", "sender", nodeAddr) + h.lggr.Debugw("rate-limited", "sender", nodeAddr) return errors.New("rate-limited") } switch msg.Body.Method { case MethodSecretsSet, MethodSecretsList: return h.pendingRequests.ProcessResponse(msg, h.processSecretsResponse) default: - h.lggr.Debug("unsupported method", "method", msg.Body.Method) - return errors.New("unsupported method") + h.lggr.Debugw("unsupported method", "method", msg.Body.Method) + return ErrUnsupportedMethod } } @@ -200,6 +237,21 @@ func newSecretsResponse(request *api.Message, success bool, responses []*api.Mes if err != nil { return nil, err } + + if request.Body.Method == MethodSecretsSet { + if success { + promSecretsSetSuccess.WithLabelValues(request.Body.DonId).Inc() + } else { + promSecretsSetFailure.WithLabelValues(request.Body.DonId).Inc() + } + } else if request.Body.Method == MethodSecretsList { + if success { + promSecretsListSuccess.WithLabelValues(request.Body.DonId).Inc() + } else { + promSecretsListFailure.WithLabelValues(request.Body.DonId).Inc() + } + } + userResponse := *request userResponse.Body.Receiver = request.Body.Sender userResponse.Body.Payload = payloadJson From 5f540a70d07c89be35ea8a11eadaf17005e90d92 Mon Sep 17 00:00:00 2001 From: Morgan Kuphal <87319522+KuphJr@users.noreply.github.com> Date: Fri, 15 Sep 2023 16:17:14 -0500 Subject: [PATCH 21/26] Test for directories and files with digit prefix (#10667) * Test for directories and files with digit prefix * lint --- .../buffer/{0.1.0 => v0.1.0}/Buffer.sol | 0 .../vendor/solidity-cborutils/v2.0.0/CBOR.sol | 2 +- .../test/cross-version/directory.test.ts | 31 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) rename contracts/src/v0.8/vendor/@ensdomains/buffer/{0.1.0 => v0.1.0}/Buffer.sol (100%) create mode 100644 contracts/test/cross-version/directory.test.ts diff --git a/contracts/src/v0.8/vendor/@ensdomains/buffer/0.1.0/Buffer.sol b/contracts/src/v0.8/vendor/@ensdomains/buffer/v0.1.0/Buffer.sol similarity index 100% rename from contracts/src/v0.8/vendor/@ensdomains/buffer/0.1.0/Buffer.sol rename to contracts/src/v0.8/vendor/@ensdomains/buffer/v0.1.0/Buffer.sol diff --git a/contracts/src/v0.8/vendor/solidity-cborutils/v2.0.0/CBOR.sol b/contracts/src/v0.8/vendor/solidity-cborutils/v2.0.0/CBOR.sol index fbcedd53f1..5c11137087 100644 --- a/contracts/src/v0.8/vendor/solidity-cborutils/v2.0.0/CBOR.sol +++ b/contracts/src/v0.8/vendor/solidity-cborutils/v2.0.0/CBOR.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: MIT pragma solidity ^0.8.4; -import "../../@ensdomains/buffer/0.1.0/Buffer.sol"; +import "../../@ensdomains/buffer/v0.1.0/Buffer.sol"; /** * @dev A library for populating CBOR encoded payload in Solidity. diff --git a/contracts/test/cross-version/directory.test.ts b/contracts/test/cross-version/directory.test.ts new file mode 100644 index 0000000000..fde5e59299 --- /dev/null +++ b/contracts/test/cross-version/directory.test.ts @@ -0,0 +1,31 @@ +import fs from 'fs' +import path from 'path' +import { expect } from 'chai' + +// Directories that start with a number do not currently work with typechain (https://github.com/dethcrypto/TypeChain/issues/794) +describe('Directory', () => { + it('Should not have a file or directory starting with a number in contracts/src', () => { + const srcPath = path.join(__dirname, '..', '..', 'src') + + const noNumbersAsFirstChar = (dirPath: string): boolean => { + const entries = fs.readdirSync(dirPath, { withFileTypes: true }) + + for (const entry of entries) { + if (/^\d/.test(entry.name)) { + throw new Error( + `${path.join(dirPath, entry.name)} starts with a number`, + ) + } + + if (entry.isDirectory()) { + const newPath = path.join(dirPath, entry.name) + noNumbersAsFirstChar(newPath) + } + } + + return true + } + + expect(noNumbersAsFirstChar(srcPath)).to.be.true + }) +}) From f6256c3b6ea64a91aadc9ac7df30e9bf35dca557 Mon Sep 17 00:00:00 2001 From: Chunkai Yang Date: Sat, 16 Sep 2023 12:23:34 -0400 Subject: [PATCH 22/26] EvmFeeEstimator return Optimistic Rollup's L1BaseFee (#10557) * Draft impl * update configs * move l1 knowledge from EVMEstimator to WrappedEVMFeeEstimator * nit fixes * change L1BaseFee to L1GasPrice * update mock * use chain type instead of modifying chain config * add mocks * beef up models tests * beef up l1 oracle tests * small nits * address comments * fix chaintype panic * address comments --- .../chains/evm/gas/mocks/evm_fee_estimator.go | 18 ++ core/chains/evm/gas/models.go | 93 ++++++++- core/chains/evm/gas/models_test.go | 105 ++++++++++- .../evm/gas/rollups/l1_gas_price_oracle.go | 176 ++++++++++++++++++ .../gas/rollups/l1_gas_price_oracle_test.go | 83 +++++++++ .../evm/gas/rollups/mocks/eth_client.go | 58 ++++++ .../chains/evm/gas/rollups/mocks/l1_oracle.go | 129 +++++++++++++ core/chains/evm/gas/rollups/models.go | 18 ++ core/chains/evm/txmgr/broadcaster_test.go | 6 +- core/chains/evm/txmgr/confirmer_test.go | 6 +- core/internal/cltest/cltest.go | 2 +- 11 files changed, 673 insertions(+), 21 deletions(-) create mode 100644 core/chains/evm/gas/rollups/l1_gas_price_oracle.go create mode 100644 core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go create mode 100644 core/chains/evm/gas/rollups/mocks/eth_client.go create mode 100644 core/chains/evm/gas/rollups/mocks/l1_oracle.go create mode 100644 core/chains/evm/gas/rollups/models.go diff --git a/core/chains/evm/gas/mocks/evm_fee_estimator.go b/core/chains/evm/gas/mocks/evm_fee_estimator.go index 20e6c940f7..dbca58dcdd 100644 --- a/core/chains/evm/gas/mocks/evm_fee_estimator.go +++ b/core/chains/evm/gas/mocks/evm_fee_estimator.go @@ -15,6 +15,8 @@ import ( mock "github.com/stretchr/testify/mock" + rollups "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups" + types "github.com/smartcontractkit/chainlink/v2/common/fee/types" ) @@ -155,6 +157,22 @@ func (_m *EvmFeeEstimator) HealthReport() map[string]error { return r0 } +// L1Oracle provides a mock function with given fields: +func (_m *EvmFeeEstimator) L1Oracle() rollups.L1Oracle { + ret := _m.Called() + + var r0 rollups.L1Oracle + if rf, ok := ret.Get(0).(func() rollups.L1Oracle); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(rollups.L1Oracle) + } + } + + return r0 +} + // Name provides a mock function with given fields: func (_m *EvmFeeEstimator) Name() string { ret := _m.Called() diff --git a/core/chains/evm/gas/models.go b/core/chains/evm/gas/models.go index 8b6580685b..c6f8edbf04 100644 --- a/core/chains/evm/gas/models.go +++ b/core/chains/evm/gas/models.go @@ -8,6 +8,7 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/pkg/errors" + "golang.org/x/exp/maps" commonfee "github.com/smartcontractkit/chainlink/v2/common/fee" feetypes "github.com/smartcontractkit/chainlink/v2/common/fee/types" @@ -15,11 +16,13 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/assets" evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmconfig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/label" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services" + "github.com/smartcontractkit/chainlink/v2/core/utils" bigmath "github.com/smartcontractkit/chainlink/v2/core/utils/big_math" ) @@ -30,6 +33,8 @@ type EvmFeeEstimator interface { services.ServiceCtx commontypes.HeadTrackable[*evmtypes.Head, common.Hash] + // L1Oracle returns the L1 gas price oracle only if the chain has one, e.g. OP stack L2s and Arbitrum. + L1Oracle() rollups.L1Oracle GetFee(ctx context.Context, calldata []byte, feeLimit uint32, maxFeePrice *assets.Wei, opts ...feetypes.Opt) (fee EvmFee, chainSpecificFeeLimit uint32, err error) BumpFee(ctx context.Context, originalFee EvmFee, feeLimit uint32, maxFeePrice *assets.Wei, attempts []EvmPriorAttempt) (bumpedFee EvmFee, chainSpecificFeeLimit uint32, err error) @@ -61,18 +66,24 @@ func NewEstimator(lggr logger.Logger, ethClient evmclient.Client, cfg Config, ge "priceMin", geCfg.PriceMin(), ) df := geCfg.EIP1559DynamicFees() + + // create l1Oracle only if it is supported for the chain + var l1Oracle rollups.L1Oracle + if rollups.IsRollupWithL1Support(cfg.ChainType()) { + l1Oracle = rollups.NewL1GasPriceOracle(lggr, ethClient, cfg.ChainType()) + } switch s { case "Arbitrum": - return NewWrappedEvmEstimator(NewArbitrumEstimator(lggr, geCfg, ethClient, ethClient), df) + return NewWrappedEvmEstimator(NewArbitrumEstimator(lggr, geCfg, ethClient, ethClient), df, l1Oracle) case "BlockHistory": - return NewWrappedEvmEstimator(NewBlockHistoryEstimator(lggr, ethClient, cfg, geCfg, bh, *ethClient.ConfiguredChainID()), df) + return NewWrappedEvmEstimator(NewBlockHistoryEstimator(lggr, ethClient, cfg, geCfg, bh, *ethClient.ConfiguredChainID()), df, l1Oracle) case "FixedPrice": - return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df) + return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) case "Optimism2", "L2Suggested": - return NewWrappedEvmEstimator(NewL2SuggestedPriceEstimator(lggr, ethClient), df) + return NewWrappedEvmEstimator(NewL2SuggestedPriceEstimator(lggr, ethClient), df, l1Oracle) default: lggr.Warnf("GasEstimator: unrecognised mode '%s', falling back to FixedPriceEstimator", s) - return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df) + return NewWrappedEvmEstimator(NewFixedPriceEstimator(geCfg, bh, lggr), df, l1Oracle) } } @@ -141,18 +152,82 @@ func (fee EvmFee) ValidDynamic() bool { type WrappedEvmEstimator struct { EvmEstimator EIP1559Enabled bool + l1Oracle rollups.L1Oracle + utils.StartStopOnce } var _ EvmFeeEstimator = (*WrappedEvmEstimator)(nil) -func NewWrappedEvmEstimator(e EvmEstimator, eip1559Enabled bool) EvmFeeEstimator { +func NewWrappedEvmEstimator(e EvmEstimator, eip1559Enabled bool, l1Oracle rollups.L1Oracle) EvmFeeEstimator { return &WrappedEvmEstimator{ EvmEstimator: e, EIP1559Enabled: eip1559Enabled, + l1Oracle: l1Oracle, } } -func (e WrappedEvmEstimator) GetFee(ctx context.Context, calldata []byte, feeLimit uint32, maxFeePrice *assets.Wei, opts ...feetypes.Opt) (fee EvmFee, chainSpecificFeeLimit uint32, err error) { +func (e *WrappedEvmEstimator) Name() string { + return fmt.Sprintf("WrappedEvmEstimator(%s)", e.EvmEstimator.Name()) +} + +func (e *WrappedEvmEstimator) Start(ctx context.Context) error { + return e.StartOnce(e.Name(), func() error { + if err := e.EvmEstimator.Start(ctx); err != nil { + return errors.Wrap(err, "failed to start EVMEstimator") + } + if e.l1Oracle != nil { + if err := e.l1Oracle.Start(ctx); err != nil { + return errors.Wrap(err, "failed to start L1Oracle") + } + } + return nil + }) +} +func (e *WrappedEvmEstimator) Close() error { + return e.StopOnce(e.Name(), func() error { + var errEVM, errOracle error + + errEVM = errors.Wrap(e.EvmEstimator.Close(), "failed to stop EVMEstimator") + if e.l1Oracle != nil { + errOracle = errors.Wrap(e.l1Oracle.Close(), "failed to stop L1Oracle") + } + + if errEVM != nil { + return errEVM + } + return errOracle + }) +} + +func (e *WrappedEvmEstimator) Ready() error { + var errEVM, errOracle error + + errEVM = e.EvmEstimator.Ready() + if e.l1Oracle != nil { + errOracle = e.l1Oracle.Ready() + } + + if errEVM != nil { + return errEVM + } + return errOracle +} + +func (e *WrappedEvmEstimator) HealthReport() map[string]error { + report := map[string]error{e.Name(): e.StartStopOnce.Healthy()} + maps.Copy(report, e.EvmEstimator.HealthReport()) + if e.l1Oracle != nil { + maps.Copy(report, e.l1Oracle.HealthReport()) + } + + return report +} + +func (e *WrappedEvmEstimator) L1Oracle() rollups.L1Oracle { + return e.l1Oracle +} + +func (e *WrappedEvmEstimator) GetFee(ctx context.Context, calldata []byte, feeLimit uint32, maxFeePrice *assets.Wei, opts ...feetypes.Opt) (fee EvmFee, chainSpecificFeeLimit uint32, err error) { // get dynamic fee if e.EIP1559Enabled { var dynamicFee DynamicFee @@ -167,7 +242,7 @@ func (e WrappedEvmEstimator) GetFee(ctx context.Context, calldata []byte, feeLim return } -func (e WrappedEvmEstimator) GetMaxCost(ctx context.Context, amount assets.Eth, calldata []byte, feeLimit uint32, maxFeePrice *assets.Wei, opts ...feetypes.Opt) (*big.Int, error) { +func (e *WrappedEvmEstimator) GetMaxCost(ctx context.Context, amount assets.Eth, calldata []byte, feeLimit uint32, maxFeePrice *assets.Wei, opts ...feetypes.Opt) (*big.Int, error) { fees, gasLimit, err := e.GetFee(ctx, calldata, feeLimit, maxFeePrice, opts...) if err != nil { return nil, err @@ -185,7 +260,7 @@ func (e WrappedEvmEstimator) GetMaxCost(ctx context.Context, amount assets.Eth, return amountWithFees, nil } -func (e WrappedEvmEstimator) BumpFee(ctx context.Context, originalFee EvmFee, feeLimit uint32, maxFeePrice *assets.Wei, attempts []EvmPriorAttempt) (bumpedFee EvmFee, chainSpecificFeeLimit uint32, err error) { +func (e *WrappedEvmEstimator) BumpFee(ctx context.Context, originalFee EvmFee, feeLimit uint32, maxFeePrice *assets.Wei, attempts []EvmPriorAttempt) (bumpedFee EvmFee, chainSpecificFeeLimit uint32, err error) { // validate only 1 fee type is present if (!originalFee.ValidDynamic() && originalFee.Legacy == nil) || (originalFee.ValidDynamic() && originalFee.Legacy != nil) { err = errors.New("only one dynamic or legacy fee can be defined") diff --git a/core/chains/evm/gas/models_test.go b/core/chains/evm/gas/models_test.go index 048646a980..c1dd9e44ff 100644 --- a/core/chains/evm/gas/models_test.go +++ b/core/chains/evm/gas/models_test.go @@ -5,6 +5,7 @@ import ( "math/big" "testing" + "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -12,6 +13,7 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/mocks" + rollupMocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups/mocks" ) func TestWrappedEvmEstimator(t *testing.T) { @@ -36,11 +38,28 @@ func TestWrappedEvmEstimator(t *testing.T) { e.On("BumpLegacyGas", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything). Return(legacyFee, gasLimit, nil).Once() + mockEvmEstimatorName := "MockEstimator" + mockEstimatorName := "WrappedEvmEstimator(MockEstimator)" + + // L1Oracle returns the correct L1Oracle interface + t.Run("L1Oracle", func(t *testing.T) { + // expect nil + estimator := gas.NewWrappedEvmEstimator(e, false, nil) + l1Oracle := estimator.L1Oracle() + assert.Nil(t, l1Oracle) + + // expect l1Oracle + oracle := rollupMocks.NewL1Oracle(t) + estimator = gas.NewWrappedEvmEstimator(e, false, oracle) + l1Oracle = estimator.L1Oracle() + assert.Equal(t, oracle, l1Oracle) + }) + // GetFee returns gas estimation based on configuration value t.Run("GetFee", func(t *testing.T) { // expect legacy fee data dynamicFees := false - estimator := gas.NewWrappedEvmEstimator(e, dynamicFees) + estimator := gas.NewWrappedEvmEstimator(e, dynamicFees, nil) fee, max, err := estimator.GetFee(ctx, nil, 0, nil) require.NoError(t, err) assert.Equal(t, gasLimit, max) @@ -50,7 +69,7 @@ func TestWrappedEvmEstimator(t *testing.T) { // expect dynamic fee data dynamicFees = true - estimator = gas.NewWrappedEvmEstimator(e, dynamicFees) + estimator = gas.NewWrappedEvmEstimator(e, dynamicFees, nil) fee, max, err = estimator.GetFee(ctx, nil, 0, nil) require.NoError(t, err) assert.Equal(t, gasLimit, max) @@ -62,7 +81,7 @@ func TestWrappedEvmEstimator(t *testing.T) { // BumpFee returns bumped fee type based on original fee calculation t.Run("BumpFee", func(t *testing.T) { dynamicFees := false - estimator := gas.NewWrappedEvmEstimator(e, dynamicFees) + estimator := gas.NewWrappedEvmEstimator(e, dynamicFees, nil) // expect legacy fee data fee, max, err := estimator.BumpFee(ctx, gas.EvmFee{Legacy: assets.NewWeiI(0)}, 0, nil, nil) @@ -99,7 +118,7 @@ func TestWrappedEvmEstimator(t *testing.T) { // expect legacy fee data dynamicFees := false - estimator := gas.NewWrappedEvmEstimator(e, dynamicFees) + estimator := gas.NewWrappedEvmEstimator(e, dynamicFees, nil) total, err := estimator.GetMaxCost(ctx, val, nil, gasLimit, nil) require.NoError(t, err) fee := new(big.Int).Mul(legacyFee.ToInt(), big.NewInt(int64(gasLimit))) @@ -107,10 +126,86 @@ func TestWrappedEvmEstimator(t *testing.T) { // expect dynamic fee data dynamicFees = true - estimator = gas.NewWrappedEvmEstimator(e, dynamicFees) + estimator = gas.NewWrappedEvmEstimator(e, dynamicFees, nil) total, err = estimator.GetMaxCost(ctx, val, nil, gasLimit, nil) require.NoError(t, err) fee = new(big.Int).Mul(dynamicFee.FeeCap.ToInt(), big.NewInt(int64(gasLimit))) assert.Equal(t, new(big.Int).Add(val.ToInt(), fee), total) }) + + t.Run("Name", func(t *testing.T) { + evmEstimator := mocks.NewEvmEstimator(t) + oracle := rollupMocks.NewL1Oracle(t) + + evmEstimator.On("Name").Return(mockEvmEstimatorName, nil).Once() + + estimator := gas.NewWrappedEvmEstimator(evmEstimator, false, oracle) + name := estimator.Name() + require.Equal(t, mockEstimatorName, name) + }) + + t.Run("Start and stop calls both EVM estimator and L1Oracle", func(t *testing.T) { + evmEstimator := mocks.NewEvmEstimator(t) + oracle := rollupMocks.NewL1Oracle(t) + + evmEstimator.On("Name").Return(mockEvmEstimatorName, nil).Times(4) + evmEstimator.On("Start", mock.Anything).Return(nil).Twice() + evmEstimator.On("Close").Return(nil).Twice() + oracle.On("Start", mock.Anything).Return(nil).Once() + oracle.On("Close").Return(nil).Once() + + estimator := gas.NewWrappedEvmEstimator(evmEstimator, false, nil) + err := estimator.Start(ctx) + require.NoError(t, err) + err = estimator.Close() + require.NoError(t, err) + + estimator = gas.NewWrappedEvmEstimator(evmEstimator, false, oracle) + err = estimator.Start(ctx) + require.NoError(t, err) + err = estimator.Close() + require.NoError(t, err) + }) + + t.Run("Read calls both EVM estimator and L1Oracle", func(t *testing.T) { + evmEstimator := mocks.NewEvmEstimator(t) + oracle := rollupMocks.NewL1Oracle(t) + + evmEstimator.On("Ready").Return(nil).Twice() + oracle.On("Ready").Return(nil).Once() + + estimator := gas.NewWrappedEvmEstimator(evmEstimator, false, nil) + err := estimator.Ready() + require.NoError(t, err) + + estimator = gas.NewWrappedEvmEstimator(evmEstimator, false, oracle) + err = estimator.Ready() + require.NoError(t, err) + }) + + t.Run("HealthReport merges report from EVM estimator and L1Oracle", func(t *testing.T) { + evmEstimator := mocks.NewEvmEstimator(t) + oracle := rollupMocks.NewL1Oracle(t) + + evmEstimatorKey := "evm" + evmEstimatorError := errors.New("evm error") + oracleKey := "oracle" + oracleError := errors.New("oracle error") + + evmEstimator.On("Name").Return(mockEvmEstimatorName, nil).Twice() + evmEstimator.On("HealthReport").Return(map[string]error{evmEstimatorKey: evmEstimatorError}).Twice() + oracle.On("HealthReport").Return(map[string]error{oracleKey: oracleError}).Once() + + estimator := gas.NewWrappedEvmEstimator(evmEstimator, false, nil) + report := estimator.HealthReport() + require.True(t, errors.Is(report[evmEstimatorKey], evmEstimatorError)) + require.Nil(t, report[oracleKey]) + require.NotNil(t, report[mockEstimatorName]) + + estimator = gas.NewWrappedEvmEstimator(evmEstimator, false, oracle) + report = estimator.HealthReport() + require.True(t, errors.Is(report[evmEstimatorKey], evmEstimatorError)) + require.True(t, errors.Is(report[oracleKey], oracleError)) + require.NotNil(t, report[mockEstimatorName]) + }) } diff --git a/core/chains/evm/gas/rollups/l1_gas_price_oracle.go b/core/chains/evm/gas/rollups/l1_gas_price_oracle.go new file mode 100644 index 0000000000..13ec5e29dd --- /dev/null +++ b/core/chains/evm/gas/rollups/l1_gas_price_oracle.go @@ -0,0 +1,176 @@ +package rollups + +import ( + "context" + "errors" + "fmt" + "math/big" + "sync" + "time" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "golang.org/x/exp/slices" + + "github.com/smartcontractkit/chainlink/v2/core/assets" + evmclient "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/core/logger" + "github.com/smartcontractkit/chainlink/v2/core/utils" +) + +//go:generate mockery --quiet --name ethClient --output ./mocks/ --case=underscore --structname ETHClient +type ethClient interface { + CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) +} + +// Reads L2-specific precompiles and caches the l1GasPrice set by the L2. +type l1GasPriceOracle struct { + client ethClient + pollPeriod time.Duration + logger logger.Logger + address string + callArgs string + + l1GasPriceMu sync.RWMutex + l1GasPrice *assets.Wei + + chInitialised chan struct{} + chStop utils.StopChan + chDone chan struct{} + utils.StartStopOnce +} + +const ( + // ArbGasInfoAddress is the address of the "Precompiled contract that exists in every Arbitrum chain." + // https://github.com/OffchainLabs/nitro/blob/f7645453cfc77bf3e3644ea1ac031eff629df325/contracts/src/precompiles/ArbGasInfo.sol + ArbGasInfoAddress = "0x000000000000000000000000000000000000006C" + // ArbGasInfo_getL1BaseFeeEstimate is the a hex encoded call to: + // `function getL1BaseFeeEstimate() external view returns (uint256);` + ArbGasInfo_getL1BaseFeeEstimate = "f5d6ded7" + + // GasOracleAddress is the address of the precompiled contract that exists on OP stack chain. + // This is the case for Optimism and Base. + OPGasOracleAddress = "0x420000000000000000000000000000000000000F" + // GasOracle_l1BaseFee is the a hex encoded call to: + // `function l1BaseFee() external view returns (uint256);` + OPGasOracle_l1BaseFee = "519b4bd3" + + // Interval at which to poll for L1BaseFee. A good starting point is the L1 block time. + PollPeriod = 12 * time.Second +) + +var supportedChainTypes = []config.ChainType{config.ChainArbitrum, config.ChainOptimismBedrock} + +func IsRollupWithL1Support(chainType config.ChainType) bool { + return slices.Contains(supportedChainTypes, chainType) +} + +func NewL1GasPriceOracle(lggr logger.Logger, ethClient ethClient, chainType config.ChainType) L1Oracle { + var address, callArgs string + switch chainType { + case config.ChainArbitrum: + address = ArbGasInfoAddress + callArgs = ArbGasInfo_getL1BaseFeeEstimate + case config.ChainOptimismBedrock: + address = OPGasOracleAddress + callArgs = OPGasOracle_l1BaseFee + default: + panic(fmt.Sprintf("Received unspported chaintype %s", chainType)) + } + + return &l1GasPriceOracle{ + client: ethClient, + pollPeriod: PollPeriod, + logger: lggr.Named(fmt.Sprintf("L1GasPriceOracle(%s)", chainType)), + address: address, + callArgs: callArgs, + chInitialised: make(chan struct{}), + chStop: make(chan struct{}), + chDone: make(chan struct{}), + } +} + +func (o *l1GasPriceOracle) Name() string { + return o.logger.Name() +} + +func (o *l1GasPriceOracle) Start(ctx context.Context) error { + return o.StartOnce(o.Name(), func() error { + go o.run() + <-o.chInitialised + return nil + }) +} +func (o *l1GasPriceOracle) Close() error { + return o.StopOnce(o.Name(), func() error { + close(o.chStop) + <-o.chDone + return nil + }) +} + +func (o *l1GasPriceOracle) Ready() error { return o.StartStopOnce.Ready() } + +func (o *l1GasPriceOracle) HealthReport() map[string]error { + return map[string]error{o.Name(): o.StartStopOnce.Healthy()} +} + +func (o *l1GasPriceOracle) run() { + defer close(o.chDone) + + t := o.refresh() + close(o.chInitialised) + + for { + select { + case <-o.chStop: + return + case <-t.C: + t = o.refresh() + } + } +} + +func (o *l1GasPriceOracle) refresh() (t *time.Timer) { + t = time.NewTimer(utils.WithJitter(o.pollPeriod)) + + ctx, cancel := o.chStop.CtxCancel(evmclient.ContextWithDefaultTimeout()) + defer cancel() + + precompile := common.HexToAddress(o.address) + b, err := o.client.CallContract(ctx, ethereum.CallMsg{ + To: &precompile, + Data: common.Hex2Bytes(o.callArgs), + }, nil) + if err != nil { + o.logger.Errorf("gas oracle contract call failed: %v", err) + return + } + + if len(b) != 32 { // returns uint256; + o.logger.Criticalf("return data length (%d) different than expected (%d)", len(b), 32) + return + } + price := new(big.Int).SetBytes(b) + + o.l1GasPriceMu.Lock() + defer o.l1GasPriceMu.Unlock() + o.l1GasPrice = assets.NewWei(price) + return +} + +func (o *l1GasPriceOracle) GasPrice(_ context.Context) (l1GasPrice *assets.Wei, err error) { + ok := o.IfStarted(func() { + o.l1GasPriceMu.RLock() + l1GasPrice = o.l1GasPrice + o.l1GasPriceMu.RUnlock() + }) + if !ok { + return l1GasPrice, errors.New("L1GasPriceOracle is not started; cannot estimate gas") + } + if l1GasPrice == nil { + return l1GasPrice, errors.New("failed to get l1 gas price; gas price not set") + } + return +} diff --git a/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go b/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go new file mode 100644 index 0000000000..9fd2a66201 --- /dev/null +++ b/core/chains/evm/gas/rollups/l1_gas_price_oracle_test.go @@ -0,0 +1,83 @@ +package rollups + +import ( + "fmt" + "math/big" + "testing" + + "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/common" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas/rollups/mocks" + + "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/config" + "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" + "github.com/smartcontractkit/chainlink/v2/core/logger" +) + +func TestL1GasPriceOracle(t *testing.T) { + t.Parallel() + + t.Run("Unsupported ChainType returns nil", func(t *testing.T) { + ethClient := mocks.NewETHClient(t) + + assert.Panicsf(t, func() { NewL1GasPriceOracle(logger.TestLogger(t), ethClient, config.ChainCelo) }, "Received unspported chaintype %s", config.ChainCelo) + }) + + t.Run("Calling L1GasPrice on unstarted L1Oracle returns error", func(t *testing.T) { + ethClient := mocks.NewETHClient(t) + + oracle := NewL1GasPriceOracle(logger.TestLogger(t), ethClient, config.ChainOptimismBedrock) + + _, err := oracle.GasPrice(testutils.Context(t)) + assert.EqualError(t, err, "L1GasPriceOracle is not started; cannot estimate gas") + }) + + t.Run("Calling GasPrice on started Arbitrum L1Oracle returns Arbitrum l1GasPrice", func(t *testing.T) { + l1BaseFee := big.NewInt(100) + + ethClient := mocks.NewETHClient(t) + ethClient.On("CallContract", mock.Anything, mock.IsType(ethereum.CallMsg{}), mock.IsType(&big.Int{})).Run(func(args mock.Arguments) { + callMsg := args.Get(1).(ethereum.CallMsg) + blockNumber := args.Get(2).(*big.Int) + assert.Equal(t, ArbGasInfoAddress, callMsg.To.String()) + assert.Equal(t, ArbGasInfo_getL1BaseFeeEstimate, fmt.Sprintf("%x", callMsg.Data)) + assert.Nil(t, blockNumber) + }).Return(common.BigToHash(l1BaseFee).Bytes(), nil) + + oracle := NewL1GasPriceOracle(logger.TestLogger(t), ethClient, config.ChainArbitrum) + require.NoError(t, oracle.Start(testutils.Context(t))) + t.Cleanup(func() { assert.NoError(t, oracle.Close()) }) + + gasPrice, err := oracle.GasPrice(testutils.Context(t)) + require.NoError(t, err) + + assert.Equal(t, assets.NewWei(l1BaseFee), gasPrice) + }) + + t.Run("Calling GasPrice on started OPStack L1Oracle returns OPStack l1GasPrice", func(t *testing.T) { + l1BaseFee := big.NewInt(200) + + ethClient := mocks.NewETHClient(t) + ethClient.On("CallContract", mock.Anything, mock.IsType(ethereum.CallMsg{}), mock.IsType(&big.Int{})).Run(func(args mock.Arguments) { + callMsg := args.Get(1).(ethereum.CallMsg) + blockNumber := args.Get(2).(*big.Int) + assert.Equal(t, OPGasOracleAddress, callMsg.To.String()) + assert.Equal(t, OPGasOracle_l1BaseFee, fmt.Sprintf("%x", callMsg.Data)) + assert.Nil(t, blockNumber) + }).Return(common.BigToHash(l1BaseFee).Bytes(), nil) + + oracle := NewL1GasPriceOracle(logger.TestLogger(t), ethClient, config.ChainOptimismBedrock) + require.NoError(t, oracle.Start(testutils.Context(t))) + t.Cleanup(func() { assert.NoError(t, oracle.Close()) }) + + gasPrice, err := oracle.GasPrice(testutils.Context(t)) + require.NoError(t, err) + + assert.Equal(t, assets.NewWei(l1BaseFee), gasPrice) + }) +} diff --git a/core/chains/evm/gas/rollups/mocks/eth_client.go b/core/chains/evm/gas/rollups/mocks/eth_client.go new file mode 100644 index 0000000000..5389661bc5 --- /dev/null +++ b/core/chains/evm/gas/rollups/mocks/eth_client.go @@ -0,0 +1,58 @@ +// Code generated by mockery v2.28.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + big "math/big" + + ethereum "github.com/ethereum/go-ethereum" + + mock "github.com/stretchr/testify/mock" +) + +// ETHClient is an autogenerated mock type for the ethClient type +type ETHClient struct { + mock.Mock +} + +// CallContract provides a mock function with given fields: ctx, msg, blockNumber +func (_m *ETHClient) CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error) { + ret := _m.Called(ctx, msg, blockNumber) + + var r0 []byte + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, ethereum.CallMsg, *big.Int) ([]byte, error)); ok { + return rf(ctx, msg, blockNumber) + } + if rf, ok := ret.Get(0).(func(context.Context, ethereum.CallMsg, *big.Int) []byte); ok { + r0 = rf(ctx, msg, blockNumber) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]byte) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, ethereum.CallMsg, *big.Int) error); ok { + r1 = rf(ctx, msg, blockNumber) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +type mockConstructorTestingTNewETHClient interface { + mock.TestingT + Cleanup(func()) +} + +// NewETHClient creates a new instance of ETHClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewETHClient(t mockConstructorTestingTNewETHClient) *ETHClient { + mock := ÐClient{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/core/chains/evm/gas/rollups/mocks/l1_oracle.go b/core/chains/evm/gas/rollups/mocks/l1_oracle.go new file mode 100644 index 0000000000..e148c0e9ac --- /dev/null +++ b/core/chains/evm/gas/rollups/mocks/l1_oracle.go @@ -0,0 +1,129 @@ +// Code generated by mockery v2.28.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + assets "github.com/smartcontractkit/chainlink/v2/core/assets" + + mock "github.com/stretchr/testify/mock" +) + +// L1Oracle is an autogenerated mock type for the L1Oracle type +type L1Oracle struct { + mock.Mock +} + +// Close provides a mock function with given fields: +func (_m *L1Oracle) Close() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// GasPrice provides a mock function with given fields: ctx +func (_m *L1Oracle) GasPrice(ctx context.Context) (*assets.Wei, error) { + ret := _m.Called(ctx) + + var r0 *assets.Wei + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*assets.Wei, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *assets.Wei); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*assets.Wei) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// HealthReport provides a mock function with given fields: +func (_m *L1Oracle) HealthReport() map[string]error { + ret := _m.Called() + + var r0 map[string]error + if rf, ok := ret.Get(0).(func() map[string]error); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]error) + } + } + + return r0 +} + +// Name provides a mock function with given fields: +func (_m *L1Oracle) Name() string { + ret := _m.Called() + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// Ready provides a mock function with given fields: +func (_m *L1Oracle) Ready() error { + ret := _m.Called() + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// Start provides a mock function with given fields: _a0 +func (_m *L1Oracle) Start(_a0 context.Context) error { + ret := _m.Called(_a0) + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(_a0) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +type mockConstructorTestingTNewL1Oracle interface { + mock.TestingT + Cleanup(func()) +} + +// NewL1Oracle creates a new instance of L1Oracle. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +func NewL1Oracle(t mockConstructorTestingTNewL1Oracle) *L1Oracle { + mock := &L1Oracle{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/core/chains/evm/gas/rollups/models.go b/core/chains/evm/gas/rollups/models.go new file mode 100644 index 0000000000..83ae29f4ea --- /dev/null +++ b/core/chains/evm/gas/rollups/models.go @@ -0,0 +1,18 @@ +package rollups + +import ( + "context" + + "github.com/smartcontractkit/chainlink/v2/core/assets" + "github.com/smartcontractkit/chainlink/v2/core/services" +) + +// L1Oracle provides interface for fetching L1-specific fee components if the chain is an L2. +// For example, on Optimistic Rollups, this oracle can return rollup-specific l1BaseFee +// +//go:generate mockery --quiet --name L1Oracle --output ./mocks/ --case=underscore +type L1Oracle interface { + services.ServiceCtx + + GasPrice(ctx context.Context) (*assets.Wei, error) +} diff --git a/core/chains/evm/txmgr/broadcaster_test.go b/core/chains/evm/txmgr/broadcaster_test.go index aa0368ecc0..e1133e8ef2 100644 --- a/core/chains/evm/txmgr/broadcaster_test.go +++ b/core/chains/evm/txmgr/broadcaster_test.go @@ -67,7 +67,7 @@ func NewTestEthBroadcaster( lggr := logger.TestLogger(t) ge := config.EVM().GasEstimator() - estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(config.EVM().GasEstimator(), ge.BlockHistory(), lggr), ge.EIP1559DynamicFees()) + estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(config.EVM().GasEstimator(), ge.BlockHistory(), lggr), ge.EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), ge, keyStore, estimator) txNonceSyncer := txmgr.NewNonceSyncer(txStore, lggr, ethClient, keyStore) ethBroadcaster := txmgr.NewEvmBroadcaster(txStore, txmgr.NewEvmTxmClient(ethClient), txmgr.NewEvmTxmConfig(config.EVM()), txmgr.NewEvmTxmFeeConfig(config.EVM().GasEstimator()), config.EVM().Transactions(), config.Database().Listener(), keyStore, eb, txBuilder, txNonceSyncer, lggr, checkerFactory, nonceAutoSync) @@ -1123,7 +1123,7 @@ func TestEthBroadcaster_ProcessUnstartedEthTxs_Errors(t *testing.T) { require.NoError(t, err) t.Cleanup(func() { assert.NoError(t, eventBroadcaster.Close()) }) lggr := logger.TestLogger(t) - estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(evmcfg.EVM().GasEstimator(), evmcfg.EVM().GasEstimator().BlockHistory(), lggr), evmcfg.EVM().GasEstimator().EIP1559DynamicFees()) + estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(evmcfg.EVM().GasEstimator(), evmcfg.EVM().GasEstimator().BlockHistory(), lggr), evmcfg.EVM().GasEstimator().EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), evmcfg.EVM().GasEstimator(), ethKeyStore, estimator) eb = txmgr.NewEvmBroadcaster(txStore, txmgr.NewEvmTxmClient(ethClient), txmgr.NewEvmTxmConfig(evmcfg.EVM()), txmgr.NewEvmTxmFeeConfig(evmcfg.EVM().GasEstimator()), evmcfg.EVM().Transactions(), evmcfg.Database().Listener(), ethKeyStore, eventBroadcaster, txBuilder, nil, lggr, &testCheckerFactory{}, false) { @@ -1771,7 +1771,7 @@ func TestEthBroadcaster_SyncNonce(t *testing.T) { sub.On("Events").Return(make(<-chan pg.Event)) sub.On("Close") eventBroadcaster.On("Subscribe", "evm.insert_on_txes", "").Return(sub, nil) - estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(evmcfg.EVM().GasEstimator(), evmcfg.EVM().GasEstimator().BlockHistory(), lggr), evmcfg.EVM().GasEstimator().EIP1559DynamicFees()) + estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(evmcfg.EVM().GasEstimator(), evmcfg.EVM().GasEstimator().BlockHistory(), lggr), evmcfg.EVM().GasEstimator().EIP1559DynamicFees(), nil) checkerFactory := &testCheckerFactory{} ge := evmcfg.EVM().GasEstimator() diff --git a/core/chains/evm/txmgr/confirmer_test.go b/core/chains/evm/txmgr/confirmer_test.go index 795725cdb2..555ea09ff3 100644 --- a/core/chains/evm/txmgr/confirmer_test.go +++ b/core/chains/evm/txmgr/confirmer_test.go @@ -122,7 +122,7 @@ func TestEthConfirmer_Lifecycle(t *testing.T) { estimator := gasmocks.NewEvmEstimator(t) lggr := logger.TestLogger(t) ge := config.EVM().GasEstimator() - feeEstimator := gas.NewWrappedEvmEstimator(estimator, ge.EIP1559DynamicFees()) + feeEstimator := gas.NewWrappedEvmEstimator(estimator, ge.EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), ge, ethKeyStore, feeEstimator) ec := txmgr.NewEvmConfirmer(txStore, txmgr.NewEvmTxmClient(ethClient), txmgr.NewEvmTxmConfig(config.EVM()), txmgr.NewEvmTxmFeeConfig(ge), config.EVM().Transactions(), config.Database(), ethKeyStore, txBuilder, lggr) ctx := testutils.Context(t) @@ -1645,7 +1645,7 @@ func TestEthConfirmer_RebroadcastWhereNecessary_WithConnectivityCheck(t *testing estimator := gasmocks.NewEvmEstimator(t) estimator.On("BumpLegacyGas", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, uint32(0), pkgerrors.Wrapf(commonfee.ErrConnectivity, "transaction...")) ge := ccfg.EVM().GasEstimator() - feeEstimator := gas.NewWrappedEvmEstimator(estimator, ge.EIP1559DynamicFees()) + feeEstimator := gas.NewWrappedEvmEstimator(estimator, ge.EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), ge, kst, feeEstimator) addresses := []gethCommon.Address{fromAddress} kst.On("EnabledAddressesForChain", &cltest.FixtureChainID).Return(addresses, nil).Maybe() @@ -1690,7 +1690,7 @@ func TestEthConfirmer_RebroadcastWhereNecessary_WithConnectivityCheck(t *testing estimator.On("BumpDynamicFee", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(gas.DynamicFee{}, uint32(0), pkgerrors.Wrapf(commonfee.ErrConnectivity, "transaction...")) // Create confirmer with necessary state ge := ccfg.EVM().GasEstimator() - feeEstimator := gas.NewWrappedEvmEstimator(estimator, ge.EIP1559DynamicFees()) + feeEstimator := gas.NewWrappedEvmEstimator(estimator, ge.EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), ge, kst, feeEstimator) addresses := []gethCommon.Address{fromAddress} kst.On("EnabledAddressesForChain", &cltest.FixtureChainID).Return(addresses, nil).Maybe() diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index 8799ff4277..139d66b590 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -213,7 +213,7 @@ func NewEthConfirmer(t testing.TB, txStore txmgr.EvmTxStore, ethClient evmclient t.Helper() lggr := logger.TestLogger(t) ge := config.EVM().GasEstimator() - estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(ge, ge.BlockHistory(), lggr), ge.EIP1559DynamicFees()) + estimator := gas.NewWrappedEvmEstimator(gas.NewFixedPriceEstimator(ge, ge.BlockHistory(), lggr), ge.EIP1559DynamicFees(), nil) txBuilder := txmgr.NewEvmTxAttemptBuilder(*ethClient.ConfiguredChainID(), ge, ks, estimator) ec := txmgr.NewEvmConfirmer(txStore, txmgr.NewEvmTxmClient(ethClient), txmgr.NewEvmTxmConfig(config.EVM()), txmgr.NewEvmTxmFeeConfig(ge), config.EVM().Transactions(), config.Database(), ks, txBuilder, lggr) ec.SetResumeCallback(fn) From f2282a2d882bfa83c6532294a519c834b8ca60d7 Mon Sep 17 00:00:00 2001 From: Matt Yang Date: Mon, 18 Sep 2023 12:01:42 -0400 Subject: [PATCH 23/26] update snapshot with new foundry version --- contracts/gas-snapshots/ccip.gas-snapshot | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/contracts/gas-snapshots/ccip.gas-snapshot b/contracts/gas-snapshots/ccip.gas-snapshot index e71196a9ee..e09516b1d0 100644 --- a/contracts/gas-snapshots/ccip.gas-snapshot +++ b/contracts/gas-snapshots/ccip.gas-snapshot @@ -1,4 +1,4 @@ -ARMProxyStandaloneTest:testARMCallEmptyContractRevert() (gas: 19518) +ARMProxyStandaloneTest:testARMCallEmptyContractRevert() (gas: 17944) ARMProxyStandaloneTest:testConstructor() (gas: 373973) ARMProxyStandaloneTest:testSetARM() (gas: 16033) ARMProxyStandaloneTest:testSetARMzero() (gas: 11176) @@ -45,14 +45,14 @@ AggregateTokenLimiter__rateLimitValue:testUnknownTokenReverts() (gas: 18240) AggregateTokenLimiter_constructor:testConstructorSuccess() (gas: 21822) AggregateTokenLimiter_getTokenBucket:testGetTokenBucketSuccess() (gas: 15863) AggregateTokenLimiter_getTokenBucket:testRefillSuccess() (gas: 37863) -AggregateTokenLimiter_getTokenBucket:testTimeUnderflowReverts() (gas: 15283) +AggregateTokenLimiter_getTokenBucket:testTimeUnderflowReverts() (gas: 14424) AggregateTokenLimiter_getTokenLimitAdmin:testGetTokenLimitAdminSuccess() (gas: 7583) AggregateTokenLimiter_setAdmin:testOnlyOwnerOrAdminReverts() (gas: 17184) AggregateTokenLimiter_setAdmin:testOwnerSuccess() (gas: 18631) AggregateTokenLimiter_setRateLimiterConfig:testOnlyOnlyCallableByAdminOrOwnerReverts() (gas: 21552) AggregateTokenLimiter_setRateLimiterConfig:testOwnerSuccess() (gas: 41466) AggregateTokenLimiter_setRateLimiterConfig:testTokenLimitAdminSuccess() (gas: 48072) -BurnMintERC677_burn:testPoolBurnRevertNotHealthyReverts() (gas: 59734) +BurnMintERC677_burn:testPoolBurnRevertNotHealthyReverts() (gas: 58150) BurnMintERC677_burn:testPoolBurnSuccess() (gas: 197641) BurnMintERC677_mint:testPoolMintNotHealthyReverts() (gas: 55384) BurnMintERC677_mint:testPoolMintSuccess() (gas: 93675) @@ -87,12 +87,12 @@ CommitStore_verify:testTooManyLeavesReverts() (gas: 36830) DefensiveExampleTest:testHappyPathSuccess() (gas: 174828) DefensiveExampleTest:testRecovery() (gas: 399728) E2E:testE2E_3MessagesSuccess_gas() (gas: 870710) -EVM2EVMOffRamp__releaseOrMintTokens:testRateLimitErrorsReverts() (gas: 438942) -EVM2EVMOffRamp__releaseOrMintTokens:testTokenHandlingErrorReverts() (gas: 101896) -EVM2EVMOffRamp__releaseOrMintTokens:testUnsupportedTokenReverts() (gas: 19741) +EVM2EVMOffRamp__releaseOrMintTokens:testRateLimitErrorsReverts() (gas: 428056) +EVM2EVMOffRamp__releaseOrMintTokens:testTokenHandlingErrorReverts() (gas: 100322) +EVM2EVMOffRamp__releaseOrMintTokens:testUnsupportedTokenReverts() (gas: 18159) EVM2EVMOffRamp__releaseOrMintTokens:test_releaseOrMintTokensSuccess() (gas: 139008) EVM2EVMOffRamp__report:testReportSuccess() (gas: 129025) -EVM2EVMOffRamp__trialExecute:testRateLimitErrorReverts() (gas: 153324) +EVM2EVMOffRamp__trialExecute:testRateLimitErrorReverts() (gas: 151693) EVM2EVMOffRamp__trialExecute:testTokenHandlingErrorIsCaughtSuccess() (gas: 181117) EVM2EVMOffRamp__trialExecute:test_trialExecuteSuccess() (gas: 229193) EVM2EVMOffRamp_applyPoolUpdates:testApplyPoolUpdatesSuccess() (gas: 2548304) @@ -186,7 +186,7 @@ EVM2EVMOnRamp_forwardFromRouter:testShouldStoreNonLinkFees() (gas: 127810) EVM2EVMOnRamp_forwardFromRouter:testTooManyTokensReverts() (gas: 28108) EVM2EVMOnRamp_forwardFromRouter:testUnhealthyReverts() (gas: 42943) EVM2EVMOnRamp_forwardFromRouter:testUnsupportedTokenReverts() (gas: 108788) -EVM2EVMOnRamp_forwardFromRouter:testZeroAddressReceiverReverts() (gas: 172104) +EVM2EVMOnRamp_forwardFromRouter:testZeroAddressReceiverReverts() (gas: 154470) EVM2EVMOnRamp_forwardFromRouter_upgrade:testV2NonceNewSenderStartsAtZeroSuccess() (gas: 151462) EVM2EVMOnRamp_forwardFromRouter_upgrade:testV2NonceStartsAtV1NonceSuccess() (gas: 197712) EVM2EVMOnRamp_forwardFromRouter_upgrade:testV2SenderNoncesReadsPreviousRampSuccess() (gas: 121267) @@ -252,9 +252,9 @@ EVM2EVMOnRamp_withdrawNonLinkFees:testWithdrawNonLinkFeesSuccess() (gas: 50104) EVM2EVMOnRamp_withdrawNonLinkFees:testWithdrawToZeroAddressReverts() (gas: 12913) LockReleaseTokenPool_addLiquidity:testLiquidityNotAcceptedReverts() (gas: 2509153) LockReleaseTokenPool_canAcceptLiquidity:test_CanAcceptLiquiditySuccess() (gas: 2509647) -LockReleaseTokenPool_lockOrBurn:testLockOrBurnWithAllowListReverts() (gas: 23303) +LockReleaseTokenPool_lockOrBurn:testLockOrBurnWithAllowListReverts() (gas: 21718) LockReleaseTokenPool_lockOrBurn:testLockOrBurnWithAllowListSuccess() (gas: 60504) -LockReleaseTokenPool_lockOrBurn:testPoolBurnRevertNotHealthyReverts() (gas: 66291) +LockReleaseTokenPool_lockOrBurn:testPoolBurnRevertNotHealthyReverts() (gas: 64707) LockReleaseTokenPool_releaseOrMint:testPoolMintNotHealthyReverts() (gas: 57674) LockReleaseTokenPool_removeLiquidity:testInsufficientLiquidityReverts() (gas: 83061) LockReleaseTokenPool_supportsInterface:testSupportsInterfaceSuccess() (gas: 8326) @@ -299,7 +299,7 @@ PriceRegistry_applyPriceUpdatersUpdates:testOnlyCallableByOwnerReverts() (gas: 1 PriceRegistry_constructor:testInvalidStalenessThresholdReverts() (gas: 66156) PriceRegistry_constructor:testSetupSuccess() (gas: 1658494) PriceRegistry_convertTokenAmount:testConvertTokenAmountSuccess() (gas: 60190) -PriceRegistry_convertTokenAmount:testLinkTokenNotSupportedReverts() (gas: 23567) +PriceRegistry_convertTokenAmount:testLinkTokenNotSupportedReverts() (gas: 22707) PriceRegistry_convertTokenAmount:testStaleFeeTokenReverts() (gas: 31634) PriceRegistry_convertTokenAmount:testStaleLinkTokenReverts() (gas: 31104) PriceRegistry_getTokenAndGasPrices:testGetFeeTokenAndGasPricesSuccess() (gas: 59721) @@ -327,7 +327,7 @@ RateLimiter_consume:testTokenRateLimitReachedReverts() (gas: 24382) RateLimiter_currentTokenBucketState:testCurrentTokenBucketStateSuccess() (gas: 32403) RateLimiter_currentTokenBucketState:testRefillSuccess() (gas: 41673) RateLimiter_setTokenBucketConfig:testSetRateLimiterConfigSuccess() (gas: 35459) -Router_applyRampUpdates:testOffRampDisable() (gas: 193482) +Router_applyRampUpdates:testOffRampDisable() (gas: 192139) Router_applyRampUpdates:testOffRampMismatchReverts() (gas: 108518) Router_applyRampUpdates:testOnRampDisable() (gas: 52147) Router_applyRampUpdates:testOnlyOwnerReverts() (gas: 12224) @@ -359,11 +359,11 @@ Router_recoverTokens:testRecoverTokensValueReceiverReverts() (gas: 444668) Router_routeMessage:testAutoExecSuccess() (gas: 38973) Router_routeMessage:testExecutionEventSuccess() (gas: 208846) Router_routeMessage:testManualExecSuccess() (gas: 31211) -Router_routeMessage:testOnlyOffRampReverts() (gas: 23620) -Router_routeMessage:testWhenNotHealthyReverts() (gas: 47157) +Router_routeMessage:testOnlyOffRampReverts() (gas: 22025) +Router_routeMessage:testWhenNotHealthyReverts() (gas: 45570) Router_setWrappedNative:testOnlyOwnerReverts() (gas: 10976) ThirdPartyBurnMintTokenPool_applyRampUpdates:testInvalidOffRampReverts() (gas: 23375) -ThirdPartyBurnMintTokenPool_lockOrBurn:testLockOrBurnWithAllowListReverts() (gas: 23317) +ThirdPartyBurnMintTokenPool_lockOrBurn:testLockOrBurnWithAllowListReverts() (gas: 21732) ThirdPartyBurnMintTokenPool_lockOrBurn:testLockOrBurnWithAllowListSuccess() (gas: 99869) TokenPoolWithAllowList_applyAllowListUpdates:testOnlyOwnerReverts() (gas: 12072) TokenPoolWithAllowList_applyAllowListUpdates:testSetAllowListSkipsZeroSuccess() (gas: 20409) @@ -389,9 +389,9 @@ TokenProxy_getFee:testGetFeeInvalidTokenReverts() (gas: 12616) TokenProxy_getFee:testGetFeeNoDataAllowedReverts() (gas: 15763) TokenProxy_getFee:testGetFeeSuccess() (gas: 73739) USDCTokenPool__validateMessage:testValidateInvalidMessageReverts() (gas: 25129) -USDCTokenPool_lockOrBurn:testLockOrBurnWithAllowListReverts() (gas: 23411) -USDCTokenPool_lockOrBurn:testPermissionsErrorReverts() (gas: 14004) -USDCTokenPool_lockOrBurn:testUnknownDomainReverts() (gas: 184546) +USDCTokenPool_lockOrBurn:testLockOrBurnWithAllowListReverts() (gas: 21826) +USDCTokenPool_lockOrBurn:testPermissionsErrorReverts() (gas: 12428) +USDCTokenPool_lockOrBurn:testUnknownDomainReverts() (gas: 183236) USDCTokenPool_releaseOrMint:testReleaseOrMintRealTxSuccess() (gas: 55869) USDCTokenPool_releaseOrMint:testTokenMaxCapacityExceededReverts() (gas: 27768) USDCTokenPool_releaseOrMint:testUnlockingUSDCFailedReverts() (gas: 50610) From 3f1736962d624cfc3c87170fdcd440017b105231 Mon Sep 17 00:00:00 2001 From: Matt Yang Date: Mon, 18 Sep 2023 12:02:27 -0400 Subject: [PATCH 24/26] update new chainlink-testing-framework --- .../ccip-tests/actions/ccip_helpers.go | 23 ++++++++++--------- .../ccip-tests/contracts/contract_deployer.go | 5 ++-- .../ccip-tests/load/ccip_test.go | 8 +++---- .../ccip-tests/smoke/ccip_test.go | 6 ++--- .../ccip-tests/testsetups/ccip.go | 19 +++++++-------- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/integration-tests/ccip-tests/actions/ccip_helpers.go b/integration-tests/ccip-tests/actions/ccip_helpers.go index 3bd0faf04a..e4999d428b 100644 --- a/integration-tests/ccip-tests/actions/ccip_helpers.go +++ b/integration-tests/ccip-tests/actions/ccip_helpers.go @@ -110,8 +110,8 @@ type CCIPCommon struct { priceUpdateWatcher map[string]*big.Int // key - token address; value - timestamp of update } -func (ccipModule *CCIPCommon) Copy(chainClient blockchain.EVMClient) (*CCIPCommon, error) { - newCD, err := contracts.NewCCIPContractsDeployer(chainClient) +func (ccipModule *CCIPCommon) Copy(chainClient blockchain.EVMClient, logger zerolog.Logger) (*CCIPCommon, error) { + newCD, err := contracts.NewCCIPContractsDeployer(chainClient, logger) if err != nil { return nil, err } @@ -517,8 +517,8 @@ func (ccipModule *CCIPCommon) DeployContracts(noOfTokens int, return nil } -func DefaultCCIPModule(chainClient blockchain.EVMClient, existingDeployment bool) (*CCIPCommon, error) { - cd, err := contracts.NewCCIPContractsDeployer(chainClient) +func DefaultCCIPModule(chainClient blockchain.EVMClient, existingDeployment bool, logger zerolog.Logger) (*CCIPCommon, error) { + cd, err := contracts.NewCCIPContractsDeployer(chainClient, logger) if err != nil { return nil, err } @@ -910,8 +910,8 @@ func (sourceCCIP *SourceCCIPModule) SendRequest( return sendTx.Hash(), time.Since(timeNow), fee, nil } -func DefaultSourceCCIPModule(chainClient blockchain.EVMClient, destChain uint64, transferAmount []*big.Int, ccipCommon *CCIPCommon) (*SourceCCIPModule, error) { - cmn, err := ccipCommon.Copy(chainClient) +func DefaultSourceCCIPModule(chainClient blockchain.EVMClient, destChain uint64, transferAmount []*big.Int, ccipCommon *CCIPCommon, logger zerolog.Logger) (*SourceCCIPModule, error) { + cmn, err := ccipCommon.Copy(chainClient, logger) if err != nil { return nil, err } @@ -1348,8 +1348,8 @@ func (destCCIP *DestCCIPModule) AssertSeqNumberExecuted( } } -func DefaultDestinationCCIPModule(chainClient blockchain.EVMClient, sourceChain uint64, ccipCommon *CCIPCommon) (*DestCCIPModule, error) { - cmn, err := ccipCommon.Copy(chainClient) +func DefaultDestinationCCIPModule(chainClient blockchain.EVMClient, sourceChain uint64, ccipCommon *CCIPCommon, logger zerolog.Logger) (*DestCCIPModule, error) { + cmn, err := ccipCommon.Copy(chainClient, logger) if err != nil { return nil, err } @@ -1729,11 +1729,11 @@ func (lane *CCIPLane) DeployNewCCIPLane( return errors.WithStack(fmt.Errorf("common contracts for destination chain %s not found", destChainClient.GetChainID().String())) } - lane.Source, err = DefaultSourceCCIPModule(sourceChainClient, destChainClient.GetChainID().Uint64(), transferAmounts, sourceCommon) + lane.Source, err = DefaultSourceCCIPModule(sourceChainClient, destChainClient.GetChainID().Uint64(), transferAmounts, sourceCommon, lane.Logger) if err != nil { return errors.WithStack(err) } - lane.Dest, err = DefaultDestinationCCIPModule(destChainClient, sourceChainClient.GetChainID().Uint64(), destCommon) + lane.Dest, err = DefaultDestinationCCIPModule(destChainClient, sourceChainClient.GetChainID().Uint64(), destCommon, lane.Logger) if err != nil { return errors.WithStack(err) } @@ -2151,6 +2151,7 @@ func (c *CCIPTestEnv) SetUpNodesAndKeys( ctx context.Context, nodeFund *big.Float, chains []blockchain.EVMClient, + logger zerolog.Logger, ) error { chainlinkNodes := make([]*client.ChainlinkClient, 0) var err error @@ -2207,7 +2208,7 @@ func (c *CCIPTestEnv) SetUpNodesAndKeys( if cfg == nil { return fmt.Errorf("blank network config") } - c1, err := blockchain.ConcurrentEVMClient(*cfg, c.K8Env, ec) + c1, err := blockchain.ConcurrentEVMClient(*cfg, c.K8Env, ec, logger) if err != nil { return fmt.Errorf("getting concurrent evmclient chain %s %+v", ec.GetNetworkName(), err) } diff --git a/integration-tests/ccip-tests/contracts/contract_deployer.go b/integration-tests/ccip-tests/contracts/contract_deployer.go index f193b386c9..5477673e96 100644 --- a/integration-tests/ccip-tests/contracts/contract_deployer.go +++ b/integration-tests/ccip-tests/contracts/contract_deployer.go @@ -11,6 +11,7 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-testing-framework/blockchain" ocrConfigHelper2 "github.com/smartcontractkit/libocr/offchainreporting2/confighelper" @@ -43,10 +44,10 @@ type CCIPContractsDeployer struct { } // NewCCIPContractsDeployer returns an instance of a contract deployer for CCIP -func NewCCIPContractsDeployer(bcClient blockchain.EVMClient) (*CCIPContractsDeployer, error) { +func NewCCIPContractsDeployer(bcClient blockchain.EVMClient, logger zerolog.Logger) (*CCIPContractsDeployer, error) { return &CCIPContractsDeployer{ evmClient: bcClient, - EthDeployer: contracts.NewEthereumContractDeployer(bcClient), + EthDeployer: contracts.NewEthereumContractDeployer(bcClient, logger), }, nil } diff --git a/integration-tests/ccip-tests/load/ccip_test.go b/integration-tests/ccip-tests/load/ccip_test.go index 9a61743f40..c46560d9c2 100644 --- a/integration-tests/ccip-tests/load/ccip_test.go +++ b/integration-tests/ccip-tests/load/ccip_test.go @@ -8,14 +8,14 @@ import ( "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-env/chaos" a "github.com/smartcontractkit/chainlink-env/pkg/alias" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions" ) func TestLoadCCIPStableRPS(t *testing.T) { t.Parallel() - lggr := utils.GetTestLogger(t) + lggr := logging.GetTestLogger(t) testArgs := NewLoadArgs(t, lggr, context.Background()) testArgs.Setup(true) // if the test runs on remote runner @@ -32,7 +32,7 @@ func TestLoadCCIPStableRPS(t *testing.T) { func TestLoadCCIPSequentialLaneAdd(t *testing.T) { t.Parallel() - lggr := utils.GetTestLogger(t) + lggr := logging.GetTestLogger(t) testArgs := NewLoadArgs(t, lggr, context.Background()) testArgs.TestCfg.SequentialLaneAddition = true if len(testArgs.TestCfg.NetworkPairs) <= 1 { @@ -94,7 +94,7 @@ func TestLoadCCIPStableRequestTriggeringWithPodChaos(t *testing.T) { in := in t.Run(in.ChaosName, func(t *testing.T) { t.Parallel() - lggr := utils.GetTestLogger(t) + lggr := logging.GetTestLogger(t) testArgs := NewLoadArgs(t, lggr, context.Background(), in) testArgs.TestCfg.TestDuration = 5 * time.Minute testArgs.TestCfg.Load.TimeUnit = 1 * time.Second diff --git a/integration-tests/ccip-tests/smoke/ccip_test.go b/integration-tests/ccip-tests/smoke/ccip_test.go index 1016a2db79..13367c12d6 100644 --- a/integration-tests/ccip-tests/smoke/ccip_test.go +++ b/integration-tests/ccip-tests/smoke/ccip_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/chainlink-testing-framework/utils" + "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions" @@ -22,7 +22,7 @@ func TestSmokeCCIPForBidirectionalLane(t *testing.T) { testName string lane *actions.CCIPLane } - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) TestCfg := testsetups.NewCCIPTestConfig(t, l, testsetups.Smoke) transferAmounts := []*big.Int{big.NewInt(1e14), big.NewInt(1e14)} setUpOutput := testsetups.CCIPDefaultTestSetUp(t, l, "smoke-ccip", 6, transferAmounts, nil, 5, true, true, TestCfg) @@ -74,7 +74,7 @@ func TestSmokeCCIPRateLimit(t *testing.T) { testName string lane *actions.CCIPLane } - l := utils.GetTestLogger(t) + l := logging.GetTestLogger(t) TestCfg := testsetups.NewCCIPTestConfig(t, l, testsetups.Smoke) require.Equal(t, actions.TokenTransfer, TestCfg.MsgType, "Test config should have token transfer message type") transferAmounts := []*big.Int{big.NewInt(1e14)} diff --git a/integration-tests/ccip-tests/testsetups/ccip.go b/integration-tests/ccip-tests/testsetups/ccip.go index af84824978..63d93341ed 100644 --- a/integration-tests/ccip-tests/testsetups/ccip.go +++ b/integration-tests/ccip-tests/testsetups/ccip.go @@ -468,6 +468,7 @@ func (o *CCIPTestSetUpOutputs) DeployChainContracts( chainClient blockchain.EVMClient, noOfTokens int, tokenDeployerFns []blockchain.ContractDeployer, + lggr zerolog.Logger, ) error { var k8Env *environment.Environment ccipEnv := o.Env @@ -475,14 +476,14 @@ func (o *CCIPTestSetUpOutputs) DeployChainContracts( k8Env = ccipEnv.K8Env } net := chainClient.GetNetworkConfig() - chain, err := blockchain.ConcurrentEVMClient(*net, k8Env, chainClient) + chain, err := blockchain.ConcurrentEVMClient(*net, k8Env, chainClient, lggr) if err != nil { return errors.WithStack(fmt.Errorf("failed to create chain client for %s: %v", net.Name, err)) } chain.ParallelTransactions(true) - ccipCommon, err := actions.DefaultCCIPModule(chain, o.Cfg.ExistingDeployment) + ccipCommon, err := actions.DefaultCCIPModule(chain, o.Cfg.ExistingDeployment, lggr) if err != nil { return errors.WithStack(fmt.Errorf("failed to create ccip common module for %s: %v", net.Name, err)) } @@ -525,11 +526,11 @@ func (o *CCIPTestSetUpOutputs) AddLanesForNetworkPair( // on one lane will keep on waiting for transactions on other lane for the same network) // Currently for simulated network clients(from same network) created with NewEVMClient does not sync nonce // ConcurrentEVMClient is a work-around for that. - sourceChainClientA2B, err := blockchain.ConcurrentEVMClient(networkA, k8Env, chainClientA) + sourceChainClientA2B, err := blockchain.ConcurrentEVMClient(networkA, k8Env, chainClientA, lggr) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") sourceChainClientA2B.ParallelTransactions(true) - destChainClientA2B, err := blockchain.ConcurrentEVMClient(networkB, k8Env, chainClientB) + destChainClientA2B, err := blockchain.ConcurrentEVMClient(networkB, k8Env, chainClientB, lggr) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") destChainClientA2B.ParallelTransactions(true) @@ -566,11 +567,11 @@ func (o *CCIPTestSetUpOutputs) AddLanesForNetworkPair( var ccipLaneB2A *actions.CCIPLane if bidirectional { - sourceChainClientB2A, err := blockchain.ConcurrentEVMClient(networkB, k8Env, destChainClientA2B) + sourceChainClientB2A, err := blockchain.ConcurrentEVMClient(networkB, k8Env, destChainClientA2B, lggr) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") sourceChainClientB2A.ParallelTransactions(true) - destChainClientB2A, err := blockchain.ConcurrentEVMClient(networkA, k8Env, sourceChainClientA2B) + destChainClientB2A, err := blockchain.ConcurrentEVMClient(networkA, k8Env, sourceChainClientA2B, lggr) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") destChainClientB2A.ParallelTransactions(true) @@ -780,7 +781,7 @@ func CCIPDefaultTestSetUp( } } else { for _, network := range inputs.AllNetworks { - ec, err := blockchain.NewEVMClient(network, k8Env) + ec, err := blockchain.NewEVMClient(network, k8Env, lggr) require.NoError(t, err, "Connecting to blockchain nodes shouldn't fail") chains = append(chains, ec) chainByChainID[network.ChainID] = ec @@ -816,7 +817,7 @@ func CCIPDefaultTestSetUp( return err } } - return ccipEnv.SetUpNodesAndKeys(ctx, inputs.NodeFunding, chains) + return ccipEnv.SetUpNodesAndKeys(ctx, inputs.NodeFunding, chains, lggr) }) } // deploy all chain specific common contracts @@ -824,7 +825,7 @@ func CCIPDefaultTestSetUp( for _, chain := range chainByChainID { chain := chain chainAddGrp.Go(func() error { - return setUpArgs.DeployChainContracts(chain, len(transferAmounts), tokenDeployerFns) + return setUpArgs.DeployChainContracts(chain, len(transferAmounts), tokenDeployerFns, lggr) }) } require.NoError(t, chainAddGrp.Wait(), "Deploying common contracts shouldn't fail") From 081980a06c155d91d020c347a2bf833d52869876 Mon Sep 17 00:00:00 2001 From: AnieeG Date: Mon, 18 Sep 2023 12:00:05 -0700 Subject: [PATCH 25/26] fix smoke tests --- integration-tests/docker/test_env/test_env_builder.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/integration-tests/docker/test_env/test_env_builder.go b/integration-tests/docker/test_env/test_env_builder.go index f3944b0ba9..73dacd10ca 100644 --- a/integration-tests/docker/test_env/test_env_builder.go +++ b/integration-tests/docker/test_env/test_env_builder.go @@ -15,6 +15,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" "github.com/smartcontractkit/chainlink-testing-framework/networks" + "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/contracts" @@ -170,10 +171,11 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e if nonDevNetworks == nil { return nil, errors.New("cannot create nodes with custom config without nonDevNetworks") } - - err = te.StartClNodes(b.clNodeConfig, b.clNodesCount) - if err != nil { - return nil, err + if b.clNodesCount > 0 { + err = te.StartClNodes(b.clNodeConfig, b.clNodesCount) + if err != nil { + return nil, err + } } return te, nil } From 397484467b060dec48603211fd26a1365daece85 Mon Sep 17 00:00:00 2001 From: AnieeG Date: Mon, 18 Sep 2023 12:52:35 -0700 Subject: [PATCH 26/26] another fix --- integration-tests/docker/test_env/test_env.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/integration-tests/docker/test_env/test_env.go b/integration-tests/docker/test_env/test_env.go index 8c4faadbd2..52624cfb6f 100644 --- a/integration-tests/docker/test_env/test_env.go +++ b/integration-tests/docker/test_env/test_env.go @@ -24,6 +24,7 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/docker/test_env" "github.com/smartcontractkit/chainlink-testing-framework/logging" "github.com/smartcontractkit/chainlink-testing-framework/logwatch" + "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/integration-tests/client" @@ -101,17 +102,18 @@ func (te *CLClusterTestEnv) WithPrivateChain(evmNetworks []blockchain.EVMNetwork var chains []test_env.PrivateChain for _, evmNetwork := range evmNetworks { n := evmNetwork - pgc := test_env.NewPrivateGethChain(&n, []string{te.Network.Name}) - if te.t != nil { - pgc.GetPrimaryNode().WithTestLogger(te.t) - } - chains = append(chains, pgc) var privateChain test_env.PrivateChain switch n.SimulationType { case "besu": privateChain = test_env.NewPrivateBesuChain(&n, []string{te.Network.Name}) + if te.t != nil { + privateChain.GetPrimaryNode().WithTestLogger(te.t) + } default: privateChain = test_env.NewPrivateGethChain(&n, []string{te.Network.Name}) + if te.t != nil { + privateChain.GetPrimaryNode().WithTestLogger(te.t) + } } chains = append(chains, privateChain) }