From 0fd3c7a828ac3701daef2656960fa2c10ba2aeb8 Mon Sep 17 00:00:00 2001 From: Chris Cushman <104409744+vreff@users.noreply.github.com> Date: Fri, 20 Dec 2024 12:20:40 -0500 Subject: [PATCH 01/19] [CM 661] Remove dead transmission code (#15565) * [CM-661] Remove dead transmission service code * Remove vendored 4337 code * Changeset * [Bot] Update changeset file with jira issues * Remove golang tests * changeset 2 * more removals * remove github actions w/transmission * More removals --------- Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com> --- .changeset/shaggy-carpets-deliver.md | 5 + .../workflows/solidity-foundry-artifacts.yml | 1 - .github/workflows/solidity-foundry.yml | 3 - .github/workflows/solidity-hardhat.yml | 2 +- contracts/.changeset/cold-geckos-yawn.md | 10 + contracts/.solhintignore-test | 1 - contracts/GNUmakefile | 2 +- contracts/foundry.toml | 6 - contracts/scripts/native_solc_compile_all | 2 +- .../native_solc_compile_all_transmission | 40 - .../transmission/dev/ERC-4337/Paymaster.sol | 134 -- .../v0.8/transmission/dev/ERC-4337/SCA.sol | 73 - .../transmission/dev/ERC-4337/SCALibrary.sol | 48 - .../ERC-4337/SmartContractAccountFactory.sol | 33 - .../transmission/dev/testhelpers/Greeter.sol | 15 - .../SmartContractAccountHelper.sol | 78 - .../src/v0.8/transmission/test/BaseTest.t.sol | 17 - .../transmission/test/EIP_712_1014_4337.t.sol | 365 ---- .../vendor/entrypoint/core/EntryPoint.sol | 861 -------- .../v0.8/vendor/entrypoint/core/Helpers.sol | 68 - .../vendor/entrypoint/core/SenderCreator.sol | 28 - .../vendor/entrypoint/core/StakeManager.sol | 124 -- .../vendor/entrypoint/interfaces/IAccount.sol | 34 - .../entrypoint/interfaces/IAggregator.sol | 36 - .../entrypoint/interfaces/IEntryPoint.sol | 197 -- .../entrypoint/interfaces/IPaymaster.sol | 51 - .../entrypoint/interfaces/IStakeManager.sol | 104 - .../entrypoint/interfaces/UserOperation.sol | 84 - .../src/v0.8/vendor/entrypoint/utils/Exec.sol | 70 - core/gethwrappers/go_generate.go | 1 - .../generated/entry_point/entry_point.go | 1871 ----------------- .../greeter_wrapper/greeter_wrapper.go | 216 -- .../paymaster_wrapper/paymaster_wrapper.go | 719 ------- .../generated/sca_wrapper/sca_wrapper.go | 292 --- .../smart_contract_account_factory.go | 333 --- .../smart_contract_account_helper.go | 322 --- ...rapper-dependency-versions-do-not-edit.txt | 9 - core/gethwrappers/transmission/go_generate.go | 11 - .../services/transmission/integration_test.go | 495 ----- core/services/transmission/signature.go | 19 - 40 files changed, 18 insertions(+), 6762 deletions(-) create mode 100644 .changeset/shaggy-carpets-deliver.md create mode 100644 contracts/.changeset/cold-geckos-yawn.md delete mode 100755 contracts/scripts/native_solc_compile_all_transmission delete mode 100644 contracts/src/v0.8/transmission/dev/ERC-4337/Paymaster.sol delete mode 100644 contracts/src/v0.8/transmission/dev/ERC-4337/SCA.sol delete mode 100644 contracts/src/v0.8/transmission/dev/ERC-4337/SCALibrary.sol delete mode 100644 contracts/src/v0.8/transmission/dev/ERC-4337/SmartContractAccountFactory.sol delete mode 100644 contracts/src/v0.8/transmission/dev/testhelpers/Greeter.sol delete mode 100644 contracts/src/v0.8/transmission/dev/testhelpers/SmartContractAccountHelper.sol delete mode 100644 contracts/src/v0.8/transmission/test/BaseTest.t.sol delete mode 100644 contracts/src/v0.8/transmission/test/EIP_712_1014_4337.t.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/core/EntryPoint.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/core/Helpers.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/core/SenderCreator.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/core/StakeManager.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/interfaces/IAccount.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/interfaces/IAggregator.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/interfaces/IEntryPoint.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/interfaces/IPaymaster.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/interfaces/IStakeManager.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/interfaces/UserOperation.sol delete mode 100644 contracts/src/v0.8/vendor/entrypoint/utils/Exec.sol delete mode 100644 core/gethwrappers/transmission/generated/entry_point/entry_point.go delete mode 100644 core/gethwrappers/transmission/generated/greeter_wrapper/greeter_wrapper.go delete mode 100644 core/gethwrappers/transmission/generated/paymaster_wrapper/paymaster_wrapper.go delete mode 100644 core/gethwrappers/transmission/generated/sca_wrapper/sca_wrapper.go delete mode 100644 core/gethwrappers/transmission/generated/smart_contract_account_factory/smart_contract_account_factory.go delete mode 100644 core/gethwrappers/transmission/generated/smart_contract_account_helper/smart_contract_account_helper.go delete mode 100644 core/gethwrappers/transmission/generation/generated-wrapper-dependency-versions-do-not-edit.txt delete mode 100644 core/gethwrappers/transmission/go_generate.go delete mode 100644 core/services/transmission/integration_test.go delete mode 100644 core/services/transmission/signature.go diff --git a/.changeset/shaggy-carpets-deliver.md b/.changeset/shaggy-carpets-deliver.md new file mode 100644 index 00000000000..676ad2fb861 --- /dev/null +++ b/.changeset/shaggy-carpets-deliver.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +#removed dead transmission tests diff --git a/.github/workflows/solidity-foundry-artifacts.yml b/.github/workflows/solidity-foundry-artifacts.yml index 5a971f65174..dbf31a4b442 100644 --- a/.github/workflows/solidity-foundry-artifacts.yml +++ b/.github/workflows/solidity-foundry-artifacts.yml @@ -16,7 +16,6 @@ on: - "llo-feeds" - "operatorforwarder" - "shared" - - "transmission" - "vrf" - "workflow" commit_to_use: diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index f94ef29a3b8..5c6889beaf8 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -38,7 +38,6 @@ jobs: { "name": "llo-feeds", "setup": { "run-coverage": true, "min-coverage": 49.3, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "operatorforwarder", "setup": { "run-coverage": true, "min-coverage": 55.7, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "shared", "setup": { "run-coverage": true, "extra-coverage-params": "--no-match-path='*CallWithExactGas*' --ir-minimum", "min-coverage": 32.6, "run-gas-snapshot": true, "run-forge-fmt": false }}, - { "name": "transmission", "setup": { "run-coverage": true, "min-coverage": 61.5, "run-gas-snapshot": true, "run-forge-fmt": false }}, { "name": "vrf", "setup": { "run-coverage": false, "min-coverage": 98.5, "run-gas-snapshot": false, "run-forge-fmt": false }}, { "name": "workflow", "setup": { "run-coverage": true, "extra-coverage-params": "--ir-minimum", "min-coverage": 96.0, "run-gas-snapshot": true, "run-forge-fmt": true }} ] @@ -112,8 +111,6 @@ jobs: - 'contracts/src/v0.8/mocks/**/*.sol' - 'contracts/src/v0.8/tests/**/*.sol' - 'contracts/src/v0.8/vendor/**/*.sol' - transmission: - - 'contracts/src/v0.8/transmission/**/*.sol' workflow: - 'contracts/src/v0.8/workflow/**/*.sol' diff --git a/.github/workflows/solidity-hardhat.yml b/.github/workflows/solidity-hardhat.yml index 7283e17e13f..6f27f8ca2f8 100644 --- a/.github/workflows/solidity-hardhat.yml +++ b/.github/workflows/solidity-hardhat.yml @@ -25,7 +25,7 @@ jobs: with: filters: | src: - - 'contracts/src/!(v0.8/(ccip|functions|keystone|l2ep|liquiditymanager|llo-feeds|transmission|vrf|workflow)/**)/**/*' + - 'contracts/src/!(v0.8/(ccip|functions|keystone|l2ep|liquiditymanager|llo-feeds|vrf|workflow)/**)/**/*' - 'contracts/test/**/*' - 'contracts/package.json' - 'contracts/pnpm-lock.yaml' diff --git a/contracts/.changeset/cold-geckos-yawn.md b/contracts/.changeset/cold-geckos-yawn.md new file mode 100644 index 00000000000..e7677f1282e --- /dev/null +++ b/contracts/.changeset/cold-geckos-yawn.md @@ -0,0 +1,10 @@ +--- +'@chainlink/contracts': minor +--- + +Remove dead transmission code + + +PR issue: CM-661 + +Solidity Review issue: CM-662 \ No newline at end of file diff --git a/contracts/.solhintignore-test b/contracts/.solhintignore-test index acaca4fe1e4..137ba9998c7 100644 --- a/contracts/.solhintignore-test +++ b/contracts/.solhintignore-test @@ -4,7 +4,6 @@ ./src/v0.8/tests ./src/v0.8/llo-feeds/ ./src/v0.8/automation/ -./src/v0.8/transmission/ ./src/v0.8/l2ep/ ./src/v0.8/shared/ ./src/v0.8/operatorforwarder/ diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile index 673198bb1e2..7361754ee0b 100644 --- a/contracts/GNUmakefile +++ b/contracts/GNUmakefile @@ -1,6 +1,6 @@ # ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry # profile defined and use the Foundry snapshots. -ALL_FOUNDRY_PRODUCTS = ccip functions keystone l2ep liquiditymanager llo-feeds operatorforwarder shared transmission workflow +ALL_FOUNDRY_PRODUCTS = ccip functions keystone l2ep liquiditymanager llo-feeds operatorforwarder shared workflow # To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var # or call the target with `FOUNDRY_PROFILE=product` diff --git a/contracts/foundry.toml b/contracts/foundry.toml index daed21c4f6c..7fe77e08c07 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -96,12 +96,6 @@ solc_version = '0.8.19' src = 'src/v0.8/operatorforwarder' test = 'src/v0.8/operatorforwarder/test' -[profile.transmission] -optimizer_runs = 1_000_000 -solc_version = '0.8.19' -src = 'src/v0.8/transmission' -test = 'src/v0.8/transmission/test' - [profile.workflow] optimizer_runs = 1_000_000 solc_version = '0.8.24' diff --git a/contracts/scripts/native_solc_compile_all b/contracts/scripts/native_solc_compile_all index 090d8c8a07b..42abac3c6b3 100755 --- a/contracts/scripts/native_solc_compile_all +++ b/contracts/scripts/native_solc_compile_all @@ -12,7 +12,7 @@ python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt # 6 and 7 are legacy contracts, for each other product we have a native_solc_compile_all_$product script # These scripts can be run individually, or all together with this script. # To add new CL products, simply write a native_solc_compile_all_$product script and add it to the list below. -for product in automation events_mock feeds functions keystone llo-feeds logpoller operatorforwarder shared transmission vrf ccip liquiditymanager workflow +for product in automation events_mock feeds functions keystone llo-feeds logpoller operatorforwarder shared vrf ccip liquiditymanager workflow do $SCRIPTPATH/native_solc_compile_all_$product done diff --git a/contracts/scripts/native_solc_compile_all_transmission b/contracts/scripts/native_solc_compile_all_transmission deleted file mode 100755 index 9650a2b27d3..00000000000 --- a/contracts/scripts/native_solc_compile_all_transmission +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -e - -echo " ┌──────────────────────────────────────────────┐" -echo " │ Compiling Transmission contracts... │" -echo " └──────────────────────────────────────────────┘" - -SOLC_VERSION="0.8.19" -OPTIMIZE_RUNS=1000000 - -SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" -ROOT="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; cd ../../ && pwd -P )" -python3 -m pip install --require-hashes -r "$SCRIPTPATH"/requirements.txt - -solc-select install $SOLC_VERSION -solc-select use $SOLC_VERSION -export SOLC_VERSION=$SOLC_VERSION - -compileContract () { - local contract - contract=$(basename "$1" ".sol") - - solc --overwrite --optimize --optimize-runs $OPTIMIZE_RUNS --metadata-hash none \ - -o "$ROOT"/contracts/solc/v$SOLC_VERSION/"$contract" \ - --abi --bin --allow-paths "$ROOT"/contracts/src/v0.8\ - "$ROOT"/contracts/src/v0.8/"$1" -} - -# Contracts -compileContract transmission/dev/ERC-4337/SCA.sol -compileContract transmission/dev/ERC-4337/Paymaster.sol -compileContract transmission/dev/ERC-4337/SmartContractAccountFactory.sol - -# Testhelpers -compileContract transmission/dev/testhelpers/SmartContractAccountHelper.sol -compileContract transmission/dev/testhelpers/Greeter.sol - -# Vendor -compileContract vendor/entrypoint/core/EntryPoint.sol diff --git a/contracts/src/v0.8/transmission/dev/ERC-4337/Paymaster.sol b/contracts/src/v0.8/transmission/dev/ERC-4337/Paymaster.sol deleted file mode 100644 index 932d35006c4..00000000000 --- a/contracts/src/v0.8/transmission/dev/ERC-4337/Paymaster.sol +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {IPaymaster} from "../../../vendor/entrypoint/interfaces/IPaymaster.sol"; -import {SCALibrary} from "./SCALibrary.sol"; -import {LinkTokenInterface} from "../../../shared/interfaces/LinkTokenInterface.sol"; -import {AggregatorV3Interface} from "../../../shared/interfaces/AggregatorV3Interface.sol"; -import {ConfirmedOwner} from "../../../shared/access/ConfirmedOwner.sol"; -import {UserOperation} from "../../../vendor/entrypoint/interfaces/UserOperation.sol"; -import {_packValidationData} from "../../../vendor/entrypoint/core/Helpers.sol"; - -/// @dev LINK token paymaster implementation. -/// TODO: more documentation. -contract Paymaster is IPaymaster, ConfirmedOwner { - error OnlyCallableFromLink(); - error InvalidCalldata(); - error Unauthorized(address sender, address validator); - error UserOperationAlreadyTried(bytes32 userOpHash); - error InsufficientFunds(uint256 juelsNeeded, uint256 subscriptionBalance); - - LinkTokenInterface public immutable i_linkToken; - AggregatorV3Interface public immutable i_linkEthFeed; - address public immutable i_entryPoint; - - struct Config { - uint32 stalenessSeconds; - int256 fallbackWeiPerUnitLink; - } - Config public s_config; - - mapping(bytes32 => bool) internal s_userOpHashMapping; - mapping(address => uint256) internal s_subscriptions; - - constructor( - LinkTokenInterface linkToken, - AggregatorV3Interface linkEthFeed, - address entryPoint - ) ConfirmedOwner(msg.sender) { - i_linkToken = linkToken; - i_linkEthFeed = linkEthFeed; - i_entryPoint = entryPoint; - } - - function setConfig(uint32 stalenessSeconds, int256 fallbackWeiPerUnitLink) external onlyOwner { - s_config = Config({stalenessSeconds: stalenessSeconds, fallbackWeiPerUnitLink: fallbackWeiPerUnitLink}); - } - - function onTokenTransfer(address /* _sender */, uint256 _amount, bytes calldata _data) external { - if (msg.sender != address(i_linkToken)) { - revert OnlyCallableFromLink(); - } - if (_data.length != 32) { - revert InvalidCalldata(); - } - - address subscription = abi.decode(_data, (address)); - s_subscriptions[subscription] += _amount; - } - - function validatePaymasterUserOp( - UserOperation calldata userOp, - bytes32 userOpHash, - uint256 maxCost - ) external returns (bytes memory context, uint256 validationData) { - if (msg.sender != i_entryPoint) { - revert Unauthorized(msg.sender, i_entryPoint); - } - if (s_userOpHashMapping[userOpHash]) { - revert UserOperationAlreadyTried(userOpHash); - } - - uint256 extraCostJuels = _handleExtraCostJuels(userOp); - uint256 costJuels = _getCostJuels(maxCost) + extraCostJuels; - if (s_subscriptions[userOp.sender] < costJuels) { - revert InsufficientFunds(costJuels, s_subscriptions[userOp.sender]); - } - - s_userOpHashMapping[userOpHash] = true; - return (abi.encode(userOp.sender, extraCostJuels), _packValidationData(false, 0, 0)); // success - } - - /// @dev Calculates any extra LINK cost for the user operation, based on the funding type passed to the - /// @dev paymaster. Handles funding the LINK token funding described in the user operation. - /// TODO: add logic for subscription top-up. - function _handleExtraCostJuels(UserOperation calldata userOp) internal returns (uint256 extraCost) { - if (userOp.paymasterAndData.length == 20) { - return 0; // no extra data, stop here - } - - uint8 paymentType = uint8(userOp.paymasterAndData[20]); - - // For direct funding, use top-up logic. - if (paymentType == uint8(SCALibrary.LinkPaymentType.DIRECT_FUNDING)) { - SCALibrary.DirectFundingData memory directFundingData = abi.decode( - userOp.paymasterAndData[21:], - (SCALibrary.DirectFundingData) - ); - if ( - directFundingData.topupThreshold != 0 && - i_linkToken.balanceOf(directFundingData.recipient) < directFundingData.topupThreshold - ) { - i_linkToken.transfer(directFundingData.recipient, directFundingData.topupAmount); - extraCost = directFundingData.topupAmount; - } - } - return extraCost; - } - - /// @dev Deducts user subscription balance after execution. - function postOp(PostOpMode /* mode */, bytes calldata context, uint256 actualGasCost) external { - if (msg.sender != i_entryPoint) { - revert Unauthorized(msg.sender, i_entryPoint); - } - (address sender, uint256 extraCostJuels) = abi.decode(context, (address, uint256)); - s_subscriptions[sender] -= (_getCostJuels(actualGasCost) + extraCostJuels); - } - - function _getCostJuels(uint256 costWei) internal view returns (uint256 costJuels) { - costJuels = (1e18 * costWei) / uint256(_getFeedData()); - return costJuels; - } - - function _getFeedData() internal view returns (int256) { - uint32 stalenessSeconds = s_config.stalenessSeconds; - bool staleFallback = stalenessSeconds > 0; - uint256 timestamp; - int256 weiPerUnitLink; - (, weiPerUnitLink, , timestamp, ) = i_linkEthFeed.latestRoundData(); - if (staleFallback && stalenessSeconds < block.timestamp - timestamp) { - weiPerUnitLink = s_config.fallbackWeiPerUnitLink; - } - return weiPerUnitLink; - } -} diff --git a/contracts/src/v0.8/transmission/dev/ERC-4337/SCA.sol b/contracts/src/v0.8/transmission/dev/ERC-4337/SCA.sol deleted file mode 100644 index 589c55f5b3b..00000000000 --- a/contracts/src/v0.8/transmission/dev/ERC-4337/SCA.sol +++ /dev/null @@ -1,73 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity 0.8.19; - -import {IAccount} from "../../../vendor/entrypoint/interfaces/IAccount.sol"; -import {SCALibrary} from "./SCALibrary.sol"; -import {UserOperation} from "../../../vendor/entrypoint/interfaces/UserOperation.sol"; -import {_packValidationData} from "../../../vendor/entrypoint/core/Helpers.sol"; - -/// @dev Smart Contract Account, a contract deployed for a single user and that allows -/// @dev them to invoke meta-transactions. -/// TODO: Consider making the Smart Contract Account upgradeable. -contract SCA is IAccount { - uint256 public s_nonce; - address public immutable i_owner; - address public immutable i_entryPoint; - - error IncorrectNonce(uint256 currentNonce, uint256 nonceGiven); - error NotAuthorized(address sender); - error BadFormatOrOOG(); - error TransactionExpired(uint256 deadline, uint256 currentTimestamp); - error InvalidSignature(bytes32 operationHash, address owner); - - // Assign the owner of this contract upon deployment. - constructor(address owner, address entryPoint) { - i_owner = owner; - i_entryPoint = entryPoint; - } - - /// @dev Validates the user operation via a signature check. - /// TODO: Utilize a "validAfter" for a tx to be only valid _after_ a certain time. - function validateUserOp( - UserOperation calldata userOp, - bytes32 userOpHash, - uint256 /* missingAccountFunds - unused in favor of paymaster */ - ) external returns (uint256 validationData) { - if (userOp.nonce != s_nonce) { - // Revert for non-signature errors. - revert IncorrectNonce(s_nonce, userOp.nonce); - } - - // Verify signature on hash. - bytes32 fullHash = SCALibrary._getUserOpFullHash(userOpHash, address(this)); - bytes memory signature = userOp.signature; - if (SCALibrary._recoverSignature(signature, fullHash) != i_owner) { - return _packValidationData(true, 0, 0); // signature error - } - s_nonce++; - - // Unpack deadline, return successful signature. - (, , uint48 deadline, ) = abi.decode(userOp.callData[4:], (address, uint256, uint48, bytes)); - return _packValidationData(false, deadline, 0); - } - - /// @dev Execute a transaction on behalf of the owner. This function can only - /// @dev be called by the EntryPoint contract, and assumes that `validateUserOp` has succeeded. - function executeTransactionFromEntryPoint(address to, uint256 value, uint48 deadline, bytes calldata data) external { - if (msg.sender != i_entryPoint) { - revert NotAuthorized(msg.sender); - } - if (deadline != 0 && block.timestamp > deadline) { - revert TransactionExpired(deadline, block.timestamp); - } - - // Execute transaction. Bubble up an error if found. - (bool success, bytes memory returnData) = to.call{value: value}(data); - if (!success) { - if (returnData.length == 0) revert BadFormatOrOOG(); - assembly { - revert(add(32, returnData), mload(returnData)) - } - } - } -} diff --git a/contracts/src/v0.8/transmission/dev/ERC-4337/SCALibrary.sol b/contracts/src/v0.8/transmission/dev/ERC-4337/SCALibrary.sol deleted file mode 100644 index 095a3428ef4..00000000000 --- a/contracts/src/v0.8/transmission/dev/ERC-4337/SCALibrary.sol +++ /dev/null @@ -1,48 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -library SCALibrary { - // keccak256("EIP712Domain(uint256 chainId, address verifyingContract)"); - bytes32 internal constant DOMAIN_SEPARATOR = hex"1c7d3b72b37a35523e273aaadd7b4cd66f618bb81429ab053412d51f50ccea61"; - - // keccak256("executeTransactionFromEntryPoint(address to, uint256 value, bytes calldata data)"); - bytes32 internal constant TYPEHASH = hex"4750045d47fce615521b32cee713ff8db50147e98aec5ca94926b52651ca3fa0"; - - enum LinkPaymentType { - DIRECT_FUNDING, - SUBSCRIPTION // TODO: implement - } - - struct DirectFundingData { - address recipient; // recipient of the top-up - uint256 topupThreshold; // set to zero to disable auto-topup - uint256 topupAmount; - } - - function _getUserOpFullHash(bytes32 userOpHash, address scaAddress) internal view returns (bytes32 fullHash) { - bytes32 hashOfEncoding = keccak256(abi.encode(SCALibrary.TYPEHASH, userOpHash)); - fullHash = keccak256( - abi.encodePacked( - bytes1(0x19), - bytes1(0x01), - SCALibrary.DOMAIN_SEPARATOR, - block.chainid, - scaAddress, - hashOfEncoding - ) - ); - return fullHash; - } - - function _recoverSignature(bytes memory signature, bytes32 fullHash) internal pure returns (address) { - bytes32 r; - bytes32 s; - assembly { - r := mload(add(signature, 0x20)) - s := mload(add(signature, 0x40)) - } - uint8 v = uint8(signature[64]); - - return ecrecover(fullHash, v + 27, r, s); - } -} diff --git a/contracts/src/v0.8/transmission/dev/ERC-4337/SmartContractAccountFactory.sol b/contracts/src/v0.8/transmission/dev/ERC-4337/SmartContractAccountFactory.sol deleted file mode 100644 index f27c8e15cf6..00000000000 --- a/contracts/src/v0.8/transmission/dev/ERC-4337/SmartContractAccountFactory.sol +++ /dev/null @@ -1,33 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -contract SmartContractAccountFactory { - event ContractCreated(address scaAddress); - - error DeploymentFailed(); - - /// @dev Use create2 to deploy a new Smart Contract Account. - /// @dev See EIP-1014 for more on CREATE2. - /// TODO: Return the address of the Smart Contract Account even if it is already - /// deployed. - function deploySmartContractAccount( - bytes32 abiEncodedOwnerAddress, - bytes memory initCode - ) external payable returns (address scaAddress) { - assembly { - scaAddress := create2( - 0, // value - left at zero here - add(0x20, initCode), // initialization bytecode - mload(initCode), // length of initialization bytecode - abiEncodedOwnerAddress // user-defined nonce to ensure unique SCA addresses - ) - } - if (scaAddress == address(0)) { - revert DeploymentFailed(); - } - - emit ContractCreated(scaAddress); - - return scaAddress; - } -} diff --git a/contracts/src/v0.8/transmission/dev/testhelpers/Greeter.sol b/contracts/src/v0.8/transmission/dev/testhelpers/Greeter.sol deleted file mode 100644 index 5851c86581e..00000000000 --- a/contracts/src/v0.8/transmission/dev/testhelpers/Greeter.sol +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -/// @dev Ownerless greeter contract. -contract Greeter { - string private s_greeting; - - function setGreeting(string memory greeting) external { - s_greeting = greeting; - } - - function getGreeting() external view returns (string memory) { - return s_greeting; - } -} diff --git a/contracts/src/v0.8/transmission/dev/testhelpers/SmartContractAccountHelper.sol b/contracts/src/v0.8/transmission/dev/testhelpers/SmartContractAccountHelper.sol deleted file mode 100644 index b080484d8cc..00000000000 --- a/contracts/src/v0.8/transmission/dev/testhelpers/SmartContractAccountHelper.sol +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.19; - -import {SCA} from "../ERC-4337/SCA.sol"; -import {SmartContractAccountFactory} from "../ERC-4337/SmartContractAccountFactory.sol"; -import {SCALibrary} from "../ERC-4337/SCALibrary.sol"; - -library SmartContractAccountHelper { - bytes internal constant INITIALIZE_CODE = type(SCA).creationCode; - - function getFullEndTxEncoding( - address endContract, - uint256 value, - uint256 deadline, - bytes memory data - ) public view returns (bytes memory encoding) { - encoding = bytes.concat( - SCA.executeTransactionFromEntryPoint.selector, - abi.encode(endContract, value, block.timestamp + deadline, data) - ); - return encoding; - } - - function getFullHashForSigning(bytes32 userOpHash, address scaAddress) public view returns (bytes32) { - return SCALibrary._getUserOpFullHash(userOpHash, scaAddress); - } - - function getSCAInitCodeWithConstructor( - address owner, - address entryPoint - ) public pure returns (bytes memory initCode) { - initCode = bytes.concat(INITIALIZE_CODE, abi.encode(owner, entryPoint)); - return initCode; - } - - function getInitCode( - address factory, - address owner, - address entryPoint - ) external pure returns (bytes memory initCode) { - bytes32 salt = bytes32(uint256(uint160(owner)) << 96); - bytes memory initializeCodeWithConstructor = bytes.concat(INITIALIZE_CODE, abi.encode(owner, entryPoint)); - initCode = bytes.concat( - bytes20(address(factory)), - abi.encodeWithSelector( - SmartContractAccountFactory.deploySmartContractAccount.selector, - salt, - initializeCodeWithConstructor - ) - ); - return initCode; - } - - /// @dev Computes the smart contract address that results from a CREATE2 operation, per EIP-1014. - function calculateSmartContractAccountAddress( - address owner, - address entryPoint, - address factory - ) external pure returns (address) { - bytes32 salt = bytes32(uint256(uint160(owner)) << 96); - bytes memory initializeCodeWithConstructor = bytes.concat(INITIALIZE_CODE, abi.encode(owner, entryPoint)); - bytes32 initializeCodeHash = keccak256(initializeCodeWithConstructor); - return address(uint160(uint256(keccak256(abi.encodePacked(hex"ff", address(factory), salt, initializeCodeHash))))); - } - - function getAbiEncodedDirectRequestData( - address recipient, - uint256 topupThreshold, - uint256 topupAmount - ) external pure returns (bytes memory) { - SCALibrary.DirectFundingData memory data = SCALibrary.DirectFundingData({ - recipient: recipient, - topupThreshold: topupThreshold, - topupAmount: topupAmount - }); - return abi.encode(data); - } -} diff --git a/contracts/src/v0.8/transmission/test/BaseTest.t.sol b/contracts/src/v0.8/transmission/test/BaseTest.t.sol deleted file mode 100644 index 4da698d1740..00000000000 --- a/contracts/src/v0.8/transmission/test/BaseTest.t.sol +++ /dev/null @@ -1,17 +0,0 @@ -pragma solidity ^0.8.0; - -import {Test} from "forge-std/Test.sol"; - -contract BaseTest is Test { - bool private s_baseTestInitialized; - address internal constant OWNER = 0x00007e64E1fB0C487F25dd6D3601ff6aF8d32e4e; - - function setUp() public virtual { - // BaseTest.setUp is often called multiple times from tests' setUp due to inheritance. - if (s_baseTestInitialized) return; - s_baseTestInitialized = true; - - // Set msg.sender to OWNER until changePrank or stopPrank is called - vm.startPrank(OWNER); - } -} diff --git a/contracts/src/v0.8/transmission/test/EIP_712_1014_4337.t.sol b/contracts/src/v0.8/transmission/test/EIP_712_1014_4337.t.sol deleted file mode 100644 index fdfe190de26..00000000000 --- a/contracts/src/v0.8/transmission/test/EIP_712_1014_4337.t.sol +++ /dev/null @@ -1,365 +0,0 @@ -pragma solidity 0.8.19; - -import "../../shared/interfaces/LinkTokenInterface.sol"; - -import "./BaseTest.t.sol"; -import "../dev/ERC-4337/SmartContractAccountFactory.sol"; -import "../dev/testhelpers/SmartContractAccountHelper.sol"; -import "../dev/ERC-4337/SCA.sol"; -import "../dev/testhelpers/Greeter.sol"; -import "../dev/ERC-4337/Paymaster.sol"; -import "../../transmission/dev/ERC-4337/SCALibrary.sol"; -import "../../mocks/MockLinkToken.sol"; -import "../../tests/MockV3Aggregator.sol"; -import "../../vrf/mocks/VRFCoordinatorMock.sol"; -import "../../vrf/testhelpers/VRFConsumer.sol"; - -import "../../vendor/entrypoint/interfaces/UserOperation.sol"; -import "../../vendor/entrypoint/core/EntryPoint.sol"; -import "../../vendor/entrypoint/interfaces/IEntryPoint.sol"; - -/*--------------------------------------------------------------------------------------------------------------------+ -| EIP 712 + 1014 + 4337 | -| ________________ | -| This implementation allows for meta-transactions to be signed by end-users and posted on-chain by executors. It | -| utilizes the following components: | -| - EIP-712: The method by which meta-transactions are authorized. | -| - EIP-1014: The method by which the Smart Contract Account is generated. | -| - EIP-4337: The method by which meta-transactions are executed. | -| | -| The below tests illustrate end-user flows for interacting with this meta-transaction system. For users with | -| existing Smart Contract Accounts (SCAs), they simply sign off on the operation, after which the executor | -| invokes the EntryPoint that authorizes the operation on the end-user's SCA, and then execute the transaction | -| as the SCA. For users without existing SCAs, EIP-1014 ensures that the address of an SCA can be known in advance, | -| so users can sign-off on transactions that will be executed by a not-yet-deployed SCA. The EntryPoint contract | -| takes advantage of this functionality and allows for the SCA to be created in the same user operation that invokes | -| it, and the end-user signs off on this creation-and-execution flow. After the initial creation-and-execution, the | -| SCA is reused for future transactions. | -| | -| End-Dapps/protocols do not need to be EIP-2771-compliant or accommodate any other kind of transaction standard. | -| They can be interacted with out-of-the-box through the SCA, which acts in place of the user's EOA as their | -| immutable identity. | -| | --+---------------------------------------------------------------------------------------------------------------------*/ - -contract EIP_712_1014_4337 is BaseTest { - event RandomnessRequest(address indexed sender, bytes32 indexed keyHash, uint256 indexed seed, uint256 fee); - - address internal constant LINK_WHALE = 0xD883a6A1C22fC4AbFE938a5aDF9B2Cc31b1BF18B; - address internal ENTRY_POINT; - - Greeter greeter; - EntryPoint entryPoint; - MockV3Aggregator linkEthFeed; - - // Randomly generated private/public key pair. - uint256 END_USER_PKEY = uint256(bytes32(hex"99d518dbfea4b4ec301390f7e26d53d711fa1ca0c1a6e4cbed89617d4c578a8e")); - address END_USER = 0xB6708257D4E1bf0b8C144793fc2Ff3193C737ed1; - - function setUp() public override { - BaseTest.setUp(); - // Fund user accounts; - vm.deal(END_USER, 10_000 ether); - vm.deal(LINK_WHALE, 10_000 ether); - - // Impersonate a LINK whale. - changePrank(LINK_WHALE); - - // Create simple greeter contract. - greeter = new Greeter(); - assertEq("", greeter.getGreeting()); - - // Create entry point contract. - entryPoint = new EntryPoint(); - ENTRY_POINT = address(entryPoint); - - // Deploy link/eth feed. - linkEthFeed = new MockV3Aggregator(18, 5000000000000000); // .005 ETH - } - - /// @dev Test case for user that already has a Smart Contract Account. - /// @dev EntryPoint.sol should use the existing SCA to execute the meta transaction. - function testEIP712EIP4337WithExistingSmartContractAccount() public { - // Pre-calculate user smart contract account address. - SmartContractAccountFactory factory = new SmartContractAccountFactory(); - address toDeployAddress = SmartContractAccountHelper.calculateSmartContractAccountAddress( - END_USER, - ENTRY_POINT, - address(factory) - ); - - // Deploy the end-contract. - bytes32 salt = bytes32(uint256(uint160(END_USER)) << 96); - bytes memory fullInitializeCode = SmartContractAccountHelper.getSCAInitCodeWithConstructor(END_USER, ENTRY_POINT); - factory.deploySmartContractAccount(salt, fullInitializeCode); - changePrank(END_USER); - - // Ensure a correct deployment and a functioning end-contract. - uint256 contractCodeSize; - assembly { - contractCodeSize := extcodesize(toDeployAddress) - } - assertTrue(contractCodeSize > 0); - assertEq(END_USER, SCA(toDeployAddress).i_owner()); - - // Create the calldata for a setGreeting call. - string memory greeting = "hi"; - bytes memory encodedGreetingCall = bytes.concat(Greeter.setGreeting.selector, abi.encode(greeting)); // abi.encodeWithSelector equivalent - - // Produce the final full end-tx encoding, to be used as calldata in the user operation. - bytes memory fullEncoding = SmartContractAccountHelper.getFullEndTxEncoding( - address(greeter), - uint256(0), - 0, - encodedGreetingCall - ); - - // Construct the user operation. - UserOperation memory op = UserOperation({ - sender: toDeployAddress, - nonce: 0, - initCode: "", - callData: fullEncoding, - callGasLimit: 1_000_000, - verificationGasLimit: 1_000_000, - preVerificationGas: 10_000, - maxFeePerGas: 100, - maxPriorityFeePerGas: 200, - paymasterAndData: "", - signature: "" - }); - - // Sign user operation. - bytes32 userOpHash = entryPoint.getUserOpHash(op); - bytes32 fullHash = SCALibrary._getUserOpFullHash(userOpHash, toDeployAddress); - (uint8 v, bytes32 r, bytes32 s) = vm.sign(END_USER_PKEY, fullHash); - op.signature = abi.encodePacked(r, s, v - 27); - - // Deposit funds for the transaction. - entryPoint.depositTo{value: 10 ether}(toDeployAddress); - - // Execute the user operation. - UserOperation[] memory operations = new UserOperation[](1); - operations[0] = op; - entryPoint.handleOps(operations, payable(END_USER)); - - // Assert that the greeting was set. - assertEq("hi", Greeter(greeter).getGreeting()); - assertEq(SCA(toDeployAddress).s_nonce(), uint256(1)); - } - - /// @dev Test case for fresh user, EntryPoint.sol should generate a - /// @dev Smart Contract Account for them and execute the meta transaction. - function testEIP712EIP4337AndCreateSmartContractAccount() public { - // Pre-calculate user smart contract account address. - SmartContractAccountFactory factory = new SmartContractAccountFactory(); - address toDeployAddress = SmartContractAccountHelper.calculateSmartContractAccountAddress( - END_USER, - ENTRY_POINT, - address(factory) - ); - - // Construct initCode byte array. - bytes memory fullInitializeCode = SmartContractAccountHelper.getInitCode(address(factory), END_USER, ENTRY_POINT); - - // Create the calldata for a setGreeting call. - string memory greeting = "bye"; - bytes memory encodedGreetingCall = bytes.concat(Greeter.setGreeting.selector, abi.encode(greeting)); - - // Produce the final full end-tx encoding, to be used as calldata in the user operation. - bytes memory fullEncoding = SmartContractAccountHelper.getFullEndTxEncoding( - address(greeter), - uint256(0), - 0, - encodedGreetingCall - ); - - // Construct the user operation. - UserOperation memory op = UserOperation({ - sender: toDeployAddress, - nonce: 0, - initCode: fullInitializeCode, - callData: fullEncoding, - callGasLimit: 1_000_000, - verificationGasLimit: 1_000_000, - preVerificationGas: 10_000, - maxFeePerGas: 100, - maxPriorityFeePerGas: 200, - paymasterAndData: "", - signature: "" - }); - - // Sign user operation. - bytes32 userOpHash = entryPoint.getUserOpHash(op); - bytes32 fullHash = SCALibrary._getUserOpFullHash(userOpHash, toDeployAddress); - (uint8 v, bytes32 r, bytes32 s) = vm.sign(END_USER_PKEY, fullHash); - op.signature = abi.encodePacked(r, s, v - 27); - - // Deposit funds for the transaction. - entryPoint.depositTo{value: 10 ether}(toDeployAddress); - - // Execute the user operation. - UserOperation[] memory operations = new UserOperation[](1); - operations[0] = op; - entryPoint.handleOps(operations, payable(END_USER)); - - // Assert that the greeting was set. - assertEq("bye", Greeter(greeter).getGreeting()); - assertEq(SCA(toDeployAddress).s_nonce(), uint256(1)); - assertEq(SCA(toDeployAddress).i_owner(), END_USER); - } - - /// @dev Test case for a user executing a setGreeting with a LINK token paymaster. - function testEIP712EIP4337AndCreateSmartContractAccountWithPaymaster() public { - // Pre-calculate user smart contract account address. - SmartContractAccountFactory factory = new SmartContractAccountFactory(); - address toDeployAddress = SmartContractAccountHelper.calculateSmartContractAccountAddress( - END_USER, - ENTRY_POINT, - address(factory) - ); - - // Construct initCode byte array. - bytes memory fullInitializeCode = SmartContractAccountHelper.getInitCode(address(factory), END_USER, ENTRY_POINT); - - // Create the calldata for a setGreeting call. - string memory greeting = "good day"; - bytes memory encodedGreetingCall = bytes.concat(Greeter.setGreeting.selector, abi.encode(greeting)); - - // Produce the final full end-tx encoding, to be used as calldata in the user operation. - bytes memory fullEncoding = SmartContractAccountHelper.getFullEndTxEncoding( - address(greeter), - uint256(0), - 0, - encodedGreetingCall - ); - - // Create Link token, and deposit into paymaster. - MockLinkToken linkToken = new MockLinkToken(); - Paymaster paymaster = new Paymaster(LinkTokenInterface(address(linkToken)), linkEthFeed, ENTRY_POINT); - linkToken.transferAndCall(address(paymaster), 1000 ether, abi.encode(address(toDeployAddress))); - - // Construct the user opeartion. - UserOperation memory op = UserOperation({ - sender: toDeployAddress, - nonce: 0, - initCode: fullInitializeCode, - callData: fullEncoding, - callGasLimit: 1_000_000, - verificationGasLimit: 1_500_000, - preVerificationGas: 10_000, - maxFeePerGas: 100, - maxPriorityFeePerGas: 200, - paymasterAndData: abi.encodePacked(address(paymaster)), - signature: "" - }); - - // Sign user operation. - bytes32 userOpHash = entryPoint.getUserOpHash(op); - bytes32 fullHash = SCALibrary._getUserOpFullHash(userOpHash, toDeployAddress); - (uint8 v, bytes32 r, bytes32 s) = vm.sign(END_USER_PKEY, fullHash); - op.signature = abi.encodePacked(r, s, v - 27); - - // Deposit funds for the transaction. - entryPoint.depositTo{value: 10 ether}(address(paymaster)); - - // Execute the user operation. - UserOperation[] memory operations = new UserOperation[](1); - operations[0] = op; - entryPoint.handleOps(operations, payable(END_USER)); - - // Assert that the greeting was set. - assertEq("good day", Greeter(greeter).getGreeting()); - assertEq(SCA(toDeployAddress).s_nonce(), uint256(1)); - } - - /// @dev Test case for a VRF Request via LINK token paymaster and an SCA. - function testEIP712EIP4337AndCreateSmartContractAccountWithPaymasterForVRFRequest() public { - // Pre-calculate user smart contract account address. - SmartContractAccountFactory factory = new SmartContractAccountFactory(); - address toDeployAddress = SmartContractAccountHelper.calculateSmartContractAccountAddress( - END_USER, - ENTRY_POINT, - address(factory) - ); - - // Construct initCode byte array. - bytes memory fullInitializeCode = SmartContractAccountHelper.getInitCode(address(factory), END_USER, ENTRY_POINT); - - // Create the calldata for a VRF request. - bytes32 keyhash = bytes32(uint256(123)); - uint256 fee = 1 ether; - bytes memory encodedVRFRequestCallData = bytes.concat( - VRFConsumer.doRequestRandomness.selector, - abi.encode(keyhash, fee) - ); - - // Create the VRF Contracts - MockLinkToken linkToken = new MockLinkToken(); - VRFCoordinatorMock vrfCoordinator = new VRFCoordinatorMock(address(linkToken)); - VRFConsumer vrfConsumer = new VRFConsumer(address(vrfCoordinator), address(linkToken)); - - // Produce the final full end-tx encoding, to be used as calldata in the user operation. - bytes memory fullEncoding = SmartContractAccountHelper.getFullEndTxEncoding( - address(vrfConsumer), // end-contract - uint256(0), // value - 0, // timeout (seconds) - encodedVRFRequestCallData - ); - - // Create Link token, and deposit into paymaster. - Paymaster paymaster = new Paymaster(LinkTokenInterface(address(linkToken)), linkEthFeed, ENTRY_POINT); - linkToken.transferAndCall(address(paymaster), 1000 ether, abi.encode(address(toDeployAddress))); - - // Construct direct funding data. - SCALibrary.DirectFundingData memory directFundingData = SCALibrary.DirectFundingData({ - recipient: address(vrfConsumer), - topupThreshold: 1, - topupAmount: 10 ether - }); - - // Construct the user operation. - UserOperation memory op = UserOperation({ - sender: toDeployAddress, - nonce: 0, - initCode: fullInitializeCode, - callData: fullEncoding, - callGasLimit: 200_000, - verificationGasLimit: 1_000_000, - preVerificationGas: 10_000, - maxFeePerGas: 10, - maxPriorityFeePerGas: 10, - paymasterAndData: abi.encodePacked(address(paymaster), uint8(0), abi.encode(directFundingData)), - signature: "" - }); - - // Sign user operation. - bytes32 fullHash = SCALibrary._getUserOpFullHash(entryPoint.getUserOpHash(op), toDeployAddress); - op.signature = getSignature(fullHash); - - // Deposit funds for the transaction. - entryPoint.depositTo{value: 10 ether}(address(paymaster)); - - // Assert correct log is emitted for the end-contract vrf request. - vm.expectEmit(true, true, true, true); - emit RandomnessRequest( - address(vrfConsumer), - keyhash, - 0, // seed - we use a zero seed - fee - ); - - // Execute the user operation. - UserOperation[] memory operations = new UserOperation[](1); - operations[0] = op; - - // Execute user operation and ensure correct outcome. - entryPoint.handleOps(operations, payable(END_USER)); - assertEq(SCA(toDeployAddress).s_nonce(), uint256(1)); - } - - function getSignature(bytes32 h) internal view returns (bytes memory) { - (uint8 v, bytes32 r, bytes32 s) = vm.sign(END_USER_PKEY, h); - return abi.encodePacked(r, s, v - 27); - } -} diff --git a/contracts/src/v0.8/vendor/entrypoint/core/EntryPoint.sol b/contracts/src/v0.8/vendor/entrypoint/core/EntryPoint.sol deleted file mode 100644 index 86a34b07bf7..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/core/EntryPoint.sol +++ /dev/null @@ -1,861 +0,0 @@ -/** - ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation. - ** Only one instance required on each chain. - **/ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -/* solhint-disable avoid-low-level-calls */ -/* solhint-disable no-inline-assembly */ - -import "../interfaces/IAccount.sol"; -import "../interfaces/IPaymaster.sol"; -import "../interfaces/IEntryPoint.sol"; - -import "../utils/Exec.sol"; -import "./StakeManager.sol"; -import "./SenderCreator.sol"; -import "./Helpers.sol"; - -contract EntryPoint is IEntryPoint, StakeManager { - using UserOperationLib for UserOperation; - - SenderCreator private immutable senderCreator = new SenderCreator(); - - // internal value used during simulation: need to query aggregator. - address private constant SIMULATE_FIND_AGGREGATOR = address(1); - - // marker for inner call revert on out of gas - bytes32 private constant INNER_OUT_OF_GAS = hex"deaddead"; - - uint256 private constant REVERT_REASON_MAX_LEN = 2048; - - /** - * for simulation purposes, validateUserOp (and validatePaymasterUserOp) must return this value - * in case of signature failure, instead of revert. - */ - uint256 public constant SIG_VALIDATION_FAILED = 1; - - /** - * compensate the caller's beneficiary address with the collected fees of all UserOperations. - * @param beneficiary the address to receive the fees - * @param amount amount to transfer. - */ - function _compensate(address payable beneficiary, uint256 amount) internal { - require(beneficiary != address(0), "AA90 invalid beneficiary"); - (bool success, ) = beneficiary.call{value: amount}(""); - require(success, "AA91 failed send to beneficiary"); - } - - /** - * execute a user op - * @param opIndex index into the opInfo array - * @param userOp the userOp to execute - * @param opInfo the opInfo filled by validatePrepayment for this userOp. - * @return collected the total amount this userOp paid. - */ - function _executeUserOp( - uint256 opIndex, - UserOperation calldata userOp, - UserOpInfo memory opInfo - ) private returns (uint256 collected) { - uint256 preGas = gasleft(); - bytes memory context = getMemoryBytesFromOffset(opInfo.contextOffset); - - try this.innerHandleOp(userOp.callData, opInfo, context) returns ( - uint256 _actualGasCost - ) { - collected = _actualGasCost; - } catch { - bytes32 innerRevertCode; - assembly { - returndatacopy(0, 0, 32) - innerRevertCode := mload(0) - } - // handleOps was called with gas limit too low. abort entire bundle. - if (innerRevertCode == INNER_OUT_OF_GAS) { - //report paymaster, since if it is not deliberately caused by the bundler, - // it must be a revert caused by paymaster. - revert FailedOp(opIndex, "AA95 out of gas"); - } - - uint256 actualGas = preGas - gasleft() + opInfo.preOpGas; - collected = _handlePostOp( - opIndex, - IPaymaster.PostOpMode.postOpReverted, - opInfo, - context, - actualGas - ); - } - } - - /** - * Execute a batch of UserOperations. - * no signature aggregator is used. - * if any account requires an aggregator (that is, it returned an aggregator when - * performing simulateValidation), then handleAggregatedOps() must be used instead. - * @param ops the operations to execute - * @param beneficiary the address to receive the fees - */ - function handleOps( - UserOperation[] calldata ops, - address payable beneficiary - ) public { - uint256 opslen = ops.length; - UserOpInfo[] memory opInfos = new UserOpInfo[](opslen); - - unchecked { - for (uint256 i = 0; i < opslen; i++) { - UserOpInfo memory opInfo = opInfos[i]; - ( - uint256 validationData, - uint256 pmValidationData - ) = _validatePrepayment(i, ops[i], opInfo); - _validateAccountAndPaymasterValidationData( - i, - validationData, - pmValidationData, - address(0) - ); - } - - uint256 collected = 0; - - for (uint256 i = 0; i < opslen; i++) { - collected += _executeUserOp(i, ops[i], opInfos[i]); - } - - _compensate(beneficiary, collected); - } //unchecked - } - - /** - * Execute a batch of UserOperation with Aggregators - * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts) - * @param beneficiary the address to receive the fees - */ - function handleAggregatedOps( - UserOpsPerAggregator[] calldata opsPerAggregator, - address payable beneficiary - ) public { - uint256 opasLen = opsPerAggregator.length; - uint256 totalOps = 0; - for (uint256 i = 0; i < opasLen; i++) { - UserOpsPerAggregator calldata opa = opsPerAggregator[i]; - UserOperation[] calldata ops = opa.userOps; - IAggregator aggregator = opa.aggregator; - - //address(1) is special marker of "signature error" - require( - address(aggregator) != address(1), - "AA96 invalid aggregator" - ); - - if (address(aggregator) != address(0)) { - // solhint-disable-next-line no-empty-blocks - try aggregator.validateSignatures(ops, opa.signature) {} catch { - revert SignatureValidationFailed(address(aggregator)); - } - } - - totalOps += ops.length; - } - - UserOpInfo[] memory opInfos = new UserOpInfo[](totalOps); - - uint256 opIndex = 0; - for (uint256 a = 0; a < opasLen; a++) { - UserOpsPerAggregator calldata opa = opsPerAggregator[a]; - UserOperation[] calldata ops = opa.userOps; - IAggregator aggregator = opa.aggregator; - - uint256 opslen = ops.length; - for (uint256 i = 0; i < opslen; i++) { - UserOpInfo memory opInfo = opInfos[opIndex]; - ( - uint256 validationData, - uint256 paymasterValidationData - ) = _validatePrepayment(opIndex, ops[i], opInfo); - _validateAccountAndPaymasterValidationData( - i, - validationData, - paymasterValidationData, - address(aggregator) - ); - opIndex++; - } - } - - uint256 collected = 0; - opIndex = 0; - for (uint256 a = 0; a < opasLen; a++) { - UserOpsPerAggregator calldata opa = opsPerAggregator[a]; - emit SignatureAggregatorChanged(address(opa.aggregator)); - UserOperation[] calldata ops = opa.userOps; - uint256 opslen = ops.length; - - for (uint256 i = 0; i < opslen; i++) { - collected += _executeUserOp(opIndex, ops[i], opInfos[opIndex]); - opIndex++; - } - } - emit SignatureAggregatorChanged(address(0)); - - _compensate(beneficiary, collected); - } - - /// @inheritdoc IEntryPoint - function simulateHandleOp( - UserOperation calldata op, - address target, - bytes calldata targetCallData - ) external override { - UserOpInfo memory opInfo; - _simulationOnlyValidations(op); - ( - uint256 validationData, - uint256 paymasterValidationData - ) = _validatePrepayment(0, op, opInfo); - ValidationData memory data = _intersectTimeRange( - validationData, - paymasterValidationData - ); - - numberMarker(); - uint256 paid = _executeUserOp(0, op, opInfo); - numberMarker(); - bool targetSuccess; - bytes memory targetResult; - if (target != address(0)) { - (targetSuccess, targetResult) = target.call(targetCallData); - } - revert ExecutionResult( - opInfo.preOpGas, - paid, - data.validAfter, - data.validUntil, - targetSuccess, - targetResult - ); - } - - // A memory copy of UserOp static fields only. - // Excluding: callData, initCode and signature. Replacing paymasterAndData with paymaster. - struct MemoryUserOp { - address sender; - uint256 nonce; - uint256 callGasLimit; - uint256 verificationGasLimit; - uint256 preVerificationGas; - address paymaster; - uint256 maxFeePerGas; - uint256 maxPriorityFeePerGas; - } - - struct UserOpInfo { - MemoryUserOp mUserOp; - bytes32 userOpHash; - uint256 prefund; - uint256 contextOffset; - uint256 preOpGas; - } - - /** - * inner function to handle a UserOperation. - * Must be declared "external" to open a call context, but it can only be called by handleOps. - */ - function innerHandleOp( - bytes memory callData, - UserOpInfo memory opInfo, - bytes calldata context - ) external returns (uint256 actualGasCost) { - uint256 preGas = gasleft(); - require(msg.sender == address(this), "AA92 internal call only"); - MemoryUserOp memory mUserOp = opInfo.mUserOp; - - uint256 callGasLimit = mUserOp.callGasLimit; - unchecked { - // handleOps was called with gas limit too low. abort entire bundle. - if ( - gasleft() < callGasLimit + mUserOp.verificationGasLimit + 5000 - ) { - assembly { - mstore(0, INNER_OUT_OF_GAS) - revert(0, 32) - } - } - } - - IPaymaster.PostOpMode mode = IPaymaster.PostOpMode.opSucceeded; - if (callData.length > 0) { - bool success = Exec.call(mUserOp.sender, 0, callData, callGasLimit); - if (!success) { - bytes memory result = Exec.getReturnData(REVERT_REASON_MAX_LEN); - if (result.length > 0) { - emit UserOperationRevertReason( - opInfo.userOpHash, - mUserOp.sender, - mUserOp.nonce, - result - ); - } - mode = IPaymaster.PostOpMode.opReverted; - } - } - - unchecked { - uint256 actualGas = preGas - gasleft() + opInfo.preOpGas; - //note: opIndex is ignored (relevant only if mode==postOpReverted, which is only possible outside of innerHandleOp) - return _handlePostOp(0, mode, opInfo, context, actualGas); - } - } - - /** - * generate a request Id - unique identifier for this request. - * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid. - */ - function getUserOpHash(UserOperation calldata userOp) - public - view - returns (bytes32) - { - return - keccak256(abi.encode(userOp.hash(), address(this), block.chainid)); - } - - /** - * copy general fields from userOp into the memory opInfo structure. - */ - function _copyUserOpToMemory( - UserOperation calldata userOp, - MemoryUserOp memory mUserOp - ) internal pure { - mUserOp.sender = userOp.sender; - mUserOp.nonce = userOp.nonce; - mUserOp.callGasLimit = userOp.callGasLimit; - mUserOp.verificationGasLimit = userOp.verificationGasLimit; - mUserOp.preVerificationGas = userOp.preVerificationGas; - mUserOp.maxFeePerGas = userOp.maxFeePerGas; - mUserOp.maxPriorityFeePerGas = userOp.maxPriorityFeePerGas; - bytes calldata paymasterAndData = userOp.paymasterAndData; - if (paymasterAndData.length > 0) { - require( - paymasterAndData.length >= 20, - "AA93 invalid paymasterAndData" - ); - mUserOp.paymaster = address(bytes20(paymasterAndData[:20])); - } else { - mUserOp.paymaster = address(0); - } - } - - /** - * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp. - * @dev this method always revert. Successful result is ValidationResult error. other errors are failures. - * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data. - * @param userOp the user operation to validate. - */ - function simulateValidation(UserOperation calldata userOp) external { - UserOpInfo memory outOpInfo; - - _simulationOnlyValidations(userOp); - ( - uint256 validationData, - uint256 paymasterValidationData - ) = _validatePrepayment(0, userOp, outOpInfo); - StakeInfo memory paymasterInfo = _getStakeInfo( - outOpInfo.mUserOp.paymaster - ); - StakeInfo memory senderInfo = _getStakeInfo(outOpInfo.mUserOp.sender); - StakeInfo memory factoryInfo; - { - bytes calldata initCode = userOp.initCode; - address factory = initCode.length >= 20 - ? address(bytes20(initCode[0:20])) - : address(0); - factoryInfo = _getStakeInfo(factory); - } - - ValidationData memory data = _intersectTimeRange( - validationData, - paymasterValidationData - ); - address aggregator = data.aggregator; - bool sigFailed = aggregator == address(1); - ReturnInfo memory returnInfo = ReturnInfo( - outOpInfo.preOpGas, - outOpInfo.prefund, - sigFailed, - data.validAfter, - data.validUntil, - getMemoryBytesFromOffset(outOpInfo.contextOffset) - ); - - if (aggregator != address(0) && aggregator != address(1)) { - AggregatorStakeInfo memory aggregatorInfo = AggregatorStakeInfo( - aggregator, - _getStakeInfo(aggregator) - ); - revert ValidationResultWithAggregation( - returnInfo, - senderInfo, - factoryInfo, - paymasterInfo, - aggregatorInfo - ); - } - revert ValidationResult( - returnInfo, - senderInfo, - factoryInfo, - paymasterInfo - ); - } - - function _getRequiredPrefund(MemoryUserOp memory mUserOp) - internal - pure - returns (uint256 requiredPrefund) - { - unchecked { - //when using a Paymaster, the verificationGasLimit is used also to as a limit for the postOp call. - // our security model might call postOp eventually twice - uint256 mul = mUserOp.paymaster != address(0) ? 3 : 1; - uint256 requiredGas = mUserOp.callGasLimit + - mUserOp.verificationGasLimit * - mul + - mUserOp.preVerificationGas; - - requiredPrefund = requiredGas * mUserOp.maxFeePerGas; - } - } - - // create the sender's contract if needed. - function _createSenderIfNeeded( - uint256 opIndex, - UserOpInfo memory opInfo, - bytes calldata initCode - ) internal { - if (initCode.length != 0) { - address sender = opInfo.mUserOp.sender; - if (sender.code.length != 0) - revert FailedOp(opIndex, "AA10 sender already constructed"); - address sender1 = senderCreator.createSender{ - gas: opInfo.mUserOp.verificationGasLimit - }(initCode); - if (sender1 == address(0)) - revert FailedOp(opIndex, "AA13 initCode failed or OOG"); - if (sender1 != sender) - revert FailedOp(opIndex, "AA14 initCode must return sender"); - if (sender1.code.length == 0) - revert FailedOp(opIndex, "AA15 initCode must create sender"); - address factory = address(bytes20(initCode[0:20])); - emit AccountDeployed( - opInfo.userOpHash, - sender, - factory, - opInfo.mUserOp.paymaster - ); - } - } - - /** - * Get counterfactual sender address. - * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation. - * this method always revert, and returns the address in SenderAddressResult error - * @param initCode the constructor code to be passed into the UserOperation. - */ - function getSenderAddress(bytes calldata initCode) public { - revert SenderAddressResult(senderCreator.createSender(initCode)); - } - - function _simulationOnlyValidations(UserOperation calldata userOp) - internal - view - { - // solhint-disable-next-line no-empty-blocks - try - this._validateSenderAndPaymaster( - userOp.initCode, - userOp.sender, - userOp.paymasterAndData - ) - {} catch Error(string memory revertReason) { - if (bytes(revertReason).length != 0) { - revert FailedOp(0, revertReason); - } - } - } - - /** - * Called only during simulation. - * This function always reverts to prevent warm/cold storage differentiation in simulation vs execution. - */ - function _validateSenderAndPaymaster( - bytes calldata initCode, - address sender, - bytes calldata paymasterAndData - ) external view { - if (initCode.length == 0 && sender.code.length == 0) { - // it would revert anyway. but give a meaningful message - revert("AA20 account not deployed"); - } - if (paymasterAndData.length >= 20) { - address paymaster = address(bytes20(paymasterAndData[0:20])); - if (paymaster.code.length == 0) { - // it would revert anyway. but give a meaningful message - revert("AA30 paymaster not deployed"); - } - } - // always revert - revert(""); - } - - /** - * call account.validateUserOp. - * revert (with FailedOp) in case validateUserOp reverts, or account didn't send required prefund. - * decrement account's deposit if needed - */ - function _validateAccountPrepayment( - uint256 opIndex, - UserOperation calldata op, - UserOpInfo memory opInfo, - uint256 requiredPrefund - ) - internal - returns ( - uint256 gasUsedByValidateAccountPrepayment, - uint256 validationData - ) - { - unchecked { - uint256 preGas = gasleft(); - MemoryUserOp memory mUserOp = opInfo.mUserOp; - address sender = mUserOp.sender; - _createSenderIfNeeded(opIndex, opInfo, op.initCode); - address paymaster = mUserOp.paymaster; - numberMarker(); - uint256 missingAccountFunds = 0; - if (paymaster == address(0)) { - uint256 bal = balanceOf(sender); - missingAccountFunds = bal > requiredPrefund - ? 0 - : requiredPrefund - bal; - } - try - IAccount(sender).validateUserOp{ - gas: mUserOp.verificationGasLimit - }(op, opInfo.userOpHash, missingAccountFunds) - returns (uint256 _validationData) { - validationData = _validationData; - } catch Error(string memory revertReason) { - revert FailedOp( - opIndex, - string.concat("AA23 reverted: ", revertReason) - ); - } catch { - revert FailedOp(opIndex, "AA23 reverted (or OOG)"); - } - if (paymaster == address(0)) { - DepositInfo storage senderInfo = deposits[sender]; - uint256 deposit = senderInfo.deposit; - if (requiredPrefund > deposit) { - revert FailedOp(opIndex, "AA21 didn't pay prefund"); - } - senderInfo.deposit = uint112(deposit - requiredPrefund); - } - gasUsedByValidateAccountPrepayment = preGas - gasleft(); - } - } - - /** - * In case the request has a paymaster: - * Validate paymaster has enough deposit. - * Call paymaster.validatePaymasterUserOp. - * Revert with proper FailedOp in case paymaster reverts. - * Decrement paymaster's deposit - */ - function _validatePaymasterPrepayment( - uint256 opIndex, - UserOperation calldata op, - UserOpInfo memory opInfo, - uint256 requiredPreFund, - uint256 gasUsedByValidateAccountPrepayment - ) internal returns (bytes memory context, uint256 validationData) { - unchecked { - MemoryUserOp memory mUserOp = opInfo.mUserOp; - uint256 verificationGasLimit = mUserOp.verificationGasLimit; - require( - verificationGasLimit > gasUsedByValidateAccountPrepayment, - "AA41 too little verificationGas" - ); - uint256 gas = verificationGasLimit - - gasUsedByValidateAccountPrepayment; - - address paymaster = mUserOp.paymaster; - DepositInfo storage paymasterInfo = deposits[paymaster]; - uint256 deposit = paymasterInfo.deposit; - if (deposit < requiredPreFund) { - revert FailedOp(opIndex, "AA31 paymaster deposit too low"); - } - paymasterInfo.deposit = uint112(deposit - requiredPreFund); - try - IPaymaster(paymaster).validatePaymasterUserOp{gas: gas}( - op, - opInfo.userOpHash, - requiredPreFund - ) - returns (bytes memory _context, uint256 _validationData) { - context = _context; - validationData = _validationData; - } catch Error(string memory revertReason) { - revert FailedOp( - opIndex, - string.concat("AA33 reverted: ", revertReason) - ); - } catch { - revert FailedOp(opIndex, "AA33 reverted (or OOG)"); - } - } - } - - /** - * revert if either account validationData or paymaster validationData is expired - */ - function _validateAccountAndPaymasterValidationData( - uint256 opIndex, - uint256 validationData, - uint256 paymasterValidationData, - address expectedAggregator - ) internal view { - (address aggregator, bool outOfTimeRange) = _getValidationData( - validationData - ); - if (expectedAggregator != aggregator) { - revert FailedOp(opIndex, "AA24 signature error"); - } - if (outOfTimeRange) { - revert FailedOp(opIndex, "AA22 expired or not due"); - } - //pmAggregator is not a real signature aggregator: we don't have logic to handle it as address. - // non-zero address means that the paymaster fails due to some signature check (which is ok only during estimation) - address pmAggregator; - (pmAggregator, outOfTimeRange) = _getValidationData( - paymasterValidationData - ); - if (pmAggregator != address(0)) { - revert FailedOp(opIndex, "AA34 signature error"); - } - if (outOfTimeRange) { - revert FailedOp(opIndex, "AA32 paymaster expired or not due"); - } - } - - function _getValidationData(uint256 validationData) - internal - view - returns (address aggregator, bool outOfTimeRange) - { - if (validationData == 0) { - return (address(0), false); - } - ValidationData memory data = _parseValidationData(validationData); - // solhint-disable-next-line not-rely-on-time - outOfTimeRange = - block.timestamp > data.validUntil || - block.timestamp < data.validAfter; - aggregator = data.aggregator; - } - - /** - * validate account and paymaster (if defined). - * also make sure total validation doesn't exceed verificationGasLimit - * this method is called off-chain (simulateValidation()) and on-chain (from handleOps) - * @param opIndex the index of this userOp into the "opInfos" array - * @param userOp the userOp to validate - */ - function _validatePrepayment( - uint256 opIndex, - UserOperation calldata userOp, - UserOpInfo memory outOpInfo - ) - private - returns (uint256 validationData, uint256 paymasterValidationData) - { - uint256 preGas = gasleft(); - MemoryUserOp memory mUserOp = outOpInfo.mUserOp; - _copyUserOpToMemory(userOp, mUserOp); - outOpInfo.userOpHash = getUserOpHash(userOp); - - // validate all numeric values in userOp are well below 128 bit, so they can safely be added - // and multiplied without causing overflow - uint256 maxGasValues = mUserOp.preVerificationGas | - mUserOp.verificationGasLimit | - mUserOp.callGasLimit | - userOp.maxFeePerGas | - userOp.maxPriorityFeePerGas; - require(maxGasValues <= type(uint120).max, "AA94 gas values overflow"); - - uint256 gasUsedByValidateAccountPrepayment; - uint256 requiredPreFund = _getRequiredPrefund(mUserOp); - ( - gasUsedByValidateAccountPrepayment, - validationData - ) = _validateAccountPrepayment( - opIndex, - userOp, - outOpInfo, - requiredPreFund - ); - //a "marker" where account opcode validation is done and paymaster opcode validation is about to start - // (used only by off-chain simulateValidation) - numberMarker(); - - bytes memory context; - if (mUserOp.paymaster != address(0)) { - (context, paymasterValidationData) = _validatePaymasterPrepayment( - opIndex, - userOp, - outOpInfo, - requiredPreFund, - gasUsedByValidateAccountPrepayment - ); - } - unchecked { - uint256 gasUsed = preGas - gasleft(); - - if (userOp.verificationGasLimit < gasUsed) { - revert FailedOp(opIndex, "AA40 over verificationGasLimit"); - } - outOpInfo.prefund = requiredPreFund; - outOpInfo.contextOffset = getOffsetOfMemoryBytes(context); - outOpInfo.preOpGas = preGas - gasleft() + userOp.preVerificationGas; - } - } - - /** - * process post-operation. - * called just after the callData is executed. - * if a paymaster is defined and its validation returned a non-empty context, its postOp is called. - * the excess amount is refunded to the account (or paymaster - if it was used in the request) - * @param opIndex index in the batch - * @param mode - whether is called from innerHandleOp, or outside (postOpReverted) - * @param opInfo userOp fields and info collected during validation - * @param context the context returned in validatePaymasterUserOp - * @param actualGas the gas used so far by this user operation - */ - function _handlePostOp( - uint256 opIndex, - IPaymaster.PostOpMode mode, - UserOpInfo memory opInfo, - bytes memory context, - uint256 actualGas - ) private returns (uint256 actualGasCost) { - uint256 preGas = gasleft(); - unchecked { - address refundAddress; - MemoryUserOp memory mUserOp = opInfo.mUserOp; - uint256 gasPrice = getUserOpGasPrice(mUserOp); - - address paymaster = mUserOp.paymaster; - if (paymaster == address(0)) { - refundAddress = mUserOp.sender; - } else { - refundAddress = paymaster; - if (context.length > 0) { - actualGasCost = actualGas * gasPrice; - if (mode != IPaymaster.PostOpMode.postOpReverted) { - IPaymaster(paymaster).postOp{ - gas: mUserOp.verificationGasLimit - }(mode, context, actualGasCost); - } else { - // solhint-disable-next-line no-empty-blocks - try - IPaymaster(paymaster).postOp{ - gas: mUserOp.verificationGasLimit - }(mode, context, actualGasCost) - {} catch Error(string memory reason) { - revert FailedOp( - opIndex, - string.concat("AA50 postOp reverted: ", reason) - ); - } catch { - revert FailedOp(opIndex, "AA50 postOp revert"); - } - } - } - } - actualGas += preGas - gasleft(); - actualGasCost = actualGas * gasPrice; - if (opInfo.prefund < actualGasCost) { - revert FailedOp(opIndex, "AA51 prefund below actualGasCost"); - } - uint256 refund = opInfo.prefund - actualGasCost; - _incrementDeposit(refundAddress, refund); - bool success = mode == IPaymaster.PostOpMode.opSucceeded; - emit UserOperationEvent( - opInfo.userOpHash, - mUserOp.sender, - mUserOp.paymaster, - mUserOp.nonce, - success, - actualGasCost, - actualGas - ); - } // unchecked - } - - /** - * the gas price this UserOp agrees to pay. - * relayer/block builder might submit the TX with higher priorityFee, but the user should not - */ - function getUserOpGasPrice(MemoryUserOp memory mUserOp) - internal - view - returns (uint256) - { - unchecked { - uint256 maxFeePerGas = mUserOp.maxFeePerGas; - uint256 maxPriorityFeePerGas = mUserOp.maxPriorityFeePerGas; - if (maxFeePerGas == maxPriorityFeePerGas) { - //legacy mode (for networks that don't support basefee opcode) - return maxFeePerGas; - } - return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); - } - } - - function min(uint256 a, uint256 b) internal pure returns (uint256) { - return a < b ? a : b; - } - - function getOffsetOfMemoryBytes(bytes memory data) - internal - pure - returns (uint256 offset) - { - assembly { - offset := data - } - } - - function getMemoryBytesFromOffset(uint256 offset) - internal - pure - returns (bytes memory data) - { - assembly { - data := offset - } - } - - //place the NUMBER opcode in the code. - // this is used as a marker during simulation, as this OP is completely banned from the simulated code of the - // account and paymaster. - function numberMarker() internal view { - assembly { - mstore(0, number()) - } - } -} diff --git a/contracts/src/v0.8/vendor/entrypoint/core/Helpers.sol b/contracts/src/v0.8/vendor/entrypoint/core/Helpers.sol deleted file mode 100644 index 71a6dc3d16b..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/core/Helpers.sol +++ /dev/null @@ -1,68 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -/** - * returned data from validateUserOp. - * validateUserOp returns a uint256, with is created by `_packedValidationData` and parsed by `_parseValidationData` - * @param aggregator - address(0) - the account validated the signature by itself. - * address(1) - the account failed to validate the signature. - * otherwise - this is an address of a signature aggregator that must be used to validate the signature. - * @param validAfter - this UserOp is valid only after this timestamp. - * @param validaUntil - this UserOp is valid only up to this timestamp. - */ -struct ValidationData { - address aggregator; - uint48 validAfter; - uint48 validUntil; -} - -//extract sigFailed, validAfter, validUntil. -// also convert zero validUntil to type(uint48).max -function _parseValidationData(uint validationData) pure returns (ValidationData memory data) { - address aggregator = address(uint160(validationData)); - uint48 validUntil = uint48(validationData >> 160); - if (validUntil == 0) { - validUntil = type(uint48).max; - } - uint48 validAfter = uint48(validationData >> (48 + 160)); - return ValidationData(aggregator, validAfter, validUntil); -} - -// intersect account and paymaster ranges. -function _intersectTimeRange( - uint256 validationData, - uint256 paymasterValidationData -) pure returns (ValidationData memory) { - ValidationData memory accountValidationData = _parseValidationData(validationData); - ValidationData memory pmValidationData = _parseValidationData(paymasterValidationData); - address aggregator = accountValidationData.aggregator; - if (aggregator == address(0)) { - aggregator = pmValidationData.aggregator; - } - uint48 validAfter = accountValidationData.validAfter; - uint48 validUntil = accountValidationData.validUntil; - uint48 pmValidAfter = pmValidationData.validAfter; - uint48 pmValidUntil = pmValidationData.validUntil; - - if (validAfter < pmValidAfter) validAfter = pmValidAfter; - if (validUntil > pmValidUntil) validUntil = pmValidUntil; - return ValidationData(aggregator, validAfter, validUntil); -} - -/** - * helper to pack the return value for validateUserOp - * @param data - the ValidationData to pack - */ -function _packValidationData(ValidationData memory data) pure returns (uint256) { - return uint160(data.aggregator) | (uint256(data.validUntil) << 160) | (uint256(data.validAfter) << (160 + 48)); -} - -/** - * helper to pack the return value for validateUserOp, when not using an aggregator - * @param sigFailed - true for signature failure, false for success - * @param validUntil last timestamp this UserOperation is valid (or zero for infinite) - * @param validAfter first timestamp this UserOperation is valid - */ -function _packValidationData(bool sigFailed, uint48 validUntil, uint48 validAfter) pure returns (uint256) { - return (sigFailed ? 1 : 0) | (uint256(validUntil) << 160) | (uint256(validAfter) << (160 + 48)); -} diff --git a/contracts/src/v0.8/vendor/entrypoint/core/SenderCreator.sol b/contracts/src/v0.8/vendor/entrypoint/core/SenderCreator.sol deleted file mode 100644 index 36fad7b91f1..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/core/SenderCreator.sol +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -/** - * helper contract for EntryPoint, to call userOp.initCode from a "neutral" address, - * which is explicitly not the entryPoint itself. - */ -contract SenderCreator { - - /** - * call the "initCode" factory to create and return the sender account address - * @param initCode the initCode value from a UserOp. contains 20 bytes of factory address, followed by calldata - * @return sender the returned address of the created account, or zero address on failure. - */ - function createSender(bytes calldata initCode) external returns (address sender) { - address factory = address(bytes20(initCode[0 : 20])); - bytes memory initCallData = initCode[20 :]; - bool success; - /* solhint-disable no-inline-assembly */ - assembly { - success := call(gas(), factory, 0, add(initCallData, 0x20), mload(initCallData), 0, 32) - sender := mload(0) - } - if (!success) { - sender = address(0); - } - } -} diff --git a/contracts/src/v0.8/vendor/entrypoint/core/StakeManager.sol b/contracts/src/v0.8/vendor/entrypoint/core/StakeManager.sol deleted file mode 100644 index e5ca2b97dd4..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/core/StakeManager.sol +++ /dev/null @@ -1,124 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.12; - -import "../interfaces/IStakeManager.sol"; - -/* solhint-disable avoid-low-level-calls */ -/* solhint-disable not-rely-on-time */ -/** - * manage deposits and stakes. - * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account) - * stake is value locked for at least "unstakeDelay" by a paymaster. - */ -abstract contract StakeManager is IStakeManager { - - /// maps paymaster to their deposits and stakes - mapping(address => DepositInfo) public deposits; - - /// @inheritdoc IStakeManager - function getDepositInfo(address account) public view returns (DepositInfo memory info) { - return deposits[account]; - } - - // internal method to return just the stake info - function _getStakeInfo(address addr) internal view returns (StakeInfo memory info) { - DepositInfo storage depositInfo = deposits[addr]; - info.stake = depositInfo.stake; - info.unstakeDelaySec = depositInfo.unstakeDelaySec; - } - - /// return the deposit (for gas payment) of the account - function balanceOf(address account) public view returns (uint256) { - return deposits[account].deposit; - } - - receive() external payable { - depositTo(msg.sender); - } - - function _incrementDeposit(address account, uint256 amount) internal { - DepositInfo storage info = deposits[account]; - uint256 newAmount = info.deposit + amount; - require(newAmount <= type(uint112).max, "deposit overflow"); - info.deposit = uint112(newAmount); - } - - /** - * add to the deposit of the given account - */ - function depositTo(address account) public payable { - _incrementDeposit(account, msg.value); - DepositInfo storage info = deposits[account]; - emit Deposited(account, info.deposit); - } - - /** - * add to the account's stake - amount and delay - * any pending unstake is first cancelled. - * @param unstakeDelaySec the new lock duration before the deposit can be withdrawn. - */ - function addStake(uint32 unstakeDelaySec) public payable { - DepositInfo storage info = deposits[msg.sender]; - require(unstakeDelaySec > 0, "must specify unstake delay"); - require(unstakeDelaySec >= info.unstakeDelaySec, "cannot decrease unstake time"); - uint256 stake = info.stake + msg.value; - require(stake > 0, "no stake specified"); - require(stake <= type(uint112).max, "stake overflow"); - deposits[msg.sender] = DepositInfo( - info.deposit, - true, - uint112(stake), - unstakeDelaySec, - 0 - ); - emit StakeLocked(msg.sender, stake, unstakeDelaySec); - } - - /** - * attempt to unlock the stake. - * the value can be withdrawn (using withdrawStake) after the unstake delay. - */ - function unlockStake() external { - DepositInfo storage info = deposits[msg.sender]; - require(info.unstakeDelaySec != 0, "not staked"); - require(info.staked, "already unstaking"); - uint48 withdrawTime = uint48(block.timestamp) + info.unstakeDelaySec; - info.withdrawTime = withdrawTime; - info.staked = false; - emit StakeUnlocked(msg.sender, withdrawTime); - } - - - /** - * withdraw from the (unlocked) stake. - * must first call unlockStake and wait for the unstakeDelay to pass - * @param withdrawAddress the address to send withdrawn value. - */ - function withdrawStake(address payable withdrawAddress) external { - DepositInfo storage info = deposits[msg.sender]; - uint256 stake = info.stake; - require(stake > 0, "No stake to withdraw"); - require(info.withdrawTime > 0, "must call unlockStake() first"); - require(info.withdrawTime <= block.timestamp, "Stake withdrawal is not due"); - info.unstakeDelaySec = 0; - info.withdrawTime = 0; - info.stake = 0; - emit StakeWithdrawn(msg.sender, withdrawAddress, stake); - (bool success,) = withdrawAddress.call{value : stake}(""); - require(success, "failed to withdraw stake"); - } - - /** - * withdraw from the deposit. - * @param withdrawAddress the address to send withdrawn value. - * @param withdrawAmount the amount to withdraw. - */ - function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external { - DepositInfo storage info = deposits[msg.sender]; - require(withdrawAmount <= info.deposit, "Withdraw amount too large"); - info.deposit = uint112(info.deposit - withdrawAmount); - emit Withdrawn(msg.sender, withdrawAddress, withdrawAmount); - (bool success,) = withdrawAddress.call{value : withdrawAmount}(""); - require(success, "failed to withdraw"); - } -} diff --git a/contracts/src/v0.8/vendor/entrypoint/interfaces/IAccount.sol b/contracts/src/v0.8/vendor/entrypoint/interfaces/IAccount.sol deleted file mode 100644 index 1600de3d71e..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/interfaces/IAccount.sol +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -import "./UserOperation.sol"; - -interface IAccount { - - /** - * Validate user's signature and nonce - * the entryPoint will make the call to the recipient only if this validation call returns successfully. - * signature failure should be reported by returning SIG_VALIDATION_FAILED (1). - * This allows making a "simulation call" without a valid signature - * Other failures (e.g. nonce mismatch, or invalid signature format) should still revert to signal failure. - * - * @dev Must validate caller is the entryPoint. - * Must validate the signature and nonce - * @param userOp the operation that is about to be executed. - * @param userOpHash hash of the user's request data. can be used as the basis for signature. - * @param missingAccountFunds missing funds on the account's deposit in the entrypoint. - * This is the minimum amount to transfer to the sender(entryPoint) to be able to make the call. - * The excess is left as a deposit in the entrypoint, for future calls. - * can be withdrawn anytime using "entryPoint.withdrawTo()" - * In case there is a paymaster in the request (or the current deposit is high enough), this value will be zero. - * @return validationData packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode - * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure, - * otherwise, an address of an "authorizer" contract. - * <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite" - * <6-byte> validAfter - first timestamp this operation is valid - * If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure. - * Note that the validation code cannot use block.timestamp (or block.number) directly. - */ - function validateUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 missingAccountFunds) - external returns (uint256 validationData); -} diff --git a/contracts/src/v0.8/vendor/entrypoint/interfaces/IAggregator.sol b/contracts/src/v0.8/vendor/entrypoint/interfaces/IAggregator.sol deleted file mode 100644 index 086c6f32241..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/interfaces/IAggregator.sol +++ /dev/null @@ -1,36 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -import "./UserOperation.sol"; - -/** - * Aggregated Signatures validator. - */ -interface IAggregator { - - /** - * validate aggregated signature. - * revert if the aggregated signature does not match the given list of operations. - */ - function validateSignatures(UserOperation[] calldata userOps, bytes calldata signature) external view; - - /** - * validate signature of a single userOp - * This method is should be called by bundler after EntryPoint.simulateValidation() returns (reverts) with ValidationResultWithAggregation - * First it validates the signature over the userOp. Then it returns data to be used when creating the handleOps. - * @param userOp the userOperation received from the user. - * @return sigForUserOp the value to put into the signature field of the userOp when calling handleOps. - * (usually empty, unless account and aggregator support some kind of "multisig" - */ - function validateUserOpSignature(UserOperation calldata userOp) - external view returns (bytes memory sigForUserOp); - - /** - * aggregate multiple signatures into a single value. - * This method is called off-chain to calculate the signature to pass with handleOps() - * bundler MAY use optimized custom code perform this aggregation - * @param userOps array of UserOperations to collect the signatures from. - * @return aggregatedSignature the aggregated signature - */ - function aggregateSignatures(UserOperation[] calldata userOps) external view returns (bytes memory aggregatedSignature); -} diff --git a/contracts/src/v0.8/vendor/entrypoint/interfaces/IEntryPoint.sol b/contracts/src/v0.8/vendor/entrypoint/interfaces/IEntryPoint.sol deleted file mode 100644 index 22bb1b7a6e7..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/interfaces/IEntryPoint.sol +++ /dev/null @@ -1,197 +0,0 @@ -/** - ** Account-Abstraction (EIP-4337) singleton EntryPoint implementation. - ** Only one instance required on each chain. - **/ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -/* solhint-disable avoid-low-level-calls */ -/* solhint-disable no-inline-assembly */ -/* solhint-disable reason-string */ - -import "./UserOperation.sol"; -import "./IStakeManager.sol"; -import "./IAggregator.sol"; - -interface IEntryPoint is IStakeManager { - - /*** - * An event emitted after each successful request - * @param userOpHash - unique identifier for the request (hash its entire content, except signature). - * @param sender - the account that generates this request. - * @param paymaster - if non-null, the paymaster that pays for this request. - * @param nonce - the nonce value from the request. - * @param success - true if the sender transaction succeeded, false if reverted. - * @param actualGasCost - actual amount paid (by account or paymaster) for this UserOperation. - * @param actualGasUsed - total gas used by this UserOperation (including preVerification, creation, validation and execution). - */ - event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed); - - /** - * account "sender" was deployed. - * @param userOpHash the userOp that deployed this account. UserOperationEvent will follow. - * @param sender the account that is deployed - * @param factory the factory used to deploy this account (in the initCode) - * @param paymaster the paymaster used by this UserOp - */ - event AccountDeployed(bytes32 indexed userOpHash, address indexed sender, address factory, address paymaster); - - /** - * An event emitted if the UserOperation "callData" reverted with non-zero length - * @param userOpHash the request unique identifier. - * @param sender the sender of this request - * @param nonce the nonce used in the request - * @param revertReason - the return bytes from the (reverted) call to "callData". - */ - event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason); - - /** - * signature aggregator used by the following UserOperationEvents within this bundle. - */ - event SignatureAggregatorChanged(address indexed aggregator); - - /** - * a custom revert error of handleOps, to identify the offending op. - * NOTE: if simulateValidation passes successfully, there should be no reason for handleOps to fail on it. - * @param opIndex - index into the array of ops to the failed one (in simulateValidation, this is always zero) - * @param reason - revert reason - * The string starts with a unique code "AAmn", where "m" is "1" for factory, "2" for account and "3" for paymaster issues, - * so a failure can be attributed to the correct entity. - * Should be caught in off-chain handleOps simulation and not happen on-chain. - * Useful for mitigating DoS attempts against batchers or for troubleshooting of factory/account/paymaster reverts. - */ - error FailedOp(uint256 opIndex, string reason); - - /** - * error case when a signature aggregator fails to verify the aggregated signature it had created. - */ - error SignatureValidationFailed(address aggregator); - - /** - * Successful result from simulateValidation. - * @param returnInfo gas and time-range returned values - * @param senderInfo stake information about the sender - * @param factoryInfo stake information about the factory (if any) - * @param paymasterInfo stake information about the paymaster (if any) - */ - error ValidationResult(ReturnInfo returnInfo, - StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo); - - /** - * Successful result from simulateValidation, if the account returns a signature aggregator - * @param returnInfo gas and time-range returned values - * @param senderInfo stake information about the sender - * @param factoryInfo stake information about the factory (if any) - * @param paymasterInfo stake information about the paymaster (if any) - * @param aggregatorInfo signature aggregation info (if the account requires signature aggregator) - * bundler MUST use it to verify the signature, or reject the UserOperation - */ - error ValidationResultWithAggregation(ReturnInfo returnInfo, - StakeInfo senderInfo, StakeInfo factoryInfo, StakeInfo paymasterInfo, - AggregatorStakeInfo aggregatorInfo); - - /** - * return value of getSenderAddress - */ - error SenderAddressResult(address sender); - - /** - * return value of simulateHandleOp - */ - error ExecutionResult(uint256 preOpGas, uint256 paid, uint48 validAfter, uint48 validUntil, bool targetSuccess, bytes targetResult); - - //UserOps handled, per aggregator - struct UserOpsPerAggregator { - UserOperation[] userOps; - - // aggregator address - IAggregator aggregator; - // aggregated signature - bytes signature; - } - - /** - * Execute a batch of UserOperation. - * no signature aggregator is used. - * if any account requires an aggregator (that is, it returned an aggregator when - * performing simulateValidation), then handleAggregatedOps() must be used instead. - * @param ops the operations to execute - * @param beneficiary the address to receive the fees - */ - function handleOps(UserOperation[] calldata ops, address payable beneficiary) external; - - /** - * Execute a batch of UserOperation with Aggregators - * @param opsPerAggregator the operations to execute, grouped by aggregator (or address(0) for no-aggregator accounts) - * @param beneficiary the address to receive the fees - */ - function handleAggregatedOps( - UserOpsPerAggregator[] calldata opsPerAggregator, - address payable beneficiary - ) external; - - /** - * generate a request Id - unique identifier for this request. - * the request ID is a hash over the content of the userOp (except the signature), the entrypoint and the chainid. - */ - function getUserOpHash(UserOperation calldata userOp) external view returns (bytes32); - - /** - * Simulate a call to account.validateUserOp and paymaster.validatePaymasterUserOp. - * @dev this method always revert. Successful result is ValidationResult error. other errors are failures. - * @dev The node must also verify it doesn't use banned opcodes, and that it doesn't reference storage outside the account's data. - * @param userOp the user operation to validate. - */ - function simulateValidation(UserOperation calldata userOp) external; - - /** - * gas and return values during simulation - * @param preOpGas the gas used for validation (including preValidationGas) - * @param prefund the required prefund for this operation - * @param sigFailed validateUserOp's (or paymaster's) signature check failed - * @param validAfter - first timestamp this UserOp is valid (merging account and paymaster time-range) - * @param validUntil - last timestamp this UserOp is valid (merging account and paymaster time-range) - * @param paymasterContext returned by validatePaymasterUserOp (to be passed into postOp) - */ - struct ReturnInfo { - uint256 preOpGas; - uint256 prefund; - bool sigFailed; - uint48 validAfter; - uint48 validUntil; - bytes paymasterContext; - } - - /** - * returned aggregated signature info. - * the aggregator returned by the account, and its current stake. - */ - struct AggregatorStakeInfo { - address aggregator; - StakeInfo stakeInfo; - } - - /** - * Get counterfactual sender address. - * Calculate the sender contract address that will be generated by the initCode and salt in the UserOperation. - * this method always revert, and returns the address in SenderAddressResult error - * @param initCode the constructor code to be passed into the UserOperation. - */ - function getSenderAddress(bytes memory initCode) external; - - - /** - * simulate full execution of a UserOperation (including both validation and target execution) - * this method will always revert with "ExecutionResult". - * it performs full validation of the UserOperation, but ignores signature error. - * an optional target address is called after the userop succeeds, and its value is returned - * (before the entire call is reverted) - * Note that in order to collect the the success/failure of the target call, it must be executed - * with trace enabled to track the emitted events. - * @param op the UserOperation to simulate - * @param target if nonzero, a target address to call after userop simulation. If called, the targetSuccess and targetResult - * are set to the return from that call. - * @param targetCallData callData to pass to target address - */ - function simulateHandleOp(UserOperation calldata op, address target, bytes calldata targetCallData) external; -} diff --git a/contracts/src/v0.8/vendor/entrypoint/interfaces/IPaymaster.sol b/contracts/src/v0.8/vendor/entrypoint/interfaces/IPaymaster.sol deleted file mode 100644 index af50367acfc..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/interfaces/IPaymaster.sol +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -import "./UserOperation.sol"; - -/** - * the interface exposed by a paymaster contract, who agrees to pay the gas for user's operations. - * a paymaster must hold a stake to cover the required entrypoint stake and also the gas for the transaction. - */ -interface IPaymaster { - - enum PostOpMode { - opSucceeded, // user op succeeded - opReverted, // user op reverted. still has to pay for gas. - postOpReverted //user op succeeded, but caused postOp to revert. Now it's a 2nd call, after user's op was deliberately reverted. - } - - /** - * payment validation: check if paymaster agrees to pay. - * Must verify sender is the entryPoint. - * Revert to reject this request. - * Note that bundlers will reject this method if it changes the state, unless the paymaster is trusted (whitelisted) - * The paymaster pre-pays using its deposit, and receive back a refund after the postOp method returns. - * @param userOp the user operation - * @param userOpHash hash of the user's request data. - * @param maxCost the maximum cost of this transaction (based on maximum gas and gas price from userOp) - * @return context value to send to a postOp - * zero length to signify postOp is not required. - * @return validationData signature and time-range of this operation, encoded the same as the return value of validateUserOperation - * <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure, - * otherwise, an address of an "authorizer" contract. - * <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite" - * <6-byte> validAfter - first timestamp this operation is valid - * Note that the validation code cannot use block.timestamp (or block.number) directly. - */ - function validatePaymasterUserOp(UserOperation calldata userOp, bytes32 userOpHash, uint256 maxCost) - external returns (bytes memory context, uint256 validationData); - - /** - * post-operation handler. - * Must verify sender is the entryPoint - * @param mode enum with the following options: - * opSucceeded - user operation succeeded. - * opReverted - user op reverted. still has to pay for gas. - * postOpReverted - user op succeeded, but caused postOp (in mode=opSucceeded) to revert. - * Now this is the 2nd call, after user's op was deliberately reverted. - * @param context - the context value returned by validatePaymasterUserOp - * @param actualGasCost - actual gas used so far (without this postOp call). - */ - function postOp(PostOpMode mode, bytes calldata context, uint256 actualGasCost) external; -} diff --git a/contracts/src/v0.8/vendor/entrypoint/interfaces/IStakeManager.sol b/contracts/src/v0.8/vendor/entrypoint/interfaces/IStakeManager.sol deleted file mode 100644 index c19c1bab88b..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/interfaces/IStakeManager.sol +++ /dev/null @@ -1,104 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-only -pragma solidity ^0.8.12; - -/** - * manage deposits and stakes. - * deposit is just a balance used to pay for UserOperations (either by a paymaster or an account) - * stake is value locked for at least "unstakeDelay" by the staked entity. - */ -interface IStakeManager { - - event Deposited( - address indexed account, - uint256 totalDeposit - ); - - event Withdrawn( - address indexed account, - address withdrawAddress, - uint256 amount - ); - - /// Emitted when stake or unstake delay are modified - event StakeLocked( - address indexed account, - uint256 totalStaked, - uint256 unstakeDelaySec - ); - - /// Emitted once a stake is scheduled for withdrawal - event StakeUnlocked( - address indexed account, - uint256 withdrawTime - ); - - event StakeWithdrawn( - address indexed account, - address withdrawAddress, - uint256 amount - ); - - /** - * @param deposit the entity's deposit - * @param staked true if this entity is staked. - * @param stake actual amount of ether staked for this entity. - * @param unstakeDelaySec minimum delay to withdraw the stake. - * @param withdrawTime - first block timestamp where 'withdrawStake' will be callable, or zero if already locked - * @dev sizes were chosen so that (deposit,staked, stake) fit into one cell (used during handleOps) - * and the rest fit into a 2nd cell. - * 112 bit allows for 10^15 eth - * 48 bit for full timestamp - * 32 bit allows 150 years for unstake delay - */ - struct DepositInfo { - uint112 deposit; - bool staked; - uint112 stake; - uint32 unstakeDelaySec; - uint48 withdrawTime; - } - - //API struct used by getStakeInfo and simulateValidation - struct StakeInfo { - uint256 stake; - uint256 unstakeDelaySec; - } - - /// @return info - full deposit information of given account - function getDepositInfo(address account) external view returns (DepositInfo memory info); - - /// @return the deposit (for gas payment) of the account - function balanceOf(address account) external view returns (uint256); - - /** - * add to the deposit of the given account - */ - function depositTo(address account) external payable; - - /** - * add to the account's stake - amount and delay - * any pending unstake is first cancelled. - * @param _unstakeDelaySec the new lock duration before the deposit can be withdrawn. - */ - function addStake(uint32 _unstakeDelaySec) external payable; - - /** - * attempt to unlock the stake. - * the value can be withdrawn (using withdrawStake) after the unstake delay. - */ - function unlockStake() external; - - /** - * withdraw from the (unlocked) stake. - * must first call unlockStake and wait for the unstakeDelay to pass - * @param withdrawAddress the address to send withdrawn value. - */ - function withdrawStake(address payable withdrawAddress) external; - - /** - * withdraw from the deposit. - * @param withdrawAddress the address to send withdrawn value. - * @param withdrawAmount the amount to withdraw. - */ - function withdrawTo(address payable withdrawAddress, uint256 withdrawAmount) external; -} diff --git a/contracts/src/v0.8/vendor/entrypoint/interfaces/UserOperation.sol b/contracts/src/v0.8/vendor/entrypoint/interfaces/UserOperation.sol deleted file mode 100644 index dfff42791f3..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/interfaces/UserOperation.sol +++ /dev/null @@ -1,84 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 -pragma solidity ^0.8.12; - -/* solhint-disable no-inline-assembly */ - - /** - * User Operation struct - * @param sender the sender account of this request. - * @param nonce unique value the sender uses to verify it is not a replay. - * @param initCode if set, the account contract will be created by this constructor/ - * @param callData the method call to execute on this account. - * @param callGasLimit the gas limit passed to the callData method call. - * @param verificationGasLimit gas used for validateUserOp and validatePaymasterUserOp. - * @param preVerificationGas gas not calculated by the handleOps method, but added to the gas paid. Covers batch overhead. - * @param maxFeePerGas same as EIP-1559 gas parameter. - * @param maxPriorityFeePerGas same as EIP-1559 gas parameter. - * @param paymasterAndData if set, this field holds the paymaster address and paymaster-specific data. the paymaster will pay for the transaction instead of the sender. - * @param signature sender-verified signature over the entire request, the EntryPoint address and the chain ID. - */ - struct UserOperation { - - address sender; - uint256 nonce; - bytes initCode; - bytes callData; - uint256 callGasLimit; - uint256 verificationGasLimit; - uint256 preVerificationGas; - uint256 maxFeePerGas; - uint256 maxPriorityFeePerGas; - bytes paymasterAndData; - bytes signature; - } - -/** - * Utility functions helpful when working with UserOperation structs. - */ -library UserOperationLib { - - function getSender(UserOperation calldata userOp) internal pure returns (address) { - address data; - //read sender from userOp, which is first userOp member (saves 800 gas...) - assembly {data := calldataload(userOp)} - return address(uint160(data)); - } - - //relayer/block builder might submit the TX with higher priorityFee, but the user should not - // pay above what he signed for. - function gasPrice(UserOperation calldata userOp) internal view returns (uint256) { - unchecked { - uint256 maxFeePerGas = userOp.maxFeePerGas; - uint256 maxPriorityFeePerGas = userOp.maxPriorityFeePerGas; - if (maxFeePerGas == maxPriorityFeePerGas) { - //legacy mode (for networks that don't support basefee opcode) - return maxFeePerGas; - } - return min(maxFeePerGas, maxPriorityFeePerGas + block.basefee); - } - } - - function pack(UserOperation calldata userOp) internal pure returns (bytes memory ret) { - //lighter signature scheme. must match UserOp.ts#packUserOp - bytes calldata sig = userOp.signature; - // copy directly the userOp from calldata up to (but not including) the signature. - // this encoding depends on the ABI encoding of calldata, but is much lighter to copy - // than referencing each field separately. - assembly { - let ofs := userOp - let len := sub(sub(sig.offset, ofs), 32) - ret := mload(0x40) - mstore(0x40, add(ret, add(len, 32))) - mstore(ret, len) - calldatacopy(add(ret, 32), ofs, len) - } - } - - function hash(UserOperation calldata userOp) internal pure returns (bytes32) { - return keccak256(pack(userOp)); - } - - function min(uint256 a, uint256 b) internal pure returns (uint256) { - return a < b ? a : b; - } -} diff --git a/contracts/src/v0.8/vendor/entrypoint/utils/Exec.sol b/contracts/src/v0.8/vendor/entrypoint/utils/Exec.sol deleted file mode 100644 index 69d653d938a..00000000000 --- a/contracts/src/v0.8/vendor/entrypoint/utils/Exec.sol +++ /dev/null @@ -1,70 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-only -pragma solidity >=0.7.5 <0.9.0; - -// solhint-disable no-inline-assembly - -/** - * Utility functions helpful when making different kinds of contract calls in Solidity. - */ -library Exec { - - function call( - address to, - uint256 value, - bytes memory data, - uint256 txGas - ) internal returns (bool success) { - assembly { - success := call(txGas, to, value, add(data, 0x20), mload(data), 0, 0) - } - } - - function staticcall( - address to, - bytes memory data, - uint256 txGas - ) internal view returns (bool success) { - assembly { - success := staticcall(txGas, to, add(data, 0x20), mload(data), 0, 0) - } - } - - function delegateCall( - address to, - bytes memory data, - uint256 txGas - ) internal returns (bool success) { - assembly { - success := delegatecall(txGas, to, add(data, 0x20), mload(data), 0, 0) - } - } - - // get returned data from last call or calldelegate - function getReturnData(uint256 maxLen) internal pure returns (bytes memory returnData) { - assembly { - let len := returndatasize() - if gt(len, maxLen) { - len := maxLen - } - let ptr := mload(0x40) - mstore(0x40, add(ptr, add(len, 0x20))) - mstore(ptr, len) - returndatacopy(add(ptr, 0x20), 0, len) - returnData := ptr - } - } - - // revert with explicit byte array (probably reverted info from call) - function revertWithData(bytes memory returnData) internal pure { - assembly { - revert(add(returnData, 32), mload(returnData)) - } - } - - function callAndRevert(address to, bytes memory data, uint256 maxLen) internal { - bool success = call(to,0,data,gasleft()); - if (!success) { - revertWithData(getReturnData(maxLen)); - } - } -} diff --git a/core/gethwrappers/go_generate.go b/core/gethwrappers/go_generate.go index 25001027a59..f725ff95c06 100644 --- a/core/gethwrappers/go_generate.go +++ b/core/gethwrappers/go_generate.go @@ -160,7 +160,6 @@ package gethwrappers //go:generate go generate ./llo-feeds //go:generate go generate ./operatorforwarder //go:generate go generate ./shared -//go:generate go generate ./transmission //go:generate go generate ./ccip //go:generate go generate ./liquiditymanager //go:generate go generate ./workflow diff --git a/core/gethwrappers/transmission/generated/entry_point/entry_point.go b/core/gethwrappers/transmission/generated/entry_point/entry_point.go deleted file mode 100644 index 5a22214cb0e..00000000000 --- a/core/gethwrappers/transmission/generated/entry_point/entry_point.go +++ /dev/null @@ -1,1871 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package entry_point - -import ( - "errors" - "fmt" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -type EntryPointMemoryUserOp struct { - Sender common.Address - Nonce *big.Int - CallGasLimit *big.Int - VerificationGasLimit *big.Int - PreVerificationGas *big.Int - Paymaster common.Address - MaxFeePerGas *big.Int - MaxPriorityFeePerGas *big.Int -} - -type EntryPointUserOpInfo struct { - MUserOp EntryPointMemoryUserOp - UserOpHash [32]byte - Prefund *big.Int - ContextOffset *big.Int - PreOpGas *big.Int -} - -type IEntryPointUserOpsPerAggregator struct { - UserOps []UserOperation - Aggregator common.Address - Signature []byte -} - -type IStakeManagerDepositInfo struct { - Deposit *big.Int - Staked bool - Stake *big.Int - UnstakeDelaySec uint32 - WithdrawTime *big.Int -} - -type UserOperation struct { - Sender common.Address - Nonce *big.Int - InitCode []byte - CallData []byte - CallGasLimit *big.Int - VerificationGasLimit *big.Int - PreVerificationGas *big.Int - MaxFeePerGas *big.Int - MaxPriorityFeePerGas *big.Int - PaymasterAndData []byte - Signature []byte -} - -var EntryPointMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"paid\",\"type\":\"uint256\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bool\",\"name\":\"targetSuccess\",\"type\":\"bool\"},{\"internalType\":\"bytes\",\"name\":\"targetResult\",\"type\":\"bytes\"}],\"name\":\"ExecutionResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"opIndex\",\"type\":\"uint256\"},{\"internalType\":\"string\",\"name\":\"reason\",\"type\":\"string\"}],\"name\":\"FailedOp\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"SenderAddressResult\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureValidationFailed\",\"type\":\"error\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sigFailed\",\"type\":\"bool\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"}],\"name\":\"ValidationResult\",\"type\":\"error\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"sigFailed\",\"type\":\"bool\"},{\"internalType\":\"uint48\",\"name\":\"validAfter\",\"type\":\"uint48\"},{\"internalType\":\"uint48\",\"name\":\"validUntil\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"paymasterContext\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.ReturnInfo\",\"name\":\"returnInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"senderInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"factoryInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"paymasterInfo\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"stake\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"internalType\":\"structIStakeManager.StakeInfo\",\"name\":\"stakeInfo\",\"type\":\"tuple\"}],\"internalType\":\"structIEntryPoint.AggregatorStakeInfo\",\"name\":\"aggregatorInfo\",\"type\":\"tuple\"}],\"name\":\"ValidationResultWithAggregation\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"}],\"name\":\"AccountDeployed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalDeposit\",\"type\":\"uint256\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"aggregator\",\"type\":\"address\"}],\"name\":\"SignatureAggregatorChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalStaked\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unstakeDelaySec\",\"type\":\"uint256\"}],\"name\":\"StakeLocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"withdrawTime\",\"type\":\"uint256\"}],\"name\":\"StakeUnlocked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"StakeWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"success\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"actualGasUsed\",\"type\":\"uint256\"}],\"name\":\"UserOperationEvent\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"revertReason\",\"type\":\"bytes\"}],\"name\":\"UserOperationRevertReason\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Withdrawn\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"SIG_VALIDATION_FAILED\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"}],\"name\":\"_validateSenderAndPaymaster\",\"outputs\":[],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"}],\"name\":\"addStake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"depositTo\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"deposits\",\"outputs\":[{\"internalType\":\"uint112\",\"name\":\"deposit\",\"type\":\"uint112\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getDepositInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint112\",\"name\":\"deposit\",\"type\":\"uint112\"},{\"internalType\":\"bool\",\"name\":\"staked\",\"type\":\"bool\"},{\"internalType\":\"uint112\",\"name\":\"stake\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"unstakeDelaySec\",\"type\":\"uint32\"},{\"internalType\":\"uint48\",\"name\":\"withdrawTime\",\"type\":\"uint48\"}],\"internalType\":\"structIStakeManager.DepositInfo\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"name\":\"getSenderAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"getUserOpHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation[]\",\"name\":\"userOps\",\"type\":\"tuple[]\"},{\"internalType\":\"contractIAggregator\",\"name\":\"aggregator\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structIEntryPoint.UserOpsPerAggregator[]\",\"name\":\"opsPerAggregator\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleAggregatedOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation[]\",\"name\":\"ops\",\"type\":\"tuple[]\"},{\"internalType\":\"addresspayable\",\"name\":\"beneficiary\",\"type\":\"address\"}],\"name\":\"handleOps\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"components\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"paymaster\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.MemoryUserOp\",\"name\":\"mUserOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"prefund\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"contextOffset\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preOpGas\",\"type\":\"uint256\"}],\"internalType\":\"structEntryPoint.UserOpInfo\",\"name\":\"opInfo\",\"type\":\"tuple\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"}],\"name\":\"innerHandleOp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"op\",\"type\":\"tuple\"},{\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"targetCallData\",\"type\":\"bytes\"}],\"name\":\"simulateHandleOp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"}],\"name\":\"simulateValidation\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unlockStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"}],\"name\":\"withdrawStake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"addresspayable\",\"name\":\"withdrawAddress\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"withdrawAmount\",\"type\":\"uint256\"}],\"name\":\"withdrawTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]", - Bin: "0x60a0604052604051620000129062000050565b604051809103906000f0801580156200002f573d6000803e3d6000fd5b506001600160a01b03166080523480156200004957600080fd5b506200005e565b61020a8062004b0483390190565b608051614a83620000816000396000818161146e015261363e0152614a836000f3fe6080604052600436106101125760003560e01c8063957122ab116100a5578063bb9fe6bf11610074578063d6383f9411610059578063d6383f941461042c578063ee2194231461044c578063fc7e286d1461046c57600080fd5b8063bb9fe6bf146103f7578063c23a5cea1461040c57600080fd5b8063957122ab146103845780639b249f69146103a4578063a6193531146103c4578063b760faf9146103e457600080fd5b80634b1d7cf5116100e15780634b1d7cf5146101ad5780635287ce12146101cd57806370a082311461031c5780638f41ec5a1461036f57600080fd5b80630396cb60146101275780631d7327561461013a5780631fad948c1461016d578063205c28781461018d57600080fd5b366101225761012033610546565b005b600080fd5b6101206101353660046139b1565b6105c1565b34801561014657600080fd5b5061015a610155366004613c28565b610944565b6040519081526020015b60405180910390f35b34801561017957600080fd5b50610120610188366004613d33565b610af7565b34801561019957600080fd5b506101206101a8366004613d8a565b610c38565b3480156101b957600080fd5b506101206101c8366004613d33565b610e3a565b3480156101d957600080fd5b506102bd6101e8366004613db6565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101919091525073ffffffffffffffffffffffffffffffffffffffff1660009081526020818152604091829020825160a08101845281546dffffffffffffffffffffffffffff80821683526e010000000000000000000000000000820460ff161515948301949094526f0100000000000000000000000000000090049092169282019290925260019091015463ffffffff81166060830152640100000000900465ffffffffffff16608082015290565b6040805182516dffffffffffffffffffffffffffff908116825260208085015115159083015283830151169181019190915260608083015163ffffffff169082015260809182015165ffffffffffff169181019190915260a001610164565b34801561032857600080fd5b5061015a610337366004613db6565b73ffffffffffffffffffffffffffffffffffffffff166000908152602081905260409020546dffffffffffffffffffffffffffff1690565b34801561037b57600080fd5b5061015a600181565b34801561039057600080fd5b5061012061039f366004613dd3565b6112d9565b3480156103b057600080fd5b506101206103bf366004613e58565b611431565b3480156103d057600080fd5b5061015a6103df366004613eb3565b611533565b6101206103f2366004613db6565b610546565b34801561040357600080fd5b50610120611575565b34801561041857600080fd5b50610120610427366004613db6565b61172c565b34801561043857600080fd5b50610120610447366004613ee8565b611a2c565b34801561045857600080fd5b50610120610467366004613eb3565b611b5a565b34801561047857600080fd5b506104f9610487366004613db6565b600060208190529081526040902080546001909101546dffffffffffffffffffffffffffff808316926e010000000000000000000000000000810460ff16926f010000000000000000000000000000009091049091169063ffffffff811690640100000000900465ffffffffffff1685565b604080516dffffffffffffffffffffffffffff96871681529415156020860152929094169183019190915263ffffffff16606082015265ffffffffffff909116608082015260a001610164565b6105508134611ec2565b73ffffffffffffffffffffffffffffffffffffffff811660008181526020818152604091829020805492516dffffffffffffffffffffffffffff909316835292917f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c491015b60405180910390a25050565b33600090815260208190526040902063ffffffff8216610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f6d757374207370656369667920756e7374616b652064656c617900000000000060448201526064015b60405180910390fd5b600181015463ffffffff90811690831610156106ba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f63616e6e6f7420646563726561736520756e7374616b652074696d65000000006044820152606401610639565b80546000906106ed9034906f0100000000000000000000000000000090046dffffffffffffffffffffffffffff16613f79565b905060008111610759576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6e6f207374616b652073706563696669656400000000000000000000000000006044820152606401610639565b6dffffffffffffffffffffffffffff8111156107d1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f7374616b65206f766572666c6f770000000000000000000000000000000000006044820152606401610639565b6040805160a08101825283546dffffffffffffffffffffffffffff90811682526001602080840182815286841685870190815263ffffffff808b16606088019081526000608089018181523380835296829052908a9020985189549551945189166f01000000000000000000000000000000027fffffff0000000000000000000000000000ffffffffffffffffffffffffffffff9515156e010000000000000000000000000000027fffffffffffffffffffffffffffffffffff0000000000000000000000000000009097169190991617949094179290921695909517865551949092018054925165ffffffffffff16640100000000027fffffffffffffffffffffffffffffffffffffffffffff00000000000000000000909316949093169390931717905590517fa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c0190610937908490879091825263ffffffff16602082015260400190565b60405180910390a2505050565b6000805a90503330146109b3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4141393220696e7465726e616c2063616c6c206f6e6c790000000000000000006044820152606401610639565b8451604081015160608201518101611388015a10156109f6577fdeaddead0000000000000000000000000000000000000000000000000000000060005260206000fd5b875160009015610a97576000610a13846000015160008c86611fbf565b905080610a95576000610a27610800611fd7565b805190915015610a8f57846000015173ffffffffffffffffffffffffffffffffffffffff168a602001517f1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201876020015184604051610a86929190613ffa565b60405180910390a35b60019250505b505b600088608001515a8603019050610ae96000838b8b8b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250612003915050565b9a9950505050505050505050565b8160008167ffffffffffffffff811115610b1357610b136139d7565b604051908082528060200260200182016040528015610b4c57816020015b610b3961390d565b815260200190600190039081610b315790505b50905060005b82811015610bc5576000828281518110610b6e57610b6e614013565b60200260200101519050600080610ba9848a8a87818110610b9157610b91614013565b9050602002810190610ba39190614042565b856123e1565b91509150610bba84838360006125a3565b505050600101610b52565b506000805b83811015610c2557610c1981888884818110610be857610be8614013565b9050602002810190610bfa9190614042565b858481518110610c0c57610c0c614013565b60200260200101516127f8565b90910190600101610bca565b50610c30848261297d565b505050505050565b33600090815260208190526040902080546dffffffffffffffffffffffffffff16821115610cc2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f576974686472617720616d6f756e7420746f6f206c61726765000000000000006044820152606401610639565b8054610cdf9083906dffffffffffffffffffffffffffff16614080565b81547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff919091161781556040805173ffffffffffffffffffffffffffffffffffffffff851681526020810184905233917fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb910160405180910390a260008373ffffffffffffffffffffffffffffffffffffffff168360405160006040518083038185875af1925050503d8060008114610dc4576040519150601f19603f3d011682016040523d82523d6000602084013e610dc9565b606091505b5050905080610e34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f6661696c656420746f20776974686472617700000000000000000000000000006044820152606401610639565b50505050565b816000805b828110156110335736868683818110610e5a57610e5a614013565b9050602002810190610e6c9190614093565b9050366000610e7b83806140c7565b90925090506000610e926040850160208601613db6565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff73ffffffffffffffffffffffffffffffffffffffff821601610f33576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4141393620696e76616c69642061676772656761746f720000000000000000006044820152606401610639565b73ffffffffffffffffffffffffffffffffffffffff8116156110105773ffffffffffffffffffffffffffffffffffffffff811663e3563a4f8484610f7a604089018961412f565b6040518563ffffffff1660e01b8152600401610f999493929190614345565b60006040518083038186803b158015610fb157600080fd5b505afa925050508015610fc2575060015b611010576040517f86a9f75000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610639565b61101a8287613f79565b955050505050808061102b906143fc565b915050610e3f565b5060008167ffffffffffffffff81111561104f5761104f6139d7565b60405190808252806020026020018201604052801561108857816020015b61107561390d565b81526020019060019003908161106d5790505b5090506000805b8481101561117357368888838181106110aa576110aa614013565b90506020028101906110bc9190614093565b90503660006110cb83806140c7565b909250905060006110e26040850160208601613db6565b90508160005b8181101561115a57600089898151811061110457611104614013565b602002602001015190506000806111278b898987818110610b9157610b91614013565b91509150611137848383896125a3565b8a611141816143fc565b9b50505050508080611152906143fc565b9150506110e8565b505050505050808061116b906143fc565b91505061108f565b50600080915060005b85811015611299573689898381811061119757611197614013565b90506020028101906111a99190614093565b90506111bb6040820160208301613db6565b73ffffffffffffffffffffffffffffffffffffffff167f575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d60405160405180910390a236600061120a83806140c7565b90925090508060005b81811015611281576112558885858481811061123157611231614013565b90506020028101906112439190614042565b8b8b81518110610c0c57610c0c614013565b61125f9088613f79565b96508761126b816143fc565b9850508080611279906143fc565b915050611213565b50505050508080611291906143fc565b91505061117c565b506040516000907f575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d908290a26112cf868261297d565b5050505050505050565b831580156112fc575073ffffffffffffffffffffffffffffffffffffffff83163b155b15611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f41413230206163636f756e74206e6f74206465706c6f796564000000000000006044820152606401610639565b601481106113f557600061137a6014828486614434565b6113839161445e565b60601c9050803b6000036113f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f41413330207061796d6173746572206e6f74206465706c6f79656400000000006044820152606401610639565b505b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526020600482015260006024820152604401610639565b6040517f570e1a3600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063570e1a36906114a590859085906004016144a6565b6020604051808303816000875af11580156114c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e891906144ba565b6040517f6ca7b80600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401610639565b600061153e82612ac9565b6040805160208101929092523090820152466060820152608001604051602081830303815290604052805190602001209050919050565b3360009081526020819052604081206001810154909163ffffffff90911690036115fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f6e6f74207374616b6564000000000000000000000000000000000000000000006044820152606401610639565b80546e010000000000000000000000000000900460ff16611678576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f616c726561647920756e7374616b696e670000000000000000000000000000006044820152606401610639565b60018101546000906116909063ffffffff16426144d7565b6001830180547fffffffffffffffffffffffffffffffffffffffffffff000000000000ffffffff1664010000000065ffffffffffff84169081029190911790915583547fffffffffffffffffffffffffffffffffff00ffffffffffffffffffffffffffff16845560405190815290915033907ffa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a906020016105b5565b33600090815260208190526040902080546f0100000000000000000000000000000090046dffffffffffffffffffffffffffff16806117c7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4e6f207374616b6520746f2077697468647261770000000000000000000000006044820152606401610639565b6001820154640100000000900465ffffffffffff16611842576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f6d7573742063616c6c20756e6c6f636b5374616b6528292066697273740000006044820152606401610639565b60018201544264010000000090910465ffffffffffff1611156118c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f5374616b65207769746864726177616c206973206e6f742064756500000000006044820152606401610639565b6001820180547fffffffffffffffffffffffffffffffffffffffffffff0000000000000000000016905581547fffffff0000000000000000000000000000ffffffffffffffffffffffffffffff1682556040805173ffffffffffffffffffffffffffffffffffffffff851681526020810183905233917fb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3910160405180910390a260008373ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146119bc576040519150601f19603f3d011682016040523d82523d6000602084013e6119c1565b606091505b5050905080610e34576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f6661696c656420746f207769746864726177207374616b6500000000000000006044820152606401610639565b611a3461390d565b611a3d85612ae2565b600080611a4c600088856123e1565b915091506000611a5c8383612bd5565b9050611a6743600052565b6000611a7560008a876127f8565b9050611a8043600052565b6000606073ffffffffffffffffffffffffffffffffffffffff8a1615611b10578973ffffffffffffffffffffffffffffffffffffffff168989604051611ac79291906144fd565b6000604051808303816000865af19150503d8060008114611b04576040519150601f19603f3d011682016040523d82523d6000602084013e611b09565b606091505b5090925090505b8660800151838560200151866040015185856040517f8b7ac9800000000000000000000000000000000000000000000000000000000081526004016106399695949392919061450d565b611b6261390d565b611b6b82612ae2565b600080611b7a600085856123e1565b845160a001516040805180820182526000808252602080830182815273ffffffffffffffffffffffffffffffffffffffff958616835282825284832080546dffffffffffffffffffffffffffff6f01000000000000000000000000000000918290048116875260019283015463ffffffff9081169094528d51518851808a018a5287815280870188815291909a16875286865288872080549390930490911689529101549091169052835180850190945281845283015293955091935090366000611c4860408a018a61412f565b909250905060006014821015611c5f576000611c7a565b611c6d601460008486614434565b611c769161445e565b60601c5b6040805180820182526000808252602080830182815273ffffffffffffffffffffffffffffffffffffffff861683529082905292902080546f0100000000000000000000000000000090046dffffffffffffffffffffffffffff1682526001015463ffffffff1690915290915093505050506000611cf88686612bd5565b90506000816000015190506000600173ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614905060006040518060c001604052808b6080015181526020018b6040015181526020018315158152602001856020015165ffffffffffff168152602001856040015165ffffffffffff168152602001611d8f8c6060015190565b9052905073ffffffffffffffffffffffffffffffffffffffff831615801590611dcf575073ffffffffffffffffffffffffffffffffffffffff8316600114155b15611e885760408051808201825273ffffffffffffffffffffffffffffffffffffffff851680825282518084018452600080825260208083018281529382528181529085902080546f0100000000000000000000000000000090046dffffffffffffffffffffffffffff1683526001015463ffffffff169092529082015290517ffaecb4e4000000000000000000000000000000000000000000000000000000008152610639908390899089908c9086906004016145af565b808686896040517fe0cff05f000000000000000000000000000000000000000000000000000000008152600401610639949392919061463c565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604081208054909190611f079084906dffffffffffffffffffffffffffff16613f79565b90506dffffffffffffffffffffffffffff811115611f81576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f6465706f736974206f766572666c6f77000000000000000000000000000000006044820152606401610639565b81547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff919091161790555050565b6000806000845160208601878987f195945050505050565b60603d82811115611fe55750815b604051602082018101604052818152816000602083013e9392505050565b6000805a85519091506000908161201982612cbc565b60a083015190915073ffffffffffffffffffffffffffffffffffffffff81166120455782519350612293565b80935060008851111561229357868202955060028a600281111561206b5761206b614693565b146121035760608301516040517fa9a2340900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169163a9a23409916120cb908e908d908c906004016146c2565b600060405180830381600088803b1580156120e557600080fd5b5087f11580156120f9573d6000803e3d6000fd5b5050505050612293565b60608301516040517fa9a2340900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169163a9a234099161215e908e908d908c906004016146c2565b600060405180830381600088803b15801561217857600080fd5b5087f19350505050801561218a575060015b61229357612196614722565b806308c379a00361222657506121aa61473e565b806121b55750612228565b8b816040516020016121c791906147e6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f220266b60000000000000000000000000000000000000000000000000000000082526106399291600401613ffa565b505b8a6040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526012908201527f4141353020706f73744f70207265766572740000000000000000000000000000606082015260800190565b5a85038701965081870295508589604001511015612315578a6040517f220266b600000000000000000000000000000000000000000000000000000000815260040161063991815260406020808301829052908201527f414135312070726566756e642062656c6f772061637475616c476173436f7374606082015260800190565b60408901518690036123278582611ec2565b6000808c600281111561233c5761233c614693565b1490508460a0015173ffffffffffffffffffffffffffffffffffffffff16856000015173ffffffffffffffffffffffffffffffffffffffff168c602001517f49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f8860200151858d8f6040516123c9949392919093845291151560208401526040830152606082015260800190565b60405180910390a45050505050505095945050505050565b60008060005a84519091506123f68682612cec565b6123ff86611533565b6020860152604081015160608201516080830151171760e087013517610100870135176effffffffffffffffffffffffffffff81111561249b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f41413934206761732076616c756573206f766572666c6f7700000000000000006044820152606401610639565b6000806124a784612e0c565b90506124b58a8a8a84612e66565b975091506124c243600052565b60a084015160609073ffffffffffffffffffffffffffffffffffffffff16156124f7576124f28b8b8b858761317c565b975090505b60005a87039050808b60a001351015612575578b6040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610639918152604060208201819052601e908201527f41413430206f76657220766572696669636174696f6e4761734c696d69740000606082015260800190565b60408a018390528160608b015260c08b01355a8803018a608001818152505050505050505050935093915050565b6000806125af8561343f565b915091508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461265157856040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526014908201527f41413234207369676e6174757265206572726f72000000000000000000000000606082015260800190565b80156126c257856040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526017908201527f414132322065787069726564206f72206e6f7420647565000000000000000000606082015260800190565b60006126cd8561343f565b9250905073ffffffffffffffffffffffffffffffffffffffff81161561275857866040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526014908201527f41413334207369676e6174757265206572726f72000000000000000000000000606082015260800190565b81156127ef57866040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526021908201527f41413332207061796d61737465722065787069726564206f72206e6f7420647560608201527f6500000000000000000000000000000000000000000000000000000000000000608082015260a00190565b50505050505050565b6000805a9050600061280b846060015190565b905030631d732756612820606088018861412f565b87856040518563ffffffff1660e01b8152600401612841949392919061482b565b6020604051808303816000875af192505050801561289a575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612897918101906148ec565b60015b61297157600060206000803e506000517f2152215300000000000000000000000000000000000000000000000000000000810161293c57866040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610639918152604060208201819052600f908201527f41413935206f7574206f66206761730000000000000000000000000000000000606082015260800190565b600085608001515a61294e9086614080565b6129589190613f79565b9050612968886002888685612003565b94505050612974565b92505b50509392505050565b73ffffffffffffffffffffffffffffffffffffffff82166129fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f4141393020696e76616c69642062656e656669636961727900000000000000006044820152606401610639565b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114612a54576040519150601f19603f3d011682016040523d82523d6000602084013e612a59565b606091505b5050905080612ac4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f41413931206661696c65642073656e6420746f2062656e6566696369617279006044820152606401610639565b505050565b6000612ad482613492565b805190602001209050919050565b3063957122ab612af5604084018461412f565b612b026020860186613db6565b612b1061012087018761412f565b6040518663ffffffff1660e01b8152600401612b30959493929190614905565b60006040518083038186803b158015612b4857600080fd5b505afa925050508015612b59575060015b612bd257612b65614722565b806308c379a003612bc65750612b7961473e565b80612b845750612bc8565b805115612bc2576000816040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610639929190613ffa565b5050565b505b3d6000803e3d6000fd5b50565b6040805160608101825260008082526020820181905291810182905290612bfb846134d1565b90506000612c08846134d1565b825190915073ffffffffffffffffffffffffffffffffffffffff8116612c2c575080515b602080840151604080860151928501519085015191929165ffffffffffff8083169085161015612c5a578193505b8065ffffffffffff168365ffffffffffff161115612c76578092505b50506040805160608101825273ffffffffffffffffffffffffffffffffffffffff909416845265ffffffffffff9283166020850152911690820152925050505b92915050565b60c081015160e082015160009190808203612cd8575092915050565b612ce48248830161354f565b949350505050565b612cf96020830183613db6565b73ffffffffffffffffffffffffffffffffffffffff16815260208083013590820152608080830135604083015260a0830135606083015260c0808401359183019190915260e0808401359183019190915261010083013590820152366000612d6561012085018561412f565b90925090508015612dff576014811015612ddb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f4141393320696e76616c6964207061796d6173746572416e64446174610000006044820152606401610639565b612de9601460008385614434565b612df29161445e565b60601c60a0840152610e34565b600060a084015250505050565b60a0810151600090819073ffffffffffffffffffffffffffffffffffffffff16612e37576001612e3a565b60035b60ff16905060008360800151828560600151028560400151010190508360c00151810292505050919050565b60008060005a8551805191925090612e8b8988612e8660408c018c61412f565b613567565b60a0820151612e9943600052565b600073ffffffffffffffffffffffffffffffffffffffff8216612f025773ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260409020546dffffffffffffffffffffffffffff16888111612efb57808903612efe565b60005b9150505b606084015160208a01516040517f3a871cdd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861692633a871cdd929091612f62918f918790600401614948565b60206040518083038160008887f193505050508015612fbc575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201909252612fb9918101906148ec565b60015b61306657612fc8614722565b806308c379a003612ff95750612fdc61473e565b80612fe75750612ffb565b8b816040516020016121c7919061496d565b505b8a6040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526016908201527f4141323320726576657274656420286f72204f4f472900000000000000000000606082015260800190565b955073ffffffffffffffffffffffffffffffffffffffff82166131695773ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902080546dffffffffffffffffffffffffffff16808a111561312d578c6040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526017908201527f41413231206469646e2774207061792070726566756e64000000000000000000606082015260800190565b81547fffffffffffffffffffffffffffffffffffff000000000000000000000000000016908a90036dffffffffffffffffffffffffffff161790555b5a85039650505050505094509492505050565b825160608181015190916000918481116131f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4141343120746f6f206c6974746c6520766572696669636174696f6e476173006044820152606401610639565b60a082015173ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902080548784039291906dffffffffffffffffffffffffffff16898110156132a7578c6040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610639918152604060208201819052601e908201527f41413331207061796d6173746572206465706f73697420746f6f206c6f770000606082015260800190565b8981038260000160006101000a8154816dffffffffffffffffffffffffffff02191690836dffffffffffffffffffffffffffff1602179055508273ffffffffffffffffffffffffffffffffffffffff1663f465c77e858e8e602001518e6040518563ffffffff1660e01b815260040161332293929190614948565b60006040518083038160008887f19350505050801561338157506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261337e91908101906149b2565b60015b61342b5761338d614722565b806308c379a0036133be57506133a161473e565b806133ac57506133c0565b8d816040516020016121c79190614a3e565b505b8c6040517f220266b60000000000000000000000000000000000000000000000000000000081526004016106399181526040602082018190526016908201527f4141333320726576657274656420286f72204f4f472900000000000000000000606082015260800190565b909e909d509b505050505050505050505050565b6000808260000361345557506000928392509050565b6000613460846134d1565b9050806040015165ffffffffffff164211806134875750806020015165ffffffffffff1642105b905194909350915050565b60603660006134a561014085018561412f565b915091508360208184030360405194506020810185016040528085528082602087013750505050919050565b60408051606081018252600080825260208201819052918101919091528160a081901c65ffffffffffff811660000361350d575065ffffffffffff5b6040805160608101825273ffffffffffffffffffffffffffffffffffffffff909316835260d09490941c602083015265ffffffffffff16928101929092525090565b600081831061355e5781613560565b825b9392505050565b8015610e345782515173ffffffffffffffffffffffffffffffffffffffff81163b156135f857846040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610639918152604060208201819052601f908201527f414131302073656e64657220616c726561647920636f6e737472756374656400606082015260800190565b8351606001516040517f570e1a3600000000000000000000000000000000000000000000000000000000815260009173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163570e1a36919061367690889088906004016144a6565b60206040518083038160008887f1158015613695573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906136ba91906144ba565b905073ffffffffffffffffffffffffffffffffffffffff811661374257856040517f220266b6000000000000000000000000000000000000000000000000000000008152600401610639918152604060208201819052601b908201527f4141313320696e6974436f6465206661696c6564206f72204f4f470000000000606082015260800190565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146137df57856040517f220266b600000000000000000000000000000000000000000000000000000000815260040161063991815260406020808301829052908201527f4141313420696e6974436f6465206d7573742072657475726e2073656e646572606082015260800190565b8073ffffffffffffffffffffffffffffffffffffffff163b60000361386857856040517f220266b600000000000000000000000000000000000000000000000000000000815260040161063991815260406020808301829052908201527f4141313520696e6974436f6465206d757374206372656174652073656e646572606082015260800190565b60006138776014828688614434565b6138809161445e565b60601c90508273ffffffffffffffffffffffffffffffffffffffff1686602001517fd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d83896000015160a001516040516138fc92919073ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b60405180910390a350505050505050565b6040518060a0016040528061398c604051806101000160405280600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001600081525090565b8152602001600080191681526020016000815260200160008152602001600081525090565b6000602082840312156139c357600080fd5b813563ffffffff8116811461356057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60a0810181811067ffffffffffffffff82111715613a2657613a266139d7565b60405250565b610100810181811067ffffffffffffffff82111715613a2657613a266139d7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116810181811067ffffffffffffffff82111715613a9157613a916139d7565b6040525050565b600067ffffffffffffffff821115613ab257613ab26139d7565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b73ffffffffffffffffffffffffffffffffffffffff81168114612bd257600080fd5b8035613b0b81613ade565b919050565b6000818303610180811215613b2457600080fd5b604051613b3081613a06565b80925061010080831215613b4357600080fd5b6040519250613b5183613a2c565b613b5a85613b00565b835260208501356020840152604085013560408401526060850135606084015260808501356080840152613b9060a08601613b00565b60a084015260c085013560c084015260e085013560e084015282825280850135602083015250610120840135604082015261014084013560608201526101608401356080820152505092915050565b60008083601f840112613bf157600080fd5b50813567ffffffffffffffff811115613c0957600080fd5b602083019150836020828501011115613c2157600080fd5b9250929050565b6000806000806101c08587031215613c3f57600080fd5b843567ffffffffffffffff80821115613c5757600080fd5b818701915087601f830112613c6b57600080fd5b8135613c7681613a98565b604051613c838282613a4d565b8281528a6020848701011115613c9857600080fd5b82602086016020830137600060208483010152809850505050613cbe8860208901613b10565b94506101a0870135915080821115613cd557600080fd5b50613ce287828801613bdf565b95989497509550505050565b60008083601f840112613d0057600080fd5b50813567ffffffffffffffff811115613d1857600080fd5b6020830191508360208260051b8501011115613c2157600080fd5b600080600060408486031215613d4857600080fd5b833567ffffffffffffffff811115613d5f57600080fd5b613d6b86828701613cee565b9094509250506020840135613d7f81613ade565b809150509250925092565b60008060408385031215613d9d57600080fd5b8235613da881613ade565b946020939093013593505050565b600060208284031215613dc857600080fd5b813561356081613ade565b600080600080600060608688031215613deb57600080fd5b853567ffffffffffffffff80821115613e0357600080fd5b613e0f89838a01613bdf565b909750955060208801359150613e2482613ade565b90935060408701359080821115613e3a57600080fd5b50613e4788828901613bdf565b969995985093965092949392505050565b60008060208385031215613e6b57600080fd5b823567ffffffffffffffff811115613e8257600080fd5b613e8e85828601613bdf565b90969095509350505050565b60006101608284031215613ead57600080fd5b50919050565b600060208284031215613ec557600080fd5b813567ffffffffffffffff811115613edc57600080fd5b612ce484828501613e9a565b60008060008060608587031215613efe57600080fd5b843567ffffffffffffffff80821115613f1657600080fd5b613f2288838901613e9a565b955060208701359150613f3482613ade565b90935060408601359080821115613cd557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115612cb657612cb6613f4a565b60005b83811015613fa7578181015183820152602001613f8f565b50506000910152565b60008151808452613fc8816020860160208601613f8c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b828152604060208201526000612ce46040830184613fb0565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffea183360301811261407657600080fd5b9190910192915050565b81810381811115612cb657612cb6613f4a565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa183360301811261407657600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126140fc57600080fd5b83018035915067ffffffffffffffff82111561411757600080fd5b6020019150600581901b3603821315613c2157600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261416457600080fd5b83018035915067ffffffffffffffff82111561417f57600080fd5b602001915036819003821315613c2157600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126141c957600080fd5b830160208101925035905067ffffffffffffffff8111156141e957600080fd5b803603821315613c2157600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061016061426d8461425385613b00565b73ffffffffffffffffffffffffffffffffffffffff169052565b602083013560208501526142846040840184614194565b82604087015261429783870182846141f8565b925050506142a86060840184614194565b85830360608701526142bb8382846141f8565b925050506080830135608085015260a083013560a085015260c083013560c085015260e083013560e085015261010080840135818601525061012061430281850185614194565b868403838801526143148482846141f8565b935050505061014061432881850185614194565b8684038388015261433a8482846141f8565b979650505050505050565b6040808252810184905260006060600586901b830181019083018783805b898110156143e5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa087860301845282357ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffea18c36030181126143c3578283fd5b6143cf868d8301614241565b9550506020938401939290920191600101614363565b50505050828103602084015261433a8185876141f8565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361442d5761442d613f4a565b5060010190565b6000808585111561444457600080fd5b8386111561445157600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000813581811691601485101561449e5780818660140360031b1b83161692505b505092915050565b602081526000612ce46020830184866141f8565b6000602082840312156144cc57600080fd5b815161356081613ade565b65ffffffffffff8181168382160190808211156144f6576144f6613f4a565b5092915050565b8183823760009101908152919050565b868152856020820152600065ffffffffffff8087166040840152808616606084015250831515608083015260c060a083015261454c60c0830184613fb0565b98975050505050505050565b80518252602081015160208301526040810151151560408301526000606082015165ffffffffffff8082166060860152806080850151166080860152505060a082015160c060a0850152612ce460c0850182613fb0565b60006101408083526145c381840189614558565b9150506145dd602083018780518252602090810151910152565b845160608301526020948501516080830152835160a08301529284015160c0820152815173ffffffffffffffffffffffffffffffffffffffff1660e0820152908301518051610100830152909201516101209092019190915292915050565b60e08152600061464f60e0830187614558565b9050614668602083018680518252602090810151910152565b8351606083015260208401516080830152825160a0830152602083015160c083015295945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000600385106146fb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b848252606060208301526147126060830185613fb0565b9050826040830152949350505050565b600060033d111561473b5760046000803e5060005160e01c5b90565b600060443d101561474c5790565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc803d016004833e81513d67ffffffffffffffff816024840111818411171561479a57505050505090565b82850191508151818111156147b25750505050505090565b843d87010160208285010111156147cc5750505050505090565b6147db60208286010187613a4d565b509095945050505050565b7f4141353020706f73744f702072657665727465643a200000000000000000000081526000825161481e816016850160208701613f8c565b9190910160160192915050565b60006101c080835261484081840187896141f8565b9050845173ffffffffffffffffffffffffffffffffffffffff808251166020860152602082015160408601526040820151606086015260608201516080860152608082015160a08601528060a08301511660c08601525060c081015160e085015260e08101516101008501525060208501516101208401526040850151610140840152606085015161016084015260808501516101808401528281036101a084015261433a8185613fb0565b6000602082840312156148fe57600080fd5b5051919050565b6060815260006149196060830187896141f8565b73ffffffffffffffffffffffffffffffffffffffff86166020840152828103604084015261454c8185876141f8565b60608152600061495b6060830186614241565b60208301949094525060400152919050565b7f414132332072657665727465643a2000000000000000000000000000000000008152600082516149a581600f850160208701613f8c565b91909101600f0192915050565b600080604083850312156149c557600080fd5b825167ffffffffffffffff8111156149dc57600080fd5b8301601f810185136149ed57600080fd5b80516149f881613a98565b604051614a058282613a4d565b828152876020848601011115614a1a57600080fd5b614a2b836020830160208701613f8c565b6020969096015195979596505050505050565b7f414133332072657665727465643a2000000000000000000000000000000000008152600082516149a581600f850160208701613f8c56fea164736f6c6343000813000a608060405234801561001057600080fd5b506101ea806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063570e1a3614610030575b600080fd5b61004361003e3660046100f9565b61006c565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b60008061007c601482858761016b565b61008591610195565b60601c90506000610099846014818861016b565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525084519495509360209350849250905082850182875af190506000519350806100f057600093505b50505092915050565b6000806020838503121561010c57600080fd5b823567ffffffffffffffff8082111561012457600080fd5b818501915085601f83011261013857600080fd5b81358181111561014757600080fd5b86602082850101111561015957600080fd5b60209290920196919550909350505050565b6000808585111561017b57600080fd5b8386111561018857600080fd5b5050820193919092039150565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081358181169160148510156101d55780818660140360031b1b83161692505b50509291505056fea164736f6c6343000813000a", -} - -var EntryPointABI = EntryPointMetaData.ABI - -var EntryPointBin = EntryPointMetaData.Bin - -func DeployEntryPoint(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *EntryPoint, error) { - parsed, err := EntryPointMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(EntryPointBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &EntryPoint{address: address, abi: *parsed, EntryPointCaller: EntryPointCaller{contract: contract}, EntryPointTransactor: EntryPointTransactor{contract: contract}, EntryPointFilterer: EntryPointFilterer{contract: contract}}, nil -} - -type EntryPoint struct { - address common.Address - abi abi.ABI - EntryPointCaller - EntryPointTransactor - EntryPointFilterer -} - -type EntryPointCaller struct { - contract *bind.BoundContract -} - -type EntryPointTransactor struct { - contract *bind.BoundContract -} - -type EntryPointFilterer struct { - contract *bind.BoundContract -} - -type EntryPointSession struct { - Contract *EntryPoint - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type EntryPointCallerSession struct { - Contract *EntryPointCaller - CallOpts bind.CallOpts -} - -type EntryPointTransactorSession struct { - Contract *EntryPointTransactor - TransactOpts bind.TransactOpts -} - -type EntryPointRaw struct { - Contract *EntryPoint -} - -type EntryPointCallerRaw struct { - Contract *EntryPointCaller -} - -type EntryPointTransactorRaw struct { - Contract *EntryPointTransactor -} - -func NewEntryPoint(address common.Address, backend bind.ContractBackend) (*EntryPoint, error) { - abi, err := abi.JSON(strings.NewReader(EntryPointABI)) - if err != nil { - return nil, err - } - contract, err := bindEntryPoint(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &EntryPoint{address: address, abi: abi, EntryPointCaller: EntryPointCaller{contract: contract}, EntryPointTransactor: EntryPointTransactor{contract: contract}, EntryPointFilterer: EntryPointFilterer{contract: contract}}, nil -} - -func NewEntryPointCaller(address common.Address, caller bind.ContractCaller) (*EntryPointCaller, error) { - contract, err := bindEntryPoint(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &EntryPointCaller{contract: contract}, nil -} - -func NewEntryPointTransactor(address common.Address, transactor bind.ContractTransactor) (*EntryPointTransactor, error) { - contract, err := bindEntryPoint(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &EntryPointTransactor{contract: contract}, nil -} - -func NewEntryPointFilterer(address common.Address, filterer bind.ContractFilterer) (*EntryPointFilterer, error) { - contract, err := bindEntryPoint(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &EntryPointFilterer{contract: contract}, nil -} - -func bindEntryPoint(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := EntryPointMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_EntryPoint *EntryPointRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _EntryPoint.Contract.EntryPointCaller.contract.Call(opts, result, method, params...) -} - -func (_EntryPoint *EntryPointRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _EntryPoint.Contract.EntryPointTransactor.contract.Transfer(opts) -} - -func (_EntryPoint *EntryPointRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _EntryPoint.Contract.EntryPointTransactor.contract.Transact(opts, method, params...) -} - -func (_EntryPoint *EntryPointCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _EntryPoint.Contract.contract.Call(opts, result, method, params...) -} - -func (_EntryPoint *EntryPointTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _EntryPoint.Contract.contract.Transfer(opts) -} - -func (_EntryPoint *EntryPointTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _EntryPoint.Contract.contract.Transact(opts, method, params...) -} - -func (_EntryPoint *EntryPointCaller) SIGVALIDATIONFAILED(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _EntryPoint.contract.Call(opts, &out, "SIG_VALIDATION_FAILED") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_EntryPoint *EntryPointSession) SIGVALIDATIONFAILED() (*big.Int, error) { - return _EntryPoint.Contract.SIGVALIDATIONFAILED(&_EntryPoint.CallOpts) -} - -func (_EntryPoint *EntryPointCallerSession) SIGVALIDATIONFAILED() (*big.Int, error) { - return _EntryPoint.Contract.SIGVALIDATIONFAILED(&_EntryPoint.CallOpts) -} - -func (_EntryPoint *EntryPointCaller) ValidateSenderAndPaymaster(opts *bind.CallOpts, initCode []byte, sender common.Address, paymasterAndData []byte) error { - var out []interface{} - err := _EntryPoint.contract.Call(opts, &out, "_validateSenderAndPaymaster", initCode, sender, paymasterAndData) - - if err != nil { - return err - } - - return err - -} - -func (_EntryPoint *EntryPointSession) ValidateSenderAndPaymaster(initCode []byte, sender common.Address, paymasterAndData []byte) error { - return _EntryPoint.Contract.ValidateSenderAndPaymaster(&_EntryPoint.CallOpts, initCode, sender, paymasterAndData) -} - -func (_EntryPoint *EntryPointCallerSession) ValidateSenderAndPaymaster(initCode []byte, sender common.Address, paymasterAndData []byte) error { - return _EntryPoint.Contract.ValidateSenderAndPaymaster(&_EntryPoint.CallOpts, initCode, sender, paymasterAndData) -} - -func (_EntryPoint *EntryPointCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { - var out []interface{} - err := _EntryPoint.contract.Call(opts, &out, "balanceOf", account) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_EntryPoint *EntryPointSession) BalanceOf(account common.Address) (*big.Int, error) { - return _EntryPoint.Contract.BalanceOf(&_EntryPoint.CallOpts, account) -} - -func (_EntryPoint *EntryPointCallerSession) BalanceOf(account common.Address) (*big.Int, error) { - return _EntryPoint.Contract.BalanceOf(&_EntryPoint.CallOpts, account) -} - -func (_EntryPoint *EntryPointCaller) Deposits(opts *bind.CallOpts, arg0 common.Address) (Deposits, - - error) { - var out []interface{} - err := _EntryPoint.contract.Call(opts, &out, "deposits", arg0) - - outstruct := new(Deposits) - if err != nil { - return *outstruct, err - } - - outstruct.Deposit = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.Staked = *abi.ConvertType(out[1], new(bool)).(*bool) - outstruct.Stake = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.UnstakeDelaySec = *abi.ConvertType(out[3], new(uint32)).(*uint32) - outstruct.WithdrawTime = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -func (_EntryPoint *EntryPointSession) Deposits(arg0 common.Address) (Deposits, - - error) { - return _EntryPoint.Contract.Deposits(&_EntryPoint.CallOpts, arg0) -} - -func (_EntryPoint *EntryPointCallerSession) Deposits(arg0 common.Address) (Deposits, - - error) { - return _EntryPoint.Contract.Deposits(&_EntryPoint.CallOpts, arg0) -} - -func (_EntryPoint *EntryPointCaller) GetDepositInfo(opts *bind.CallOpts, account common.Address) (IStakeManagerDepositInfo, error) { - var out []interface{} - err := _EntryPoint.contract.Call(opts, &out, "getDepositInfo", account) - - if err != nil { - return *new(IStakeManagerDepositInfo), err - } - - out0 := *abi.ConvertType(out[0], new(IStakeManagerDepositInfo)).(*IStakeManagerDepositInfo) - - return out0, err - -} - -func (_EntryPoint *EntryPointSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { - return _EntryPoint.Contract.GetDepositInfo(&_EntryPoint.CallOpts, account) -} - -func (_EntryPoint *EntryPointCallerSession) GetDepositInfo(account common.Address) (IStakeManagerDepositInfo, error) { - return _EntryPoint.Contract.GetDepositInfo(&_EntryPoint.CallOpts, account) -} - -func (_EntryPoint *EntryPointCaller) GetUserOpHash(opts *bind.CallOpts, userOp UserOperation) ([32]byte, error) { - var out []interface{} - err := _EntryPoint.contract.Call(opts, &out, "getUserOpHash", userOp) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -func (_EntryPoint *EntryPointSession) GetUserOpHash(userOp UserOperation) ([32]byte, error) { - return _EntryPoint.Contract.GetUserOpHash(&_EntryPoint.CallOpts, userOp) -} - -func (_EntryPoint *EntryPointCallerSession) GetUserOpHash(userOp UserOperation) ([32]byte, error) { - return _EntryPoint.Contract.GetUserOpHash(&_EntryPoint.CallOpts, userOp) -} - -func (_EntryPoint *EntryPointTransactor) AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "addStake", unstakeDelaySec) -} - -func (_EntryPoint *EntryPointSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { - return _EntryPoint.Contract.AddStake(&_EntryPoint.TransactOpts, unstakeDelaySec) -} - -func (_EntryPoint *EntryPointTransactorSession) AddStake(unstakeDelaySec uint32) (*types.Transaction, error) { - return _EntryPoint.Contract.AddStake(&_EntryPoint.TransactOpts, unstakeDelaySec) -} - -func (_EntryPoint *EntryPointTransactor) DepositTo(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "depositTo", account) -} - -func (_EntryPoint *EntryPointSession) DepositTo(account common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.DepositTo(&_EntryPoint.TransactOpts, account) -} - -func (_EntryPoint *EntryPointTransactorSession) DepositTo(account common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.DepositTo(&_EntryPoint.TransactOpts, account) -} - -func (_EntryPoint *EntryPointTransactor) GetSenderAddress(opts *bind.TransactOpts, initCode []byte) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "getSenderAddress", initCode) -} - -func (_EntryPoint *EntryPointSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { - return _EntryPoint.Contract.GetSenderAddress(&_EntryPoint.TransactOpts, initCode) -} - -func (_EntryPoint *EntryPointTransactorSession) GetSenderAddress(initCode []byte) (*types.Transaction, error) { - return _EntryPoint.Contract.GetSenderAddress(&_EntryPoint.TransactOpts, initCode) -} - -func (_EntryPoint *EntryPointTransactor) HandleAggregatedOps(opts *bind.TransactOpts, opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "handleAggregatedOps", opsPerAggregator, beneficiary) -} - -func (_EntryPoint *EntryPointSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.HandleAggregatedOps(&_EntryPoint.TransactOpts, opsPerAggregator, beneficiary) -} - -func (_EntryPoint *EntryPointTransactorSession) HandleAggregatedOps(opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.HandleAggregatedOps(&_EntryPoint.TransactOpts, opsPerAggregator, beneficiary) -} - -func (_EntryPoint *EntryPointTransactor) HandleOps(opts *bind.TransactOpts, ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "handleOps", ops, beneficiary) -} - -func (_EntryPoint *EntryPointSession) HandleOps(ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.HandleOps(&_EntryPoint.TransactOpts, ops, beneficiary) -} - -func (_EntryPoint *EntryPointTransactorSession) HandleOps(ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.HandleOps(&_EntryPoint.TransactOpts, ops, beneficiary) -} - -func (_EntryPoint *EntryPointTransactor) InnerHandleOp(opts *bind.TransactOpts, callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "innerHandleOp", callData, opInfo, context) -} - -func (_EntryPoint *EntryPointSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { - return _EntryPoint.Contract.InnerHandleOp(&_EntryPoint.TransactOpts, callData, opInfo, context) -} - -func (_EntryPoint *EntryPointTransactorSession) InnerHandleOp(callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) { - return _EntryPoint.Contract.InnerHandleOp(&_EntryPoint.TransactOpts, callData, opInfo, context) -} - -func (_EntryPoint *EntryPointTransactor) SimulateHandleOp(opts *bind.TransactOpts, op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "simulateHandleOp", op, target, targetCallData) -} - -func (_EntryPoint *EntryPointSession) SimulateHandleOp(op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { - return _EntryPoint.Contract.SimulateHandleOp(&_EntryPoint.TransactOpts, op, target, targetCallData) -} - -func (_EntryPoint *EntryPointTransactorSession) SimulateHandleOp(op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) { - return _EntryPoint.Contract.SimulateHandleOp(&_EntryPoint.TransactOpts, op, target, targetCallData) -} - -func (_EntryPoint *EntryPointTransactor) SimulateValidation(opts *bind.TransactOpts, userOp UserOperation) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "simulateValidation", userOp) -} - -func (_EntryPoint *EntryPointSession) SimulateValidation(userOp UserOperation) (*types.Transaction, error) { - return _EntryPoint.Contract.SimulateValidation(&_EntryPoint.TransactOpts, userOp) -} - -func (_EntryPoint *EntryPointTransactorSession) SimulateValidation(userOp UserOperation) (*types.Transaction, error) { - return _EntryPoint.Contract.SimulateValidation(&_EntryPoint.TransactOpts, userOp) -} - -func (_EntryPoint *EntryPointTransactor) UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "unlockStake") -} - -func (_EntryPoint *EntryPointSession) UnlockStake() (*types.Transaction, error) { - return _EntryPoint.Contract.UnlockStake(&_EntryPoint.TransactOpts) -} - -func (_EntryPoint *EntryPointTransactorSession) UnlockStake() (*types.Transaction, error) { - return _EntryPoint.Contract.UnlockStake(&_EntryPoint.TransactOpts) -} - -func (_EntryPoint *EntryPointTransactor) WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "withdrawStake", withdrawAddress) -} - -func (_EntryPoint *EntryPointSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.WithdrawStake(&_EntryPoint.TransactOpts, withdrawAddress) -} - -func (_EntryPoint *EntryPointTransactorSession) WithdrawStake(withdrawAddress common.Address) (*types.Transaction, error) { - return _EntryPoint.Contract.WithdrawStake(&_EntryPoint.TransactOpts, withdrawAddress) -} - -func (_EntryPoint *EntryPointTransactor) WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { - return _EntryPoint.contract.Transact(opts, "withdrawTo", withdrawAddress, withdrawAmount) -} - -func (_EntryPoint *EntryPointSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { - return _EntryPoint.Contract.WithdrawTo(&_EntryPoint.TransactOpts, withdrawAddress, withdrawAmount) -} - -func (_EntryPoint *EntryPointTransactorSession) WithdrawTo(withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) { - return _EntryPoint.Contract.WithdrawTo(&_EntryPoint.TransactOpts, withdrawAddress, withdrawAmount) -} - -func (_EntryPoint *EntryPointTransactor) Receive(opts *bind.TransactOpts) (*types.Transaction, error) { - return _EntryPoint.contract.RawTransact(opts, nil) -} - -func (_EntryPoint *EntryPointSession) Receive() (*types.Transaction, error) { - return _EntryPoint.Contract.Receive(&_EntryPoint.TransactOpts) -} - -func (_EntryPoint *EntryPointTransactorSession) Receive() (*types.Transaction, error) { - return _EntryPoint.Contract.Receive(&_EntryPoint.TransactOpts) -} - -type EntryPointAccountDeployedIterator struct { - Event *EntryPointAccountDeployed - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointAccountDeployedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointAccountDeployed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointAccountDeployed) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointAccountDeployedIterator) Error() error { - return it.fail -} - -func (it *EntryPointAccountDeployedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointAccountDeployed struct { - UserOpHash [32]byte - Sender common.Address - Factory common.Address - Paymaster common.Address - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterAccountDeployed(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*EntryPointAccountDeployedIterator, error) { - - var userOpHashRule []interface{} - for _, userOpHashItem := range userOpHash { - userOpHashRule = append(userOpHashRule, userOpHashItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "AccountDeployed", userOpHashRule, senderRule) - if err != nil { - return nil, err - } - return &EntryPointAccountDeployedIterator{contract: _EntryPoint.contract, event: "AccountDeployed", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchAccountDeployed(opts *bind.WatchOpts, sink chan<- *EntryPointAccountDeployed, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { - - var userOpHashRule []interface{} - for _, userOpHashItem := range userOpHash { - userOpHashRule = append(userOpHashRule, userOpHashItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "AccountDeployed", userOpHashRule, senderRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointAccountDeployed) - if err := _EntryPoint.contract.UnpackLog(event, "AccountDeployed", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseAccountDeployed(log types.Log) (*EntryPointAccountDeployed, error) { - event := new(EntryPointAccountDeployed) - if err := _EntryPoint.contract.UnpackLog(event, "AccountDeployed", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointDepositedIterator struct { - Event *EntryPointDeposited - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointDepositedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointDeposited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointDeposited) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointDepositedIterator) Error() error { - return it.fail -} - -func (it *EntryPointDepositedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointDeposited struct { - Account common.Address - TotalDeposit *big.Int - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterDeposited(opts *bind.FilterOpts, account []common.Address) (*EntryPointDepositedIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "Deposited", accountRule) - if err != nil { - return nil, err - } - return &EntryPointDepositedIterator{contract: _EntryPoint.contract, event: "Deposited", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchDeposited(opts *bind.WatchOpts, sink chan<- *EntryPointDeposited, account []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "Deposited", accountRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointDeposited) - if err := _EntryPoint.contract.UnpackLog(event, "Deposited", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseDeposited(log types.Log) (*EntryPointDeposited, error) { - event := new(EntryPointDeposited) - if err := _EntryPoint.contract.UnpackLog(event, "Deposited", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointSignatureAggregatorChangedIterator struct { - Event *EntryPointSignatureAggregatorChanged - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointSignatureAggregatorChangedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointSignatureAggregatorChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointSignatureAggregatorChanged) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointSignatureAggregatorChangedIterator) Error() error { - return it.fail -} - -func (it *EntryPointSignatureAggregatorChangedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointSignatureAggregatorChanged struct { - Aggregator common.Address - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterSignatureAggregatorChanged(opts *bind.FilterOpts, aggregator []common.Address) (*EntryPointSignatureAggregatorChangedIterator, error) { - - var aggregatorRule []interface{} - for _, aggregatorItem := range aggregator { - aggregatorRule = append(aggregatorRule, aggregatorItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "SignatureAggregatorChanged", aggregatorRule) - if err != nil { - return nil, err - } - return &EntryPointSignatureAggregatorChangedIterator{contract: _EntryPoint.contract, event: "SignatureAggregatorChanged", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchSignatureAggregatorChanged(opts *bind.WatchOpts, sink chan<- *EntryPointSignatureAggregatorChanged, aggregator []common.Address) (event.Subscription, error) { - - var aggregatorRule []interface{} - for _, aggregatorItem := range aggregator { - aggregatorRule = append(aggregatorRule, aggregatorItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "SignatureAggregatorChanged", aggregatorRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointSignatureAggregatorChanged) - if err := _EntryPoint.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseSignatureAggregatorChanged(log types.Log) (*EntryPointSignatureAggregatorChanged, error) { - event := new(EntryPointSignatureAggregatorChanged) - if err := _EntryPoint.contract.UnpackLog(event, "SignatureAggregatorChanged", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointStakeLockedIterator struct { - Event *EntryPointStakeLocked - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointStakeLockedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointStakeLocked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointStakeLocked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointStakeLockedIterator) Error() error { - return it.fail -} - -func (it *EntryPointStakeLockedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointStakeLocked struct { - Account common.Address - TotalStaked *big.Int - UnstakeDelaySec *big.Int - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterStakeLocked(opts *bind.FilterOpts, account []common.Address) (*EntryPointStakeLockedIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "StakeLocked", accountRule) - if err != nil { - return nil, err - } - return &EntryPointStakeLockedIterator{contract: _EntryPoint.contract, event: "StakeLocked", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchStakeLocked(opts *bind.WatchOpts, sink chan<- *EntryPointStakeLocked, account []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "StakeLocked", accountRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointStakeLocked) - if err := _EntryPoint.contract.UnpackLog(event, "StakeLocked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseStakeLocked(log types.Log) (*EntryPointStakeLocked, error) { - event := new(EntryPointStakeLocked) - if err := _EntryPoint.contract.UnpackLog(event, "StakeLocked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointStakeUnlockedIterator struct { - Event *EntryPointStakeUnlocked - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointStakeUnlockedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointStakeUnlocked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointStakeUnlocked) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointStakeUnlockedIterator) Error() error { - return it.fail -} - -func (it *EntryPointStakeUnlockedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointStakeUnlocked struct { - Account common.Address - WithdrawTime *big.Int - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterStakeUnlocked(opts *bind.FilterOpts, account []common.Address) (*EntryPointStakeUnlockedIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "StakeUnlocked", accountRule) - if err != nil { - return nil, err - } - return &EntryPointStakeUnlockedIterator{contract: _EntryPoint.contract, event: "StakeUnlocked", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchStakeUnlocked(opts *bind.WatchOpts, sink chan<- *EntryPointStakeUnlocked, account []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "StakeUnlocked", accountRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointStakeUnlocked) - if err := _EntryPoint.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseStakeUnlocked(log types.Log) (*EntryPointStakeUnlocked, error) { - event := new(EntryPointStakeUnlocked) - if err := _EntryPoint.contract.UnpackLog(event, "StakeUnlocked", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointStakeWithdrawnIterator struct { - Event *EntryPointStakeWithdrawn - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointStakeWithdrawnIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointStakeWithdrawn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointStakeWithdrawn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointStakeWithdrawnIterator) Error() error { - return it.fail -} - -func (it *EntryPointStakeWithdrawnIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointStakeWithdrawn struct { - Account common.Address - WithdrawAddress common.Address - Amount *big.Int - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterStakeWithdrawn(opts *bind.FilterOpts, account []common.Address) (*EntryPointStakeWithdrawnIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "StakeWithdrawn", accountRule) - if err != nil { - return nil, err - } - return &EntryPointStakeWithdrawnIterator{contract: _EntryPoint.contract, event: "StakeWithdrawn", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchStakeWithdrawn(opts *bind.WatchOpts, sink chan<- *EntryPointStakeWithdrawn, account []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "StakeWithdrawn", accountRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointStakeWithdrawn) - if err := _EntryPoint.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseStakeWithdrawn(log types.Log) (*EntryPointStakeWithdrawn, error) { - event := new(EntryPointStakeWithdrawn) - if err := _EntryPoint.contract.UnpackLog(event, "StakeWithdrawn", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointUserOperationEventIterator struct { - Event *EntryPointUserOperationEvent - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointUserOperationEventIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointUserOperationEvent) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointUserOperationEvent) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointUserOperationEventIterator) Error() error { - return it.fail -} - -func (it *EntryPointUserOperationEventIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointUserOperationEvent struct { - UserOpHash [32]byte - Sender common.Address - Paymaster common.Address - Nonce *big.Int - Success bool - ActualGasCost *big.Int - ActualGasUsed *big.Int - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterUserOperationEvent(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (*EntryPointUserOperationEventIterator, error) { - - var userOpHashRule []interface{} - for _, userOpHashItem := range userOpHash { - userOpHashRule = append(userOpHashRule, userOpHashItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var paymasterRule []interface{} - for _, paymasterItem := range paymaster { - paymasterRule = append(paymasterRule, paymasterItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) - if err != nil { - return nil, err - } - return &EntryPointUserOperationEventIterator{contract: _EntryPoint.contract, event: "UserOperationEvent", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchUserOperationEvent(opts *bind.WatchOpts, sink chan<- *EntryPointUserOperationEvent, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (event.Subscription, error) { - - var userOpHashRule []interface{} - for _, userOpHashItem := range userOpHash { - userOpHashRule = append(userOpHashRule, userOpHashItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var paymasterRule []interface{} - for _, paymasterItem := range paymaster { - paymasterRule = append(paymasterRule, paymasterItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "UserOperationEvent", userOpHashRule, senderRule, paymasterRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointUserOperationEvent) - if err := _EntryPoint.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseUserOperationEvent(log types.Log) (*EntryPointUserOperationEvent, error) { - event := new(EntryPointUserOperationEvent) - if err := _EntryPoint.contract.UnpackLog(event, "UserOperationEvent", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointUserOperationRevertReasonIterator struct { - Event *EntryPointUserOperationRevertReason - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointUserOperationRevertReasonIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointUserOperationRevertReason) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointUserOperationRevertReason) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointUserOperationRevertReasonIterator) Error() error { - return it.fail -} - -func (it *EntryPointUserOperationRevertReasonIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointUserOperationRevertReason struct { - UserOpHash [32]byte - Sender common.Address - Nonce *big.Int - RevertReason []byte - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterUserOperationRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*EntryPointUserOperationRevertReasonIterator, error) { - - var userOpHashRule []interface{} - for _, userOpHashItem := range userOpHash { - userOpHashRule = append(userOpHashRule, userOpHashItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) - if err != nil { - return nil, err - } - return &EntryPointUserOperationRevertReasonIterator{contract: _EntryPoint.contract, event: "UserOperationRevertReason", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchUserOperationRevertReason(opts *bind.WatchOpts, sink chan<- *EntryPointUserOperationRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) { - - var userOpHashRule []interface{} - for _, userOpHashItem := range userOpHash { - userOpHashRule = append(userOpHashRule, userOpHashItem) - } - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "UserOperationRevertReason", userOpHashRule, senderRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointUserOperationRevertReason) - if err := _EntryPoint.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseUserOperationRevertReason(log types.Log) (*EntryPointUserOperationRevertReason, error) { - event := new(EntryPointUserOperationRevertReason) - if err := _EntryPoint.contract.UnpackLog(event, "UserOperationRevertReason", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type EntryPointWithdrawnIterator struct { - Event *EntryPointWithdrawn - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *EntryPointWithdrawnIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(EntryPointWithdrawn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(EntryPointWithdrawn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *EntryPointWithdrawnIterator) Error() error { - return it.fail -} - -func (it *EntryPointWithdrawnIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type EntryPointWithdrawn struct { - Account common.Address - WithdrawAddress common.Address - Amount *big.Int - Raw types.Log -} - -func (_EntryPoint *EntryPointFilterer) FilterWithdrawn(opts *bind.FilterOpts, account []common.Address) (*EntryPointWithdrawnIterator, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.FilterLogs(opts, "Withdrawn", accountRule) - if err != nil { - return nil, err - } - return &EntryPointWithdrawnIterator{contract: _EntryPoint.contract, event: "Withdrawn", logs: logs, sub: sub}, nil -} - -func (_EntryPoint *EntryPointFilterer) WatchWithdrawn(opts *bind.WatchOpts, sink chan<- *EntryPointWithdrawn, account []common.Address) (event.Subscription, error) { - - var accountRule []interface{} - for _, accountItem := range account { - accountRule = append(accountRule, accountItem) - } - - logs, sub, err := _EntryPoint.contract.WatchLogs(opts, "Withdrawn", accountRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(EntryPointWithdrawn) - if err := _EntryPoint.contract.UnpackLog(event, "Withdrawn", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_EntryPoint *EntryPointFilterer) ParseWithdrawn(log types.Log) (*EntryPointWithdrawn, error) { - event := new(EntryPointWithdrawn) - if err := _EntryPoint.contract.UnpackLog(event, "Withdrawn", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type Deposits struct { - Deposit *big.Int - Staked bool - Stake *big.Int - UnstakeDelaySec uint32 - WithdrawTime *big.Int -} - -func (_EntryPoint *EntryPoint) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _EntryPoint.abi.Events["AccountDeployed"].ID: - return _EntryPoint.ParseAccountDeployed(log) - case _EntryPoint.abi.Events["Deposited"].ID: - return _EntryPoint.ParseDeposited(log) - case _EntryPoint.abi.Events["SignatureAggregatorChanged"].ID: - return _EntryPoint.ParseSignatureAggregatorChanged(log) - case _EntryPoint.abi.Events["StakeLocked"].ID: - return _EntryPoint.ParseStakeLocked(log) - case _EntryPoint.abi.Events["StakeUnlocked"].ID: - return _EntryPoint.ParseStakeUnlocked(log) - case _EntryPoint.abi.Events["StakeWithdrawn"].ID: - return _EntryPoint.ParseStakeWithdrawn(log) - case _EntryPoint.abi.Events["UserOperationEvent"].ID: - return _EntryPoint.ParseUserOperationEvent(log) - case _EntryPoint.abi.Events["UserOperationRevertReason"].ID: - return _EntryPoint.ParseUserOperationRevertReason(log) - case _EntryPoint.abi.Events["Withdrawn"].ID: - return _EntryPoint.ParseWithdrawn(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (EntryPointAccountDeployed) Topic() common.Hash { - return common.HexToHash("0xd51a9c61267aa6196961883ecf5ff2da6619c37dac0fa92122513fb32c032d2d") -} - -func (EntryPointDeposited) Topic() common.Hash { - return common.HexToHash("0x2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4") -} - -func (EntryPointSignatureAggregatorChanged) Topic() common.Hash { - return common.HexToHash("0x575ff3acadd5ab348fe1855e217e0f3678f8d767d7494c9f9fefbee2e17cca4d") -} - -func (EntryPointStakeLocked) Topic() common.Hash { - return common.HexToHash("0xa5ae833d0bb1dcd632d98a8b70973e8516812898e19bf27b70071ebc8dc52c01") -} - -func (EntryPointStakeUnlocked) Topic() common.Hash { - return common.HexToHash("0xfa9b3c14cc825c412c9ed81b3ba365a5b459439403f18829e572ed53a4180f0a") -} - -func (EntryPointStakeWithdrawn) Topic() common.Hash { - return common.HexToHash("0xb7c918e0e249f999e965cafeb6c664271b3f4317d296461500e71da39f0cbda3") -} - -func (EntryPointUserOperationEvent) Topic() common.Hash { - return common.HexToHash("0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f") -} - -func (EntryPointUserOperationRevertReason) Topic() common.Hash { - return common.HexToHash("0x1c4fada7374c0a9ee8841fc38afe82932dc0f8e69012e927f061a8bae611a201") -} - -func (EntryPointWithdrawn) Topic() common.Hash { - return common.HexToHash("0xd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb") -} - -func (_EntryPoint *EntryPoint) Address() common.Address { - return _EntryPoint.address -} - -type EntryPointInterface interface { - SIGVALIDATIONFAILED(opts *bind.CallOpts) (*big.Int, error) - - ValidateSenderAndPaymaster(opts *bind.CallOpts, initCode []byte, sender common.Address, paymasterAndData []byte) error - - BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) - - Deposits(opts *bind.CallOpts, arg0 common.Address) (Deposits, - - error) - - GetDepositInfo(opts *bind.CallOpts, account common.Address) (IStakeManagerDepositInfo, error) - - GetUserOpHash(opts *bind.CallOpts, userOp UserOperation) ([32]byte, error) - - AddStake(opts *bind.TransactOpts, unstakeDelaySec uint32) (*types.Transaction, error) - - DepositTo(opts *bind.TransactOpts, account common.Address) (*types.Transaction, error) - - GetSenderAddress(opts *bind.TransactOpts, initCode []byte) (*types.Transaction, error) - - HandleAggregatedOps(opts *bind.TransactOpts, opsPerAggregator []IEntryPointUserOpsPerAggregator, beneficiary common.Address) (*types.Transaction, error) - - HandleOps(opts *bind.TransactOpts, ops []UserOperation, beneficiary common.Address) (*types.Transaction, error) - - InnerHandleOp(opts *bind.TransactOpts, callData []byte, opInfo EntryPointUserOpInfo, context []byte) (*types.Transaction, error) - - SimulateHandleOp(opts *bind.TransactOpts, op UserOperation, target common.Address, targetCallData []byte) (*types.Transaction, error) - - SimulateValidation(opts *bind.TransactOpts, userOp UserOperation) (*types.Transaction, error) - - UnlockStake(opts *bind.TransactOpts) (*types.Transaction, error) - - WithdrawStake(opts *bind.TransactOpts, withdrawAddress common.Address) (*types.Transaction, error) - - WithdrawTo(opts *bind.TransactOpts, withdrawAddress common.Address, withdrawAmount *big.Int) (*types.Transaction, error) - - Receive(opts *bind.TransactOpts) (*types.Transaction, error) - - FilterAccountDeployed(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*EntryPointAccountDeployedIterator, error) - - WatchAccountDeployed(opts *bind.WatchOpts, sink chan<- *EntryPointAccountDeployed, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) - - ParseAccountDeployed(log types.Log) (*EntryPointAccountDeployed, error) - - FilterDeposited(opts *bind.FilterOpts, account []common.Address) (*EntryPointDepositedIterator, error) - - WatchDeposited(opts *bind.WatchOpts, sink chan<- *EntryPointDeposited, account []common.Address) (event.Subscription, error) - - ParseDeposited(log types.Log) (*EntryPointDeposited, error) - - FilterSignatureAggregatorChanged(opts *bind.FilterOpts, aggregator []common.Address) (*EntryPointSignatureAggregatorChangedIterator, error) - - WatchSignatureAggregatorChanged(opts *bind.WatchOpts, sink chan<- *EntryPointSignatureAggregatorChanged, aggregator []common.Address) (event.Subscription, error) - - ParseSignatureAggregatorChanged(log types.Log) (*EntryPointSignatureAggregatorChanged, error) - - FilterStakeLocked(opts *bind.FilterOpts, account []common.Address) (*EntryPointStakeLockedIterator, error) - - WatchStakeLocked(opts *bind.WatchOpts, sink chan<- *EntryPointStakeLocked, account []common.Address) (event.Subscription, error) - - ParseStakeLocked(log types.Log) (*EntryPointStakeLocked, error) - - FilterStakeUnlocked(opts *bind.FilterOpts, account []common.Address) (*EntryPointStakeUnlockedIterator, error) - - WatchStakeUnlocked(opts *bind.WatchOpts, sink chan<- *EntryPointStakeUnlocked, account []common.Address) (event.Subscription, error) - - ParseStakeUnlocked(log types.Log) (*EntryPointStakeUnlocked, error) - - FilterStakeWithdrawn(opts *bind.FilterOpts, account []common.Address) (*EntryPointStakeWithdrawnIterator, error) - - WatchStakeWithdrawn(opts *bind.WatchOpts, sink chan<- *EntryPointStakeWithdrawn, account []common.Address) (event.Subscription, error) - - ParseStakeWithdrawn(log types.Log) (*EntryPointStakeWithdrawn, error) - - FilterUserOperationEvent(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (*EntryPointUserOperationEventIterator, error) - - WatchUserOperationEvent(opts *bind.WatchOpts, sink chan<- *EntryPointUserOperationEvent, userOpHash [][32]byte, sender []common.Address, paymaster []common.Address) (event.Subscription, error) - - ParseUserOperationEvent(log types.Log) (*EntryPointUserOperationEvent, error) - - FilterUserOperationRevertReason(opts *bind.FilterOpts, userOpHash [][32]byte, sender []common.Address) (*EntryPointUserOperationRevertReasonIterator, error) - - WatchUserOperationRevertReason(opts *bind.WatchOpts, sink chan<- *EntryPointUserOperationRevertReason, userOpHash [][32]byte, sender []common.Address) (event.Subscription, error) - - ParseUserOperationRevertReason(log types.Log) (*EntryPointUserOperationRevertReason, error) - - FilterWithdrawn(opts *bind.FilterOpts, account []common.Address) (*EntryPointWithdrawnIterator, error) - - WatchWithdrawn(opts *bind.WatchOpts, sink chan<- *EntryPointWithdrawn, account []common.Address) (event.Subscription, error) - - ParseWithdrawn(log types.Log) (*EntryPointWithdrawn, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/transmission/generated/greeter_wrapper/greeter_wrapper.go b/core/gethwrappers/transmission/generated/greeter_wrapper/greeter_wrapper.go deleted file mode 100644 index 0f9e4a7719d..00000000000 --- a/core/gethwrappers/transmission/generated/greeter_wrapper/greeter_wrapper.go +++ /dev/null @@ -1,216 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package greeter_wrapper - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -var GreeterMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"getGreeting\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"string\",\"name\":\"greeting\",\"type\":\"string\"}],\"name\":\"setGreeting\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610443806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063a41368621461003b578063fe50cc7214610050575b600080fd5b61004e61004936600461013f565b61006e565b005b61005861007e565b604051610065919061020e565b60405180910390f35b600061007a828261031c565b5050565b60606000805461008d9061027a565b80601f01602080910402602001604051908101604052809291908181526020018280546100b99061027a565b80156101065780601f106100db57610100808354040283529160200191610106565b820191906000526020600020905b8154815290600101906020018083116100e957829003601f168201915b5050505050905090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60006020828403121561015157600080fd5b813567ffffffffffffffff8082111561016957600080fd5b818401915084601f83011261017d57600080fd5b81358181111561018f5761018f610110565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156101d5576101d5610110565b816040528281528760208487010111156101ee57600080fd5b826020860160208301376000928101602001929092525095945050505050565b600060208083528351808285015260005b8181101561023b5785810183015185820160400152820161021f565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600181811c9082168061028e57607f821691505b6020821081036102c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b601f82111561031757600081815260208120601f850160051c810160208610156102f45750805b601f850160051c820191505b8181101561031357828155600101610300565b5050505b505050565b815167ffffffffffffffff81111561033657610336610110565b61034a81610344845461027a565b846102cd565b602080601f83116001811461039d57600084156103675750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555610313565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b828110156103ea578886015182559484019460019091019084016103cb565b508582101561042657878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b0190555056fea164736f6c6343000813000a", -} - -var GreeterABI = GreeterMetaData.ABI - -var GreeterBin = GreeterMetaData.Bin - -func DeployGreeter(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Greeter, error) { - parsed, err := GreeterMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(GreeterBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Greeter{address: address, abi: *parsed, GreeterCaller: GreeterCaller{contract: contract}, GreeterTransactor: GreeterTransactor{contract: contract}, GreeterFilterer: GreeterFilterer{contract: contract}}, nil -} - -type Greeter struct { - address common.Address - abi abi.ABI - GreeterCaller - GreeterTransactor - GreeterFilterer -} - -type GreeterCaller struct { - contract *bind.BoundContract -} - -type GreeterTransactor struct { - contract *bind.BoundContract -} - -type GreeterFilterer struct { - contract *bind.BoundContract -} - -type GreeterSession struct { - Contract *Greeter - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type GreeterCallerSession struct { - Contract *GreeterCaller - CallOpts bind.CallOpts -} - -type GreeterTransactorSession struct { - Contract *GreeterTransactor - TransactOpts bind.TransactOpts -} - -type GreeterRaw struct { - Contract *Greeter -} - -type GreeterCallerRaw struct { - Contract *GreeterCaller -} - -type GreeterTransactorRaw struct { - Contract *GreeterTransactor -} - -func NewGreeter(address common.Address, backend bind.ContractBackend) (*Greeter, error) { - abi, err := abi.JSON(strings.NewReader(GreeterABI)) - if err != nil { - return nil, err - } - contract, err := bindGreeter(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Greeter{address: address, abi: abi, GreeterCaller: GreeterCaller{contract: contract}, GreeterTransactor: GreeterTransactor{contract: contract}, GreeterFilterer: GreeterFilterer{contract: contract}}, nil -} - -func NewGreeterCaller(address common.Address, caller bind.ContractCaller) (*GreeterCaller, error) { - contract, err := bindGreeter(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &GreeterCaller{contract: contract}, nil -} - -func NewGreeterTransactor(address common.Address, transactor bind.ContractTransactor) (*GreeterTransactor, error) { - contract, err := bindGreeter(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &GreeterTransactor{contract: contract}, nil -} - -func NewGreeterFilterer(address common.Address, filterer bind.ContractFilterer) (*GreeterFilterer, error) { - contract, err := bindGreeter(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &GreeterFilterer{contract: contract}, nil -} - -func bindGreeter(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := GreeterMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_Greeter *GreeterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Greeter.Contract.GreeterCaller.contract.Call(opts, result, method, params...) -} - -func (_Greeter *GreeterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Greeter.Contract.GreeterTransactor.contract.Transfer(opts) -} - -func (_Greeter *GreeterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Greeter.Contract.GreeterTransactor.contract.Transact(opts, method, params...) -} - -func (_Greeter *GreeterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Greeter.Contract.contract.Call(opts, result, method, params...) -} - -func (_Greeter *GreeterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Greeter.Contract.contract.Transfer(opts) -} - -func (_Greeter *GreeterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Greeter.Contract.contract.Transact(opts, method, params...) -} - -func (_Greeter *GreeterCaller) GetGreeting(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _Greeter.contract.Call(opts, &out, "getGreeting") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -func (_Greeter *GreeterSession) GetGreeting() (string, error) { - return _Greeter.Contract.GetGreeting(&_Greeter.CallOpts) -} - -func (_Greeter *GreeterCallerSession) GetGreeting() (string, error) { - return _Greeter.Contract.GetGreeting(&_Greeter.CallOpts) -} - -func (_Greeter *GreeterTransactor) SetGreeting(opts *bind.TransactOpts, greeting string) (*types.Transaction, error) { - return _Greeter.contract.Transact(opts, "setGreeting", greeting) -} - -func (_Greeter *GreeterSession) SetGreeting(greeting string) (*types.Transaction, error) { - return _Greeter.Contract.SetGreeting(&_Greeter.TransactOpts, greeting) -} - -func (_Greeter *GreeterTransactorSession) SetGreeting(greeting string) (*types.Transaction, error) { - return _Greeter.Contract.SetGreeting(&_Greeter.TransactOpts, greeting) -} - -func (_Greeter *Greeter) Address() common.Address { - return _Greeter.address -} - -type GreeterInterface interface { - GetGreeting(opts *bind.CallOpts) (string, error) - - SetGreeting(opts *bind.TransactOpts, greeting string) (*types.Transaction, error) - - Address() common.Address -} diff --git a/core/gethwrappers/transmission/generated/paymaster_wrapper/paymaster_wrapper.go b/core/gethwrappers/transmission/generated/paymaster_wrapper/paymaster_wrapper.go deleted file mode 100644 index 63a2712ca3f..00000000000 --- a/core/gethwrappers/transmission/generated/paymaster_wrapper/paymaster_wrapper.go +++ /dev/null @@ -1,719 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package paymaster_wrapper - -import ( - "errors" - "fmt" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -type UserOperation struct { - Sender common.Address - Nonce *big.Int - InitCode []byte - CallData []byte - CallGasLimit *big.Int - VerificationGasLimit *big.Int - PreVerificationGas *big.Int - MaxFeePerGas *big.Int - MaxPriorityFeePerGas *big.Int - PaymasterAndData []byte - Signature []byte -} - -var PaymasterMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"linkToken\",\"type\":\"address\"},{\"internalType\":\"contractAggregatorV3Interface\",\"name\":\"linkEthFeed\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entryPoint\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"juelsNeeded\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"subscriptionBalance\",\"type\":\"uint256\"}],\"name\":\"InsufficientFunds\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidCalldata\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"OnlyCallableFromLink\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"Unauthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"}],\"name\":\"UserOperationAlreadyTried\",\"type\":\"error\"},{\"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\"},{\"inputs\":[],\"name\":\"acceptOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_entryPoint\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_linkEthFeed\",\"outputs\":[{\"internalType\":\"contractAggregatorV3Interface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_linkToken\",\"outputs\":[{\"internalType\":\"contractLinkTokenInterface\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"onTokenTransfer\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enumIPaymaster.PostOpMode\",\"name\":\"\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"actualGasCost\",\"type\":\"uint256\"}],\"name\":\"postOp\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_config\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"stalenessSeconds\",\"type\":\"uint32\"},{\"internalType\":\"int256\",\"name\":\"fallbackWeiPerUnitLink\",\"type\":\"int256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32\",\"name\":\"stalenessSeconds\",\"type\":\"uint32\"},{\"internalType\":\"int256\",\"name\":\"fallbackWeiPerUnitLink\",\"type\":\"int256\"}],\"name\":\"setConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"maxCost\",\"type\":\"uint256\"}],\"name\":\"validatePaymasterUserOp\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"context\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60e06040523480156200001157600080fd5b50604051620014c4380380620014c48339810160408190526200003491620001a3565b33806000816200008b5760405162461bcd60e51b815260206004820152601860248201527f43616e6e6f7420736574206f776e657220746f207a65726f000000000000000060448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0384811691909117909155811615620000be57620000be81620000df565b5050506001600160a01b0392831660805290821660a0521660c052620001f7565b336001600160a01b03821603620001395760405162461bcd60e51b815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c66000000000000000000604482015260640162000082565b600180546001600160a01b0319166001600160a01b0383811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b6001600160a01b0381168114620001a057600080fd5b50565b600080600060608486031215620001b957600080fd5b8351620001c6816200018a565b6020850151909350620001d9816200018a565b6040850151909250620001ec816200018a565b809150509250925092565b60805160a05160c0516112656200025f600039600081816101080152818161049f01528181610507015281816105cd015261063501526000818161018f0152610cb60152600081816101dc015281816103a201528181610ac90152610b8101526112656000f3fe608060405234801561001057600080fd5b50600436106100c95760003560e01c80639b9bd4de11610081578063db37983b1161005b578063db37983b146101d7578063f2fde38b146101fe578063f465c77e1461021157600080fd5b80639b9bd4de1461018a578063a4c0ed36146101b1578063a9a23409146101c457600080fd5b806379ba5097116100b257806379ba50971461014f5780638a38f365146101595780638da5cb5b1461016c57600080fd5b8063088070f5146100ce578063140fcfb114610103575b600080fd5b6002546003546100e29163ffffffff169082565b6040805163ffffffff90931683526020830191909152015b60405180910390f35b61012a7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100fa565b610157610232565b005b610157610167366004610d5b565b610334565b60005473ffffffffffffffffffffffffffffffffffffffff1661012a565b61012a7f000000000000000000000000000000000000000000000000000000000000000081565b6101576101bf366004610dfb565b61038a565b6101576101d2366004610e57565b610487565b61012a7f000000000000000000000000000000000000000000000000000000000000000081565b61015761020c366004610eb7565b61059d565b61022461021f366004610edb565b6105b1565b6040516100fa929190610f2f565b60015473ffffffffffffffffffffffffffffffffffffffff1633146102b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4d7573742062652070726f706f736564206f776e65720000000000000000000060448201526064015b60405180910390fd5b60008054337fffffffffffffffffffffffff00000000000000000000000000000000000000008083168217845560018054909116905560405173ffffffffffffffffffffffffffffffffffffffff90921692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a350565b61033c610849565b6040805180820190915263ffffffff9092168083526020909201819052600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000016909217909155600355565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146103f9576040517f44b0e3c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60208114610433576040517f8129bbcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061044182840184610eb7565b73ffffffffffffffffffffffffffffffffffffffff811660009081526005602052604081208054929350869290919061047b908490610fd1565b90915550505050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610534576040517f295a81c100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044016102af565b60008061054384860186610fe4565b9150915080610551846108cc565b61055b9190610fd1565b73ffffffffffffffffffffffffffffffffffffffff831660009081526005602052604081208054909190610590908490611002565b9091555050505050505050565b6105a5610849565b6105ae816108f8565b50565b606060003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610662576040517f295a81c100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001660248201526044016102af565b60008481526004602052604090205460ff16156106ae576040517f7413dcf8000000000000000000000000000000000000000000000000000000008152600481018590526024016102af565b60006106b9866109ed565b90506000816106c7866108cc565b6106d19190610fd1565b905080600560006106e560208b018b610eb7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156107b057806005600061073860208b018b610eb7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040517f03eb8b540000000000000000000000000000000000000000000000000000000081526004016102af929190918252602082015260400190565b600086815260046020908152604090912080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556107f690880188610eb7565b6040805173ffffffffffffffffffffffffffffffffffffffff9092166020830152810183905260600160405160208183030381529060405261083b6000806000610c29565b935093505050935093915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146108ca576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4f6e6c792063616c6c61626c65206279206f776e65720000000000000000000060448201526064016102af565b565b60006108d6610c61565b6108e883670de0b6b3a7640000611015565b6108f2919061102c565b92915050565b3373ffffffffffffffffffffffffffffffffffffffff821603610977576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f43616e6e6f74207472616e7366657220746f2073656c6600000000000000000060448201526064016102af565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83811691821790925560008054604051929316917fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae12789190a350565b60006109fd610120830183611067565b9050601403610a0e57506000919050565b6000610a1e610120840184611067565b6014818110610a2f57610a2f6110cc565b919091013560f81c9150819050610c23576000610a50610120850185611067565b610a5e9160159082906110fb565b810190610a6b9190611125565b90508060200151600014158015610b385750602081015181516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527f0000000000000000000000000000000000000000000000000000000000000000909116906370a0823190602401602060405180830381865afa158015610b12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b3691906111ae565b105b15610c2157805160408083015190517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169263a9059cbb92610bd59260040173ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020604051808303816000875af1158015610bf4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1891906111c7565b50806040015192505b505b50919050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b85610c51576000610c54565b60015b60ff161717949350505050565b600254604080517ffeaf968c000000000000000000000000000000000000000000000000000000008152905160009263ffffffff1691821515918491829173ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169163feaf968c9160048083019260a09291908290030181865afa158015610d01573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d259190611208565b509450909250849150508015610d495750610d408242611002565b8463ffffffff16105b15610d5357506003545b949350505050565b60008060408385031215610d6e57600080fd5b823563ffffffff81168114610d8257600080fd5b946020939093013593505050565b73ffffffffffffffffffffffffffffffffffffffff811681146105ae57600080fd5b60008083601f840112610dc457600080fd5b50813567ffffffffffffffff811115610ddc57600080fd5b602083019150836020828501011115610df457600080fd5b9250929050565b60008060008060608587031215610e1157600080fd5b8435610e1c81610d90565b935060208501359250604085013567ffffffffffffffff811115610e3f57600080fd5b610e4b87828801610db2565b95989497509550505050565b60008060008060608587031215610e6d57600080fd5b843560038110610e7c57600080fd5b9350602085013567ffffffffffffffff811115610e9857600080fd5b610ea487828801610db2565b9598909750949560400135949350505050565b600060208284031215610ec957600080fd5b8135610ed481610d90565b9392505050565b600080600060608486031215610ef057600080fd5b833567ffffffffffffffff811115610f0757600080fd5b84016101608187031215610f1a57600080fd5b95602085013595506040909401359392505050565b604081526000835180604084015260005b81811015610f5d5760208187018101516060868401015201610f40565b5060006060828501015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168401019150508260208301529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156108f2576108f2610fa2565b60008060408385031215610ff757600080fd5b8235610d8281610d90565b818103818111156108f2576108f2610fa2565b80820281158282048414176108f2576108f2610fa2565b600082611062577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261109c57600080fd5b83018035915067ffffffffffffffff8211156110b757600080fd5b602001915036819003821315610df457600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000808585111561110b57600080fd5b8386111561111857600080fd5b5050820193919092039150565b60006060828403121561113757600080fd5b6040516060810181811067ffffffffffffffff82111715611181577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052823561118f81610d90565b8152602083810135908201526040928301359281019290925250919050565b6000602082840312156111c057600080fd5b5051919050565b6000602082840312156111d957600080fd5b81518015158114610ed457600080fd5b805169ffffffffffffffffffff8116811461120357600080fd5b919050565b600080600080600060a0868803121561122057600080fd5b611229866111e9565b945060208601519350604086015192506060860151915061124c608087016111e9565b9050929550929590935056fea164736f6c6343000813000a", -} - -var PaymasterABI = PaymasterMetaData.ABI - -var PaymasterBin = PaymasterMetaData.Bin - -func DeployPaymaster(auth *bind.TransactOpts, backend bind.ContractBackend, linkToken common.Address, linkEthFeed common.Address, entryPoint common.Address) (common.Address, *types.Transaction, *Paymaster, error) { - parsed, err := PaymasterMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(PaymasterBin), backend, linkToken, linkEthFeed, entryPoint) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Paymaster{address: address, abi: *parsed, PaymasterCaller: PaymasterCaller{contract: contract}, PaymasterTransactor: PaymasterTransactor{contract: contract}, PaymasterFilterer: PaymasterFilterer{contract: contract}}, nil -} - -type Paymaster struct { - address common.Address - abi abi.ABI - PaymasterCaller - PaymasterTransactor - PaymasterFilterer -} - -type PaymasterCaller struct { - contract *bind.BoundContract -} - -type PaymasterTransactor struct { - contract *bind.BoundContract -} - -type PaymasterFilterer struct { - contract *bind.BoundContract -} - -type PaymasterSession struct { - Contract *Paymaster - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type PaymasterCallerSession struct { - Contract *PaymasterCaller - CallOpts bind.CallOpts -} - -type PaymasterTransactorSession struct { - Contract *PaymasterTransactor - TransactOpts bind.TransactOpts -} - -type PaymasterRaw struct { - Contract *Paymaster -} - -type PaymasterCallerRaw struct { - Contract *PaymasterCaller -} - -type PaymasterTransactorRaw struct { - Contract *PaymasterTransactor -} - -func NewPaymaster(address common.Address, backend bind.ContractBackend) (*Paymaster, error) { - abi, err := abi.JSON(strings.NewReader(PaymasterABI)) - if err != nil { - return nil, err - } - contract, err := bindPaymaster(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Paymaster{address: address, abi: abi, PaymasterCaller: PaymasterCaller{contract: contract}, PaymasterTransactor: PaymasterTransactor{contract: contract}, PaymasterFilterer: PaymasterFilterer{contract: contract}}, nil -} - -func NewPaymasterCaller(address common.Address, caller bind.ContractCaller) (*PaymasterCaller, error) { - contract, err := bindPaymaster(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &PaymasterCaller{contract: contract}, nil -} - -func NewPaymasterTransactor(address common.Address, transactor bind.ContractTransactor) (*PaymasterTransactor, error) { - contract, err := bindPaymaster(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &PaymasterTransactor{contract: contract}, nil -} - -func NewPaymasterFilterer(address common.Address, filterer bind.ContractFilterer) (*PaymasterFilterer, error) { - contract, err := bindPaymaster(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &PaymasterFilterer{contract: contract}, nil -} - -func bindPaymaster(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := PaymasterMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_Paymaster *PaymasterRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Paymaster.Contract.PaymasterCaller.contract.Call(opts, result, method, params...) -} - -func (_Paymaster *PaymasterRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Paymaster.Contract.PaymasterTransactor.contract.Transfer(opts) -} - -func (_Paymaster *PaymasterRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Paymaster.Contract.PaymasterTransactor.contract.Transact(opts, method, params...) -} - -func (_Paymaster *PaymasterCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Paymaster.Contract.contract.Call(opts, result, method, params...) -} - -func (_Paymaster *PaymasterTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Paymaster.Contract.contract.Transfer(opts) -} - -func (_Paymaster *PaymasterTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Paymaster.Contract.contract.Transact(opts, method, params...) -} - -func (_Paymaster *PaymasterCaller) IEntryPoint(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Paymaster.contract.Call(opts, &out, "i_entryPoint") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_Paymaster *PaymasterSession) IEntryPoint() (common.Address, error) { - return _Paymaster.Contract.IEntryPoint(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCallerSession) IEntryPoint() (common.Address, error) { - return _Paymaster.Contract.IEntryPoint(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCaller) ILinkEthFeed(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Paymaster.contract.Call(opts, &out, "i_linkEthFeed") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_Paymaster *PaymasterSession) ILinkEthFeed() (common.Address, error) { - return _Paymaster.Contract.ILinkEthFeed(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCallerSession) ILinkEthFeed() (common.Address, error) { - return _Paymaster.Contract.ILinkEthFeed(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCaller) ILinkToken(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Paymaster.contract.Call(opts, &out, "i_linkToken") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_Paymaster *PaymasterSession) ILinkToken() (common.Address, error) { - return _Paymaster.Contract.ILinkToken(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCallerSession) ILinkToken() (common.Address, error) { - return _Paymaster.Contract.ILinkToken(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCaller) Owner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Paymaster.contract.Call(opts, &out, "owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_Paymaster *PaymasterSession) Owner() (common.Address, error) { - return _Paymaster.Contract.Owner(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCallerSession) Owner() (common.Address, error) { - return _Paymaster.Contract.Owner(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCaller) SConfig(opts *bind.CallOpts) (SConfig, - - error) { - var out []interface{} - err := _Paymaster.contract.Call(opts, &out, "s_config") - - outstruct := new(SConfig) - if err != nil { - return *outstruct, err - } - - outstruct.StalenessSeconds = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.FallbackWeiPerUnitLink = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -func (_Paymaster *PaymasterSession) SConfig() (SConfig, - - error) { - return _Paymaster.Contract.SConfig(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterCallerSession) SConfig() (SConfig, - - error) { - return _Paymaster.Contract.SConfig(&_Paymaster.CallOpts) -} - -func (_Paymaster *PaymasterTransactor) AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Paymaster.contract.Transact(opts, "acceptOwnership") -} - -func (_Paymaster *PaymasterSession) AcceptOwnership() (*types.Transaction, error) { - return _Paymaster.Contract.AcceptOwnership(&_Paymaster.TransactOpts) -} - -func (_Paymaster *PaymasterTransactorSession) AcceptOwnership() (*types.Transaction, error) { - return _Paymaster.Contract.AcceptOwnership(&_Paymaster.TransactOpts) -} - -func (_Paymaster *PaymasterTransactor) OnTokenTransfer(opts *bind.TransactOpts, arg0 common.Address, _amount *big.Int, _data []byte) (*types.Transaction, error) { - return _Paymaster.contract.Transact(opts, "onTokenTransfer", arg0, _amount, _data) -} - -func (_Paymaster *PaymasterSession) OnTokenTransfer(arg0 common.Address, _amount *big.Int, _data []byte) (*types.Transaction, error) { - return _Paymaster.Contract.OnTokenTransfer(&_Paymaster.TransactOpts, arg0, _amount, _data) -} - -func (_Paymaster *PaymasterTransactorSession) OnTokenTransfer(arg0 common.Address, _amount *big.Int, _data []byte) (*types.Transaction, error) { - return _Paymaster.Contract.OnTokenTransfer(&_Paymaster.TransactOpts, arg0, _amount, _data) -} - -func (_Paymaster *PaymasterTransactor) PostOp(opts *bind.TransactOpts, arg0 uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) { - return _Paymaster.contract.Transact(opts, "postOp", arg0, context, actualGasCost) -} - -func (_Paymaster *PaymasterSession) PostOp(arg0 uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) { - return _Paymaster.Contract.PostOp(&_Paymaster.TransactOpts, arg0, context, actualGasCost) -} - -func (_Paymaster *PaymasterTransactorSession) PostOp(arg0 uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) { - return _Paymaster.Contract.PostOp(&_Paymaster.TransactOpts, arg0, context, actualGasCost) -} - -func (_Paymaster *PaymasterTransactor) SetConfig(opts *bind.TransactOpts, stalenessSeconds uint32, fallbackWeiPerUnitLink *big.Int) (*types.Transaction, error) { - return _Paymaster.contract.Transact(opts, "setConfig", stalenessSeconds, fallbackWeiPerUnitLink) -} - -func (_Paymaster *PaymasterSession) SetConfig(stalenessSeconds uint32, fallbackWeiPerUnitLink *big.Int) (*types.Transaction, error) { - return _Paymaster.Contract.SetConfig(&_Paymaster.TransactOpts, stalenessSeconds, fallbackWeiPerUnitLink) -} - -func (_Paymaster *PaymasterTransactorSession) SetConfig(stalenessSeconds uint32, fallbackWeiPerUnitLink *big.Int) (*types.Transaction, error) { - return _Paymaster.Contract.SetConfig(&_Paymaster.TransactOpts, stalenessSeconds, fallbackWeiPerUnitLink) -} - -func (_Paymaster *PaymasterTransactor) TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _Paymaster.contract.Transact(opts, "transferOwnership", to) -} - -func (_Paymaster *PaymasterSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _Paymaster.Contract.TransferOwnership(&_Paymaster.TransactOpts, to) -} - -func (_Paymaster *PaymasterTransactorSession) TransferOwnership(to common.Address) (*types.Transaction, error) { - return _Paymaster.Contract.TransferOwnership(&_Paymaster.TransactOpts, to) -} - -func (_Paymaster *PaymasterTransactor) ValidatePaymasterUserOp(opts *bind.TransactOpts, userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { - return _Paymaster.contract.Transact(opts, "validatePaymasterUserOp", userOp, userOpHash, maxCost) -} - -func (_Paymaster *PaymasterSession) ValidatePaymasterUserOp(userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { - return _Paymaster.Contract.ValidatePaymasterUserOp(&_Paymaster.TransactOpts, userOp, userOpHash, maxCost) -} - -func (_Paymaster *PaymasterTransactorSession) ValidatePaymasterUserOp(userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) { - return _Paymaster.Contract.ValidatePaymasterUserOp(&_Paymaster.TransactOpts, userOp, userOpHash, maxCost) -} - -type PaymasterOwnershipTransferRequestedIterator struct { - Event *PaymasterOwnershipTransferRequested - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *PaymasterOwnershipTransferRequestedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(PaymasterOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(PaymasterOwnershipTransferRequested) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *PaymasterOwnershipTransferRequestedIterator) Error() error { - return it.fail -} - -func (it *PaymasterOwnershipTransferRequestedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type PaymasterOwnershipTransferRequested struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_Paymaster *PaymasterFilterer) FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PaymasterOwnershipTransferRequestedIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Paymaster.contract.FilterLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return &PaymasterOwnershipTransferRequestedIterator{contract: _Paymaster.contract, event: "OwnershipTransferRequested", logs: logs, sub: sub}, nil -} - -func (_Paymaster *PaymasterFilterer) WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *PaymasterOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Paymaster.contract.WatchLogs(opts, "OwnershipTransferRequested", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(PaymasterOwnershipTransferRequested) - if err := _Paymaster.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_Paymaster *PaymasterFilterer) ParseOwnershipTransferRequested(log types.Log) (*PaymasterOwnershipTransferRequested, error) { - event := new(PaymasterOwnershipTransferRequested) - if err := _Paymaster.contract.UnpackLog(event, "OwnershipTransferRequested", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type PaymasterOwnershipTransferredIterator struct { - Event *PaymasterOwnershipTransferred - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *PaymasterOwnershipTransferredIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(PaymasterOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(PaymasterOwnershipTransferred) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *PaymasterOwnershipTransferredIterator) Error() error { - return it.fail -} - -func (it *PaymasterOwnershipTransferredIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type PaymasterOwnershipTransferred struct { - From common.Address - To common.Address - Raw types.Log -} - -func (_Paymaster *PaymasterFilterer) FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PaymasterOwnershipTransferredIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Paymaster.contract.FilterLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return &PaymasterOwnershipTransferredIterator{contract: _Paymaster.contract, event: "OwnershipTransferred", logs: logs, sub: sub}, nil -} - -func (_Paymaster *PaymasterFilterer) WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *PaymasterOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Paymaster.contract.WatchLogs(opts, "OwnershipTransferred", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(PaymasterOwnershipTransferred) - if err := _Paymaster.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_Paymaster *PaymasterFilterer) ParseOwnershipTransferred(log types.Log) (*PaymasterOwnershipTransferred, error) { - event := new(PaymasterOwnershipTransferred) - if err := _Paymaster.contract.UnpackLog(event, "OwnershipTransferred", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -type SConfig struct { - StalenessSeconds uint32 - FallbackWeiPerUnitLink *big.Int -} - -func (_Paymaster *Paymaster) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _Paymaster.abi.Events["OwnershipTransferRequested"].ID: - return _Paymaster.ParseOwnershipTransferRequested(log) - case _Paymaster.abi.Events["OwnershipTransferred"].ID: - return _Paymaster.ParseOwnershipTransferred(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (PaymasterOwnershipTransferRequested) Topic() common.Hash { - return common.HexToHash("0xed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae1278") -} - -func (PaymasterOwnershipTransferred) Topic() common.Hash { - return common.HexToHash("0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0") -} - -func (_Paymaster *Paymaster) Address() common.Address { - return _Paymaster.address -} - -type PaymasterInterface interface { - IEntryPoint(opts *bind.CallOpts) (common.Address, error) - - ILinkEthFeed(opts *bind.CallOpts) (common.Address, error) - - ILinkToken(opts *bind.CallOpts) (common.Address, error) - - Owner(opts *bind.CallOpts) (common.Address, error) - - SConfig(opts *bind.CallOpts) (SConfig, - - error) - - AcceptOwnership(opts *bind.TransactOpts) (*types.Transaction, error) - - OnTokenTransfer(opts *bind.TransactOpts, arg0 common.Address, _amount *big.Int, _data []byte) (*types.Transaction, error) - - PostOp(opts *bind.TransactOpts, arg0 uint8, context []byte, actualGasCost *big.Int) (*types.Transaction, error) - - SetConfig(opts *bind.TransactOpts, stalenessSeconds uint32, fallbackWeiPerUnitLink *big.Int) (*types.Transaction, error) - - TransferOwnership(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) - - ValidatePaymasterUserOp(opts *bind.TransactOpts, userOp UserOperation, userOpHash [32]byte, maxCost *big.Int) (*types.Transaction, error) - - FilterOwnershipTransferRequested(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PaymasterOwnershipTransferRequestedIterator, error) - - WatchOwnershipTransferRequested(opts *bind.WatchOpts, sink chan<- *PaymasterOwnershipTransferRequested, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferRequested(log types.Log) (*PaymasterOwnershipTransferRequested, error) - - FilterOwnershipTransferred(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*PaymasterOwnershipTransferredIterator, error) - - WatchOwnershipTransferred(opts *bind.WatchOpts, sink chan<- *PaymasterOwnershipTransferred, from []common.Address, to []common.Address) (event.Subscription, error) - - ParseOwnershipTransferred(log types.Log) (*PaymasterOwnershipTransferred, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/transmission/generated/sca_wrapper/sca_wrapper.go b/core/gethwrappers/transmission/generated/sca_wrapper/sca_wrapper.go deleted file mode 100644 index 989e4058685..00000000000 --- a/core/gethwrappers/transmission/generated/sca_wrapper/sca_wrapper.go +++ /dev/null @@ -1,292 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package sca_wrapper - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -type UserOperation struct { - Sender common.Address - Nonce *big.Int - InitCode []byte - CallData []byte - CallGasLimit *big.Int - VerificationGasLimit *big.Int - PreVerificationGas *big.Int - MaxFeePerGas *big.Int - MaxPriorityFeePerGas *big.Int - PaymasterAndData []byte - Signature []byte -} - -var SCAMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entryPoint\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"BadFormatOrOOG\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"currentNonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"nonceGiven\",\"type\":\"uint256\"}],\"name\":\"IncorrectNonce\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"operationHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"InvalidSignature\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"NotAuthorized\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"currentTimestamp\",\"type\":\"uint256\"}],\"name\":\"TransactionExpired\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint48\",\"name\":\"deadline\",\"type\":\"uint48\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"executeTransactionFromEntryPoint\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_entryPoint\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"i_owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"s_nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"callData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"callGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"verificationGasLimit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"preVerificationGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxPriorityFeePerGas\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"paymasterAndData\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"signature\",\"type\":\"bytes\"}],\"internalType\":\"structUserOperation\",\"name\":\"userOp\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"validateUserOp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"validationData\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60c060405234801561001057600080fd5b50604051610acb380380610acb83398101604081905261002f91610062565b6001600160a01b039182166080521660a052610095565b80516001600160a01b038116811461005d57600080fd5b919050565b6000806040838503121561007557600080fd5b61007e83610046565b915061008c60208401610046565b90509250929050565b60805160a051610a046100c760003960008181607101526102b801526000818161010101526101e30152610a046000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80637eccf63e116100505780637eccf63e146100de57806389553be4146100e7578063dba6335f146100fc57600080fd5b8063140fcfb11461006c5780633a871cdd146100bd575b600080fd5b6100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100d06100cb366004610646565b610123565b6040519081526020016100b4565b6100d060005481565b6100fa6100f53660046106da565b6102a0565b005b6100937f000000000000000000000000000000000000000000000000000000000000000081565b60008054846020013514610179576000546040517f7ba633940000000000000000000000000000000000000000000000000000000081526004810191909152602085013560248201526044015b60405180910390fd5b60006101858430610439565b90506000610197610140870187610777565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915061021190508284610550565b73ffffffffffffffffffffffffffffffffffffffff161461024257610239600160008061060e565b92505050610299565b60008054908061025183610812565b90915550600090506102666060880188610777565b61027491600490829061084a565b81019061028191906108a3565b5092505050610293600082600061060e565b93505050505b9392505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610311576040517f4a0bfec1000000000000000000000000000000000000000000000000000000008152336004820152602401610170565b65ffffffffffff83161580159061032f57508265ffffffffffff1642115b15610376576040517f300249d700000000000000000000000000000000000000000000000000000000815265ffffffffffff84166004820152426024820152604401610170565b6000808673ffffffffffffffffffffffffffffffffffffffff168685856040516103a192919061099f565b60006040518083038185875af1925050503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b509150915081610430578051600003610428576040517f20e9b5d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b50505050505050565b604080517f4750045d47fce615521b32cee713ff8db50147e98aec5ca94926b52651ca3fa0602080830191909152818301859052825180830384018152606080840185528151918301919091207f190000000000000000000000000000000000000000000000000000000000000060808501527f010000000000000000000000000000000000000000000000000000000000000060818501527f1c7d3b72b37a35523e273aaadd7b4cd66f618bb81429ab053412d51f50ccea6160828501524660a28501529085901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660c284015260d6808401919091528351808403909101815260f690920190925280519101205b92915050565b602082015160408084015184516000939284918791908110610574576105746109af565b016020015160f81c905060018561058c83601b6109de565b6040805160008152602081018083529390935260ff90911690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156105db573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00151979650505050505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b85610636576000610639565b60015b60ff161717949350505050565b60008060006060848603121561065b57600080fd5b833567ffffffffffffffff81111561067257600080fd5b8401610160818703121561068557600080fd5b95602085013595506040909401359392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146106bc57600080fd5b50565b803565ffffffffffff811681146106d557600080fd5b919050565b6000806000806000608086880312156106f257600080fd5b85356106fd8161069a565b945060208601359350610712604087016106bf565b9250606086013567ffffffffffffffff8082111561072f57600080fd5b818801915088601f83011261074357600080fd5b81358181111561075257600080fd5b89602082850101111561076457600080fd5b9699959850939650602001949392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126107ac57600080fd5b83018035915067ffffffffffffffff8211156107c757600080fd5b6020019150368190038213156107dc57600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610843576108436107e3565b5060010190565b6000808585111561085a57600080fd5b8386111561086757600080fd5b5050820193919092039150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600080608085870312156108b957600080fd5b84356108c48161069a565b9350602085013592506108d9604086016106bf565b9150606085013567ffffffffffffffff808211156108f657600080fd5b818701915087601f83011261090a57600080fd5b81358181111561091c5761091c610874565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561096257610962610874565b816040528281528a602084870101111561097b57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60ff818116838216019081111561054a5761054a6107e356fea164736f6c6343000813000a", -} - -var SCAABI = SCAMetaData.ABI - -var SCABin = SCAMetaData.Bin - -func DeploySCA(auth *bind.TransactOpts, backend bind.ContractBackend, owner common.Address, entryPoint common.Address) (common.Address, *types.Transaction, *SCA, error) { - parsed, err := SCAMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SCABin), backend, owner, entryPoint) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SCA{address: address, abi: *parsed, SCACaller: SCACaller{contract: contract}, SCATransactor: SCATransactor{contract: contract}, SCAFilterer: SCAFilterer{contract: contract}}, nil -} - -type SCA struct { - address common.Address - abi abi.ABI - SCACaller - SCATransactor - SCAFilterer -} - -type SCACaller struct { - contract *bind.BoundContract -} - -type SCATransactor struct { - contract *bind.BoundContract -} - -type SCAFilterer struct { - contract *bind.BoundContract -} - -type SCASession struct { - Contract *SCA - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type SCACallerSession struct { - Contract *SCACaller - CallOpts bind.CallOpts -} - -type SCATransactorSession struct { - Contract *SCATransactor - TransactOpts bind.TransactOpts -} - -type SCARaw struct { - Contract *SCA -} - -type SCACallerRaw struct { - Contract *SCACaller -} - -type SCATransactorRaw struct { - Contract *SCATransactor -} - -func NewSCA(address common.Address, backend bind.ContractBackend) (*SCA, error) { - abi, err := abi.JSON(strings.NewReader(SCAABI)) - if err != nil { - return nil, err - } - contract, err := bindSCA(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SCA{address: address, abi: abi, SCACaller: SCACaller{contract: contract}, SCATransactor: SCATransactor{contract: contract}, SCAFilterer: SCAFilterer{contract: contract}}, nil -} - -func NewSCACaller(address common.Address, caller bind.ContractCaller) (*SCACaller, error) { - contract, err := bindSCA(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SCACaller{contract: contract}, nil -} - -func NewSCATransactor(address common.Address, transactor bind.ContractTransactor) (*SCATransactor, error) { - contract, err := bindSCA(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SCATransactor{contract: contract}, nil -} - -func NewSCAFilterer(address common.Address, filterer bind.ContractFilterer) (*SCAFilterer, error) { - contract, err := bindSCA(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SCAFilterer{contract: contract}, nil -} - -func bindSCA(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SCAMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_SCA *SCARaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SCA.Contract.SCACaller.contract.Call(opts, result, method, params...) -} - -func (_SCA *SCARaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SCA.Contract.SCATransactor.contract.Transfer(opts) -} - -func (_SCA *SCARaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SCA.Contract.SCATransactor.contract.Transact(opts, method, params...) -} - -func (_SCA *SCACallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SCA.Contract.contract.Call(opts, result, method, params...) -} - -func (_SCA *SCATransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SCA.Contract.contract.Transfer(opts) -} - -func (_SCA *SCATransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SCA.Contract.contract.Transact(opts, method, params...) -} - -func (_SCA *SCACaller) IEntryPoint(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SCA.contract.Call(opts, &out, "i_entryPoint") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_SCA *SCASession) IEntryPoint() (common.Address, error) { - return _SCA.Contract.IEntryPoint(&_SCA.CallOpts) -} - -func (_SCA *SCACallerSession) IEntryPoint() (common.Address, error) { - return _SCA.Contract.IEntryPoint(&_SCA.CallOpts) -} - -func (_SCA *SCACaller) IOwner(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _SCA.contract.Call(opts, &out, "i_owner") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_SCA *SCASession) IOwner() (common.Address, error) { - return _SCA.Contract.IOwner(&_SCA.CallOpts) -} - -func (_SCA *SCACallerSession) IOwner() (common.Address, error) { - return _SCA.Contract.IOwner(&_SCA.CallOpts) -} - -func (_SCA *SCACaller) SNonce(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _SCA.contract.Call(opts, &out, "s_nonce") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -func (_SCA *SCASession) SNonce() (*big.Int, error) { - return _SCA.Contract.SNonce(&_SCA.CallOpts) -} - -func (_SCA *SCACallerSession) SNonce() (*big.Int, error) { - return _SCA.Contract.SNonce(&_SCA.CallOpts) -} - -func (_SCA *SCATransactor) ExecuteTransactionFromEntryPoint(opts *bind.TransactOpts, to common.Address, value *big.Int, deadline *big.Int, data []byte) (*types.Transaction, error) { - return _SCA.contract.Transact(opts, "executeTransactionFromEntryPoint", to, value, deadline, data) -} - -func (_SCA *SCASession) ExecuteTransactionFromEntryPoint(to common.Address, value *big.Int, deadline *big.Int, data []byte) (*types.Transaction, error) { - return _SCA.Contract.ExecuteTransactionFromEntryPoint(&_SCA.TransactOpts, to, value, deadline, data) -} - -func (_SCA *SCATransactorSession) ExecuteTransactionFromEntryPoint(to common.Address, value *big.Int, deadline *big.Int, data []byte) (*types.Transaction, error) { - return _SCA.Contract.ExecuteTransactionFromEntryPoint(&_SCA.TransactOpts, to, value, deadline, data) -} - -func (_SCA *SCATransactor) ValidateUserOp(opts *bind.TransactOpts, userOp UserOperation, userOpHash [32]byte, arg2 *big.Int) (*types.Transaction, error) { - return _SCA.contract.Transact(opts, "validateUserOp", userOp, userOpHash, arg2) -} - -func (_SCA *SCASession) ValidateUserOp(userOp UserOperation, userOpHash [32]byte, arg2 *big.Int) (*types.Transaction, error) { - return _SCA.Contract.ValidateUserOp(&_SCA.TransactOpts, userOp, userOpHash, arg2) -} - -func (_SCA *SCATransactorSession) ValidateUserOp(userOp UserOperation, userOpHash [32]byte, arg2 *big.Int) (*types.Transaction, error) { - return _SCA.Contract.ValidateUserOp(&_SCA.TransactOpts, userOp, userOpHash, arg2) -} - -func (_SCA *SCA) Address() common.Address { - return _SCA.address -} - -type SCAInterface interface { - IEntryPoint(opts *bind.CallOpts) (common.Address, error) - - IOwner(opts *bind.CallOpts) (common.Address, error) - - SNonce(opts *bind.CallOpts) (*big.Int, error) - - ExecuteTransactionFromEntryPoint(opts *bind.TransactOpts, to common.Address, value *big.Int, deadline *big.Int, data []byte) (*types.Transaction, error) - - ValidateUserOp(opts *bind.TransactOpts, userOp UserOperation, userOpHash [32]byte, arg2 *big.Int) (*types.Transaction, error) - - Address() common.Address -} diff --git a/core/gethwrappers/transmission/generated/smart_contract_account_factory/smart_contract_account_factory.go b/core/gethwrappers/transmission/generated/smart_contract_account_factory/smart_contract_account_factory.go deleted file mode 100644 index aa9205641c5..00000000000 --- a/core/gethwrappers/transmission/generated/smart_contract_account_factory/smart_contract_account_factory.go +++ /dev/null @@ -1,333 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package smart_contract_account_factory - -import ( - "errors" - "fmt" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -var SmartContractAccountFactoryMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"name\":\"DeploymentFailed\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"scaAddress\",\"type\":\"address\"}],\"name\":\"ContractCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"abiEncodedOwnerAddress\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"name\":\"deploySmartContractAccount\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"scaAddress\",\"type\":\"address\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b5061021e806100206000396000f3fe60806040526004361061001e5760003560e01c80630af4926f14610023575b600080fd5b610036610031366004610138565b61005f565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b6000828251836020016000f5905073ffffffffffffffffffffffffffffffffffffffff81166100ba576040517f3011642500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff821681527fcf78cf0d6f3d8371e1075c69c492ab4ec5d8cf23a1a239b6a51a1d00be7ca3129060200160405180910390a192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806040838503121561014b57600080fd5b82359150602083013567ffffffffffffffff8082111561016a57600080fd5b818501915085601f83011261017e57600080fd5b81358181111561019057610190610109565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019083821181831017156101d6576101d6610109565b816040528281528860208487010111156101ef57600080fd5b826020860160208301376000602084830101528095505050505050925092905056fea164736f6c6343000813000a", -} - -var SmartContractAccountFactoryABI = SmartContractAccountFactoryMetaData.ABI - -var SmartContractAccountFactoryBin = SmartContractAccountFactoryMetaData.Bin - -func DeploySmartContractAccountFactory(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SmartContractAccountFactory, error) { - parsed, err := SmartContractAccountFactoryMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SmartContractAccountFactoryBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SmartContractAccountFactory{address: address, abi: *parsed, SmartContractAccountFactoryCaller: SmartContractAccountFactoryCaller{contract: contract}, SmartContractAccountFactoryTransactor: SmartContractAccountFactoryTransactor{contract: contract}, SmartContractAccountFactoryFilterer: SmartContractAccountFactoryFilterer{contract: contract}}, nil -} - -type SmartContractAccountFactory struct { - address common.Address - abi abi.ABI - SmartContractAccountFactoryCaller - SmartContractAccountFactoryTransactor - SmartContractAccountFactoryFilterer -} - -type SmartContractAccountFactoryCaller struct { - contract *bind.BoundContract -} - -type SmartContractAccountFactoryTransactor struct { - contract *bind.BoundContract -} - -type SmartContractAccountFactoryFilterer struct { - contract *bind.BoundContract -} - -type SmartContractAccountFactorySession struct { - Contract *SmartContractAccountFactory - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type SmartContractAccountFactoryCallerSession struct { - Contract *SmartContractAccountFactoryCaller - CallOpts bind.CallOpts -} - -type SmartContractAccountFactoryTransactorSession struct { - Contract *SmartContractAccountFactoryTransactor - TransactOpts bind.TransactOpts -} - -type SmartContractAccountFactoryRaw struct { - Contract *SmartContractAccountFactory -} - -type SmartContractAccountFactoryCallerRaw struct { - Contract *SmartContractAccountFactoryCaller -} - -type SmartContractAccountFactoryTransactorRaw struct { - Contract *SmartContractAccountFactoryTransactor -} - -func NewSmartContractAccountFactory(address common.Address, backend bind.ContractBackend) (*SmartContractAccountFactory, error) { - abi, err := abi.JSON(strings.NewReader(SmartContractAccountFactoryABI)) - if err != nil { - return nil, err - } - contract, err := bindSmartContractAccountFactory(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SmartContractAccountFactory{address: address, abi: abi, SmartContractAccountFactoryCaller: SmartContractAccountFactoryCaller{contract: contract}, SmartContractAccountFactoryTransactor: SmartContractAccountFactoryTransactor{contract: contract}, SmartContractAccountFactoryFilterer: SmartContractAccountFactoryFilterer{contract: contract}}, nil -} - -func NewSmartContractAccountFactoryCaller(address common.Address, caller bind.ContractCaller) (*SmartContractAccountFactoryCaller, error) { - contract, err := bindSmartContractAccountFactory(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SmartContractAccountFactoryCaller{contract: contract}, nil -} - -func NewSmartContractAccountFactoryTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartContractAccountFactoryTransactor, error) { - contract, err := bindSmartContractAccountFactory(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SmartContractAccountFactoryTransactor{contract: contract}, nil -} - -func NewSmartContractAccountFactoryFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartContractAccountFactoryFilterer, error) { - contract, err := bindSmartContractAccountFactory(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SmartContractAccountFactoryFilterer{contract: contract}, nil -} - -func bindSmartContractAccountFactory(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SmartContractAccountFactoryMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SmartContractAccountFactory.Contract.SmartContractAccountFactoryCaller.contract.Call(opts, result, method, params...) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SmartContractAccountFactory.Contract.SmartContractAccountFactoryTransactor.contract.Transfer(opts) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SmartContractAccountFactory.Contract.SmartContractAccountFactoryTransactor.contract.Transact(opts, method, params...) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SmartContractAccountFactory.Contract.contract.Call(opts, result, method, params...) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SmartContractAccountFactory.Contract.contract.Transfer(opts) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SmartContractAccountFactory.Contract.contract.Transact(opts, method, params...) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryTransactor) DeploySmartContractAccount(opts *bind.TransactOpts, abiEncodedOwnerAddress [32]byte, initCode []byte) (*types.Transaction, error) { - return _SmartContractAccountFactory.contract.Transact(opts, "deploySmartContractAccount", abiEncodedOwnerAddress, initCode) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactorySession) DeploySmartContractAccount(abiEncodedOwnerAddress [32]byte, initCode []byte) (*types.Transaction, error) { - return _SmartContractAccountFactory.Contract.DeploySmartContractAccount(&_SmartContractAccountFactory.TransactOpts, abiEncodedOwnerAddress, initCode) -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryTransactorSession) DeploySmartContractAccount(abiEncodedOwnerAddress [32]byte, initCode []byte) (*types.Transaction, error) { - return _SmartContractAccountFactory.Contract.DeploySmartContractAccount(&_SmartContractAccountFactory.TransactOpts, abiEncodedOwnerAddress, initCode) -} - -type SmartContractAccountFactoryContractCreatedIterator struct { - Event *SmartContractAccountFactoryContractCreated - - contract *bind.BoundContract - event string - - logs chan types.Log - sub ethereum.Subscription - done bool - fail error -} - -func (it *SmartContractAccountFactoryContractCreatedIterator) Next() bool { - - if it.fail != nil { - return false - } - - if it.done { - select { - case log := <-it.logs: - it.Event = new(SmartContractAccountFactoryContractCreated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - - select { - case log := <-it.logs: - it.Event = new(SmartContractAccountFactoryContractCreated) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -func (it *SmartContractAccountFactoryContractCreatedIterator) Error() error { - return it.fail -} - -func (it *SmartContractAccountFactoryContractCreatedIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -type SmartContractAccountFactoryContractCreated struct { - ScaAddress common.Address - Raw types.Log -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryFilterer) FilterContractCreated(opts *bind.FilterOpts) (*SmartContractAccountFactoryContractCreatedIterator, error) { - - logs, sub, err := _SmartContractAccountFactory.contract.FilterLogs(opts, "ContractCreated") - if err != nil { - return nil, err - } - return &SmartContractAccountFactoryContractCreatedIterator{contract: _SmartContractAccountFactory.contract, event: "ContractCreated", logs: logs, sub: sub}, nil -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryFilterer) WatchContractCreated(opts *bind.WatchOpts, sink chan<- *SmartContractAccountFactoryContractCreated) (event.Subscription, error) { - - logs, sub, err := _SmartContractAccountFactory.contract.WatchLogs(opts, "ContractCreated") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - - event := new(SmartContractAccountFactoryContractCreated) - if err := _SmartContractAccountFactory.contract.UnpackLog(event, "ContractCreated", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -func (_SmartContractAccountFactory *SmartContractAccountFactoryFilterer) ParseContractCreated(log types.Log) (*SmartContractAccountFactoryContractCreated, error) { - event := new(SmartContractAccountFactoryContractCreated) - if err := _SmartContractAccountFactory.contract.UnpackLog(event, "ContractCreated", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -func (_SmartContractAccountFactory *SmartContractAccountFactory) ParseLog(log types.Log) (generated.AbigenLog, error) { - switch log.Topics[0] { - case _SmartContractAccountFactory.abi.Events["ContractCreated"].ID: - return _SmartContractAccountFactory.ParseContractCreated(log) - - default: - return nil, fmt.Errorf("abigen wrapper received unknown log topic: %v", log.Topics[0]) - } -} - -func (SmartContractAccountFactoryContractCreated) Topic() common.Hash { - return common.HexToHash("0xcf78cf0d6f3d8371e1075c69c492ab4ec5d8cf23a1a239b6a51a1d00be7ca312") -} - -func (_SmartContractAccountFactory *SmartContractAccountFactory) Address() common.Address { - return _SmartContractAccountFactory.address -} - -type SmartContractAccountFactoryInterface interface { - DeploySmartContractAccount(opts *bind.TransactOpts, abiEncodedOwnerAddress [32]byte, initCode []byte) (*types.Transaction, error) - - FilterContractCreated(opts *bind.FilterOpts) (*SmartContractAccountFactoryContractCreatedIterator, error) - - WatchContractCreated(opts *bind.WatchOpts, sink chan<- *SmartContractAccountFactoryContractCreated) (event.Subscription, error) - - ParseContractCreated(log types.Log) (*SmartContractAccountFactoryContractCreated, error) - - ParseLog(log types.Log) (generated.AbigenLog, error) - - Address() common.Address -} diff --git a/core/gethwrappers/transmission/generated/smart_contract_account_helper/smart_contract_account_helper.go b/core/gethwrappers/transmission/generated/smart_contract_account_helper/smart_contract_account_helper.go deleted file mode 100644 index 36e63e3683e..00000000000 --- a/core/gethwrappers/transmission/generated/smart_contract_account_helper/smart_contract_account_helper.go +++ /dev/null @@ -1,322 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package smart_contract_account_helper - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -var SmartContractAccountHelperMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entryPoint\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"}],\"name\":\"calculateSmartContractAccountAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"topupThreshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupAmount\",\"type\":\"uint256\"}],\"name\":\"getAbiEncodedDirectRequestData\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"endContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"getFullEndTxEncoding\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"encoding\",\"type\":\"bytes\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"userOpHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"scaAddress\",\"type\":\"address\"}],\"name\":\"getFullHashForSigning\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"factory\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entryPoint\",\"type\":\"address\"}],\"name\":\"getInitCode\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"entryPoint\",\"type\":\"address\"}],\"name\":\"getSCAInitCodeWithConstructor\",\"outputs\":[{\"internalType\":\"bytes\",\"name\":\"initCode\",\"type\":\"bytes\"}],\"stateMutability\":\"pure\",\"type\":\"function\"}]", - Bin: "0x61161361003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe730000000000000000000000000000000000000000301460806040526004361061007c5760003560e01c8063e0237bef1161005a578063e0237bef14610134578063e464b3631461016c578063fc59bac31461017f57600080fd5b80632c86cb35146100815780634b770f561461010057806382311e3314610113575b600080fd5b6100ea61008f36600461076d565b604080516060808201835273ffffffffffffffffffffffffffffffffffffffff959095168082526020808301958652918301938452825191820152925183820152905182840152805180830390930183526080909101905290565b6040516100f7919061080e565b60405180910390f35b6100ea61010e366004610821565b610192565b610126610121366004610864565b610336565b6040519081526020016100f7565b610147610142366004610821565b610456565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100f7565b6100ea61017a366004610890565b6105e1565b6100ea61018d3660046108e9565b61069f565b6040516060907fffffffffffffffffffffffffffffffffffffffff00000000000000000000000084831b16906000906101cd60208201610737565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f90910116604081815273ffffffffffffffffffffffffffffffffffffffff8881166020840152871690820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261026292916020016109dc565b60405160208183030381529060405290508560601b630af4926f60e01b8383604051602401610292929190610a0b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152602080830180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909516949094179093525161031c939201610a2c565b604051602081830303815290604052925050509392505050565b600061044d8383604080517f4750045d47fce615521b32cee713ff8db50147e98aec5ca94926b52651ca3fa060208083019190915281830194909452815180820383018152606080830184528151918601919091207f190000000000000000000000000000000000000000000000000000000000000060808401527f010000000000000000000000000000000000000000000000000000000000000060818401527f1c7d3b72b37a35523e273aaadd7b4cd66f618bb81429ab053412d51f50ccea6160828401524660a284015293901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660c282015260d6808201939093528151808203909301835260f6019052805191012090565b90505b92915050565b6040516000907fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606086901b1690829061049260208201610737565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f90910116604081815273ffffffffffffffffffffffffffffffffffffffff8981166020840152881690820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261052792916020016109dc565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815282825280516020918201207fff000000000000000000000000000000000000000000000000000000000000008285015260609790971b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166021840152603583019490945260558083019690965280518083039096018652607590910190525082519201919091209392505050565b6060604051806020016105f390610737565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f90910116604081815273ffffffffffffffffffffffffffffffffffffffff8681166020840152851690820152606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261068892916020016109dc565b604051602081830303815290604052905092915050565b60607f89553be40000000000000000000000000000000000000000000000000000000085856106ce8642610a74565b856040516020016106e29493929190610aae565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261071e9291602001610af3565b6040516020818303038152906040529050949350505050565b610acb80610b3c83390190565b803573ffffffffffffffffffffffffffffffffffffffff8116811461076857600080fd5b919050565b60008060006060848603121561078257600080fd5b61078b84610744565b95602085013595506040909401359392505050565b60005b838110156107bb5781810151838201526020016107a3565b50506000910152565b600081518084526107dc8160208601602086016107a0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061044d60208301846107c4565b60008060006060848603121561083657600080fd5b61083f84610744565b925061084d60208501610744565b915061085b60408501610744565b90509250925092565b6000806040838503121561087757600080fd5b8235915061088760208401610744565b90509250929050565b600080604083850312156108a357600080fd5b6108ac83610744565b915061088760208401610744565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600080608085870312156108ff57600080fd5b61090885610744565b93506020850135925060408501359150606085013567ffffffffffffffff8082111561093357600080fd5b818701915087601f83011261094757600080fd5b813581811115610959576109596108ba565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561099f5761099f6108ba565b816040528281528a60208487010111156109b857600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b600083516109ee8184602088016107a0565b835190830190610a028183602088016107a0565b01949350505050565b828152604060208201526000610a2460408301846107c4565b949350505050565b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008316815260008251610a668160148501602087016107a0565b919091016014019392505050565b80820180821115610450577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff85168152836020820152826040820152608060608201526000610ae960808301846107c4565b9695505050505050565b7fffffffff000000000000000000000000000000000000000000000000000000008316815260008251610b2d8160048501602087016107a0565b91909101600401939250505056fe60c060405234801561001057600080fd5b50604051610acb380380610acb83398101604081905261002f91610062565b6001600160a01b039182166080521660a052610095565b80516001600160a01b038116811461005d57600080fd5b919050565b6000806040838503121561007557600080fd5b61007e83610046565b915061008c60208401610046565b90509250929050565b60805160a051610a046100c760003960008181607101526102b801526000818161010101526101e30152610a046000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80637eccf63e116100505780637eccf63e146100de57806389553be4146100e7578063dba6335f146100fc57600080fd5b8063140fcfb11461006c5780633a871cdd146100bd575b600080fd5b6100937f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6100d06100cb366004610646565b610123565b6040519081526020016100b4565b6100d060005481565b6100fa6100f53660046106da565b6102a0565b005b6100937f000000000000000000000000000000000000000000000000000000000000000081565b60008054846020013514610179576000546040517f7ba633940000000000000000000000000000000000000000000000000000000081526004810191909152602085013560248201526044015b60405180910390fd5b60006101858430610439565b90506000610197610140870187610777565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915061021190508284610550565b73ffffffffffffffffffffffffffffffffffffffff161461024257610239600160008061060e565b92505050610299565b60008054908061025183610812565b90915550600090506102666060880188610777565b61027491600490829061084a565b81019061028191906108a3565b5092505050610293600082600061060e565b93505050505b9392505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610311576040517f4a0bfec1000000000000000000000000000000000000000000000000000000008152336004820152602401610170565b65ffffffffffff83161580159061032f57508265ffffffffffff1642115b15610376576040517f300249d700000000000000000000000000000000000000000000000000000000815265ffffffffffff84166004820152426024820152604401610170565b6000808673ffffffffffffffffffffffffffffffffffffffff168685856040516103a192919061099f565b60006040518083038185875af1925050503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b509150915081610430578051600003610428576040517f20e9b5d200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805181602001fd5b50505050505050565b604080517f4750045d47fce615521b32cee713ff8db50147e98aec5ca94926b52651ca3fa0602080830191909152818301859052825180830384018152606080840185528151918301919091207f190000000000000000000000000000000000000000000000000000000000000060808501527f010000000000000000000000000000000000000000000000000000000000000060818501527f1c7d3b72b37a35523e273aaadd7b4cd66f618bb81429ab053412d51f50ccea6160828501524660a28501529085901b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660c284015260d6808401919091528351808403909101815260f690920190925280519101205b92915050565b602082015160408084015184516000939284918791908110610574576105746109af565b016020015160f81c905060018561058c83601b6109de565b6040805160008152602081018083529390935260ff90911690820152606081018590526080810184905260a0016020604051602081039080840390855afa1580156105db573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00151979650505050505050565b600060d08265ffffffffffff16901b60a08465ffffffffffff16901b85610636576000610639565b60015b60ff161717949350505050565b60008060006060848603121561065b57600080fd5b833567ffffffffffffffff81111561067257600080fd5b8401610160818703121561068557600080fd5b95602085013595506040909401359392505050565b73ffffffffffffffffffffffffffffffffffffffff811681146106bc57600080fd5b50565b803565ffffffffffff811681146106d557600080fd5b919050565b6000806000806000608086880312156106f257600080fd5b85356106fd8161069a565b945060208601359350610712604087016106bf565b9250606086013567ffffffffffffffff8082111561072f57600080fd5b818801915088601f83011261074357600080fd5b81358181111561075257600080fd5b89602082850101111561076457600080fd5b9699959850939650602001949392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126107ac57600080fd5b83018035915067ffffffffffffffff8211156107c757600080fd5b6020019150368190038213156107dc57600080fd5b9250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610843576108436107e3565b5060010190565b6000808585111561085a57600080fd5b8386111561086757600080fd5b5050820193919092039150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080600080608085870312156108b957600080fd5b84356108c48161069a565b9350602085013592506108d9604086016106bf565b9150606085013567ffffffffffffffff808211156108f657600080fd5b818701915087601f83011261090a57600080fd5b81358181111561091c5761091c610874565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561096257610962610874565b816040528281528a602084870101111561097b57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60ff818116838216019081111561054a5761054a6107e356fea164736f6c6343000813000aa164736f6c6343000813000a", -} - -var SmartContractAccountHelperABI = SmartContractAccountHelperMetaData.ABI - -var SmartContractAccountHelperBin = SmartContractAccountHelperMetaData.Bin - -func DeploySmartContractAccountHelper(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SmartContractAccountHelper, error) { - parsed, err := SmartContractAccountHelperMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SmartContractAccountHelperBin), backend) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &SmartContractAccountHelper{address: address, abi: *parsed, SmartContractAccountHelperCaller: SmartContractAccountHelperCaller{contract: contract}, SmartContractAccountHelperTransactor: SmartContractAccountHelperTransactor{contract: contract}, SmartContractAccountHelperFilterer: SmartContractAccountHelperFilterer{contract: contract}}, nil -} - -type SmartContractAccountHelper struct { - address common.Address - abi abi.ABI - SmartContractAccountHelperCaller - SmartContractAccountHelperTransactor - SmartContractAccountHelperFilterer -} - -type SmartContractAccountHelperCaller struct { - contract *bind.BoundContract -} - -type SmartContractAccountHelperTransactor struct { - contract *bind.BoundContract -} - -type SmartContractAccountHelperFilterer struct { - contract *bind.BoundContract -} - -type SmartContractAccountHelperSession struct { - Contract *SmartContractAccountHelper - CallOpts bind.CallOpts - TransactOpts bind.TransactOpts -} - -type SmartContractAccountHelperCallerSession struct { - Contract *SmartContractAccountHelperCaller - CallOpts bind.CallOpts -} - -type SmartContractAccountHelperTransactorSession struct { - Contract *SmartContractAccountHelperTransactor - TransactOpts bind.TransactOpts -} - -type SmartContractAccountHelperRaw struct { - Contract *SmartContractAccountHelper -} - -type SmartContractAccountHelperCallerRaw struct { - Contract *SmartContractAccountHelperCaller -} - -type SmartContractAccountHelperTransactorRaw struct { - Contract *SmartContractAccountHelperTransactor -} - -func NewSmartContractAccountHelper(address common.Address, backend bind.ContractBackend) (*SmartContractAccountHelper, error) { - abi, err := abi.JSON(strings.NewReader(SmartContractAccountHelperABI)) - if err != nil { - return nil, err - } - contract, err := bindSmartContractAccountHelper(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &SmartContractAccountHelper{address: address, abi: abi, SmartContractAccountHelperCaller: SmartContractAccountHelperCaller{contract: contract}, SmartContractAccountHelperTransactor: SmartContractAccountHelperTransactor{contract: contract}, SmartContractAccountHelperFilterer: SmartContractAccountHelperFilterer{contract: contract}}, nil -} - -func NewSmartContractAccountHelperCaller(address common.Address, caller bind.ContractCaller) (*SmartContractAccountHelperCaller, error) { - contract, err := bindSmartContractAccountHelper(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SmartContractAccountHelperCaller{contract: contract}, nil -} - -func NewSmartContractAccountHelperTransactor(address common.Address, transactor bind.ContractTransactor) (*SmartContractAccountHelperTransactor, error) { - contract, err := bindSmartContractAccountHelper(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SmartContractAccountHelperTransactor{contract: contract}, nil -} - -func NewSmartContractAccountHelperFilterer(address common.Address, filterer bind.ContractFilterer) (*SmartContractAccountHelperFilterer, error) { - contract, err := bindSmartContractAccountHelper(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SmartContractAccountHelperFilterer{contract: contract}, nil -} - -func bindSmartContractAccountHelper(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SmartContractAccountHelperMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SmartContractAccountHelper.Contract.SmartContractAccountHelperCaller.contract.Call(opts, result, method, params...) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SmartContractAccountHelper.Contract.SmartContractAccountHelperTransactor.contract.Transfer(opts) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SmartContractAccountHelper.Contract.SmartContractAccountHelperTransactor.contract.Transact(opts, method, params...) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _SmartContractAccountHelper.Contract.contract.Call(opts, result, method, params...) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _SmartContractAccountHelper.Contract.contract.Transfer(opts) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _SmartContractAccountHelper.Contract.contract.Transact(opts, method, params...) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCaller) CalculateSmartContractAccountAddress(opts *bind.CallOpts, owner common.Address, entryPoint common.Address, factory common.Address) (common.Address, error) { - var out []interface{} - err := _SmartContractAccountHelper.contract.Call(opts, &out, "calculateSmartContractAccountAddress", owner, entryPoint, factory) - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperSession) CalculateSmartContractAccountAddress(owner common.Address, entryPoint common.Address, factory common.Address) (common.Address, error) { - return _SmartContractAccountHelper.Contract.CalculateSmartContractAccountAddress(&_SmartContractAccountHelper.CallOpts, owner, entryPoint, factory) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerSession) CalculateSmartContractAccountAddress(owner common.Address, entryPoint common.Address, factory common.Address) (common.Address, error) { - return _SmartContractAccountHelper.Contract.CalculateSmartContractAccountAddress(&_SmartContractAccountHelper.CallOpts, owner, entryPoint, factory) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCaller) GetAbiEncodedDirectRequestData(opts *bind.CallOpts, recipient common.Address, topupThreshold *big.Int, topupAmount *big.Int) ([]byte, error) { - var out []interface{} - err := _SmartContractAccountHelper.contract.Call(opts, &out, "getAbiEncodedDirectRequestData", recipient, topupThreshold, topupAmount) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperSession) GetAbiEncodedDirectRequestData(recipient common.Address, topupThreshold *big.Int, topupAmount *big.Int) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetAbiEncodedDirectRequestData(&_SmartContractAccountHelper.CallOpts, recipient, topupThreshold, topupAmount) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerSession) GetAbiEncodedDirectRequestData(recipient common.Address, topupThreshold *big.Int, topupAmount *big.Int) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetAbiEncodedDirectRequestData(&_SmartContractAccountHelper.CallOpts, recipient, topupThreshold, topupAmount) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCaller) GetFullEndTxEncoding(opts *bind.CallOpts, endContract common.Address, value *big.Int, deadline *big.Int, data []byte) ([]byte, error) { - var out []interface{} - err := _SmartContractAccountHelper.contract.Call(opts, &out, "getFullEndTxEncoding", endContract, value, deadline, data) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperSession) GetFullEndTxEncoding(endContract common.Address, value *big.Int, deadline *big.Int, data []byte) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetFullEndTxEncoding(&_SmartContractAccountHelper.CallOpts, endContract, value, deadline, data) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerSession) GetFullEndTxEncoding(endContract common.Address, value *big.Int, deadline *big.Int, data []byte) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetFullEndTxEncoding(&_SmartContractAccountHelper.CallOpts, endContract, value, deadline, data) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCaller) GetFullHashForSigning(opts *bind.CallOpts, userOpHash [32]byte, scaAddress common.Address) ([32]byte, error) { - var out []interface{} - err := _SmartContractAccountHelper.contract.Call(opts, &out, "getFullHashForSigning", userOpHash, scaAddress) - - if err != nil { - return *new([32]byte), err - } - - out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte) - - return out0, err - -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperSession) GetFullHashForSigning(userOpHash [32]byte, scaAddress common.Address) ([32]byte, error) { - return _SmartContractAccountHelper.Contract.GetFullHashForSigning(&_SmartContractAccountHelper.CallOpts, userOpHash, scaAddress) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerSession) GetFullHashForSigning(userOpHash [32]byte, scaAddress common.Address) ([32]byte, error) { - return _SmartContractAccountHelper.Contract.GetFullHashForSigning(&_SmartContractAccountHelper.CallOpts, userOpHash, scaAddress) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCaller) GetInitCode(opts *bind.CallOpts, factory common.Address, owner common.Address, entryPoint common.Address) ([]byte, error) { - var out []interface{} - err := _SmartContractAccountHelper.contract.Call(opts, &out, "getInitCode", factory, owner, entryPoint) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperSession) GetInitCode(factory common.Address, owner common.Address, entryPoint common.Address) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetInitCode(&_SmartContractAccountHelper.CallOpts, factory, owner, entryPoint) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerSession) GetInitCode(factory common.Address, owner common.Address, entryPoint common.Address) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetInitCode(&_SmartContractAccountHelper.CallOpts, factory, owner, entryPoint) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCaller) GetSCAInitCodeWithConstructor(opts *bind.CallOpts, owner common.Address, entryPoint common.Address) ([]byte, error) { - var out []interface{} - err := _SmartContractAccountHelper.contract.Call(opts, &out, "getSCAInitCodeWithConstructor", owner, entryPoint) - - if err != nil { - return *new([]byte), err - } - - out0 := *abi.ConvertType(out[0], new([]byte)).(*[]byte) - - return out0, err - -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperSession) GetSCAInitCodeWithConstructor(owner common.Address, entryPoint common.Address) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetSCAInitCodeWithConstructor(&_SmartContractAccountHelper.CallOpts, owner, entryPoint) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelperCallerSession) GetSCAInitCodeWithConstructor(owner common.Address, entryPoint common.Address) ([]byte, error) { - return _SmartContractAccountHelper.Contract.GetSCAInitCodeWithConstructor(&_SmartContractAccountHelper.CallOpts, owner, entryPoint) -} - -func (_SmartContractAccountHelper *SmartContractAccountHelper) Address() common.Address { - return _SmartContractAccountHelper.address -} - -type SmartContractAccountHelperInterface interface { - CalculateSmartContractAccountAddress(opts *bind.CallOpts, owner common.Address, entryPoint common.Address, factory common.Address) (common.Address, error) - - GetAbiEncodedDirectRequestData(opts *bind.CallOpts, recipient common.Address, topupThreshold *big.Int, topupAmount *big.Int) ([]byte, error) - - GetFullEndTxEncoding(opts *bind.CallOpts, endContract common.Address, value *big.Int, deadline *big.Int, data []byte) ([]byte, error) - - GetFullHashForSigning(opts *bind.CallOpts, userOpHash [32]byte, scaAddress common.Address) ([32]byte, error) - - GetInitCode(opts *bind.CallOpts, factory common.Address, owner common.Address, entryPoint common.Address) ([]byte, error) - - GetSCAInitCodeWithConstructor(opts *bind.CallOpts, owner common.Address, entryPoint common.Address) ([]byte, error) - - Address() common.Address -} diff --git a/core/gethwrappers/transmission/generation/generated-wrapper-dependency-versions-do-not-edit.txt b/core/gethwrappers/transmission/generation/generated-wrapper-dependency-versions-do-not-edit.txt deleted file mode 100644 index 3ccf8656388..00000000000 --- a/core/gethwrappers/transmission/generation/generated-wrapper-dependency-versions-do-not-edit.txt +++ /dev/null @@ -1,9 +0,0 @@ -GETH_VERSION: 1.14.11 -entry_point: ../../../contracts/solc/v0.8.19/EntryPoint/EntryPoint.abi ../../../contracts/solc/v0.8.19/EntryPoint/EntryPoint.bin e43da0e61256471b317cab1c87f2425cecba9b81ac21633334f889bab2f0777d -greeter: ../../../contracts/solc/v0.8.15/Greeter.abi ../../../contracts/solc/v0.8.15/Greeter.bin 653dcba5c33a46292073939ce1e639372cf521c0ec2814d4c9f20c72f796f18c -greeter_wrapper: ../../../contracts/solc/v0.8.19/Greeter/Greeter.abi ../../../contracts/solc/v0.8.19/Greeter/Greeter.bin 7f6def58e337a53553a46cb7992cf2d75ec951014d79376fcb869a2b16b53f6d -paymaster_wrapper: ../../../contracts/solc/v0.8.19/Paymaster/Paymaster.abi ../../../contracts/solc/v0.8.19/Paymaster/Paymaster.bin dbdd1341cfa2d5c09730e0decc32339f62d1a4ea89835a51ff774226ddfbd04b -sca: ../../../contracts/solc/v0.8.15/SCA.abi ../../../contracts/solc/v0.8.15/SCA.bin ae0f860cdac87d4ac505edbd228bd3ea1108550453aba67aebcb61f09cf70d0b -sca_wrapper: ../../../contracts/solc/v0.8.19/SCA/SCA.abi ../../../contracts/solc/v0.8.19/SCA/SCA.bin 6ef817bdefad1b5e84f06e0bdc40848000ab00e1a38371435b793946f425a8e6 -smart_contract_account_factory: ../../../contracts/solc/v0.8.19/SmartContractAccountFactory/SmartContractAccountFactory.abi ../../../contracts/solc/v0.8.19/SmartContractAccountFactory/SmartContractAccountFactory.bin a357132e2782c462fa31ed80c270fe002e666a48ecfe407b71c278fc3a0d3679 -smart_contract_account_helper: ../../../contracts/solc/v0.8.19/SmartContractAccountHelper/SmartContractAccountHelper.abi ../../../contracts/solc/v0.8.19/SmartContractAccountHelper/SmartContractAccountHelper.bin a06aff23aded74d53bd342fdc32d80c3b474ff38223df27f3395e9fd90abd12a diff --git a/core/gethwrappers/transmission/go_generate.go b/core/gethwrappers/transmission/go_generate.go deleted file mode 100644 index b3f2b4b0eb9..00000000000 --- a/core/gethwrappers/transmission/go_generate.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package gethwrappers provides tools for wrapping solidity contracts with -// golang packages, using abigen. -package gethwrappers - -// Transmission -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/Greeter/Greeter.abi ../../../contracts/solc/v0.8.19/Greeter/Greeter.bin Greeter greeter_wrapper -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/SmartContractAccountFactory/SmartContractAccountFactory.abi ../../../contracts/solc/v0.8.19/SmartContractAccountFactory/SmartContractAccountFactory.bin SmartContractAccountFactory smart_contract_account_factory -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/EntryPoint/EntryPoint.abi ../../../contracts/solc/v0.8.19/EntryPoint/EntryPoint.bin EntryPoint entry_point -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/SmartContractAccountHelper/SmartContractAccountHelper.abi ../../../contracts/solc/v0.8.19/SmartContractAccountHelper/SmartContractAccountHelper.bin SmartContractAccountHelper smart_contract_account_helper -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/SCA/SCA.abi ../../../contracts/solc/v0.8.19/SCA/SCA.bin SCA sca_wrapper -//go:generate go run ../generation/generate/wrap.go ../../../contracts/solc/v0.8.19/Paymaster/Paymaster.abi ../../../contracts/solc/v0.8.19/Paymaster/Paymaster.bin Paymaster paymaster_wrapper diff --git a/core/services/transmission/integration_test.go b/core/services/transmission/integration_test.go deleted file mode 100644 index 6e38687313c..00000000000 --- a/core/services/transmission/integration_test.go +++ /dev/null @@ -1,495 +0,0 @@ -package transmission_test - -import ( - "math/big" - "testing" - - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_v3_aggregator_contract" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/solidity_vrf_consumer_interface_v08" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/vrf_coordinator_mock" - - "github.com/ethereum/go-ethereum/core/types" - - evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/transmission/generated/entry_point" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/transmission/generated/greeter_wrapper" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/transmission/generated/paymaster_wrapper" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/transmission/generated/sca_wrapper" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/transmission/generated/smart_contract_account_factory" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/transmission/generated/smart_contract_account_helper" - "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/ethkey" - "github.com/smartcontractkit/chainlink/v2/core/services/transmission" -) - -var ( - greeterABI = evmtypes.MustGetABI(greeter_wrapper.GreeterABI) - consumerABI = evmtypes.MustGetABI(solidity_vrf_consumer_interface_v08.VRFConsumerABI) - entrypointABI = evmtypes.MustGetABI(entry_point.EntryPointABI) -) - -type EntryPointUniverse struct { - holder1 *bind.TransactOpts - holder1Key ethkey.KeyV2 - holder2 *bind.TransactOpts - backend evmtypes.Backend - entryPointAddress common.Address - entryPoint *entry_point.EntryPoint - factoryAddress common.Address - helper *smart_contract_account_helper.SmartContractAccountHelper - greeterAddress common.Address - greeter *greeter_wrapper.Greeter - linkTokenAddress common.Address - linkToken *link_token_interface.LinkToken - linkEthFeedAddress common.Address - vrfCoordinatorAddress common.Address - vrfCoordinator *vrf_coordinator_mock.VRFCoordinatorMock - vrfConsumerAddress common.Address -} - -func deployTransmissionUniverse(t *testing.T) *EntryPointUniverse { - // Create a key for holder1 that we can use to sign - holder1Key := cltest.MustGenerateRandomKey(t) - t.Log("Holder key:", holder1Key.String()) - - // Construct simulated blockchain environment. - holder1Transactor, err := bind.NewKeyedTransactorWithChainID(holder1Key.ToEcdsaPrivKey(), testutils.SimulatedChainID) - require.NoError(t, err) - var ( - holder1 = holder1Transactor - holder2 = testutils.MustNewSimTransactor(t) - ) - genesisData := types.GenesisAlloc{ - holder1.From: {Balance: assets.Ether(1000).ToInt()}, - holder2.From: {Balance: assets.Ether(1000).ToInt()}, - } - backend := cltest.NewSimulatedBackend(t, genesisData, 30e6) - backend.Commit() - - // Setup all contracts and addresses used by tests. - entryPointAddress, _, entryPoint, err := entry_point.DeployEntryPoint(holder1, backend.Client()) - require.NoError(t, err) - factoryAddress, _, _, _ := smart_contract_account_factory.DeploySmartContractAccountFactory(holder1, backend.Client()) - require.NoError(t, err) - _, _, helper, err := smart_contract_account_helper.DeploySmartContractAccountHelper(holder1, backend.Client()) - require.NoError(t, err) - greeterAddress, _, greeter, err := greeter_wrapper.DeployGreeter(holder1, backend.Client()) - require.NoError(t, err) - linkTokenAddress, _, linkToken, err := link_token_interface.DeployLinkToken(holder1, backend.Client()) - require.NoError(t, err) - linkEthFeedAddress, _, _, err := mock_v3_aggregator_contract.DeployMockV3AggregatorContract( - holder1, - backend.Client(), - 18, - (*big.Int)(assets.GWei(5000000)), // .005 ETH - ) - require.NoError(t, err) - vrfCoordinatorAddress, _, vrfCoordinator, err := vrf_coordinator_mock.DeployVRFCoordinatorMock(holder1, backend.Client(), linkTokenAddress) - require.NoError(t, err) - vrfConsumerAddress, _, _, err := solidity_vrf_consumer_interface_v08.DeployVRFConsumer(holder1, backend.Client(), vrfCoordinatorAddress, linkTokenAddress) - require.NoError(t, err) - backend.Commit() - - return &EntryPointUniverse{ - holder1: holder1, - holder1Key: holder1Key, - holder2: holder2, - backend: backend, - entryPointAddress: entryPointAddress, - entryPoint: entryPoint, - factoryAddress: factoryAddress, - helper: helper, - greeterAddress: greeterAddress, - greeter: greeter, - linkTokenAddress: linkTokenAddress, - linkToken: linkToken, - linkEthFeedAddress: linkEthFeedAddress, - vrfCoordinatorAddress: vrfCoordinatorAddress, - vrfCoordinator: vrfCoordinator, - vrfConsumerAddress: vrfConsumerAddress, - } -} - -func Test4337Basic(t *testing.T) { - // Deploy universe. - universe := deployTransmissionUniverse(t) - holder1 := universe.holder1 - holder2 := universe.holder2 - backend := universe.backend - - // Ensure no greeting is already set. - initialGreeting, err := universe.greeter.GetGreeting(nil) - require.NoError(t, err) - require.Equal(t, "", initialGreeting) - - // Get the address at which the Smart Contract Account will be deployed. - toDeployAddress, err := universe.helper.CalculateSmartContractAccountAddress( - nil, - holder1.From, - universe.entryPointAddress, - universe.factoryAddress, - ) - require.NoError(t, err) - t.Log("Smart Contract Account Address:", toDeployAddress) - - // Get the initialization code for the Smart Contract Account. - fullInitializeCode, err := universe.helper.GetInitCode(nil, universe.factoryAddress, holder1.From, universe.entryPointAddress) - require.NoError(t, err) - t.Log("Full initialization code:", common.Bytes2Hex(fullInitializeCode)) - - // Construct calldata for setGreeting. - encodedGreetingCall, err := greeterABI.Pack("setGreeting", "bye") - require.NoError(t, err) - t.Log("Encoded greeting call:", common.Bytes2Hex(encodedGreetingCall)) - - // Construct the calldata to be passed in the user operation. - var ( - value = big.NewInt(0) - nonce = big.NewInt(0) - deadline = big.NewInt(1000) - ) - fullEncoding, err := universe.helper.GetFullEndTxEncoding(nil, universe.greeterAddress, value, deadline, encodedGreetingCall) - require.NoError(t, err) - t.Log("Full user operation calldata:", common.Bytes2Hex(fullEncoding)) - - // Construct and execute user operation. - userOp := entry_point.UserOperation{ - Sender: toDeployAddress, - Nonce: nonce, - InitCode: fullInitializeCode, - CallData: fullEncoding, - CallGasLimit: big.NewInt(10_000_000), - VerificationGasLimit: big.NewInt(10_000_000), - PreVerificationGas: big.NewInt(10_000_000), - MaxFeePerGas: big.NewInt(100), - MaxPriorityFeePerGas: big.NewInt(200), - PaymasterAndData: []byte(""), - Signature: []byte(""), - } - - // Generate hash from user operation, sign it, and include it in the user operation. - userOpHash, err := universe.entryPoint.GetUserOpHash(nil, userOp) - require.NoError(t, err) - fullHash, err := universe.helper.GetFullHashForSigning(nil, userOpHash, toDeployAddress) - require.NoError(t, err) - t.Log("Full hash for signing:", common.Bytes2Hex(fullHash[:])) - sig, err := transmission.SignMessage(universe.holder1Key.ToEcdsaPrivKey(), fullHash[:]) - require.NoError(t, err) - t.Log("Signature:", common.Bytes2Hex(sig)) - userOp.Signature = sig - - // Deposit to the SCA's account to pay for this transaction. - holder1.Value = assets.Ether(10).ToInt() - tx, err := universe.entryPoint.DepositTo(holder1, toDeployAddress) - require.NoError(t, err) - backend.Commit() - _, err = bind.WaitMined(testutils.Context(t), backend.Client(), tx) - require.NoError(t, err) - holder1.Value = assets.Ether(0).ToInt() - balance, err := universe.entryPoint.BalanceOf(nil, toDeployAddress) - require.NoError(t, err) - require.Equal(t, assets.Ether(10).ToInt(), balance) - - // Run handleOps from holder2's account, to demonstrate that any account can execute this signed user operation. - tx, err = universe.entryPoint.HandleOps(holder2, []entry_point.UserOperation{userOp}, holder1.From) - require.NoError(t, err) - backend.Commit() - _, err = bind.WaitMined(testutils.Context(t), backend.Client(), tx) - require.NoError(t, err) - - // Ensure "bye" was successfully set as the greeting. - greetingResult, err := universe.greeter.GetGreeting(nil) - require.NoError(t, err) - require.Equal(t, "bye", greetingResult) - - // Assert smart contract account is created and nonce incremented. - sca, err := sca_wrapper.NewSCA(toDeployAddress, backend.Client()) - require.NoError(t, err) - onChainNonce, err := sca.SNonce(nil) - require.NoError(t, err) - require.Equal(t, big.NewInt(1), onChainNonce) -} - -func Test4337WithLinkTokenPaymaster(t *testing.T) { - // Deploy universe. - universe := deployTransmissionUniverse(t) - holder1 := universe.holder1 - holder2 := universe.holder2 - backend := universe.backend - - // Ensure no greeting is already set. - initialGreeting, err := universe.greeter.GetGreeting(nil) - require.NoError(t, err) - require.Equal(t, "", initialGreeting) - - // Get the address at which the Smart Contract Account will be deployed. - toDeployAddress, err := universe.helper.CalculateSmartContractAccountAddress( - nil, - holder1.From, - universe.entryPointAddress, - universe.factoryAddress, - ) - require.NoError(t, err) - t.Log("Smart Contract Account Address:", toDeployAddress) - - // Get the initialization code for the Smart Contract Account. - fullInitializeCode, err := universe.helper.GetInitCode(nil, universe.factoryAddress, holder1.From, universe.entryPointAddress) - require.NoError(t, err) - t.Log("Full initialization code:", common.Bytes2Hex(fullInitializeCode)) - - // Construct calldata for setGreeting. - encodedGreetingCall, err := greeterABI.Pack("setGreeting", "bye") - require.NoError(t, err) - t.Log("Encoded greeting call:", common.Bytes2Hex(encodedGreetingCall)) - - // Construct the calldata to be passed in the user operation. - var ( - value = big.NewInt(0) - nonce = big.NewInt(0) - deadline = big.NewInt(1000) - ) - fullEncoding, err := universe.helper.GetFullEndTxEncoding(nil, universe.greeterAddress, value, deadline, encodedGreetingCall) - require.NoError(t, err) - t.Log("Full user operation calldata:", common.Bytes2Hex(fullEncoding)) - - // Deposit to LINK paymaster. - linkTokenAddress, _, linkToken, err := link_token_interface.DeployLinkToken(holder1, backend.Client()) - require.NoError(t, err) - linkEthFeedAddress, _, _, err := mock_v3_aggregator_contract.DeployMockV3AggregatorContract( - holder1, - backend.Client(), - 18, - (*big.Int)(assets.GWei(5000000)), // .005 ETH - ) - require.NoError(t, err) - paymasterAddress, _, _, err := paymaster_wrapper.DeployPaymaster(holder1, backend.Client(), linkTokenAddress, linkEthFeedAddress, universe.entryPointAddress) - require.NoError(t, err) - backend.Commit() - tx, err := linkToken.TransferAndCall( - holder1, - paymasterAddress, - assets.Ether(1000).ToInt(), - common.LeftPadBytes(toDeployAddress.Bytes(), 32), - ) - require.NoError(t, err) - backend.Commit() - _, err = bind.WaitMined(testutils.Context(t), backend.Client(), tx) - require.NoError(t, err) - - // Construct and execute user operation. - userOp := entry_point.UserOperation{ - Sender: toDeployAddress, - Nonce: nonce, - InitCode: fullInitializeCode, - CallData: fullEncoding, - CallGasLimit: big.NewInt(10_000_000), - VerificationGasLimit: big.NewInt(10_000_000), - PreVerificationGas: big.NewInt(10_000_000), - MaxFeePerGas: big.NewInt(100), - MaxPriorityFeePerGas: big.NewInt(200), - PaymasterAndData: paymasterAddress.Bytes(), - Signature: []byte(""), - } - - // Generate hash from user operation, sign it, and include it in the user operation. - userOpHash, err := universe.entryPoint.GetUserOpHash(nil, userOp) - require.NoError(t, err) - fullHash, err := universe.helper.GetFullHashForSigning(nil, userOpHash, toDeployAddress) - require.NoError(t, err) - t.Log("Full hash for signing:", common.Bytes2Hex(fullHash[:])) - sig, err := transmission.SignMessage(universe.holder1Key.ToEcdsaPrivKey(), fullHash[:]) - require.NoError(t, err) - t.Log("Signature:", common.Bytes2Hex(sig)) - userOp.Signature = sig - - // Deposit to the Paymaster's account to pay for this transaction. - holder1.Value = assets.Ether(10).ToInt() - tx, err = universe.entryPoint.DepositTo(holder1, paymasterAddress) - require.NoError(t, err) - backend.Commit() - _, err = bind.WaitMined(testutils.Context(t), backend.Client(), tx) - require.NoError(t, err) - holder1.Value = assets.Ether(0).ToInt() - balance, err := universe.entryPoint.BalanceOf(nil, paymasterAddress) - require.NoError(t, err) - require.Equal(t, assets.Ether(10).ToInt(), balance) - - // Run handleOps from holder2's account, to demonstrate that any account can execute this signed user operation. - tx, err = universe.entryPoint.HandleOps(holder2, []entry_point.UserOperation{userOp}, holder1.From) - require.NoError(t, err) - backend.Commit() - _, err = bind.WaitMined(testutils.Context(t), backend.Client(), tx) - require.NoError(t, err) - - // Ensure "bye" was successfully set as the greeting. - greetingResult, err := universe.greeter.GetGreeting(nil) - require.NoError(t, err) - require.Equal(t, "bye", greetingResult) - - // Assert smart contract account is created and nonce incremented. - sca, err := sca_wrapper.NewSCA(toDeployAddress, backend.Client()) - require.NoError(t, err) - onChainNonce, err := sca.SNonce(nil) - require.NoError(t, err) - require.Equal(t, big.NewInt(1), onChainNonce) -} - -func Test4337WithLinkTokenVRFRequestAndPaymaster(t *testing.T) { - // Deploy universe. - universe := deployTransmissionUniverse(t) - holder1 := universe.holder1 - holder2 := universe.holder2 - backend := universe.backend - - // Get the address at which the Smart Contract Account will be deployed. - toDeployAddress, err := universe.helper.CalculateSmartContractAccountAddress( - nil, - holder1.From, - universe.entryPointAddress, - universe.factoryAddress, - ) - require.NoError(t, err) - t.Log("Smart Contract Account Address:", toDeployAddress) - - // Get the initialization code for the Smart Contract Account. - fullInitializeCode, err := universe.helper.GetInitCode(nil, universe.factoryAddress, holder1.From, universe.entryPointAddress) - require.NoError(t, err) - t.Log("Full initialization code:", common.Bytes2Hex(fullInitializeCode)) - - // Construct calldata for the vrf request. - var keyhash [32]byte - copy(keyhash[:], common.LeftPadBytes(big.NewInt(123).Bytes(), 32)) - var fee = assets.Ether(1).ToInt() - encodedVRFRequest, err := consumerABI.Pack("doRequestRandomness", keyhash, fee) - require.NoError(t, err) - t.Log("Encoded vrf request:", common.Bytes2Hex(encodedVRFRequest)) - - // Construct the calldata to be passed in the user operation. - var ( - value = big.NewInt(0) - nonce = big.NewInt(0) - deadline = big.NewInt(1000) - ) - fullEncoding, err := universe.helper.GetFullEndTxEncoding(nil, universe.vrfConsumerAddress, value, deadline, encodedVRFRequest) - require.NoError(t, err) - t.Log("Full user operation calldata:", common.Bytes2Hex(fullEncoding)) - - // Deposit to LINK paymaster. - paymasterAddress, _, _, err := paymaster_wrapper.DeployPaymaster(holder1, backend.Client(), universe.linkTokenAddress, universe.linkEthFeedAddress, universe.entryPointAddress) - require.NoError(t, err) - backend.Commit() - tx, err := universe.linkToken.TransferAndCall( - holder1, - paymasterAddress, - assets.Ether(1000).ToInt(), - common.LeftPadBytes(toDeployAddress.Bytes(), 32), - ) - require.NoError(t, err) - backend.Commit() - - ctx := testutils.Context(t) - _, err = bind.WaitMined(ctx, backend.Client(), tx) - require.NoError(t, err) - - // Generate encoded paymaster data to fund the VRF consumer. - encodedPaymasterData, err := universe.helper.GetAbiEncodedDirectRequestData(nil, universe.vrfConsumerAddress, fee, fee) - require.NoError(t, err) - - // Construct and execute user operation. - userOp := entry_point.UserOperation{ - Sender: toDeployAddress, - Nonce: nonce, - InitCode: fullInitializeCode, - CallData: fullEncoding, - CallGasLimit: big.NewInt(10_000_000), - VerificationGasLimit: big.NewInt(10_000_000), - PreVerificationGas: big.NewInt(10_000_000), - MaxFeePerGas: big.NewInt(100), - MaxPriorityFeePerGas: big.NewInt(200), - PaymasterAndData: append(append(paymasterAddress.Bytes(), byte(0)), encodedPaymasterData...), - Signature: []byte(""), - } - - // Generate hash from user operation, sign it, and include it in the user operation. - userOpHash, err := universe.entryPoint.GetUserOpHash(nil, userOp) - require.NoError(t, err) - fullHash, err := universe.helper.GetFullHashForSigning(nil, userOpHash, toDeployAddress) - require.NoError(t, err) - t.Log("Full hash for signing:", common.Bytes2Hex(fullHash[:])) - sig, err := transmission.SignMessage(universe.holder1Key.ToEcdsaPrivKey(), fullHash[:]) - require.NoError(t, err) - t.Log("Signature:", common.Bytes2Hex(sig)) - userOp.Signature = sig - - // Deposit to the Paymaster's account to pay for this transaction. - holder1.Value = assets.Ether(10).ToInt() - tx, err = universe.entryPoint.DepositTo(holder1, paymasterAddress) - require.NoError(t, err) - backend.Commit() - _, err = bind.WaitMined(ctx, backend.Client(), tx) - require.NoError(t, err) - holder1.Value = assets.Ether(0).ToInt() - balance, err := universe.entryPoint.BalanceOf(nil, paymasterAddress) - require.NoError(t, err) - require.Equal(t, assets.Ether(10).ToInt(), balance) - - // Run handleOps from holder2's account, to demonstrate that any account can execute this signed user operation. - // Manually execute transaction to test ABI packing. - gasPrice, err := backend.Client().SuggestGasPrice(ctx) - require.NoError(t, err) - accountNonce, err := backend.Client().PendingNonceAt(ctx, holder2.From) - require.NoError(t, err) - payload, err := entrypointABI.Pack("handleOps", []entry_point.UserOperation{userOp}, holder1.From) - require.NoError(t, err) - gas, err := backend.Client().EstimateGas(ctx, ethereum.CallMsg{ - From: holder2.From, - To: &universe.entryPointAddress, - Gas: 0, - Data: payload, - GasPrice: gasPrice, - }) - unsigned := types.NewTx(&types.LegacyTx{ - Nonce: accountNonce, - Gas: gas, - To: &universe.entryPointAddress, - Value: big.NewInt(0), - Data: payload, - GasPrice: gasPrice, - }) - require.NoError(t, err) - signedtx, err := holder2.Signer(holder2.From, unsigned) - require.NoError(t, err) - err = backend.Client().SendTransaction(ctx, signedtx) - require.NoError(t, err) - backend.Commit() - receipt, err := bind.WaitMined(ctx, backend.Client(), signedtx) - require.NoError(t, err) - t.Log("Receipt:", receipt.Status) - - // Assert the VRF request was correctly made. - logs, err := backend.Client().FilterLogs(ctx, ethereum.FilterQuery{ - Addresses: []common.Address{universe.vrfCoordinatorAddress}, - }) - require.NoError(t, err) - require.Equal(t, 1, len(logs)) - randomnessRequestLog, err := universe.vrfCoordinator.ParseRandomnessRequest(logs[0]) - require.NoError(t, err) - require.Equal(t, fee, randomnessRequestLog.Fee) - require.Equal(t, keyhash, randomnessRequestLog.KeyHash) - require.Equal(t, universe.vrfConsumerAddress, randomnessRequestLog.Sender) - - // Assert smart contract account is created and nonce incremented. - sca, err := sca_wrapper.NewSCA(toDeployAddress, backend.Client()) - require.NoError(t, err) - onChainNonce, err := sca.SNonce(nil) - require.NoError(t, err) - require.Equal(t, big.NewInt(1), onChainNonce) -} diff --git a/core/services/transmission/signature.go b/core/services/transmission/signature.go deleted file mode 100644 index 50b7bc584dc..00000000000 --- a/core/services/transmission/signature.go +++ /dev/null @@ -1,19 +0,0 @@ -package transmission - -import ( - "crypto/ecdsa" - - "github.com/ethereum/go-ethereum/crypto" -) - -func SignMessage( - ownerPrivateKey *ecdsa.PrivateKey, - message []byte, -) ([]byte, error) { - sig, err := crypto.Sign(message, ownerPrivateKey) - if err != nil { - return nil, err - } - - return sig, nil -} From 6ea85ea4fec062c7fb98c5c55511997c1ae2a2b5 Mon Sep 17 00:00:00 2001 From: Anindita Ghosh <88458927+AnieeG@users.noreply.github.com> Date: Fri, 20 Dec 2024 09:22:34 -0800 Subject: [PATCH 02/19] Ccip-4693 deprecate add lane replaced with granular changesets (#15784) * remove deployCCIPContracts * deprecate existing add lane * more changes * fix tests * test fix * updates * review comments * review comments * add a test * more validation --- deployment/ccip/changeset/cs_add_lane.go | 227 ----------- deployment/ccip/changeset/cs_add_lane_test.go | 227 ++++------- deployment/ccip/changeset/cs_ccip_home.go | 8 +- .../ccip/changeset/cs_ccip_home_test.go | 2 +- .../ccip/changeset/cs_chain_contracts.go | 384 +++++++++++++++++- .../ccip/changeset/cs_chain_contracts_test.go | 59 +++ deployment/ccip/changeset/test_environment.go | 4 +- deployment/ccip/changeset/test_helpers.go | 110 ++++- deployment/environment/crib/ccip_deployer.go | 89 +++- .../contracts/ccipreader_test.go | 26 +- .../smoke/ccip/ccip_batching_test.go | 4 +- .../smoke/ccip/ccip_fee_boosting_test.go | 129 ++---- .../smoke/ccip/ccip_fees_test.go | 2 +- .../smoke/ccip/ccip_gas_price_updates_test.go | 2 +- .../ccip/ccip_message_limitations_test.go | 2 +- .../smoke/ccip/ccip_messaging_test.go | 2 +- .../smoke/ccip/ccip_ooo_execution_test.go | 2 +- integration-tests/smoke/ccip/ccip_rmn_test.go | 2 +- .../ccip/ccip_token_price_updates_test.go | 2 +- .../smoke/ccip/ccip_token_transfer_test.go | 2 +- .../smoke/ccip/ccip_usdc_test.go | 2 +- 21 files changed, 764 insertions(+), 523 deletions(-) delete mode 100644 deployment/ccip/changeset/cs_add_lane.go diff --git a/deployment/ccip/changeset/cs_add_lane.go b/deployment/ccip/changeset/cs_add_lane.go deleted file mode 100644 index 0bd03b56559..00000000000 --- a/deployment/ccip/changeset/cs_add_lane.go +++ /dev/null @@ -1,227 +0,0 @@ -package changeset - -import ( - "encoding/hex" - "fmt" - "math/big" - - "github.com/ethereum/go-ethereum/common" - "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" - - "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" -) - -var _ deployment.ChangeSet[AddLanesConfig] = AddLanes - -type InitialPrices struct { - LinkPrice *big.Int // USD to the power of 18 (e18) per LINK - WethPrice *big.Int // USD to the power of 18 (e18) per WETH - GasPrice *big.Int // uint224 packed gas price in USD (112 for exec // 112 for da) -} - -func (p InitialPrices) Validate() error { - if p.LinkPrice == nil { - return fmt.Errorf("missing link price") - } - if p.WethPrice == nil { - return fmt.Errorf("missing weth price") - } - if p.GasPrice == nil { - return fmt.Errorf("missing gas price") - } - return nil -} - -type LaneConfig struct { - SourceSelector uint64 - DestSelector uint64 - InitialPricesBySource InitialPrices - FeeQuoterDestChain fee_quoter.FeeQuoterDestChainConfig - TestRouter bool -} - -type AddLanesConfig struct { - LaneConfigs []LaneConfig -} - -func (c AddLanesConfig) Validate() error { - for _, pair := range c.LaneConfigs { - if pair.SourceSelector == pair.DestSelector { - return fmt.Errorf("cannot add lane to the same chain") - } - if err := pair.InitialPricesBySource.Validate(); err != nil { - return fmt.Errorf("error in validating initial prices for chain %d : %w", pair.SourceSelector, err) - } - // TODO: add more FeeQuoterDestChainConfigArgs validation - if pair.FeeQuoterDestChain == (fee_quoter.FeeQuoterDestChainConfig{}) { - return fmt.Errorf("missing fee quoter dest chain config") - } - } - return nil -} - -// AddLanes adds lanes between chains. -// AddLanes is run while the contracts are still owned by the deployer. -// This is useful to test the initial deployment to enable lanes between chains. -// If the testrouter is enabled, the lanes can be used to send messages between chains with testrouter. -// On successful verification with testrouter, the lanes can be enabled with the main router with different addLane ChangeSet. -func AddLanes(e deployment.Environment, cfg AddLanesConfig) (deployment.ChangesetOutput, error) { - if err := cfg.Validate(); err != nil { - return deployment.ChangesetOutput{}, fmt.Errorf("invalid AddLanesConfig: %w", err) - } - newAddresses := deployment.NewMemoryAddressBook() - err := addLanes(e, cfg) - if err != nil { - e.Logger.Errorw("Failed to add lanes", "err", err) - return deployment.ChangesetOutput{}, err - } - return deployment.ChangesetOutput{ - Proposals: []timelock.MCMSWithTimelockProposal{}, - AddressBook: newAddresses, - JobSpecs: nil, - }, nil -} - -var DefaultInitialPrices = InitialPrices{ - LinkPrice: deployment.E18Mult(20), - WethPrice: deployment.E18Mult(4000), - GasPrice: ToPackedFee(big.NewInt(8e14), big.NewInt(0)), -} - -func addLanes(e deployment.Environment, cfg AddLanesConfig) error { - state, err := LoadOnchainState(e) - if err != nil { - return fmt.Errorf("failed to load onchain state: %w", err) - } - for _, laneCfg := range cfg.LaneConfigs { - e.Logger.Infow("Enabling lane with test router", "from", laneCfg.SourceSelector, "to", laneCfg.DestSelector) - if err := addLane(e, state, laneCfg, laneCfg.TestRouter); err != nil { - return err - } - } - return nil -} - -func addLane(e deployment.Environment, state CCIPOnChainState, config LaneConfig, isTestRouter bool) error { - // TODO: Batch - var fromRouter *router.Router - var toRouter *router.Router - from := config.SourceSelector - to := config.DestSelector - feeQuoterDestChainConfig := config.FeeQuoterDestChain - initialPrices := config.InitialPricesBySource - if isTestRouter { - fromRouter = state.Chains[from].TestRouter - toRouter = state.Chains[to].TestRouter - } else { - fromRouter = state.Chains[from].Router - toRouter = state.Chains[to].Router - } - tx, err := fromRouter.ApplyRampUpdates(e.Chains[from].DeployerKey, []router.RouterOnRamp{ - { - DestChainSelector: to, - OnRamp: state.Chains[from].OnRamp.Address(), - }, - }, []router.RouterOffRamp{}, []router.RouterOffRamp{}) - if _, err := deployment.ConfirmIfNoError(e.Chains[from], tx, err); err != nil { - return err - } - tx, err = state.Chains[from].OnRamp.ApplyDestChainConfigUpdates(e.Chains[from].DeployerKey, - []onramp.OnRampDestChainConfigArgs{ - { - DestChainSelector: to, - Router: fromRouter.Address(), - }, - }) - if _, err := deployment.ConfirmIfNoError(e.Chains[from], tx, err); err != nil { - return err - } - - _, err = state.Chains[from].FeeQuoter.UpdatePrices( - e.Chains[from].DeployerKey, fee_quoter.InternalPriceUpdates{ - TokenPriceUpdates: []fee_quoter.InternalTokenPriceUpdate{ - { - SourceToken: state.Chains[from].LinkToken.Address(), - UsdPerToken: initialPrices.LinkPrice, - }, - { - SourceToken: state.Chains[from].Weth9.Address(), - UsdPerToken: initialPrices.WethPrice, - }, - }, - GasPriceUpdates: []fee_quoter.InternalGasPriceUpdate{ - { - DestChainSelector: to, - UsdPerUnitGas: initialPrices.GasPrice, - }, - }}) - if _, err := deployment.ConfirmIfNoError(e.Chains[from], tx, err); err != nil { - return err - } - - // Enable dest in fee quoter - tx, err = state.Chains[from].FeeQuoter.ApplyDestChainConfigUpdates(e.Chains[from].DeployerKey, - []fee_quoter.FeeQuoterDestChainConfigArgs{ - { - DestChainSelector: to, - DestChainConfig: feeQuoterDestChainConfig, - }, - }) - if _, err := deployment.ConfirmIfNoError(e.Chains[from], tx, err); err != nil { - return err - } - - tx, err = state.Chains[to].OffRamp.ApplySourceChainConfigUpdates(e.Chains[to].DeployerKey, - []offramp.OffRampSourceChainConfigArgs{ - { - Router: toRouter.Address(), - SourceChainSelector: from, - IsEnabled: true, - OnRamp: common.LeftPadBytes(state.Chains[from].OnRamp.Address().Bytes(), 32), - }, - }) - if _, err := deployment.ConfirmIfNoError(e.Chains[to], tx, err); err != nil { - return err - } - tx, err = toRouter.ApplyRampUpdates(e.Chains[to].DeployerKey, []router.RouterOnRamp{}, []router.RouterOffRamp{}, []router.RouterOffRamp{ - { - SourceChainSelector: from, - OffRamp: state.Chains[to].OffRamp.Address(), - }, - }) - _, err = deployment.ConfirmIfNoError(e.Chains[to], tx, err) - return err -} - -func DefaultFeeQuoterDestChainConfig() fee_quoter.FeeQuoterDestChainConfig { - // https://github.com/smartcontractkit/ccip/blob/c4856b64bd766f1ddbaf5d13b42d3c4b12efde3a/contracts/src/v0.8/ccip/libraries/Internal.sol#L337-L337 - /* - ```Solidity - // bytes4(keccak256("CCIP ChainFamilySelector EVM")) - bytes4 public constant CHAIN_FAMILY_SELECTOR_EVM = 0x2812d52c; - ``` - */ - evmFamilySelector, _ := hex.DecodeString("2812d52c") - return fee_quoter.FeeQuoterDestChainConfig{ - IsEnabled: true, - MaxNumberOfTokensPerMsg: 10, - MaxDataBytes: 256, - MaxPerMsgGasLimit: 3_000_000, - DestGasOverhead: ccipevm.DestGasOverhead, - DefaultTokenFeeUSDCents: 1, - DestGasPerPayloadByte: ccipevm.CalldataGasPerByte, - DestDataAvailabilityOverheadGas: 100, - DestGasPerDataAvailabilityByte: 100, - DestDataAvailabilityMultiplierBps: 1, - DefaultTokenDestGasOverhead: 125_000, - DefaultTxGasLimit: 200_000, - GasMultiplierWeiPerEth: 11e17, // Gas multiplier in wei per eth is scaled by 1e18, so 11e17 is 1.1 = 110% - NetworkFeeUSDCents: 1, - ChainFamilySelector: [4]byte(evmFamilySelector), - } -} diff --git a/deployment/ccip/changeset/cs_add_lane_test.go b/deployment/ccip/changeset/cs_add_lane_test.go index 5c324c975ef..e793c1866d9 100644 --- a/deployment/ccip/changeset/cs_add_lane_test.go +++ b/deployment/ccip/changeset/cs_add_lane_test.go @@ -1,17 +1,16 @@ package changeset import ( + "math/big" "testing" - "time" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - commonutils "github.com/smartcontractkit/chainlink-common/pkg/utils" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp" + commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" ) @@ -25,14 +24,79 @@ func TestAddLanesWithTestRouter(t *testing.T) { selectors := e.Env.AllChainSelectors() chain1, chain2 := selectors[0], selectors[1] - _, err = AddLanes(e.Env, AddLanesConfig{ - LaneConfigs: []LaneConfig{ - { - SourceSelector: chain1, - DestSelector: chain2, - InitialPricesBySource: DefaultInitialPrices, - FeeQuoterDestChain: DefaultFeeQuoterDestChainConfig(), - TestRouter: true, + stateChain1 := state.Chains[chain1] + e.Env, err = commoncs.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commoncs.ChangesetApplication{ + { + Changeset: commoncs.WrapChangeSet(UpdateOnRampsDests), + Config: UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]OnRampDestinationUpdate{ + chain1: { + chain2: { + IsEnabled: true, + TestRouter: true, + AllowListEnabled: false, + }, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterPricesCS), + Config: UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]FeeQuoterPriceUpdatePerSource{ + chain1: { + TokenPrices: map[common.Address]*big.Int{ + stateChain1.LinkToken.Address(): DefaultLinkPrice, + stateChain1.Weth9.Address(): DefaultWethPrice, + }, + GasPrices: map[uint64]*big.Int{ + chain2: DefaultGasPrice, + }, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterDests), + Config: UpdateFeeQuoterDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ + chain1: { + chain2: DefaultFeeQuoterDestChainConfig(), + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateOffRampSources), + Config: UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]OffRampSourceUpdate{ + chain2: { + chain1: { + IsEnabled: true, + TestRouter: true, + }, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateRouterRamps), + Config: UpdateRouterRampsConfig{ + TestRouter: true, + UpdatesByChain: map[uint64]RouterUpdates{ + // onRamp update on source chain + chain1: { + OnRampUpdates: map[uint64]bool{ + chain2: true, + }, + }, + // offramp update on dest chain + chain2: { + OffRampUpdates: map[uint64]bool{ + chain1: true, + }, + }, + }, }, }, }) @@ -58,142 +122,3 @@ func TestAddLanesWithTestRouter(t *testing.T) { }] = []uint64{msgSentEvent.SequenceNumber} ConfirmExecWithSeqNrsForAll(t, e.Env, state, expectedSeqNumExec, startBlocks) } - -// TestAddLane covers the workflow of adding a lane between two chains and enabling it. -// It also covers the case where the onRamp is disabled on the OffRamp contract initially and then enabled. -func TestAddLane(t *testing.T) { - t.Skip("This test is flaky and needs to be fixed: reverted," + - "error reason: 0x07da6ee6 InsufficientFeeTokenAmount: Replace time.sleep() with polling") - - t.Parallel() - // We add more chains to the chainlink nodes than the number of chains where CCIP is deployed. - e := NewMemoryEnvironment(t) - // Here we have CR + nodes set up, but no CCIP contracts deployed. - state, err := LoadOnchainState(e.Env) - require.NoError(t, err) - - selectors := e.Env.AllChainSelectors() - chain1, chain2 := selectors[0], selectors[1] - - // We expect no lanes available on any chain. - for _, sel := range []uint64{chain1, chain2} { - chain := state.Chains[sel] - offRamps, err := chain.Router.GetOffRamps(nil) - require.NoError(t, err) - require.Len(t, offRamps, 0) - } - - replayBlocks, err := LatestBlocksByChain(testcontext.Get(t), e.Env.Chains) - require.NoError(t, err) - - // Add one lane from chain1 to chain 2 and send traffic. - require.NoError(t, AddLaneWithDefaultPricesAndFeeQuoterConfig(e.Env, state, chain1, chain2, false)) - - ReplayLogs(t, e.Env.Offchain, replayBlocks) - time.Sleep(30 * time.Second) - // disable the onRamp initially on OffRamp - disableRampTx, err := state.Chains[chain2].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[chain2].DeployerKey, []offramp.OffRampSourceChainConfigArgs{ - { - Router: state.Chains[chain2].Router.Address(), - SourceChainSelector: chain1, - IsEnabled: false, - OnRamp: common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), - }, - }) - _, err = deployment.ConfirmIfNoError(e.Env.Chains[chain2], disableRampTx, err) - require.NoError(t, err) - - for _, sel := range []uint64{chain1, chain2} { - chain := state.Chains[sel] - offRamps, err := chain.Router.GetOffRamps(nil) - require.NoError(t, err) - if sel == chain2 { - require.Len(t, offRamps, 1) - srcCfg, err := chain.OffRamp.GetSourceChainConfig(nil, chain1) - require.NoError(t, err) - require.Equal(t, common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), srcCfg.OnRamp) - require.False(t, srcCfg.IsEnabled) - } else { - require.Len(t, offRamps, 0) - } - } - - latesthdr, err := e.Env.Chains[chain2].Client.HeaderByNumber(testcontext.Get(t), nil) - require.NoError(t, err) - startBlock := latesthdr.Number.Uint64() - // Send traffic on the first lane and it should not be processed by the plugin as onRamp is disabled - // we will check this by confirming that the message is not executed by the end of the test - msgSentEvent1 := TestSendRequest(t, e.Env, state, chain1, chain2, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[chain2].Receiver.Address().Bytes(), 32), - Data: []byte("hello world"), - TokenAmounts: nil, - FeeToken: common.HexToAddress("0x0"), - ExtraArgs: nil, - }) - require.Equal(t, uint64(1), msgSentEvent1.SequenceNumber) - - // Add another lane - require.NoError(t, AddLaneWithDefaultPricesAndFeeQuoterConfig(e.Env, state, chain2, chain1, false)) - - // Send traffic on the second lane and it should succeed - latesthdr, err = e.Env.Chains[chain1].Client.HeaderByNumber(testcontext.Get(t), nil) - require.NoError(t, err) - startBlock2 := latesthdr.Number.Uint64() - msgSentEvent2 := TestSendRequest(t, e.Env, state, chain2, chain1, false, router.ClientEVM2AnyMessage{ - Receiver: common.LeftPadBytes(state.Chains[chain2].Receiver.Address().Bytes(), 32), - Data: []byte("hello world"), - TokenAmounts: nil, - FeeToken: common.HexToAddress("0x0"), - ExtraArgs: nil, - }) - require.Equal(t, uint64(1), msgSentEvent2.SequenceNumber) - require.NoError(t, - commonutils.JustError( - ConfirmExecWithSeqNrs( - t, - e.Env.Chains[chain2], - e.Env.Chains[chain1], - state.Chains[chain1].OffRamp, - &startBlock2, - []uint64{msgSentEvent2.SequenceNumber}, - ), - ), - ) - - // now check for the previous message from chain 1 to chain 2 that it has not been executed till now as the onRamp was disabled - ConfirmNoExecConsistentlyWithSeqNr(t, e.Env.Chains[chain1], e.Env.Chains[chain2], state.Chains[chain2].OffRamp, msgSentEvent1.SequenceNumber, 30*time.Second) - - // enable the onRamp on OffRamp - enableRampTx, err := state.Chains[chain2].OffRamp.ApplySourceChainConfigUpdates(e.Env.Chains[chain2].DeployerKey, []offramp.OffRampSourceChainConfigArgs{ - { - Router: state.Chains[chain2].Router.Address(), - SourceChainSelector: chain1, - IsEnabled: true, - OnRamp: common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), - }, - }) - _, err = deployment.ConfirmIfNoError(e.Env.Chains[chain2], enableRampTx, err) - require.NoError(t, err) - - srcCfg, err := state.Chains[chain2].OffRamp.GetSourceChainConfig(nil, chain1) - require.NoError(t, err) - require.Equal(t, common.LeftPadBytes(state.Chains[chain1].OnRamp.Address().Bytes(), 32), srcCfg.OnRamp) - require.True(t, srcCfg.IsEnabled) - - // we need the replay here otherwise plugin is not able to locate the message - ReplayLogs(t, e.Env.Offchain, replayBlocks) - time.Sleep(30 * time.Second) - // Now that the onRamp is enabled, the request should be processed - require.NoError(t, - commonutils.JustError( - ConfirmExecWithSeqNrs( - t, - e.Env.Chains[chain1], - e.Env.Chains[chain2], - state.Chains[chain2].OffRamp, - &startBlock, - []uint64{msgSentEvent1.SequenceNumber}, - ), - ), - ) -} diff --git a/deployment/ccip/changeset/cs_ccip_home.go b/deployment/ccip/changeset/cs_ccip_home.go index a2abad5101f..0c82afee261 100644 --- a/deployment/ccip/changeset/cs_ccip_home.go +++ b/deployment/ccip/changeset/cs_ccip_home.go @@ -34,7 +34,7 @@ import ( var ( _ deployment.ChangeSet[AddDonAndSetCandidateChangesetConfig] = AddDonAndSetCandidateChangeset - _ deployment.ChangeSet[PromoteAllCandidatesChangesetConfig] = PromoteAllCandidatesChangeset + _ deployment.ChangeSet[PromoteCandidatesChangesetConfig] = PromoteAllCandidatesChangeset _ deployment.ChangeSet[SetCandidateChangesetConfig] = SetCandidateChangeset _ deployment.ChangeSet[RevokeCandidateChangesetConfig] = RevokeCandidateChangeset _ deployment.ChangeSet[UpdateChainConfigConfig] = UpdateChainConfig @@ -107,7 +107,7 @@ func DefaultOCRParams( } } -type PromoteAllCandidatesChangesetConfig struct { +type PromoteCandidatesChangesetConfig struct { HomeChainSelector uint64 // RemoteChainSelectors is the chain selector of the DONs that we want to promote the candidate config of. @@ -121,7 +121,7 @@ type PromoteAllCandidatesChangesetConfig struct { MCMS *MCMSConfig } -func (p PromoteAllCandidatesChangesetConfig) Validate(e deployment.Environment) ([]uint32, error) { +func (p PromoteCandidatesChangesetConfig) Validate(e deployment.Environment) ([]uint32, error) { state, err := LoadOnchainState(e) if err != nil { return nil, err @@ -201,7 +201,7 @@ func (p PromoteAllCandidatesChangesetConfig) Validate(e deployment.Environment) // At that point you can call the RemoveDON changeset to remove the DON entirely from the capability registry. func PromoteAllCandidatesChangeset( e deployment.Environment, - cfg PromoteAllCandidatesChangesetConfig, + cfg PromoteCandidatesChangesetConfig, ) (deployment.ChangesetOutput, error) { donIDs, err := cfg.Validate(e) if err != nil { diff --git a/deployment/ccip/changeset/cs_ccip_home_test.go b/deployment/ccip/changeset/cs_ccip_home_test.go index 6b4683ae12c..dae32557f8b 100644 --- a/deployment/ccip/changeset/cs_ccip_home_test.go +++ b/deployment/ccip/changeset/cs_ccip_home_test.go @@ -88,7 +88,7 @@ func Test_PromoteCandidate(t *testing.T) { }, []commonchangeset.ChangesetApplication{ { Changeset: commonchangeset.WrapChangeSet(PromoteAllCandidatesChangeset), - Config: PromoteAllCandidatesChangesetConfig{ + Config: PromoteCandidatesChangesetConfig{ HomeChainSelector: tenv.HomeChainSel, RemoteChainSelectors: []uint64{dest}, MCMS: mcmsConfig, diff --git a/deployment/ccip/changeset/cs_chain_contracts.go b/deployment/ccip/changeset/cs_chain_contracts.go index e97772793b0..f85814f1768 100644 --- a/deployment/ccip/changeset/cs_chain_contracts.go +++ b/deployment/ccip/changeset/cs_chain_contracts.go @@ -4,35 +4,220 @@ import ( "bytes" "context" "encoding/hex" + "errors" "fmt" "math/big" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/mcms" "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset/internal" commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" cctypes "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/types" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/nonce_manager" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/offramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/router" ) var ( - _ deployment.ChangeSet[UpdateOnRampDestsConfig] = UpdateOnRampsDests - _ deployment.ChangeSet[UpdateOffRampSourcesConfig] = UpdateOffRampSources - _ deployment.ChangeSet[UpdateRouterRampsConfig] = UpdateRouterRamps - _ deployment.ChangeSet[UpdateFeeQuoterDestsConfig] = UpdateFeeQuoterDests - _ deployment.ChangeSet[SetOCR3OffRampConfig] = SetOCR3OffRamp + _ deployment.ChangeSet[UpdateOnRampDestsConfig] = UpdateOnRampsDests + _ deployment.ChangeSet[UpdateOffRampSourcesConfig] = UpdateOffRampSources + _ deployment.ChangeSet[UpdateRouterRampsConfig] = UpdateRouterRamps + _ deployment.ChangeSet[UpdateFeeQuoterDestsConfig] = UpdateFeeQuoterDests + _ deployment.ChangeSet[SetOCR3OffRampConfig] = SetOCR3OffRamp + _ deployment.ChangeSet[UpdateFeeQuoterPricesConfig] = UpdateFeeQuoterPricesCS + _ deployment.ChangeSet[UpdateNonceManagerConfig] = UpdateNonceManagersCS ) +type UpdateNonceManagerConfig struct { + UpdatesByChain map[uint64]NonceManagerUpdate // source -> dest -> update + MCMS *MCMSConfig +} + +type NonceManagerUpdate struct { + AddedAuthCallers []common.Address + RemovedAuthCallers []common.Address + PreviousRampsArgs []PreviousRampCfg +} + +type PreviousRampCfg struct { + RemoteChainSelector uint64 + OverrideExisting bool + EnableOnRamp bool + EnableOffRamp bool +} + +func (cfg UpdateNonceManagerConfig) Validate(e deployment.Environment) error { + state, err := LoadOnchainState(e) + if err != nil { + return err + } + for sourceSel, update := range cfg.UpdatesByChain { + sourceChainState, ok := state.Chains[sourceSel] + if !ok { + return fmt.Errorf("chain %d not found in onchain state", sourceSel) + } + if sourceChainState.NonceManager == nil { + return fmt.Errorf("missing nonce manager for chain %d", sourceSel) + } + sourceChain, ok := e.Chains[sourceSel] + if !ok { + return fmt.Errorf("missing chain %d in environment", sourceSel) + } + if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, sourceChain.DeployerKey.From, sourceChainState.Timelock.Address(), sourceChainState.OnRamp); err != nil { + return fmt.Errorf("chain %s: %w", sourceChain.String(), err) + } + for _, prevRamp := range update.PreviousRampsArgs { + if prevRamp.RemoteChainSelector == sourceSel { + return errors.New("source and dest chain cannot be the same") + } + if _, ok := state.Chains[prevRamp.RemoteChainSelector]; !ok { + return fmt.Errorf("dest chain %d not found in onchain state for chain %d", prevRamp.RemoteChainSelector, sourceSel) + } + if !prevRamp.EnableOnRamp && !prevRamp.EnableOffRamp { + return errors.New("must specify either onramp or offramp") + } + if prevRamp.EnableOnRamp { + if prevOnRamp := state.Chains[sourceSel].EVM2EVMOnRamp; prevOnRamp == nil { + return fmt.Errorf("no previous onramp for source chain %d", sourceSel) + } else if prevOnRamp[prevRamp.RemoteChainSelector] == nil { + return fmt.Errorf("no previous onramp for source chain %d and dest chain %d", sourceSel, prevRamp.RemoteChainSelector) + } + } + if prevRamp.EnableOffRamp { + if prevOffRamp := state.Chains[sourceSel].EVM2EVMOffRamp; prevOffRamp == nil { + return fmt.Errorf("missing previous offramps for chain %d", sourceSel) + } else if prevOffRamp[prevRamp.RemoteChainSelector] == nil { + return fmt.Errorf("no previous offramp for source chain %d and dest chain %d", prevRamp.RemoteChainSelector, sourceSel) + } + } + } + } + return nil +} + +func UpdateNonceManagersCS(e deployment.Environment, cfg UpdateNonceManagerConfig) (deployment.ChangesetOutput, error) { + if err := cfg.Validate(e); err != nil { + return deployment.ChangesetOutput{}, err + } + s, err := LoadOnchainState(e) + if err != nil { + return deployment.ChangesetOutput{}, err + } + var batches []timelock.BatchChainOperation + timelocks := make(map[uint64]common.Address) + proposers := make(map[uint64]*gethwrappers.ManyChainMultiSig) + for chainSel, updates := range cfg.UpdatesByChain { + txOpts := e.Chains[chainSel].DeployerKey + if cfg.MCMS != nil { + txOpts = deployment.SimTransactOpts() + } + nm := s.Chains[chainSel].NonceManager + var authTx, prevRampsTx *types.Transaction + if len(updates.AddedAuthCallers) > 0 || len(updates.RemovedAuthCallers) > 0 { + authTx, err = nm.ApplyAuthorizedCallerUpdates(txOpts, nonce_manager.AuthorizedCallersAuthorizedCallerArgs{ + AddedCallers: updates.AddedAuthCallers, + RemovedCallers: updates.RemovedAuthCallers, + }) + if err != nil { + return deployment.ChangesetOutput{}, fmt.Errorf("error updating authorized callers for chain %s: %w", e.Chains[chainSel].String(), err) + } + } + if len(updates.PreviousRampsArgs) > 0 { + previousRampsArgs := make([]nonce_manager.NonceManagerPreviousRampsArgs, 0) + for _, prevRamp := range updates.PreviousRampsArgs { + var onRamp, offRamp common.Address + if prevRamp.EnableOnRamp { + onRamp = s.Chains[chainSel].EVM2EVMOnRamp[prevRamp.RemoteChainSelector].Address() + } + if prevRamp.EnableOffRamp { + offRamp = s.Chains[chainSel].EVM2EVMOffRamp[prevRamp.RemoteChainSelector].Address() + } + previousRampsArgs = append(previousRampsArgs, nonce_manager.NonceManagerPreviousRampsArgs{ + RemoteChainSelector: prevRamp.RemoteChainSelector, + OverrideExistingRamps: prevRamp.OverrideExisting, + PrevRamps: nonce_manager.NonceManagerPreviousRamps{ + PrevOnRamp: onRamp, + PrevOffRamp: offRamp, + }, + }) + } + prevRampsTx, err = nm.ApplyPreviousRampsUpdates(txOpts, previousRampsArgs) + if err != nil { + return deployment.ChangesetOutput{}, fmt.Errorf("error updating previous ramps for chain %s: %w", e.Chains[chainSel].String(), err) + } + if err != nil { + return deployment.ChangesetOutput{}, fmt.Errorf("error updating previous ramps for chain %s: %w", e.Chains[chainSel].String(), err) + } + } + if cfg.MCMS == nil { + if authTx != nil { + if _, err := deployment.ConfirmIfNoError(e.Chains[chainSel], authTx, err); err != nil { + return deployment.ChangesetOutput{}, err + } + } + if prevRampsTx != nil { + if _, err := deployment.ConfirmIfNoError(e.Chains[chainSel], prevRampsTx, err); err != nil { + return deployment.ChangesetOutput{}, err + } + } + } else { + ops := make([]mcms.Operation, 0) + if authTx != nil { + ops = append(ops, mcms.Operation{ + To: nm.Address(), + Data: authTx.Data(), + Value: big.NewInt(0), + }) + } + if prevRampsTx != nil { + ops = append(ops, mcms.Operation{ + To: nm.Address(), + Data: prevRampsTx.Data(), + Value: big.NewInt(0), + }) + } + if len(ops) == 0 { + return deployment.ChangesetOutput{}, errors.New("no operations to batch") + } + batches = append(batches, timelock.BatchChainOperation{ + ChainIdentifier: mcms.ChainIdentifier(chainSel), + Batch: ops, + }) + timelocks[chainSel] = s.Chains[chainSel].Timelock.Address() + proposers[chainSel] = s.Chains[chainSel].ProposerMcm + } + } + if cfg.MCMS == nil { + return deployment.ChangesetOutput{}, nil + } + + p, err := proposalutils.BuildProposalFromBatches( + timelocks, + proposers, + batches, + "Update nonce manager for previous ramps and authorized callers", + cfg.MCMS.MinDelay, + ) + if err != nil { + return deployment.ChangesetOutput{}, err + } + return deployment.ChangesetOutput{Proposals: []timelock.MCMSWithTimelockProposal{ + *p, + }}, nil +} + type UpdateOnRampDestsConfig struct { UpdatesByChain map[uint64]map[uint64]OnRampDestinationUpdate // Disallow mixing MCMS/non-MCMS per chain for simplicity. @@ -167,6 +352,165 @@ func UpdateOnRampsDests(e deployment.Environment, cfg UpdateOnRampDestsConfig) ( }}, nil } +type UpdateFeeQuoterPricesConfig struct { + PricesByChain map[uint64]FeeQuoterPriceUpdatePerSource // source -> PriceDetails + MCMS *MCMSConfig +} + +type FeeQuoterPriceUpdatePerSource struct { + TokenPrices map[common.Address]*big.Int // token address -> price + GasPrices map[uint64]*big.Int // dest chain -> gas price +} + +func (cfg UpdateFeeQuoterPricesConfig) Validate(e deployment.Environment) error { + state, err := LoadOnchainState(e) + if err != nil { + return err + } + for chainSel, initialPrice := range cfg.PricesByChain { + if err := deployment.IsValidChainSelector(chainSel); err != nil { + return fmt.Errorf("invalid chain selector: %w", err) + } + chainState, ok := state.Chains[chainSel] + if !ok { + return fmt.Errorf("chain %d not found in onchain state", chainSel) + } + fq := chainState.FeeQuoter + if fq == nil { + return fmt.Errorf("missing fee quoter for chain %d", chainSel) + } + if err := commoncs.ValidateOwnership(e.GetContext(), cfg.MCMS != nil, e.Chains[chainSel].DeployerKey.From, chainState.Timelock.Address(), chainState.FeeQuoter); err != nil { + return err + } + // check that whether price updaters are set + authCallers, err := fq.GetAllAuthorizedCallers(&bind.CallOpts{Context: e.GetContext()}) + if err != nil { + return fmt.Errorf("failed to get authorized callers for chain %d: %w", chainSel, err) + } + if len(authCallers) == 0 { + return fmt.Errorf("no authorized callers for chain %d", chainSel) + } + expectedAuthCaller := e.Chains[chainSel].DeployerKey.From + if cfg.MCMS != nil { + expectedAuthCaller = chainState.Timelock.Address() + } + foundCaller := false + for _, authCaller := range authCallers { + if authCaller.Cmp(expectedAuthCaller) == 0 { + foundCaller = true + } + } + if !foundCaller { + return fmt.Errorf("expected authorized caller %s not found for chain %d", expectedAuthCaller.String(), chainSel) + } + for token, price := range initialPrice.TokenPrices { + if price == nil { + return fmt.Errorf("token price for chain %d is nil", chainSel) + } + if token == (common.Address{}) { + return fmt.Errorf("token address for chain %d is empty", chainSel) + } + contains, err := deployment.AddressBookContains(e.ExistingAddresses, chainSel, token.String()) + if err != nil { + return fmt.Errorf("error checking address book for token %s: %w", token.String(), err) + } + if !contains { + return fmt.Errorf("token %s not found in address book for chain %d", token.String(), chainSel) + } + } + for dest, price := range initialPrice.GasPrices { + if chainSel == dest { + return errors.New("source and dest chain cannot be the same") + } + if err := deployment.IsValidChainSelector(dest); err != nil { + return fmt.Errorf("invalid dest chain selector: %w", err) + } + if price == nil { + return fmt.Errorf("gas price for chain %d is nil", chainSel) + } + if _, ok := state.Chains[dest]; !ok { + return fmt.Errorf("dest chain %d not found in onchain state for chain %d", dest, chainSel) + } + } + } + + return nil +} + +func UpdateFeeQuoterPricesCS(e deployment.Environment, cfg UpdateFeeQuoterPricesConfig) (deployment.ChangesetOutput, error) { + if err := cfg.Validate(e); err != nil { + return deployment.ChangesetOutput{}, err + } + s, err := LoadOnchainState(e) + if err != nil { + return deployment.ChangesetOutput{}, err + } + var batches []timelock.BatchChainOperation + timelocks := make(map[uint64]common.Address) + proposers := make(map[uint64]*gethwrappers.ManyChainMultiSig) + for chainSel, initialPrice := range cfg.PricesByChain { + txOpts := e.Chains[chainSel].DeployerKey + if cfg.MCMS != nil { + txOpts = deployment.SimTransactOpts() + } + fq := s.Chains[chainSel].FeeQuoter + var tokenPricesArgs []fee_quoter.InternalTokenPriceUpdate + for token, price := range initialPrice.TokenPrices { + tokenPricesArgs = append(tokenPricesArgs, fee_quoter.InternalTokenPriceUpdate{ + SourceToken: token, + UsdPerToken: price, + }) + } + var gasPricesArgs []fee_quoter.InternalGasPriceUpdate + for dest, price := range initialPrice.GasPrices { + gasPricesArgs = append(gasPricesArgs, fee_quoter.InternalGasPriceUpdate{ + DestChainSelector: dest, + UsdPerUnitGas: price, + }) + } + tx, err := fq.UpdatePrices(txOpts, fee_quoter.InternalPriceUpdates{ + TokenPriceUpdates: tokenPricesArgs, + GasPriceUpdates: gasPricesArgs, + }) + if err != nil { + return deployment.ChangesetOutput{}, fmt.Errorf("error updating prices for chain %s: %w", e.Chains[chainSel].String(), err) + } + if cfg.MCMS == nil { + if _, err := deployment.ConfirmIfNoError(e.Chains[chainSel], tx, err); err != nil { + return deployment.ChangesetOutput{}, fmt.Errorf("error confirming transaction for chain %s: %w", e.Chains[chainSel].String(), err) + } + } else { + batches = append(batches, timelock.BatchChainOperation{ + ChainIdentifier: mcms.ChainIdentifier(chainSel), + Batch: []mcms.Operation{ + { + To: fq.Address(), + Data: tx.Data(), + Value: big.NewInt(0), + }, + }, + }) + } + } + if cfg.MCMS == nil { + return deployment.ChangesetOutput{}, nil + } + + p, err := proposalutils.BuildProposalFromBatches( + timelocks, + proposers, + batches, + "Update fq prices", + cfg.MCMS.MinDelay, + ) + if err != nil { + return deployment.ChangesetOutput{}, err + } + return deployment.ChangesetOutput{Proposals: []timelock.MCMSWithTimelockProposal{ + *p, + }}, nil +} + type UpdateFeeQuoterDestsConfig struct { UpdatesByChain map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig // Disallow mixing MCMS/non-MCMS per chain for simplicity. @@ -208,7 +552,7 @@ func (cfg UpdateFeeQuoterDestsConfig) Validate(e deployment.Environment) error { return fmt.Errorf("failed to get onramp static config %s: %w", chainState.OnRamp.Address(), err) } if destination == sc.ChainSelector { - return fmt.Errorf("cannot update onramp destination to the same chain") + return fmt.Errorf("source and destination chain cannot be the same") } } } @@ -755,3 +1099,31 @@ func isOCR3ConfigSetOnOffRamp( } return true, nil } + +func DefaultFeeQuoterDestChainConfig() fee_quoter.FeeQuoterDestChainConfig { + // https://github.com/smartcontractkit/ccip/blob/c4856b64bd766f1ddbaf5d13b42d3c4b12efde3a/contracts/src/v0.8/ccip/libraries/Internal.sol#L337-L337 + /* + ```Solidity + // bytes4(keccak256("CCIP ChainFamilySelector EVM")) + bytes4 public constant CHAIN_FAMILY_SELECTOR_EVM = 0x2812d52c; + ``` + */ + evmFamilySelector, _ := hex.DecodeString("2812d52c") + return fee_quoter.FeeQuoterDestChainConfig{ + IsEnabled: true, + MaxNumberOfTokensPerMsg: 10, + MaxDataBytes: 256, + MaxPerMsgGasLimit: 3_000_000, + DestGasOverhead: ccipevm.DestGasOverhead, + DefaultTokenFeeUSDCents: 1, + DestGasPerPayloadByte: ccipevm.CalldataGasPerByte, + DestDataAvailabilityOverheadGas: 100, + DestGasPerDataAvailabilityByte: 100, + DestDataAvailabilityMultiplierBps: 1, + DefaultTokenDestGasOverhead: 125_000, + DefaultTxGasLimit: 200_000, + GasMultiplierWeiPerEth: 11e17, // Gas multiplier in wei per eth is scaled by 1e18, so 11e17 is 1.1 = 110% + NetworkFeeUSDCents: 1, + ChainFamilySelector: [4]byte(evmFamilySelector), + } +} diff --git a/deployment/ccip/changeset/cs_chain_contracts_test.go b/deployment/ccip/changeset/cs_chain_contracts_test.go index ad1b1a9f2b5..0a1e0ce3b7b 100644 --- a/deployment/ccip/changeset/cs_chain_contracts_test.go +++ b/deployment/ccip/changeset/cs_chain_contracts_test.go @@ -9,6 +9,7 @@ import ( "golang.org/x/exp/maps" "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" + commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" ) @@ -303,3 +304,61 @@ func TestUpdateRouterRamps(t *testing.T) { }) } } + +func TestUpdateNonceManagersCS(t *testing.T) { + for _, tc := range []struct { + name string + mcmsEnabled bool + }{ + { + name: "MCMS enabled", + mcmsEnabled: true, + }, + { + name: "MCMS disabled", + mcmsEnabled: false, + }, + } { + t.Run(tc.name, func(t *testing.T) { + tenv := NewMemoryEnvironment(t) + state, err := LoadOnchainState(tenv.Env) + require.NoError(t, err) + + allChains := maps.Keys(tenv.Env.Chains) + source := allChains[0] + dest := allChains[1] + + if tc.mcmsEnabled { + // Transfer ownership to timelock so that we can promote the zero digest later down the line. + transferToTimelock(t, tenv, state, source, dest) + } + + var mcmsConfig *MCMSConfig + if tc.mcmsEnabled { + mcmsConfig = &MCMSConfig{ + MinDelay: 0, + } + } + + _, err = commonchangeset.ApplyChangesets(t, tenv.Env, tenv.TimelockContracts(t), []commonchangeset.ChangesetApplication{ + { + Changeset: commonchangeset.WrapChangeSet(UpdateNonceManagersCS), + Config: UpdateNonceManagerConfig{ + UpdatesByChain: map[uint64]NonceManagerUpdate{ + source: { + RemovedAuthCallers: []common.Address{state.Chains[source].OnRamp.Address()}, + }, + }, + MCMS: mcmsConfig, + }, + }, + }) + require.NoError(t, err) + // Assert the nonce manager configuration is as we expect. + callers, err := state.Chains[source].NonceManager.GetAllAuthorizedCallers(nil) + require.NoError(t, err) + require.NotContains(t, callers, state.Chains[source].OnRamp.Address()) + require.Contains(t, callers, state.Chains[source].OffRamp.Address()) + }) + } +} diff --git a/deployment/ccip/changeset/test_environment.go b/deployment/ccip/changeset/test_environment.go index 1ab184573ce..f723efbf619 100644 --- a/deployment/ccip/changeset/test_environment.go +++ b/deployment/ccip/changeset/test_environment.go @@ -551,7 +551,7 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test { // Promote everything Changeset: commonchangeset.WrapChangeSet(PromoteAllCandidatesChangeset), - Config: PromoteAllCandidatesChangesetConfig{ + Config: PromoteCandidatesChangesetConfig{ HomeChainSelector: e.HomeChainSel, RemoteChainSelectors: allChains, PluginType: types.PluginTypeCCIPCommit, @@ -560,7 +560,7 @@ func NewEnvironmentWithJobsAndContracts(t *testing.T, tc *TestConfigs, tEnv Test { // Promote everything Changeset: commonchangeset.WrapChangeSet(PromoteAllCandidatesChangeset), - Config: PromoteAllCandidatesChangesetConfig{ + Config: PromoteCandidatesChangesetConfig{ HomeChainSelector: e.HomeChainSel, RemoteChainSelectors: allChains, PluginType: types.PluginTypeCCIPExec, diff --git a/deployment/ccip/changeset/test_helpers.go b/deployment/ccip/changeset/test_helpers.go index 75801d99cff..cfd24d88ebd 100644 --- a/deployment/ccip/changeset/test_helpers.go +++ b/deployment/ccip/changeset/test_helpers.go @@ -18,6 +18,8 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/pkg/errors" + commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/ethereum/go-ethereum/common" @@ -60,6 +62,10 @@ var ( evmExtraArgsV2Tag = hexutil.MustDecode("0x181dcf10") routerABI = abihelpers.MustParseABI(router.RouterABI) + + DefaultLinkPrice = deployment.E18Mult(20) + DefaultWethPrice = deployment.E18Mult(4000) + DefaultGasPrice = ToPackedFee(big.NewInt(8e14), big.NewInt(0)) ) // Context returns a context with the test's deadline, if available. @@ -384,30 +390,102 @@ func MakeEVMExtraArgsV2(gasLimit uint64, allowOOO bool) []byte { return extraArgs } -func AddLaneWithDefaultPricesAndFeeQuoterConfig(e deployment.Environment, state CCIPOnChainState, from, to uint64, isTestRouter bool) error { - cfg := LaneConfig{ - SourceSelector: from, - DestSelector: to, - InitialPricesBySource: DefaultInitialPrices, - FeeQuoterDestChain: DefaultFeeQuoterDestChainConfig(), - } - return addLane(e, state, cfg, isTestRouter) +func AddLane(t *testing.T, e *DeployedEnv, from, to uint64, isTestRouter bool, gasprice map[uint64]*big.Int, tokenPrices map[common.Address]*big.Int, fqCfg fee_quoter.FeeQuoterDestChainConfig) { + var err error + e.Env, err = commoncs.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commoncs.ChangesetApplication{ + { + Changeset: commoncs.WrapChangeSet(UpdateOnRampsDests), + Config: UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]OnRampDestinationUpdate{ + from: { + to: { + IsEnabled: true, + TestRouter: isTestRouter, + AllowListEnabled: false, + }, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterPricesCS), + Config: UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]FeeQuoterPriceUpdatePerSource{ + from: { + TokenPrices: tokenPrices, + GasPrices: gasprice, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateFeeQuoterDests), + Config: UpdateFeeQuoterDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ + from: { + to: fqCfg, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateOffRampSources), + Config: UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]OffRampSourceUpdate{ + to: { + from: { + IsEnabled: true, + TestRouter: isTestRouter, + }, + }, + }, + }, + }, + { + Changeset: commoncs.WrapChangeSet(UpdateRouterRamps), + Config: UpdateRouterRampsConfig{ + TestRouter: isTestRouter, + UpdatesByChain: map[uint64]RouterUpdates{ + // onRamp update on source chain + from: { + OnRampUpdates: map[uint64]bool{ + to: true, + }, + }, + // offramp update on dest chain + to: { + OffRampUpdates: map[uint64]bool{ + from: true, + }, + }, + }, + }, + }, + }) + require.NoError(t, err) +} + +func AddLaneWithDefaultPricesAndFeeQuoterConfig(t *testing.T, e *DeployedEnv, state CCIPOnChainState, from, to uint64, isTestRouter bool) { + stateChainFrom := state.Chains[from] + AddLane(t, e, from, to, isTestRouter, + map[uint64]*big.Int{ + to: DefaultGasPrice, + }, map[common.Address]*big.Int{ + stateChainFrom.LinkToken.Address(): DefaultLinkPrice, + stateChainFrom.Weth9.Address(): DefaultWethPrice, + }, DefaultFeeQuoterDestChainConfig()) } // AddLanesForAll adds densely connected lanes for all chains in the environment so that each chain // is connected to every other chain except itself. -func AddLanesForAll(e deployment.Environment, state CCIPOnChainState) error { - for source := range e.Chains { - for dest := range e.Chains { +func AddLanesForAll(t *testing.T, e *DeployedEnv, state CCIPOnChainState) { + for source := range e.Env.Chains { + for dest := range e.Env.Chains { if source != dest { - err := AddLaneWithDefaultPricesAndFeeQuoterConfig(e, state, source, dest, false) - if err != nil { - return err - } + AddLaneWithDefaultPricesAndFeeQuoterConfig(t, e, state, source, dest, false) } } } - return nil } func ToPackedFee(execFee, daFee *big.Int) *big.Int { diff --git a/deployment/environment/crib/ccip_deployer.go b/deployment/environment/crib/ccip_deployer.go index 4c52cc72416..bb3acec8aa4 100644 --- a/deployment/environment/crib/ccip_deployer.go +++ b/deployment/environment/crib/ccip_deployer.go @@ -12,6 +12,7 @@ import ( commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/deployment/environment/devenv" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/deployment" @@ -126,9 +127,91 @@ func DeployCCIPAndAddLanes(ctx context.Context, lggr logger.Logger, envConfig de return DeployCCIPOutput{}, fmt.Errorf("failed to load onchain state: %w", err) } // Add all lanes - err = changeset.AddLanesForAll(*e, state) - if err != nil { - return DeployCCIPOutput{}, fmt.Errorf("failed to add lanes: %w", err) + for from := range e.Chains { + for to := range e.Chains { + if from != to { + stateChain1 := state.Chains[from] + newEnv, err := commonchangeset.ApplyChangesets(nil, *e, nil, []commonchangeset.ChangesetApplication{ + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateOnRampsDests), + Config: changeset.UpdateOnRampDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]changeset.OnRampDestinationUpdate{ + from: { + to: { + IsEnabled: true, + TestRouter: false, + AllowListEnabled: false, + }, + }, + }, + }, + }, + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateFeeQuoterPricesCS), + Config: changeset.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + from: { + TokenPrices: map[common.Address]*big.Int{ + stateChain1.LinkToken.Address(): changeset.DefaultLinkPrice, + stateChain1.Weth9.Address(): changeset.DefaultWethPrice, + }, + GasPrices: map[uint64]*big.Int{ + to: changeset.DefaultGasPrice, + }, + }, + }, + }, + }, + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateFeeQuoterDests), + Config: changeset.UpdateFeeQuoterDestsConfig{ + UpdatesByChain: map[uint64]map[uint64]fee_quoter.FeeQuoterDestChainConfig{ + from: { + to: changeset.DefaultFeeQuoterDestChainConfig(), + }, + }, + }, + }, + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateOffRampSources), + Config: changeset.UpdateOffRampSourcesConfig{ + UpdatesByChain: map[uint64]map[uint64]changeset.OffRampSourceUpdate{ + to: { + from: { + IsEnabled: true, + TestRouter: true, + }, + }, + }, + }, + }, + { + Changeset: commonchangeset.WrapChangeSet(changeset.UpdateRouterRamps), + Config: changeset.UpdateRouterRampsConfig{ + TestRouter: true, + UpdatesByChain: map[uint64]changeset.RouterUpdates{ + // onRamp update on source chain + from: { + OnRampUpdates: map[uint64]bool{ + to: true, + }, + }, + // off + from: { + OffRampUpdates: map[uint64]bool{ + to: true, + }, + }, + }, + }, + }, + }) + if err != nil { + return DeployCCIPOutput{}, fmt.Errorf("failed to apply changesets: %w", err) + } + e = &newEnv + } + } } addresses, err := e.ExistingAddresses.Addresses() diff --git a/integration-tests/contracts/ccipreader_test.go b/integration-tests/contracts/ccipreader_test.go index 3b0ac1d79a1..f46a680c8a0 100644 --- a/integration-tests/contracts/ccipreader_test.go +++ b/integration-tests/contracts/ccipreader_test.go @@ -597,8 +597,8 @@ func TestCCIPReader_GetExpectedNextSequenceNumber(t *testing.T) { selectors := env.Env.AllChainSelectors() destChain, srcChain := selectors[0], selectors[1] - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, destChain, srcChain, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, srcChain, destChain, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, destChain, srcChain, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, srcChain, destChain, false) reader := testSetupRealContracts( ctx, @@ -707,8 +707,8 @@ func Test_GetChainFeePriceUpdates(t *testing.T) { selectors := env.Env.AllChainSelectors() chain1, chain2 := selectors[0], selectors[1] - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain1, chain2, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain2, chain1, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain1, chain2, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain2, chain1, false) // Change the gas price for chain2 feeQuoter := state.Chains[chain1].FeeQuoter @@ -763,8 +763,8 @@ func Test_LinkPriceUSD(t *testing.T) { selectors := env.Env.AllChainSelectors() chain1, chain2 := selectors[0], selectors[1] - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain1, chain2, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain2, chain1, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain1, chain2, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain2, chain1, false) reader := testSetupRealContracts( ctx, @@ -785,7 +785,7 @@ func Test_LinkPriceUSD(t *testing.T) { linkPriceUSD, err := reader.LinkPriceUSD(ctx) require.NoError(t, err) require.NotNil(t, linkPriceUSD.Int) - require.Equal(t, changeset.DefaultInitialPrices.LinkPrice, linkPriceUSD.Int) + require.Equal(t, changeset.DefaultLinkPrice, linkPriceUSD.Int) } func Test_GetMedianDataAvailabilityGasConfig(t *testing.T) { @@ -798,9 +798,9 @@ func Test_GetMedianDataAvailabilityGasConfig(t *testing.T) { selectors := env.Env.AllChainSelectors() destChain, chain1, chain2, chain3 := selectors[0], selectors[1], selectors[2], selectors[3] - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain1, destChain, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain2, destChain, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain3, destChain, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain1, destChain, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain2, destChain, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain3, destChain, false) boundContracts := map[cciptypes.ChainSelector][]types.BoundContract{} for i, selector := range env.Env.AllChainSelectorsExcluding([]uint64{destChain}) { @@ -857,8 +857,8 @@ func Test_GetWrappedNativeTokenPriceUSD(t *testing.T) { selectors := env.Env.AllChainSelectors() chain1, chain2 := selectors[0], selectors[1] - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain1, chain2, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(env.Env, state, chain2, chain1, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain1, chain2, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &env, state, chain2, chain1, false) reader := testSetupRealContracts( ctx, @@ -884,7 +884,7 @@ func Test_GetWrappedNativeTokenPriceUSD(t *testing.T) { // Only chainD has reader contracts bound require.Len(t, prices, 1) - require.Equal(t, changeset.DefaultInitialPrices.WethPrice, prices[cciptypes.ChainSelector(chain1)].Int) + require.Equal(t, changeset.DefaultWethPrice, prices[cciptypes.ChainSelector(chain1)].Int) } // Benchmark Results: diff --git a/integration-tests/smoke/ccip/ccip_batching_test.go b/integration-tests/smoke/ccip/ccip_batching_test.go index 58f4e922ac5..3752faa4e6e 100644 --- a/integration-tests/smoke/ccip/ccip_batching_test.go +++ b/integration-tests/smoke/ccip/ccip_batching_test.go @@ -63,8 +63,8 @@ func newBatchTestSetup(t *testing.T) batchTestSetup { ) // connect sourceChain1 and sourceChain2 to destChain - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(e.Env, state, sourceChain1, destChain, false)) - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(e.Env, state, sourceChain2, destChain, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, sourceChain1, destChain, false) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, sourceChain2, destChain, false) return batchTestSetup{e, state, sourceChain1, sourceChain2, destChain} } diff --git a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go index 576ee356fbb..3b0ebf22455 100644 --- a/integration-tests/smoke/ccip/ccip_fee_boosting_test.go +++ b/integration-tests/smoke/ccip/ccip_fee_boosting_test.go @@ -2,15 +2,13 @@ package smoke import ( "context" - "fmt" "math/big" "testing" "time" - "github.com/pkg/errors" - "github.com/smartcontractkit/chainlink-common/pkg/config" - commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" + + commoncs "github.com/smartcontractkit/chainlink/deployment/common/changeset" testsetups "github.com/smartcontractkit/chainlink/integration-tests/testsetups/ccip" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -20,11 +18,10 @@ import ( "github.com/smartcontractkit/chainlink-testing-framework/lib/utils/testcontext" - "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/fee_quoter" - cciptypes "github.com/smartcontractkit/chainlink-ccip/pkg/types/ccipocr3" + "github.com/smartcontractkit/chainlink/v2/core/capabilities/ccip/ccipevm" + "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/ccip/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/ccip/generated/onramp" @@ -84,32 +81,31 @@ func Test_CCIPFeeBoosting(t *testing.T) { ) t.Log("Adjusted gas price on dest chain:", adjustedGasPriceDest) - initialPrices := changeset.InitialPrices{ - LinkPrice: linkPrice, - WethPrice: wethPrice, - GasPrice: changeset.ToPackedFee(adjustedGasPriceDest, big.NewInt(0)), - } - - laneCfg := changeset.LaneConfig{ - SourceSelector: sourceChain, - DestSelector: destChain, - InitialPricesBySource: initialPrices, - FeeQuoterDestChain: changeset.DefaultFeeQuoterDestChainConfig(), - TestRouter: false, - } - - e.Env, err = commonchangeset.ApplyChangesets(t, e.Env, nil, []commonchangeset.ChangesetApplication{ - { - Changeset: commonchangeset.WrapChangeSet(changeset.AddLanes), - Config: changeset.AddLanesConfig{LaneConfigs: []changeset.LaneConfig{laneCfg}}, + changeset.AddLane(t, &e, sourceChain, destChain, false, + map[uint64]*big.Int{ + destChain: changeset.ToPackedFee(adjustedGasPriceDest, big.NewInt(0)), }, - }) - require.NoError(t, err) + map[common.Address]*big.Int{ + state.Chains[sourceChain].LinkToken.Address(): linkPrice, + state.Chains[sourceChain].Weth9.Address(): wethPrice, + }, + changeset.DefaultFeeQuoterDestChainConfig()) // Update token prices in destination chain FeeQuoter - err = updateTokensPrices(e, state, destChain, map[common.Address]*big.Int{ - state.Chains[destChain].LinkToken.Address(): linkPrice, - state.Chains[destChain].Weth9.Address(): wethPrice, + e.Env, err = commoncs.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commoncs.ChangesetApplication{ + { + Changeset: commoncs.WrapChangeSet(changeset.UpdateFeeQuoterPricesCS), + Config: changeset.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + destChain: { + TokenPrices: map[common.Address]*big.Int{ + state.Chains[destChain].LinkToken.Address(): linkPrice, + state.Chains[destChain].Weth9.Address(): wethPrice, + }, + }, + }, + }, + }, }) require.NoError(t, err) @@ -137,7 +133,20 @@ func Test_CCIPFeeBoosting(t *testing.T) { DestChainSelector: destChain, }] = []uint64{msgSentEvent.SequenceNumber} - err = updateGasPrice(e, state, sourceChain, destChain, originalGasPriceDestUSD) + e.Env, err = commoncs.ApplyChangesets(t, e.Env, e.TimelockContracts(t), []commoncs.ChangesetApplication{ + { + Changeset: commoncs.WrapChangeSet(changeset.UpdateFeeQuoterPricesCS), + Config: changeset.UpdateFeeQuoterPricesConfig{ + PricesByChain: map[uint64]changeset.FeeQuoterPriceUpdatePerSource{ + sourceChain: { + GasPrices: map[uint64]*big.Int{ + destChain: originalGasPriceDestUSD, + }, + }, + }, + }, + }, + }) require.NoError(t, err) // Confirm gas prices are updated @@ -270,61 +279,3 @@ func convertToMessage(msg onramp.InternalEVM2AnyRampMessage) cciptypes.Message { TokenAmounts: tokenAmounts, } } - -func updateGasPrice(env changeset.DeployedEnv, state changeset.CCIPOnChainState, srcChain, destChain uint64, gasPrice *big.Int) error { - chainState, exists := state.Chains[srcChain] - if !exists { - return fmt.Errorf("chain state not found for selector: %d", srcChain) - } - - feeQuoter := chainState.FeeQuoter - // Update gas price - auth := env.Env.Chains[srcChain].DeployerKey - tx, err := feeQuoter.UpdatePrices(auth, fee_quoter.InternalPriceUpdates{ - TokenPriceUpdates: nil, - GasPriceUpdates: []fee_quoter.InternalGasPriceUpdate{ - { - DestChainSelector: destChain, - UsdPerUnitGas: gasPrice, - }, - }, - }) - if err != nil { - return errors.Wrapf(err, "updating gas price on chain %d", srcChain) - } - if _, err := deployment.ConfirmIfNoError(env.Env.Chains[srcChain], tx, err); err != nil { - return err - } - - return nil -} - -func updateTokensPrices(env changeset.DeployedEnv, state changeset.CCIPOnChainState, chain uint64, tokenPrices map[common.Address]*big.Int) error { - chainState, exists := state.Chains[chain] - if !exists { - return fmt.Errorf("chain state not found for selector: %d", chain) - } - - feeQuoter := chainState.FeeQuoter - // Update token prices - auth := env.Env.Chains[chain].DeployerKey - tokenPricesUpdates := make([]fee_quoter.InternalTokenPriceUpdate, 0, len(tokenPrices)) - for token, price := range tokenPrices { - tokenPricesUpdates = append(tokenPricesUpdates, fee_quoter.InternalTokenPriceUpdate{ - SourceToken: token, - UsdPerToken: price, - }) - } - tx, err := feeQuoter.UpdatePrices(auth, fee_quoter.InternalPriceUpdates{ - TokenPriceUpdates: tokenPricesUpdates, - GasPriceUpdates: nil, - }) - if err != nil { - return errors.Wrapf(err, "updating token prices on chain %d", chain) - } - if _, err := deployment.ConfirmIfNoError(env.Env.Chains[chain], tx, err); err != nil { - return err - } - - return nil -} diff --git a/integration-tests/smoke/ccip/ccip_fees_test.go b/integration-tests/smoke/ccip/ccip_fees_test.go index 55788a4aa5f..57a6bc58d82 100644 --- a/integration-tests/smoke/ccip/ccip_fees_test.go +++ b/integration-tests/smoke/ccip/ccip_fees_test.go @@ -130,7 +130,7 @@ func Test_CCIPFees(t *testing.T) { changeset.ReplayLogs(t, e.Offchain, tenv.ReplayBlocks) // Add all lanes - require.NoError(t, changeset.AddLanesForAll(e, state)) + changeset.AddLanesForAll(t, &tenv, state) t.Run("Send programmable token transfer pay with Link token", func(t *testing.T) { runFeeTokenTestCase(feeTokenTestCase{ diff --git a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go index d11e4304366..2c1d97f6c12 100644 --- a/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_gas_price_updates_test.go @@ -34,7 +34,7 @@ func Test_CCIPGasPriceUpdates(t *testing.T) { ) state, err := changeset.LoadOnchainState(e.Env) require.NoError(t, err) - require.NoError(t, changeset.AddLanesForAll(e.Env, state)) + changeset.AddLanesForAll(t, &e, state) allChainSelectors := maps.Keys(e.Env.Chains) assert.GreaterOrEqual(t, len(allChainSelectors), 2, "test requires at least 2 chains") diff --git a/integration-tests/smoke/ccip/ccip_message_limitations_test.go b/integration-tests/smoke/ccip/ccip_message_limitations_test.go index 9398fd9f932..f9299b735d0 100644 --- a/integration-tests/smoke/ccip/ccip_message_limitations_test.go +++ b/integration-tests/smoke/ccip/ccip_message_limitations_test.go @@ -29,7 +29,7 @@ func Test_CCIPMessageLimitations(t *testing.T) { onChainState, err := changeset.LoadOnchainState(testEnv.Env) require.NoError(t, err) - require.NoError(t, changeset.AddLanesForAll(testEnv.Env, onChainState)) + changeset.AddLanesForAll(t, &testEnv, onChainState) srcToken, _ := setupTokens( t, diff --git a/integration-tests/smoke/ccip/ccip_messaging_test.go b/integration-tests/smoke/ccip/ccip_messaging_test.go index 13f14fcda16..8ee18a31918 100644 --- a/integration-tests/smoke/ccip/ccip_messaging_test.go +++ b/integration-tests/smoke/ccip/ccip_messaging_test.go @@ -63,7 +63,7 @@ func Test_CCIPMessaging(t *testing.T) { ", dest chain selector:", destChain, ) // connect a single lane, source to dest - require.NoError(t, changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(e.Env, state, sourceChain, destChain, false)) + changeset.AddLaneWithDefaultPricesAndFeeQuoterConfig(t, &e, state, sourceChain, destChain, false) var ( replayed bool diff --git a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go index 19c36c6e021..e3da473984d 100644 --- a/integration-tests/smoke/ccip/ccip_ooo_execution_test.go +++ b/integration-tests/smoke/ccip/ccip_ooo_execution_test.go @@ -86,7 +86,7 @@ func Test_OutOfOrderExecution(t *testing.T) { }, }, ) - require.NoError(t, changeset.AddLanesForAll(e, state)) + changeset.AddLanesForAll(t, &tenv, state) tokenTransfer := []router.ClientEVMTokenAmount{ { diff --git a/integration-tests/smoke/ccip/ccip_rmn_test.go b/integration-tests/smoke/ccip/ccip_rmn_test.go index 166f4422fe6..a3877013103 100644 --- a/integration-tests/smoke/ccip/ccip_rmn_test.go +++ b/integration-tests/smoke/ccip/ccip_rmn_test.go @@ -323,7 +323,7 @@ func runRmnTestCase(t *testing.T, tc rmnTestCase) { tc.killMarkedRmnNodes(t, rmnCluster) changeset.ReplayLogs(t, envWithRMN.Env.Offchain, envWithRMN.ReplayBlocks) - require.NoError(t, changeset.AddLanesForAll(envWithRMN.Env, onChainState)) + changeset.AddLanesForAll(t, &envWithRMN, onChainState) disabledNodes := tc.disableOraclesIfThisIsACursingTestCase(ctx, t, envWithRMN) startBlocks, seqNumCommit, seqNumExec := tc.sendMessages(t, onChainState, envWithRMN) diff --git a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go index e3496b6f407..fb7ddc847d4 100644 --- a/integration-tests/smoke/ccip/ccip_token_price_updates_test.go +++ b/integration-tests/smoke/ccip/ccip_token_price_updates_test.go @@ -35,7 +35,7 @@ func Test_CCIPTokenPriceUpdates(t *testing.T) { })) state, err := changeset.LoadOnchainState(e.Env) require.NoError(t, err) - require.NoError(t, changeset.AddLanesForAll(e.Env, state)) + changeset.AddLanesForAll(t, &e, state) allChainSelectors := maps.Keys(e.Env.Chains) assert.GreaterOrEqual(t, len(allChainSelectors), 2, "test requires at least 2 chains") diff --git a/integration-tests/smoke/ccip/ccip_token_transfer_test.go b/integration-tests/smoke/ccip/ccip_token_transfer_test.go index 2088960639e..c5cabfe63e4 100644 --- a/integration-tests/smoke/ccip/ccip_token_transfer_test.go +++ b/integration-tests/smoke/ccip/ccip_token_transfer_test.go @@ -69,7 +69,7 @@ func TestTokenTransfer(t *testing.T) { "SELF_SERVE_TOKEN", ) require.NoError(t, err) - require.NoError(t, changeset.AddLanesForAll(e, state)) + changeset.AddLanesForAll(t, &tenv, state) changeset.MintAndAllow( t, diff --git a/integration-tests/smoke/ccip/ccip_usdc_test.go b/integration-tests/smoke/ccip/ccip_usdc_test.go index 174ab941387..7bea68a9cbf 100644 --- a/integration-tests/smoke/ccip/ccip_usdc_test.go +++ b/integration-tests/smoke/ccip/ccip_usdc_test.go @@ -71,7 +71,7 @@ func TestUSDCTokenTransfer(t *testing.T) { require.NoError(t, err) // Add all lanes - require.NoError(t, changeset.AddLanesForAll(e, state)) + changeset.AddLanesForAll(t, &tenv, state) changeset.MintAndAllow( t, From 0b8172dfcc9bc5ca3c166139286b9675239250c8 Mon Sep 17 00:00:00 2001 From: krehermann <16602512+krehermann@users.noreply.github.com> Date: Fri, 20 Dec 2024 11:46:42 -0700 Subject: [PATCH 03/19] deprecate kslib (#15759) * logging, edge case fixes * delete used CLO code * remove unused test data * deprecate kslib * mv to internal; expose func required downstream * code comments * fix scripts deps * missing file * typo --- .changeset/sour-hairs-cross.md | 5 + .../keystone/src/01_deploy_contracts_cmd.go | 4 +- core/scripts/keystone/src/88_gen_jobspecs.go | 4 +- .../keystone/src/88_gen_ocr3_config.go | 4 +- core/scripts/keystone/src/99_fetch_keys.go | 10 +- .../keystone/changeset/accept_ownership.go | 2 +- .../changeset/accept_ownership_test.go | 2 +- .../keystone/changeset/addrbook_utils.go | 15 ++- .../changeset/append_node_capabilities.go | 3 +- deployment/keystone/changeset/compatiblity.go | 95 +++++++++++++ .../keystone/changeset/configure_contracts.go | 2 +- .../keystone/changeset/deploy_consumer.go | 2 +- .../keystone/changeset/deploy_forwarder.go | 32 +++-- .../changeset/deploy_forwarder_test.go | 2 +- deployment/keystone/changeset/deploy_ocr3.go | 2 +- .../keystone/changeset/deploy_ocr3_test.go | 8 +- .../keystone/changeset/deploy_registry.go | 2 +- .../internal/append_node_capabilities.go | 6 +- .../internal}/capability_definitions.go | 2 +- .../internal}/capability_management.go | 4 +- .../internal}/capability_registry_deployer.go | 2 +- .../internal}/consumer_deployer.go | 2 +- .../{ => changeset/internal}/contract_set.go | 17 +-- .../{ => changeset/internal}/deploy.go | 25 ++-- .../internal}/forwarder_deployer.go | 2 +- .../{ => changeset/internal}/ocr3_deployer.go | 2 +- .../{ => changeset/internal}/ocr3config.go | 8 +- .../internal}/ocr3config_test.go | 2 +- .../{ => changeset/internal}/state.go | 2 +- .../keystone/changeset/internal/test/utils.go | 108 +++++---------- .../internal}/testdata/testnet_wf_view.json | 0 .../{ => changeset/internal}/types.go | 2 +- .../{ => changeset/internal}/types_test.go | 2 +- .../keystone/changeset/internal/update_don.go | 8 +- .../changeset/internal/update_don_test.go | 20 ++- .../internal/update_node_capabilities.go | 5 +- .../internal/update_node_capabilities_test.go | 16 +-- .../changeset/internal/update_nodes.go | 19 ++- .../changeset/internal/update_nodes_test.go | 11 +- deployment/keystone/changeset/test/helpers.go | 49 ++++--- deployment/keystone/changeset/update_don.go | 3 +- .../changeset/update_node_capabilities.go | 3 +- deployment/keystone/changeset/update_nodes.go | 3 +- deployment/keystone/changeset/view.go | 4 +- deployment/keystone/changeset/view_test.go | 2 +- .../changeset/workflowregistry/deploy.go | 3 +- .../changeset/workflowregistry/setup_test.go | 54 ++++++++ .../changeset/workflowregistry/strategies.go | 3 +- .../workflowregistry/update_allowed_dons.go | 5 +- .../update_allowed_dons_test.go | 3 +- .../update_authorized_addresses.go | 7 +- .../update_authorized_addresses_test.go | 3 +- .../workflow_registry_deployer.go | 37 +++-- deployment/keystone/deprecated.go | 127 ++++++++++++++++++ .../test/changeset/capability_registry.go | 13 +- 55 files changed, 506 insertions(+), 272 deletions(-) create mode 100644 .changeset/sour-hairs-cross.md create mode 100644 deployment/keystone/changeset/compatiblity.go rename deployment/keystone/{ => changeset/internal}/capability_definitions.go (98%) rename deployment/keystone/{ => changeset/internal}/capability_management.go (97%) rename deployment/keystone/{ => changeset/internal}/capability_registry_deployer.go (99%) rename deployment/keystone/{ => changeset/internal}/consumer_deployer.go (98%) rename deployment/keystone/{ => changeset/internal}/contract_set.go (86%) rename deployment/keystone/{ => changeset/internal}/deploy.go (97%) rename deployment/keystone/{ => changeset/internal}/forwarder_deployer.go (99%) rename deployment/keystone/{ => changeset/internal}/ocr3_deployer.go (98%) rename deployment/keystone/{ => changeset/internal}/ocr3config.go (98%) rename deployment/keystone/{ => changeset/internal}/ocr3config_test.go (99%) rename deployment/keystone/{ => changeset/internal}/state.go (99%) rename deployment/keystone/{ => changeset/internal}/testdata/testnet_wf_view.json (100%) rename deployment/keystone/{ => changeset/internal}/types.go (99%) rename deployment/keystone/{ => changeset/internal}/types_test.go (99%) create mode 100644 deployment/keystone/changeset/workflowregistry/setup_test.go rename deployment/keystone/{ => changeset/workflowregistry}/workflow_registry_deployer.go (50%) create mode 100644 deployment/keystone/deprecated.go diff --git a/.changeset/sour-hairs-cross.md b/.changeset/sour-hairs-cross.md new file mode 100644 index 00000000000..fa12a38b5be --- /dev/null +++ b/.changeset/sour-hairs-cross.md @@ -0,0 +1,5 @@ +--- +"chainlink": patch +--- + +#internal depreciate keystone deployment library diff --git a/core/scripts/keystone/src/01_deploy_contracts_cmd.go b/core/scripts/keystone/src/01_deploy_contracts_cmd.go index 59ddc79acd8..14c8d989063 100644 --- a/core/scripts/keystone/src/01_deploy_contracts_cmd.go +++ b/core/scripts/keystone/src/01_deploy_contracts_cmd.go @@ -12,7 +12,7 @@ import ( "github.com/ethereum/go-ethereum/common" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" forwarder "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder_1_0_0" ocr3_capability "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/ocr3_capability_1_0_0" ) @@ -157,7 +157,7 @@ func deploy( func setOCR3Config( env helpers.Environment, - ocrConfig ksdeploy.OCR2OracleConfig, + ocrConfig changeset.OCR3OnchainConfig, artefacts string, ) { loadedContracts, err := LoadDeployedContracts(artefacts) diff --git a/core/scripts/keystone/src/88_gen_jobspecs.go b/core/scripts/keystone/src/88_gen_jobspecs.go index 4f59a89be2d..e88833c9865 100644 --- a/core/scripts/keystone/src/88_gen_jobspecs.go +++ b/core/scripts/keystone/src/88_gen_jobspecs.go @@ -7,7 +7,7 @@ import ( "strings" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" ) type spec []string @@ -74,7 +74,7 @@ func replacePlaceholders( chainID, p2pPort int64, contractAddress, bootHost string, - boot, node ksdeploy.NodeKeys, + boot, node changeset.NodeKeys, ) (output []string) { chainIDStr := strconv.FormatInt(chainID, 10) bootstrapper := fmt.Sprintf("%s@%s:%d", boot.P2PPeerID, bootHost, p2pPort) diff --git a/core/scripts/keystone/src/88_gen_ocr3_config.go b/core/scripts/keystone/src/88_gen_ocr3_config.go index 707616b833b..94217b07f4e 100644 --- a/core/scripts/keystone/src/88_gen_ocr3_config.go +++ b/core/scripts/keystone/src/88_gen_ocr3_config.go @@ -3,14 +3,14 @@ package src import ( helpers "github.com/smartcontractkit/chainlink/core/scripts/common" "github.com/smartcontractkit/chainlink/deployment" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" + ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" ) func mustReadConfig(fileName string) (output ksdeploy.TopLevelConfigSource) { return mustParseJSON[ksdeploy.TopLevelConfigSource](fileName) } -func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKeysPath string) ksdeploy.OCR2OracleConfig { +func generateOCR3Config(nodeList string, configFile string, chainID int64, pubKeysPath string) ksdeploy.OCR3OnchainConfig { topLevelCfg := mustReadConfig(configFile) cfg := topLevelCfg.OracleConfig nca := downloadNodePubKeys(nodeList, chainID, pubKeysPath) diff --git a/core/scripts/keystone/src/99_fetch_keys.go b/core/scripts/keystone/src/99_fetch_keys.go index 8899da95b11..056769dc714 100644 --- a/core/scripts/keystone/src/99_fetch_keys.go +++ b/core/scripts/keystone/src/99_fetch_keys.go @@ -13,17 +13,17 @@ import ( "github.com/urfave/cli" helpers "github.com/smartcontractkit/chainlink/core/scripts/common" - ksdeploy "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/web/presenters" ) -func downloadNodePubKeys(nodeList string, chainID int64, pubKeysPath string) []ksdeploy.NodeKeys { +func downloadNodePubKeys(nodeList string, chainID int64, pubKeysPath string) []changeset.NodeKeys { // Check if file exists already, and if so, return the keys if _, err := os.Stat(pubKeysPath); err == nil { fmt.Println("Loading existing public keys at:", pubKeysPath) - return mustParseJSON[[]ksdeploy.NodeKeys](pubKeysPath) + return mustParseJSON[[]changeset.NodeKeys](pubKeysPath) } nodes := downloadNodeAPICredentials(nodeList) @@ -97,7 +97,7 @@ type ocr2Bundle struct { ConfigPublicKey string `json:"configPublicKey"` } -func mustFetchNodesKeys(chainID int64, nodes []*node) (nca []ksdeploy.NodeKeys) { +func mustFetchNodesKeys(chainID int64, nodes []*node) (nca []changeset.NodeKeys) { for _, n := range nodes { output := &bytes.Buffer{} client, app := newApp(n, output) @@ -209,7 +209,7 @@ func mustFetchNodesKeys(chainID int64, nodes []*node) (nca []ksdeploy.NodeKeys) helpers.PanicErr(err) output.Reset() - nc := ksdeploy.NodeKeys{ + nc := changeset.NodeKeys{ EthAddress: ethAddress, AptosAccount: aptosAccount, P2PPeerID: peerID, diff --git a/deployment/keystone/changeset/accept_ownership.go b/deployment/keystone/changeset/accept_ownership.go index 662a4c2dcfa..dd709523bc2 100644 --- a/deployment/keystone/changeset/accept_ownership.go +++ b/deployment/keystone/changeset/accept_ownership.go @@ -5,7 +5,7 @@ import ( "github.com/ethereum/go-ethereum/common" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/changeset" diff --git a/deployment/keystone/changeset/accept_ownership_test.go b/deployment/keystone/changeset/accept_ownership_test.go index d949e63c7aa..4007fde4f79 100644 --- a/deployment/keystone/changeset/accept_ownership_test.go +++ b/deployment/keystone/changeset/accept_ownership_test.go @@ -35,7 +35,7 @@ func TestAcceptAllOwnership(t *testing.T) { }, { Changeset: commonchangeset.WrapChangeSet(changeset.DeployForwarder), - Config: registrySel, + Config: changeset.DeployForwarderRequest{}, }, { Changeset: commonchangeset.WrapChangeSet(changeset.DeployFeedsConsumer), diff --git a/deployment/keystone/changeset/addrbook_utils.go b/deployment/keystone/changeset/addrbook_utils.go index 3eb23011ef0..fa4dd27ca18 100644 --- a/deployment/keystone/changeset/addrbook_utils.go +++ b/deployment/keystone/changeset/addrbook_utils.go @@ -8,7 +8,8 @@ import ( ccipowner "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/keystone" + + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" capReg "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" feeds_consumer "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/feeds_consumer_1_0_0" keystoneForwarder "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/forwarder_1_0_0" @@ -56,7 +57,7 @@ func capRegistriesFromAddrBook(addrBook deployment.AddressBook, chain deployment return getContractsFromAddrBook[capReg.CapabilitiesRegistry]( addrBook, chain, - keystone.CapabilitiesRegistry, + internal.CapabilitiesRegistry, capReg.NewCapabilitiesRegistry, ) } @@ -66,7 +67,7 @@ func ocr3FromAddrBook(addrBook deployment.AddressBook, chain deployment.Chain) ( return getContractsFromAddrBook[ocr3Capability.OCR3Capability]( addrBook, chain, - keystone.OCR3Capability, + internal.OCR3Capability, ocr3Capability.NewOCR3Capability, ) } @@ -76,7 +77,7 @@ func forwardersFromAddrBook(addrBook deployment.AddressBook, chain deployment.Ch return getContractsFromAddrBook[keystoneForwarder.KeystoneForwarder]( addrBook, chain, - keystone.KeystoneForwarder, + internal.KeystoneForwarder, keystoneForwarder.NewKeystoneForwarder, ) } @@ -86,7 +87,7 @@ func feedsConsumersFromAddrBook(addrBook deployment.AddressBook, chain deploymen return getContractsFromAddrBook[feeds_consumer.KeystoneFeedsConsumer]( addrBook, chain, - keystone.FeedConsumer, + internal.FeedConsumer, feeds_consumer.NewKeystoneFeedsConsumer, ) } @@ -96,7 +97,7 @@ func proposersFromAddrBook(addrBook deployment.AddressBook, chain deployment.Cha return getContractsFromAddrBook[ccipowner.ManyChainMultiSig]( addrBook, chain, - keystone.ProposerManyChainMultiSig, + internal.ProposerManyChainMultiSig, ccipowner.NewManyChainMultiSig, ) } @@ -106,7 +107,7 @@ func timelocksFromAddrBook(addrBook deployment.AddressBook, chain deployment.Cha return getContractsFromAddrBook[ccipowner.RBACTimelock]( addrBook, chain, - keystone.RBACTimelock, + internal.RBACTimelock, ccipowner.NewRBACTimelock, ) } diff --git a/deployment/keystone/changeset/append_node_capabilities.go b/deployment/keystone/changeset/append_node_capabilities.go index 688d4fd8d2f..d558cf39c95 100644 --- a/deployment/keystone/changeset/append_node_capabilities.go +++ b/deployment/keystone/changeset/append_node_capabilities.go @@ -8,7 +8,6 @@ import ( "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) @@ -63,7 +62,7 @@ func (req *AppendNodeCapabilitiesRequest) convert(e deployment.Environment) (*in if !ok { return nil, fmt.Errorf("registry chain selector %d does not exist in environment", req.RegistryChainSel) } - resp, err := kslib.GetContractSets(e.Logger, &kslib.GetContractSetsRequest{ + resp, err := internal.GetContractSets(e.Logger, &internal.GetContractSetsRequest{ Chains: map[uint64]deployment.Chain{req.RegistryChainSel: registryChain}, AddressBook: e.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/compatiblity.go b/deployment/keystone/changeset/compatiblity.go new file mode 100644 index 00000000000..7f80b6ab53d --- /dev/null +++ b/deployment/keystone/changeset/compatiblity.go @@ -0,0 +1,95 @@ +package changeset + +import "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" + +//TODO: KS-673 refactor internal package to reduce and remove the duplication + +// OracleConfig is the configuration for an oracle +type OracleConfig = internal.OracleConfig + +// OCR3OnchainConfig is the onchain configuration of an OCR2 contract +type OCR3OnchainConfig = internal.OCR2OracleConfig + +// NodeKeys is a set of public keys for a node +type NodeKeys = internal.NodeKeys + +// TopLevelConfigSource is the top level configuration source +type TopLevelConfigSource = internal.TopLevelConfigSource + +// GenerateOCR3Config generates an OCR3 config +var GenerateOCR3Config = internal.GenerateOCR3Config + +// FeedConsumer is a feed consumer contract type +var FeedConsumer = internal.FeedConsumer + +// KeystoneForwarder is a keystone forwarder contract type +var KeystoneForwarder = internal.KeystoneForwarder + +// GetContractSetsRequest is a request to get contract sets +type GetContractSetsRequest = internal.GetContractSetsRequest + +// GetContractSetsResponse is a response to get contract sets +type GetContractSetsResponse = internal.GetContractSetsResponse + +// GetContractSets gets contract sets +var GetContractSets = internal.GetContractSets + +// RegisterCapabilitiesRequest is a request to register capabilities +type RegisterCapabilitiesRequest = internal.RegisterCapabilitiesRequest + +// RegisterCapabilitiesResponse is a response to register capabilities +type RegisterCapabilitiesResponse = internal.RegisterCapabilitiesResponse + +// RegisterCapabilities registers capabilities +var RegisterCapabilities = internal.RegisterCapabilities + +// RegisterNOPSRequest is a request to register NOPS +type RegisterNOPSRequest = internal.RegisterNOPSRequest + +// RegisterNOPSResponse is a response to register NOPS +type RegisterNOPSResponse = internal.RegisterNOPSResponse + +// RegisterNOPS registers NOPS +var RegisterNOPS = internal.RegisterNOPS + +// RegisterNodesRequest is a request to register nodes with the capabilities registry +type RegisterNodesRequest = internal.RegisterNodesRequest + +// RegisterNodesResponse is a response to register nodes with the capabilities registry +type RegisterNodesResponse = internal.RegisterNodesResponse + +// RegisterNodes registers nodes with the capabilities registry +var RegisterNodes = internal.RegisterNodes + +// RegisteredCapability is a wrapper of a capability and its ID +type RegisteredCapability = internal.RegisteredCapability + +// FromCapabilitiesRegistryCapability converts a capabilities registry capability to a registered capability +var FromCapabilitiesRegistryCapability = internal.FromCapabilitiesRegistryCapability + +// RegisterDonsRequest is a request to register Dons with the capabilities registry +type RegisterDonsRequest = internal.RegisterDonsRequest + +// RegisterDonsResponse is a response to register Dons with the capabilities registry +type RegisterDonsResponse = internal.RegisterDonsResponse + +// RegisterDons registers Dons with the capabilities registry +var RegisterDons = internal.RegisterDons + +// DONToRegister is the minimal information needed to register a DON with the capabilities registry +type DONToRegister = internal.DONToRegister + +// ConfigureContractsRequest is a request to configure ALL the contracts +type ConfigureContractsRequest = internal.ConfigureContractsRequest + +// ConfigureContractsResponse is a response to configure ALL the contracts +type ConfigureContractsResponse = internal.ConfigureContractsResponse + +// DonCapabilities is a set of capabilities hosted by a set of node operators +// in is in a convenient form to handle the CLO representation of the nop data +type DonCapabilities = internal.DonCapabilities + +type DeployRequest = internal.DeployRequest +type DeployResponse = internal.DeployResponse + +type ContractSet = internal.ContractSet diff --git a/deployment/keystone/changeset/configure_contracts.go b/deployment/keystone/changeset/configure_contracts.go index 3a92782e12b..b57ebb0ed52 100644 --- a/deployment/keystone/changeset/configure_contracts.go +++ b/deployment/keystone/changeset/configure_contracts.go @@ -7,7 +7,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) var _ deployment.ChangeSet[InitialContractsCfg] = ConfigureInitialContractsChangeset diff --git a/deployment/keystone/changeset/deploy_consumer.go b/deployment/keystone/changeset/deploy_consumer.go index fc7992e2a7d..d94d7ac0adc 100644 --- a/deployment/keystone/changeset/deploy_consumer.go +++ b/deployment/keystone/changeset/deploy_consumer.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) type DeployFeedsConsumerRequest struct { diff --git a/deployment/keystone/changeset/deploy_forwarder.go b/deployment/keystone/changeset/deploy_forwarder.go index b4b242b72df..66923140e6a 100644 --- a/deployment/keystone/changeset/deploy_forwarder.go +++ b/deployment/keystone/changeset/deploy_forwarder.go @@ -2,26 +2,40 @@ package changeset import ( "fmt" + "maps" + "slices" "github.com/ethereum/go-ethereum/common" "github.com/smartcontractkit/ccip-owner-contracts/pkg/gethwrappers" "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) -var _ deployment.ChangeSet[uint64] = DeployForwarder +var _ deployment.ChangeSet[DeployForwarderRequest] = DeployForwarder + +type DeployForwarderRequest struct { + ChainSelectors []uint64 // filter to only deploy to these chains; if empty, deploy to all chains +} // DeployForwarder deploys the KeystoneForwarder contract to all chains in the environment // callers must merge the output addressbook with the existing one // TODO: add selectors to deploy only to specific chains -func DeployForwarder(env deployment.Environment, _ uint64) (deployment.ChangesetOutput, error) { +func DeployForwarder(env deployment.Environment, cfg DeployForwarderRequest) (deployment.ChangesetOutput, error) { lggr := env.Logger ab := deployment.NewMemoryAddressBook() - for _, chain := range env.Chains { + selectors := cfg.ChainSelectors + if len(selectors) == 0 { + selectors = slices.Collect(maps.Keys(env.Chains)) + } + for _, sel := range selectors { + chain, ok := env.Chains[sel] + if !ok { + return deployment.ChangesetOutput{}, fmt.Errorf("chain with selector %d not found", sel) + } lggr.Infow("deploying forwarder", "chainSelector", chain.Selector) - forwarderResp, err := kslib.DeployForwarder(chain, ab) + forwarderResp, err := internal.DeployForwarder(chain, ab) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to deploy KeystoneForwarder to chain selector %d: %w", chain.Selector, err) } @@ -55,7 +69,7 @@ func (r ConfigureForwardContractsRequest) UseMCMS() bool { } func ConfigureForwardContracts(env deployment.Environment, req ConfigureForwardContractsRequest) (deployment.ChangesetOutput, error) { - wfDon, err := kslib.NewRegisteredDon(env, kslib.RegisteredDonConfig{ + wfDon, err := internal.NewRegisteredDon(env, internal.RegisteredDonConfig{ NodeIDs: req.WFNodeIDs, Name: req.WFDonName, RegistryChainSel: req.RegistryChainSel, @@ -63,15 +77,15 @@ func ConfigureForwardContracts(env deployment.Environment, req ConfigureForwardC if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to create registered don: %w", err) } - r, err := kslib.ConfigureForwardContracts(&env, kslib.ConfigureForwarderContractsRequest{ - Dons: []kslib.RegisteredDon{*wfDon}, + r, err := internal.ConfigureForwardContracts(&env, internal.ConfigureForwarderContractsRequest{ + Dons: []internal.RegisteredDon{*wfDon}, UseMCMS: req.UseMCMS(), }) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to configure forward contracts: %w", err) } - cresp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + cresp, err := internal.GetContractSets(env.Logger, &internal.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/deploy_forwarder_test.go b/deployment/keystone/changeset/deploy_forwarder_test.go index f40b0f560c4..ec80a9432b0 100644 --- a/deployment/keystone/changeset/deploy_forwarder_test.go +++ b/deployment/keystone/changeset/deploy_forwarder_test.go @@ -34,7 +34,7 @@ func TestDeployForwarder(t *testing.T) { // deploy forwarder env.ExistingAddresses = ab - resp, err := changeset.DeployForwarder(env, registrySel) + resp, err := changeset.DeployForwarder(env, changeset.DeployForwarderRequest{}) require.NoError(t, err) require.NotNil(t, resp) // registry, ocr3, forwarder should be deployed on registry chain diff --git a/deployment/keystone/changeset/deploy_ocr3.go b/deployment/keystone/changeset/deploy_ocr3.go index 057bba4c12d..4e85590e521 100644 --- a/deployment/keystone/changeset/deploy_ocr3.go +++ b/deployment/keystone/changeset/deploy_ocr3.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) var _ deployment.ChangeSet[uint64] = DeployOCR3 diff --git a/deployment/keystone/changeset/deploy_ocr3_test.go b/deployment/keystone/changeset/deploy_ocr3_test.go index 1aa8f0a0caa..c12f6878835 100644 --- a/deployment/keystone/changeset/deploy_ocr3_test.go +++ b/deployment/keystone/changeset/deploy_ocr3_test.go @@ -15,8 +15,8 @@ import ( commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/environment/memory" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/test" ) @@ -48,7 +48,7 @@ func TestDeployOCR3(t *testing.T) { func TestConfigureOCR3(t *testing.T) { t.Parallel() - c := kslib.OracleConfig{ + c := internal.OracleConfig{ MaxFaultyOracles: 1, DeltaProgressMillis: 12345, } @@ -77,7 +77,7 @@ func TestConfigureOCR3(t *testing.T) { csOut, err := changeset.ConfigureOCR3Contract(te.Env, cfg) require.NoError(t, err) - var got kslib.OCR2OracleConfig + var got internal.OCR2OracleConfig err = json.Unmarshal(w.Bytes(), &got) require.NoError(t, err) assert.Len(t, got.Signers, 4) @@ -110,7 +110,7 @@ func TestConfigureOCR3(t *testing.T) { csOut, err := changeset.ConfigureOCR3Contract(te.Env, cfg) require.NoError(t, err) - var got kslib.OCR2OracleConfig + var got internal.OCR2OracleConfig err = json.Unmarshal(w.Bytes(), &got) require.NoError(t, err) assert.Len(t, got.Signers, 4) diff --git a/deployment/keystone/changeset/deploy_registry.go b/deployment/keystone/changeset/deploy_registry.go index d07e2728282..2b8342c06dd 100644 --- a/deployment/keystone/changeset/deploy_registry.go +++ b/deployment/keystone/changeset/deploy_registry.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" ) var _ deployment.ChangeSet[uint64] = DeployCapabilityRegistry diff --git a/deployment/keystone/changeset/internal/append_node_capabilities.go b/deployment/keystone/changeset/internal/append_node_capabilities.go index 652dff4693a..32fe8572da3 100644 --- a/deployment/keystone/changeset/internal/append_node_capabilities.go +++ b/deployment/keystone/changeset/internal/append_node_capabilities.go @@ -5,14 +5,14 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" + kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" ) type AppendNodeCapabilitiesRequest struct { Chain deployment.Chain - ContractSet *kslib.ContractSet + ContractSet *ContractSet P2pToCapabilities map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability UseMCMS bool @@ -48,7 +48,7 @@ func AppendNodeCapabilitiesImpl(lggr logger.Logger, req *AppendNodeCapabilitiesR for _, cap := range req.P2pToCapabilities { capabilities = append(capabilities, cap...) } - op, err := kslib.AddCapabilities(lggr, req.ContractSet, req.Chain, capabilities, req.UseMCMS) + op, err := AddCapabilities(lggr, req.ContractSet, req.Chain, capabilities, req.UseMCMS) if err != nil { return nil, fmt.Errorf("failed to add capabilities: %w", err) } diff --git a/deployment/keystone/capability_definitions.go b/deployment/keystone/changeset/internal/capability_definitions.go similarity index 98% rename from deployment/keystone/capability_definitions.go rename to deployment/keystone/changeset/internal/capability_definitions.go index 2a234e18f52..21c2b4fce01 100644 --- a/deployment/keystone/capability_definitions.go +++ b/deployment/keystone/changeset/internal/capability_definitions.go @@ -1,4 +1,4 @@ -package keystone +package internal import kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" diff --git a/deployment/keystone/capability_management.go b/deployment/keystone/changeset/internal/capability_management.go similarity index 97% rename from deployment/keystone/capability_management.go rename to deployment/keystone/changeset/internal/capability_management.go index a643112457f..268b4fd0d01 100644 --- a/deployment/keystone/capability_management.go +++ b/deployment/keystone/changeset/internal/capability_management.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "fmt" @@ -27,7 +27,7 @@ func AddCapabilities(lggr logger.Logger, contractSet *ContractSet, chain deploym } tx, err := registry.AddCapabilities(txOpts, deduped) if err != nil { - err = DecodeErr(kcr.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to add capabilities: %w", err) } var batch *timelock.BatchChainOperation diff --git a/deployment/keystone/capability_registry_deployer.go b/deployment/keystone/changeset/internal/capability_registry_deployer.go similarity index 99% rename from deployment/keystone/capability_registry_deployer.go rename to deployment/keystone/changeset/internal/capability_registry_deployer.go index 217250cd606..492ba168c9d 100644 --- a/deployment/keystone/capability_registry_deployer.go +++ b/deployment/keystone/changeset/internal/capability_registry_deployer.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "context" diff --git a/deployment/keystone/consumer_deployer.go b/deployment/keystone/changeset/internal/consumer_deployer.go similarity index 98% rename from deployment/keystone/consumer_deployer.go rename to deployment/keystone/changeset/internal/consumer_deployer.go index 4886039e791..3c2de539ccb 100644 --- a/deployment/keystone/consumer_deployer.go +++ b/deployment/keystone/changeset/internal/consumer_deployer.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "fmt" diff --git a/deployment/keystone/contract_set.go b/deployment/keystone/changeset/internal/contract_set.go similarity index 86% rename from deployment/keystone/contract_set.go rename to deployment/keystone/changeset/internal/contract_set.go index 51b5c823600..e60f37d6f76 100644 --- a/deployment/keystone/contract_set.go +++ b/deployment/keystone/changeset/internal/contract_set.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "fmt" @@ -58,21 +58,6 @@ func DeployCapabilitiesRegistry(chain deployment.Chain, ab deployment.AddressBoo return capabilitiesRegistryResp, nil } -// DeployWorkflowRegistry deploys the WorkflowRegistry contract to the chain -// and saves the address in the address book. This mutates the address book. -func DeployWorkflowRegistry(chain deployment.Chain, ab deployment.AddressBook) (*DeployResponse, error) { - deployer, err := NewWorkflowRegistryDeployer() - resp, err := deployer.Deploy(DeployRequest{Chain: chain}) - if err != nil { - return nil, fmt.Errorf("failed to deploy WorkflowRegistry: %w", err) - } - err = ab.Save(chain.Selector, resp.Address.String(), resp.Tv) - if err != nil { - return nil, fmt.Errorf("failed to save WorkflowRegistry: %w", err) - } - return resp, nil -} - // DeployOCR3 deploys the OCR3Capability contract to the chain // and saves the address in the address book. This mutates the address book. func DeployOCR3(chain deployment.Chain, ab deployment.AddressBook) (*DeployResponse, error) { diff --git a/deployment/keystone/deploy.go b/deployment/keystone/changeset/internal/deploy.go similarity index 97% rename from deployment/keystone/deploy.go rename to deployment/keystone/changeset/internal/deploy.go index 58fbf07963c..5afcae11e93 100644 --- a/deployment/keystone/deploy.go +++ b/deployment/keystone/changeset/internal/deploy.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "bytes" @@ -540,7 +540,7 @@ func RegisterNOPS(ctx context.Context, lggr logger.Logger, req RegisterNOPSReque } tx, err := registry.AddNodeOperators(registryChain.DeployerKey, nops) if err != nil { - err = DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call AddNodeOperators: %w", err) } // for some reason that i don't understand, the confirm must be called before the WaitMined or the latter will hang @@ -603,12 +603,6 @@ func DefaultCapConfig(capType uint8, nNodes int) *capabilitiespb.CapabilityConfi } } -// DEPRECATED: use deployment.DecodeErr instead -// todo: refactor all keystone deps to use deployment.DecodeErr -func DecodeErr(encodedABI string, err error) error { - return deployment.DecodeErr(encodedABI, err) -} - // register nodes type RegisterNodesRequest struct { Env *deployment.Environment @@ -624,7 +618,6 @@ type RegisterNodesResponse struct { // registerNodes registers the nodes with the registry. it assumes that the deployer key in the Chain // can sign the transactions update the contract state -// TODO: 467 refactor to support MCMS. Specifically need to separate the call data generation from the actual contract call func RegisterNodes(lggr logger.Logger, req *RegisterNodesRequest) (*RegisterNodesResponse, error) { registry, registryChain, err := GetRegistryContract(req.Env, req.RegistryChainSelector) if err != nil { @@ -727,7 +720,7 @@ func RegisterNodes(lggr logger.Logger, req *RegisterNodesRequest) (*RegisterNode lggr.Debugw("unique node params to add", "count", len(uniqueNodeParams), "params", uniqueNodeParams) tx, err := registry.AddNodes(registryChain.DeployerKey, uniqueNodeParams) if err != nil { - err = DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) // no typed errors in the abi, so we have to do string matching // try to add all nodes in one go, if that fails, fall back to 1-by-1 if !strings.Contains(err.Error(), "NodeAlreadyExists") { @@ -737,7 +730,7 @@ func RegisterNodes(lggr logger.Logger, req *RegisterNodesRequest) (*RegisterNode for _, singleNodeParams := range uniqueNodeParams { tx, err = registry.AddNodes(registryChain.DeployerKey, []capabilities_registry.CapabilitiesRegistryNodeParams{singleNodeParams}) if err != nil { - err = DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) if strings.Contains(err.Error(), "NodeAlreadyExists") { lggr.Warnw("node already exists, skipping", "p2pid", hex.EncodeToString(singleNodeParams.P2pId[:])) continue @@ -806,7 +799,7 @@ func RegisterDons(lggr logger.Logger, req RegisterDonsRequest) (*RegisterDonsRes donInfos, err := registry.GetDONs(&bind.CallOpts{}) if err != nil { - err = DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call GetDONs: %w", err) } existingDONs := make(map[string]struct{}) @@ -860,7 +853,7 @@ func RegisterDons(lggr logger.Logger, req RegisterDonsRequest) (*RegisterDonsRes tx, err := registry.AddDON(registryChain.DeployerKey, p2pIds, cfgs, true, wfSupported, don.F) if err != nil { - err = DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call AddDON for don '%s' p2p2Id hash %s capability %v: %w", don.Name, p2pSortedHash, cfgs, err) } _, err = registryChain.Confirm(tx) @@ -887,7 +880,7 @@ func RegisterDons(lggr logger.Logger, req RegisterDonsRequest) (*RegisterDonsRes } } if err != nil { - err = DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call GetDONs: %w", err) } if !foundAll { @@ -943,13 +936,13 @@ func configureForwarder(lggr logger.Logger, chain deployment.Chain, contractSet } tx, err := fwdr.SetConfig(txOpts, dn.Info.Id, ver, dn.Info.F, signers) if err != nil { - err = DecodeErr(kf.KeystoneForwarderABI, err) + err = deployment.DecodeErr(kf.KeystoneForwarderABI, err) return nil, fmt.Errorf("failed to call SetConfig for forwarder %s on chain %d: %w", fwdr.Address().String(), chain.Selector, err) } if !useMCMS { _, err = chain.Confirm(tx) if err != nil { - err = DecodeErr(kf.KeystoneForwarderABI, err) + err = deployment.DecodeErr(kf.KeystoneForwarderABI, err) return nil, fmt.Errorf("failed to confirm SetConfig for forwarder %s: %w", fwdr.Address().String(), err) } } else { diff --git a/deployment/keystone/forwarder_deployer.go b/deployment/keystone/changeset/internal/forwarder_deployer.go similarity index 99% rename from deployment/keystone/forwarder_deployer.go rename to deployment/keystone/changeset/internal/forwarder_deployer.go index 33ff61eb834..2ce3ae88146 100644 --- a/deployment/keystone/forwarder_deployer.go +++ b/deployment/keystone/changeset/internal/forwarder_deployer.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "fmt" diff --git a/deployment/keystone/ocr3_deployer.go b/deployment/keystone/changeset/internal/ocr3_deployer.go similarity index 98% rename from deployment/keystone/ocr3_deployer.go rename to deployment/keystone/changeset/internal/ocr3_deployer.go index fae05cbfbcd..beafe9bb9e2 100644 --- a/deployment/keystone/ocr3_deployer.go +++ b/deployment/keystone/changeset/internal/ocr3_deployer.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "fmt" diff --git a/deployment/keystone/ocr3config.go b/deployment/keystone/changeset/internal/ocr3config.go similarity index 98% rename from deployment/keystone/ocr3config.go rename to deployment/keystone/changeset/internal/ocr3config.go index b23eaf8c462..74f8a9dabd5 100644 --- a/deployment/keystone/ocr3config.go +++ b/deployment/keystone/changeset/internal/ocr3config.go @@ -1,6 +1,6 @@ // TODO: KS-458 copied from https://github.com/smartcontractkit/chainlink/blob/65924811dc53a211613927c814d7f04fd85439a4/core/scripts/keystone/src/88_gen_ocr3_config.go#L1 // to unblock go mod issues when trying to import the scripts package -package keystone +package internal import ( "crypto/ed25519" @@ -327,15 +327,15 @@ func configureOCR3contract(req configureOCR3Request) (*configureOCR3Response, er ocrConfig.OffchainConfig, ) if err != nil { - err = DecodeErr(kocr3.OCR3CapabilityABI, err) - return nil, fmt.Errorf("failed to call SetConfig for OCR3 contract %s using mcms: %t: %w", req.contract.Address().String(), req.useMCMS, err) + err = deployment.DecodeErr(kocr3.OCR3CapabilityABI, err) + return nil, fmt.Errorf("failed to call SetConfig for OCR3 contract %s using mcms: %T: %w", req.contract.Address().String(), req.useMCMS, err) } var ops *timelock.BatchChainOperation if !req.useMCMS { _, err = req.chain.Confirm(tx) if err != nil { - err = DecodeErr(kocr3.OCR3CapabilityABI, err) + err = deployment.DecodeErr(kocr3.OCR3CapabilityABI, err) return nil, fmt.Errorf("failed to confirm SetConfig for OCR3 contract %s: %w", req.contract.Address().String(), err) } } else { diff --git a/deployment/keystone/ocr3config_test.go b/deployment/keystone/changeset/internal/ocr3config_test.go similarity index 99% rename from deployment/keystone/ocr3config_test.go rename to deployment/keystone/changeset/internal/ocr3config_test.go index 55fa16af68c..b412a727eb9 100644 --- a/deployment/keystone/ocr3config_test.go +++ b/deployment/keystone/changeset/internal/ocr3config_test.go @@ -1,6 +1,6 @@ // TODO: KS-458 copied from https://github.com/smartcontractkit/chainlink/blob/65924811dc53a211613927c814d7f04fd85439a4/core/scripts/keystone/src/88_gen_ocr3_config.go#L1 // to unblock go mod issues when trying to import the scripts package -package keystone +package internal import ( "encoding/json" diff --git a/deployment/keystone/state.go b/deployment/keystone/changeset/internal/state.go similarity index 99% rename from deployment/keystone/state.go rename to deployment/keystone/changeset/internal/state.go index 85259bdc342..d0817069d9a 100644 --- a/deployment/keystone/state.go +++ b/deployment/keystone/changeset/internal/state.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "fmt" diff --git a/deployment/keystone/changeset/internal/test/utils.go b/deployment/keystone/changeset/internal/test/utils.go index a0cad0039e8..cc7e3b27160 100644 --- a/deployment/keystone/changeset/internal/test/utils.go +++ b/deployment/keystone/changeset/internal/test/utils.go @@ -17,45 +17,11 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/environment/memory" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" - kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" - workflow_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/workflow/generated/workflow_registry_wrapper" + capabilities_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" ) -type SetupTestWorkflowRegistryResponse struct { - Registry *workflow_registry.WorkflowRegistry - Chain deployment.Chain - RegistrySelector uint64 - AddressBook deployment.AddressBook -} - -func SetupTestWorkflowRegistry(t *testing.T, lggr logger.Logger, chainSel uint64) *SetupTestWorkflowRegistryResponse { - chain := testChain(t) - - deployer, err := kslib.NewWorkflowRegistryDeployer() - require.NoError(t, err) - resp, err := deployer.Deploy(kslib.DeployRequest{Chain: chain}) - require.NoError(t, err) - - addressBook := deployment.NewMemoryAddressBookFromMap( - map[uint64]map[string]deployment.TypeAndVersion{ - chainSel: map[string]deployment.TypeAndVersion{ - resp.Address.Hex(): resp.Tv, - }, - }, - ) - - return &SetupTestWorkflowRegistryResponse{ - Registry: deployer.Contract(), - Chain: chain, - RegistrySelector: chain.Selector, - AddressBook: addressBook, - } -} - type Don struct { Name string P2PIDs []p2pkey.PeerID @@ -63,17 +29,17 @@ type Don struct { } type SetupTestRegistryRequest struct { - P2pToCapabilities map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability - NopToNodes map[kcr.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc + P2pToCapabilities map[p2pkey.PeerID][]capabilities_registry.CapabilitiesRegistryCapability + NopToNodes map[capabilities_registry.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc Dons []Don // TODO maybe add support for MCMS at this level } type SetupTestRegistryResponse struct { - Registry *kcr.CapabilitiesRegistry + Registry *capabilities_registry.CapabilitiesRegistry Chain deployment.Chain RegistrySelector uint64 - ContractSet *kslib.ContractSet + ContractSet *internal.ContractSet } func SetupTestRegistry(t *testing.T, lggr logger.Logger, req *SetupTestRegistryRequest) *SetupTestRegistryResponse { @@ -81,7 +47,7 @@ func SetupTestRegistry(t *testing.T, lggr logger.Logger, req *SetupTestRegistryR // deploy the registry registry := deployCapReg(t, chain) // convert req to nodeoperators - nops := make([]kcr.CapabilitiesRegistryNodeOperator, 0) + nops := make([]capabilities_registry.CapabilitiesRegistryNodeOperator, 0) for nop := range req.NopToNodes { nops = append(nops, nop) } @@ -93,19 +59,19 @@ func SetupTestRegistry(t *testing.T, lggr logger.Logger, req *SetupTestRegistryR // add capabilities to registry capCache := NewCapabiltyCache(t) - var capabilities []kcr.CapabilitiesRegistryCapability + var capabilities []capabilities_registry.CapabilitiesRegistryCapability for _, caps := range req.P2pToCapabilities { capabilities = append(capabilities, caps...) } registeredCapabilities := capCache.AddCapabilities(lggr, chain, registry, capabilities) - expectedDeduped := make(map[kcr.CapabilitiesRegistryCapability]struct{}) + expectedDeduped := make(map[capabilities_registry.CapabilitiesRegistryCapability]struct{}) for _, cap := range capabilities { expectedDeduped[cap] = struct{}{} } require.Len(t, registeredCapabilities, len(expectedDeduped)) // make the nodes and register node - var nodeParams []kcr.CapabilitiesRegistryNodeParams + var nodeParams []capabilities_registry.CapabilitiesRegistryNodeParams initialp2pToCapabilities := make(map[p2pkey.PeerID][][32]byte) for p2pID := range req.P2pToCapabilities { initialp2pToCapabilities[p2pID] = mustCapabilityIds(t, registry, registeredCapabilities) @@ -116,7 +82,7 @@ func SetupTestRegistry(t *testing.T, lggr logger.Logger, req *SetupTestRegistryR require.Fail(t, "missing nopToNodes for %s", nop.Name) } for _, p2pSignerEnc := range req.NopToNodes[nop] { - nodeParams = append(nodeParams, kcr.CapabilitiesRegistryNodeParams{ + nodeParams = append(nodeParams, capabilities_registry.CapabilitiesRegistryNodeParams{ Signer: p2pSignerEnc.Signer, P2pId: p2pSignerEnc.P2PKey, EncryptionPublicKey: p2pSignerEnc.EncryptionPublicKey, @@ -134,21 +100,21 @@ func SetupTestRegistry(t *testing.T, lggr logger.Logger, req *SetupTestRegistryR Registry: registry, Chain: chain, RegistrySelector: chain.Selector, - ContractSet: &kslib.ContractSet{ + ContractSet: &internal.ContractSet{ CapabilitiesRegistry: registry, }, } } -func deployCapReg(t *testing.T, chain deployment.Chain) *kcr.CapabilitiesRegistry { - capabilitiesRegistryDeployer, err := kslib.NewCapabilitiesRegistryDeployer() +func deployCapReg(t *testing.T, chain deployment.Chain) *capabilities_registry.CapabilitiesRegistry { + capabilitiesRegistryDeployer, err := internal.NewCapabilitiesRegistryDeployer() require.NoError(t, err) - _, err = capabilitiesRegistryDeployer.Deploy(kslib.DeployRequest{Chain: chain}) + _, err = capabilitiesRegistryDeployer.Deploy(internal.DeployRequest{Chain: chain}) require.NoError(t, err) return capabilitiesRegistryDeployer.Contract() } -func addNops(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *kcr.CapabilitiesRegistry, nops []kcr.CapabilitiesRegistryNodeOperator) *kslib.RegisterNOPSResponse { +func addNops(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *capabilities_registry.CapabilitiesRegistry, nops []capabilities_registry.CapabilitiesRegistryNodeOperator) *internal.RegisterNOPSResponse { env := &deployment.Environment{ Logger: lggr, Chains: map[uint64]deployment.Chain{ @@ -157,13 +123,13 @@ func addNops(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry ExistingAddresses: deployment.NewMemoryAddressBookFromMap(map[uint64]map[string]deployment.TypeAndVersion{ chain.Selector: { registry.Address().String(): deployment.TypeAndVersion{ - Type: kslib.CapabilitiesRegistry, + Type: internal.CapabilitiesRegistry, Version: deployment.Version1_0_0, }, }, }), } - resp, err := kslib.RegisterNOPS(context.TODO(), lggr, kslib.RegisterNOPSRequest{ + resp, err := internal.RegisterNOPS(context.TODO(), lggr, internal.RegisterNOPSRequest{ Env: env, RegistryChainSelector: chain.Selector, Nops: nops, @@ -172,23 +138,23 @@ func addNops(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry return resp } -func addNodes(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *kcr.CapabilitiesRegistry, nodes []kcr.CapabilitiesRegistryNodeParams) { +func addNodes(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *capabilities_registry.CapabilitiesRegistry, nodes []capabilities_registry.CapabilitiesRegistryNodeParams) { tx, err := registry.AddNodes(chain.DeployerKey, nodes) if err != nil { - err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err2 := deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddNodes: %s: %s", err, err2)) } _, err = chain.Confirm(tx) require.NoError(t, err) } -func addDons(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *kcr.CapabilitiesRegistry, capCache *CapabilityCache, dons []Don) { +func addDons(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry *capabilities_registry.CapabilitiesRegistry, capCache *CapabilityCache, dons []Don) { for _, don := range dons { acceptsWorkflows := false // lookup the capabilities - var capConfigs []kcr.CapabilitiesRegistryCapabilityConfiguration + var capConfigs []capabilities_registry.CapabilitiesRegistryCapabilityConfiguration for _, ccfg := range don.CapabilityConfigs { - var cc = kcr.CapabilitiesRegistryCapabilityConfiguration{ + var cc = capabilities_registry.CapabilitiesRegistryCapabilityConfiguration{ CapabilityId: [32]byte{}, Config: ccfg.Config, } @@ -208,7 +174,7 @@ func addDons(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry f := len(don.P2PIDs)/3 + 1 tx, err := registry.AddDON(chain.DeployerKey, internal.PeerIDsToBytes(don.P2PIDs), capConfigs, isPublic, acceptsWorkflows, uint8(f)) if err != nil { - err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err2 := deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddDON: %s: %s", err, err2)) } _, err = chain.Confirm(tx) @@ -216,7 +182,7 @@ func addDons(t *testing.T, lggr logger.Logger, chain deployment.Chain, registry } } -func defaultCapConfig(t *testing.T, cap kcr.CapabilitiesRegistryCapability) []byte { +func defaultCapConfig(t *testing.T, cap capabilities_registry.CapabilitiesRegistryCapability) []byte { empty := &capabilitiespb.CapabilityConfig{ DefaultConfig: values.Proto(values.EmptyMap()).GetMapValue(), } @@ -237,24 +203,24 @@ func NewCapabiltyCache(t *testing.T) *CapabilityCache { nameToId: make(map[string][32]byte), } } -func (cc *CapabilityCache) Get(cap kcr.CapabilitiesRegistryCapability) ([32]byte, bool) { - id, exists := cc.nameToId[kslib.CapabilityID(cap)] +func (cc *CapabilityCache) Get(cap capabilities_registry.CapabilitiesRegistryCapability) ([32]byte, bool) { + id, exists := cc.nameToId[internal.CapabilityID(cap)] return id, exists } // AddCapabilities adds the capabilities to the registry and returns the registered capabilities // if the capability is already registered, it will not be re-registered // if duplicate capabilities are passed, they will be deduped -func (cc *CapabilityCache) AddCapabilities(lggr logger.Logger, chain deployment.Chain, registry *kcr.CapabilitiesRegistry, capabilities []kcr.CapabilitiesRegistryCapability) []kslib.RegisteredCapability { +func (cc *CapabilityCache) AddCapabilities(lggr logger.Logger, chain deployment.Chain, registry *capabilities_registry.CapabilitiesRegistry, capabilities []capabilities_registry.CapabilitiesRegistryCapability) []internal.RegisteredCapability { t := cc.t - var out []kslib.RegisteredCapability + var out []internal.RegisteredCapability // get the registered capabilities & dedup - seen := make(map[kcr.CapabilitiesRegistryCapability]struct{}) - var toRegister []kcr.CapabilitiesRegistryCapability + seen := make(map[capabilities_registry.CapabilitiesRegistryCapability]struct{}) + var toRegister []capabilities_registry.CapabilitiesRegistryCapability for _, cap := range capabilities { - id, cached := cc.nameToId[kslib.CapabilityID(cap)] + id, cached := cc.nameToId[internal.CapabilityID(cap)] if cached { - out = append(out, kslib.RegisteredCapability{ + out = append(out, internal.RegisteredCapability{ CapabilitiesRegistryCapability: cap, ID: id, }) @@ -271,7 +237,7 @@ func (cc *CapabilityCache) AddCapabilities(lggr logger.Logger, chain deployment. } tx, err := registry.AddCapabilities(chain.DeployerKey, toRegister) if err != nil { - err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err2 := deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddCapabilities: %s: %s", err, err2)) } _, err = chain.Confirm(tx) @@ -282,12 +248,12 @@ func (cc *CapabilityCache) AddCapabilities(lggr logger.Logger, chain deployment. capb := capb id, err := registry.GetHashedCapabilityId(&bind.CallOpts{}, capb.LabelledName, capb.Version) require.NoError(t, err) - out = append(out, kslib.RegisteredCapability{ + out = append(out, internal.RegisteredCapability{ CapabilitiesRegistryCapability: capb, ID: id, }) // cache the id - cc.nameToId[kslib.CapabilityID(capb)] = id + cc.nameToId[internal.CapabilityID(capb)] = id } return out } @@ -303,7 +269,7 @@ func testChain(t *testing.T) deployment.Chain { return chain } -func capabilityIds(registry *capabilities_registry.CapabilitiesRegistry, rcs []kslib.RegisteredCapability) ([][32]byte, error) { +func capabilityIds(registry *capabilities_registry.CapabilitiesRegistry, rcs []internal.RegisteredCapability) ([][32]byte, error) { out := make([][32]byte, len(rcs)) for i := range rcs { id, err := registry.GetHashedCapabilityId(&bind.CallOpts{}, rcs[i].LabelledName, rcs[i].Version) @@ -315,7 +281,7 @@ func capabilityIds(registry *capabilities_registry.CapabilitiesRegistry, rcs []k return out, nil } -func mustCapabilityIds(t *testing.T, registry *capabilities_registry.CapabilitiesRegistry, rcs []kslib.RegisteredCapability) [][32]byte { +func mustCapabilityIds(t *testing.T, registry *capabilities_registry.CapabilitiesRegistry, rcs []internal.RegisteredCapability) [][32]byte { t.Helper() out, err := capabilityIds(registry, rcs) require.NoError(t, err) diff --git a/deployment/keystone/testdata/testnet_wf_view.json b/deployment/keystone/changeset/internal/testdata/testnet_wf_view.json similarity index 100% rename from deployment/keystone/testdata/testnet_wf_view.json rename to deployment/keystone/changeset/internal/testdata/testnet_wf_view.json diff --git a/deployment/keystone/types.go b/deployment/keystone/changeset/internal/types.go similarity index 99% rename from deployment/keystone/types.go rename to deployment/keystone/changeset/internal/types.go index e12cf935d3d..173e3ba1ad0 100644 --- a/deployment/keystone/types.go +++ b/deployment/keystone/changeset/internal/types.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "errors" diff --git a/deployment/keystone/types_test.go b/deployment/keystone/changeset/internal/types_test.go similarity index 99% rename from deployment/keystone/types_test.go rename to deployment/keystone/changeset/internal/types_test.go index ea122837aa6..cfc953d6126 100644 --- a/deployment/keystone/types_test.go +++ b/deployment/keystone/changeset/internal/types_test.go @@ -1,4 +1,4 @@ -package keystone +package internal import ( "encoding/hex" diff --git a/deployment/keystone/changeset/internal/update_don.go b/deployment/keystone/changeset/internal/update_don.go index fd9288c7426..3cfc386b2ba 100644 --- a/deployment/keystone/changeset/internal/update_don.go +++ b/deployment/keystone/changeset/internal/update_don.go @@ -18,8 +18,6 @@ import ( "google.golang.org/protobuf/proto" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" - - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" ) // CapabilityConfig is a struct that holds a capability and its configuration @@ -30,7 +28,7 @@ type CapabilityConfig struct { type UpdateDonRequest struct { Chain deployment.Chain - ContractSet *kslib.ContractSet // contract set for the given chain + ContractSet *ContractSet // contract set for the given chain P2PIDs []p2pkey.PeerID // this is the unique identifier for the don CapabilityConfigs []CapabilityConfig // if Config subfield is nil, a default config is used @@ -97,7 +95,7 @@ func UpdateDon(lggr logger.Logger, req *UpdateDonRequest) (*UpdateDonResponse, e } tx, err := registry.UpdateDON(txOpts, don.Id, don.NodeP2PIds, cfgs, don.IsPublic, don.F) if err != nil { - err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call UpdateDON: %w", err) } var ops *timelock.BatchChainOperation @@ -150,7 +148,7 @@ func computeConfigs(registry *kcr.CapabilitiesRegistry, caps []CapabilityConfig, } out[i].CapabilityId = id if out[i].Config == nil { - c := kslib.DefaultCapConfig(cap.Capability.CapabilityType, int(donInfo.F)) + c := DefaultCapConfig(cap.Capability.CapabilityType, int(donInfo.F)) cb, err := proto.Marshal(c) if err != nil { return nil, fmt.Errorf("failed to marshal capability config for %v: %w", c, err) diff --git a/deployment/keystone/changeset/internal/update_don_test.go b/deployment/keystone/changeset/internal/update_don_test.go index f4b5fd46fc7..57b15138538 100644 --- a/deployment/keystone/changeset/internal/update_don_test.go +++ b/deployment/keystone/changeset/internal/update_don_test.go @@ -13,8 +13,6 @@ import ( chainsel "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" - "github.com/smartcontractkit/chainlink/deployment/keystone" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" kscs "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" kstest "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal/test" @@ -100,14 +98,14 @@ func TestUpdateDon(t *testing.T) { t.Run("empty", func(t *testing.T) { cfg := setupUpdateDonTestConfig{ - dons: []kslib.DonInfo{ + dons: []internal.DonInfo{ { Name: "don 1", Nodes: []deployment.Node{node_1, node_2, node_3, node_4}, Capabilities: []kcr.CapabilitiesRegistryCapability{initialCap}, }, }, - nops: []keystone.NOP{ + nops: []internal.NOP{ { Name: "nop 1", Nodes: []string{node_1.NodeID, node_2.NodeID, node_3.NodeID, node_4.NodeID}, @@ -223,8 +221,8 @@ func newNode(t *testing.T, cfg minimalNodeCfg) deployment.Node { } type setupUpdateDonTestConfig struct { - dons []kslib.DonInfo - nops []keystone.NOP + dons []internal.DonInfo + nops []internal.NOP } type setupUpdateDonTestResult struct { @@ -239,7 +237,7 @@ func registerTestDon(t *testing.T, lggr logger.Logger, cfg setupUpdateDonTestCon } -func newSetupTestRegistryRequest(t *testing.T, dons []kslib.DonInfo, nops []keystone.NOP) *kstest.SetupTestRegistryRequest { +func newSetupTestRegistryRequest(t *testing.T, dons []internal.DonInfo, nops []internal.NOP) *kstest.SetupTestRegistryRequest { t.Helper() nodes := make(map[string]deployment.Node) for _, don := range dons { @@ -258,7 +256,7 @@ func newSetupTestRegistryRequest(t *testing.T, dons []kslib.DonInfo, nops []keys return req } -func makeNopToNodes(t *testing.T, nops []keystone.NOP, nodes map[string]deployment.Node) map[kcr.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc { +func makeNopToNodes(t *testing.T, nops []internal.NOP, nodes map[string]deployment.Node) map[kcr.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc { nopToNodes := make(map[kcr.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc) for _, nop := range nops { @@ -282,7 +280,7 @@ func makeNopToNodes(t *testing.T, nops []keystone.NOP, nodes map[string]deployme return nopToNodes } -func makeP2PToCapabilities(t *testing.T, dons []kslib.DonInfo) map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability { +func makeP2PToCapabilities(t *testing.T, dons []internal.DonInfo) map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability { p2pToCapabilities := make(map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability) for _, don := range dons { for _, node := range don.Nodes { @@ -296,7 +294,7 @@ func makeP2PToCapabilities(t *testing.T, dons []kslib.DonInfo) map[p2pkey.PeerID return p2pToCapabilities } -func makeTestDon(t *testing.T, dons []kslib.DonInfo) []kstest.Don { +func makeTestDon(t *testing.T, dons []internal.DonInfo) []kstest.Don { out := make([]kstest.Don, len(dons)) for i, don := range dons { out[i] = testDon(t, don) @@ -304,7 +302,7 @@ func makeTestDon(t *testing.T, dons []kslib.DonInfo) []kstest.Don { return out } -func testDon(t *testing.T, don kslib.DonInfo) kstest.Don { +func testDon(t *testing.T, don internal.DonInfo) kstest.Don { var p2pids []p2pkey.PeerID for _, node := range don.Nodes { // all chain configs are the same wrt admin address & node keys diff --git a/deployment/keystone/changeset/internal/update_node_capabilities.go b/deployment/keystone/changeset/internal/update_node_capabilities.go index fba8e78f7ab..16c37267060 100644 --- a/deployment/keystone/changeset/internal/update_node_capabilities.go +++ b/deployment/keystone/changeset/internal/update_node_capabilities.go @@ -5,14 +5,13 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" ) type UpdateNodeCapabilitiesImplRequest struct { Chain deployment.Chain - ContractSet *kslib.ContractSet + ContractSet *ContractSet P2pToCapabilities map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability UseMCMS bool @@ -38,7 +37,7 @@ func UpdateNodeCapabilitiesImpl(lggr logger.Logger, req *UpdateNodeCapabilitiesI for _, cap := range req.P2pToCapabilities { capabilities = append(capabilities, cap...) } - op, err := kslib.AddCapabilities(lggr, req.ContractSet, req.Chain, capabilities, req.UseMCMS) + op, err := AddCapabilities(lggr, req.ContractSet, req.Chain, capabilities, req.UseMCMS) if err != nil { return nil, fmt.Errorf("failed to add capabilities: %w", err) } diff --git a/deployment/keystone/changeset/internal/update_node_capabilities_test.go b/deployment/keystone/changeset/internal/update_node_capabilities_test.go index 804fc32e537..65da264dd01 100644 --- a/deployment/keystone/changeset/internal/update_node_capabilities_test.go +++ b/deployment/keystone/changeset/internal/update_node_capabilities_test.go @@ -8,7 +8,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" kstest "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal/test" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" @@ -25,9 +25,9 @@ func TestUpdateNodeCapabilities(t *testing.T) { }, }, } - nopToNodes = map[kcr.CapabilitiesRegistryNodeOperator][]*kslib.P2PSignerEnc{ - testNop(t, "testNop"): []*kslib.P2PSignerEnc{ - &kslib.P2PSignerEnc{ + nopToNodes = map[kcr.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc{ + testNop(t, "testNop"): []*internal.P2PSignerEnc{ + &internal.P2PSignerEnc{ Signer: [32]byte{0: 1}, P2PKey: testPeerID(t, "0x1"), EncryptionPublicKey: [32]byte{3: 16, 4: 2}, @@ -40,7 +40,7 @@ func TestUpdateNodeCapabilities(t *testing.T) { type args struct { lggr logger.Logger - req *kslib.UpdateNodeCapabilitiesImplRequest // chain and registry are set in the test setup + req *internal.UpdateNodeCapabilitiesImplRequest // chain and registry are set in the test setup initialState *kstest.SetupTestRegistryRequest } tests := []struct { @@ -53,7 +53,7 @@ func TestUpdateNodeCapabilities(t *testing.T) { name: "invalid request", args: args{ lggr: lggr, - req: &kslib.UpdateNodeCapabilitiesImplRequest{ + req: &internal.UpdateNodeCapabilitiesImplRequest{ Chain: deployment.Chain{}, }, initialState: &kstest.SetupTestRegistryRequest{}, @@ -68,7 +68,7 @@ func TestUpdateNodeCapabilities(t *testing.T) { P2pToCapabilities: initialp2pToCapabilities, NopToNodes: nopToNodes, }, - req: &kslib.UpdateNodeCapabilitiesImplRequest{ + req: &internal.UpdateNodeCapabilitiesImplRequest{ P2pToCapabilities: map[p2pkey.PeerID][]kcr.CapabilitiesRegistryCapability{ testPeerID(t, "0x1"): []kcr.CapabilitiesRegistryCapability{ { @@ -95,7 +95,7 @@ func TestUpdateNodeCapabilities(t *testing.T) { tt.args.req.Chain = setupResp.Chain tt.args.req.ContractSet = setupResp.ContractSet - got, err := kslib.UpdateNodeCapabilitiesImpl(tt.args.lggr, tt.args.req) + got, err := internal.UpdateNodeCapabilitiesImpl(tt.args.lggr, tt.args.req) if (err != nil) != tt.wantErr { t.Errorf("UpdateNodeCapabilities() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/deployment/keystone/changeset/internal/update_nodes.go b/deployment/keystone/changeset/internal/update_nodes.go index e483c5ddf87..b27c17ad19f 100644 --- a/deployment/keystone/changeset/internal/update_nodes.go +++ b/deployment/keystone/changeset/internal/update_nodes.go @@ -17,7 +17,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" ) type NodeUpdate struct { @@ -30,7 +29,7 @@ type NodeUpdate struct { type UpdateNodesRequest struct { Chain deployment.Chain - ContractSet *kslib.ContractSet // contract set for the given chain + ContractSet *ContractSet // contract set for the given chain P2pToUpdates map[p2pkey.PeerID]NodeUpdate @@ -60,7 +59,7 @@ func (req *UpdateNodesRequest) Validate() error { for peer, updates := range req.P2pToUpdates { seen := make(map[string]struct{}) for _, cap := range updates.Capabilities { - id := kslib.CapabilityID(cap) + id := CapabilityID(cap) if _, exists := seen[id]; exists { return fmt.Errorf("duplicate capability %s for %s", id, peer) } @@ -103,7 +102,7 @@ func UpdateNodes(lggr logger.Logger, req *UpdateNodesRequest) (*UpdateNodesRespo params, err := req.NodeParams() if err != nil { - err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to make node params: %w", err) } txOpts := req.Chain.DeployerKey @@ -113,7 +112,7 @@ func UpdateNodes(lggr logger.Logger, req *UpdateNodesRequest) (*UpdateNodesRespo registry := req.ContractSet.CapabilitiesRegistry tx, err := registry.UpdateNodes(txOpts, params) if err != nil { - err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to call UpdateNodes: %w", err) } @@ -183,8 +182,8 @@ func AppendCapabilities(lggr logger.Logger, registry *kcr.CapabilitiesRegistry, var deduped []kcr.CapabilitiesRegistryCapability seen := make(map[string]struct{}) for _, cap := range mergedCaps { - if _, ok := seen[kslib.CapabilityID(cap)]; !ok { - seen[kslib.CapabilityID(cap)] = struct{}{} + if _, ok := seen[CapabilityID(cap)]; !ok { + seen[CapabilityID(cap)] = struct{}{} deduped = append(deduped, cap) } } @@ -204,7 +203,7 @@ func makeNodeParams(registry *kcr.CapabilitiesRegistry, nodes, err := registry.GetNodesByP2PIds(&bind.CallOpts{}, PeerIDsToBytes(p2pIds)) if err != nil { - err = kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err = deployment.DecodeErr(kcr.CapabilitiesRegistryABI, err) return nil, fmt.Errorf("failed to get nodes by p2p ids: %w", err) } for _, node := range nodes { @@ -261,11 +260,11 @@ func makeNodeParams(registry *kcr.CapabilitiesRegistry, } -// fetchkslib.CapabilityIDs fetches the capability ids for the given capabilities +// fetchCapabilityIDs fetches the capability ids for the given capabilities func fetchCapabilityIDs(registry *kcr.CapabilitiesRegistry, caps []kcr.CapabilitiesRegistryCapability) (map[string][32]byte, error) { out := make(map[string][32]byte) for _, cap := range caps { - name := kslib.CapabilityID(cap) + name := CapabilityID(cap) if _, exists := out[name]; exists { continue } diff --git a/deployment/keystone/changeset/internal/update_nodes_test.go b/deployment/keystone/changeset/internal/update_nodes_test.go index a0810225762..0f22120998a 100644 --- a/deployment/keystone/changeset/internal/update_nodes_test.go +++ b/deployment/keystone/changeset/internal/update_nodes_test.go @@ -16,7 +16,6 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" kstest "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal/test" @@ -30,7 +29,7 @@ func Test_UpdateNodesRequest_validate(t *testing.T) { p2pToUpdates map[p2pkey.PeerID]internal.NodeUpdate nopToNodes map[kcr.CapabilitiesRegistryNodeOperator][]*internal.P2PSignerEnc chain deployment.Chain - contractSet *kslib.ContractSet + contractSet *internal.ContractSet } tests := []struct { name string @@ -465,14 +464,14 @@ func TestUpdateNodes(t *testing.T) { require.NoError(t, err) // register the capabilities that the Update will use - expectedUpdatedCaps := make(map[p2pkey.PeerID][]kslib.RegisteredCapability) + expectedUpdatedCaps := make(map[p2pkey.PeerID][]internal.RegisteredCapability) capCache := kstest.NewCapabiltyCache(t) for p2p, update := range tt.args.req.P2pToUpdates { if len(update.Capabilities) > 0 { expectedCaps := capCache.AddCapabilities(tt.args.lggr, tt.args.req.Chain, registry, update.Capabilities) expectedUpdatedCaps[p2p] = expectedCaps } else { - expectedUpdatedCaps[p2p] = []kslib.RegisteredCapability{ + expectedUpdatedCaps[p2p] = []internal.RegisteredCapability{ {CapabilitiesRegistryCapability: phonyCap, ID: id}, } } @@ -564,7 +563,7 @@ func TestUpdateNodes(t *testing.T) { toRegister := p2pToCapabilitiesUpdated[testPeerID(t, "peerID_1")] tx, err := registry.AddCapabilities(chain.DeployerKey, toRegister) if err != nil { - err2 := kslib.DecodeErr(kcr.CapabilitiesRegistryABI, err) + err2 := deployment.DecodeErr(kcr.CapabilitiesRegistryABI, err) require.Fail(t, fmt.Sprintf("failed to call AddCapabilities: %s: %s", err, err2)) } _, err = chain.Confirm(tx) @@ -654,7 +653,7 @@ func TestAppendCapabilities(t *testing.T) { wantCaps = append(wantCaps, newCaps...) for i, got := range gotCaps { - assert.Equal(t, kslib.CapabilityID(wantCaps[i]), kslib.CapabilityID(got)) + assert.Equal(t, internal.CapabilityID(wantCaps[i]), internal.CapabilityID(got)) } // trying to append an existing capability should not change the result diff --git a/deployment/keystone/changeset/test/helpers.go b/deployment/keystone/changeset/test/helpers.go index 94a65920cf5..5ddaeda524e 100644 --- a/deployment/keystone/changeset/test/helpers.go +++ b/deployment/keystone/changeset/test/helpers.go @@ -22,9 +22,8 @@ import ( "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" commontypes "github.com/smartcontractkit/chainlink/deployment/common/types" "github.com/smartcontractkit/chainlink/deployment/environment/memory" - "github.com/smartcontractkit/chainlink/deployment/keystone" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" kschangeset "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/workflowregistry" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" @@ -81,8 +80,8 @@ type TestEnv struct { AssetNodes map[string]memory.Node } -func (te TestEnv) ContractSets() map[uint64]kslib.ContractSet { - r, err := kslib.GetContractSets(te.Env.Logger, &kslib.GetContractSetsRequest{ +func (te TestEnv) ContractSets() map[uint64]internal.ContractSet { + r, err := internal.GetContractSets(te.Env.Logger, &internal.GetContractSetsRequest{ Chains: te.Env.Chains, AddressBook: te.Env.ExistingAddresses, }) @@ -118,7 +117,7 @@ func SetupTestEnv(t *testing.T, c TestConfig) TestEnv { }, { Changeset: commonchangeset.WrapChangeSet(kschangeset.DeployForwarder), - Config: registryChainSel, + Config: kschangeset.DeployForwarderRequest{}, }, { Changeset: commonchangeset.WrapChangeSet(workflowregistry.Deploy), @@ -153,35 +152,35 @@ func SetupTestEnv(t *testing.T, c TestConfig) TestEnv { // TODO: partition nodes into multiple nops - wfDon := keystone.DonCapabilities{ - Name: keystone.WFDonName, - Nops: []keystone.NOP{ + wfDon := internal.DonCapabilities{ + Name: internal.WFDonName, + Nops: []internal.NOP{ { Name: "nop 1", Nodes: maps.Keys(wfNodes), }, }, - Capabilities: []kcr.CapabilitiesRegistryCapability{keystone.OCR3Cap}, + Capabilities: []kcr.CapabilitiesRegistryCapability{internal.OCR3Cap}, } - cwDon := keystone.DonCapabilities{ - Name: keystone.TargetDonName, - Nops: []keystone.NOP{ + cwDon := internal.DonCapabilities{ + Name: internal.TargetDonName, + Nops: []internal.NOP{ { Name: "nop 2", Nodes: maps.Keys(cwNodes), }, }, - Capabilities: []kcr.CapabilitiesRegistryCapability{keystone.WriteChainCap}, + Capabilities: []kcr.CapabilitiesRegistryCapability{internal.WriteChainCap}, } - assetDon := keystone.DonCapabilities{ - Name: keystone.StreamDonName, - Nops: []keystone.NOP{ + assetDon := internal.DonCapabilities{ + Name: internal.StreamDonName, + Nops: []internal.NOP{ { Name: "nop 3", Nodes: maps.Keys(assetNodes), }, }, - Capabilities: []kcr.CapabilitiesRegistryCapability{keystone.StreamTriggerCap}, + Capabilities: []kcr.CapabilitiesRegistryCapability{internal.StreamTriggerCap}, } allChains := make(map[uint64]deployment.Chain) @@ -196,10 +195,10 @@ func SetupTestEnv(t *testing.T, c TestConfig) TestEnv { err = env.ExistingAddresses.Merge(e.ExistingAddresses) require.NoError(t, err) - var ocr3Config = keystone.OracleConfig{ + var ocr3Config = internal.OracleConfig{ MaxFaultyOracles: len(wfNodes) / 3, } - var allDons = []keystone.DonCapabilities{wfDon, cwDon, assetDon} + var allDons = []internal.DonCapabilities{wfDon, cwDon, assetDon} csOut, err := kschangeset.ConfigureInitialContractsChangeset(env, kschangeset.InitialContractsCfg{ RegistryChainSel: registryChainSel, @@ -209,12 +208,12 @@ func SetupTestEnv(t *testing.T, c TestConfig) TestEnv { require.NoError(t, err) require.Nil(t, csOut.AddressBook, "no new addresses should be created in configure initial contracts") - req := &keystone.GetContractSetsRequest{ + req := &internal.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, } - contractSetsResp, err := keystone.GetContractSets(lggr, req) + contractSetsResp, err := internal.GetContractSets(lggr, req) require.NoError(t, err) require.Len(t, contractSetsResp.ContractSets, len(env.Chains)) // check the registry @@ -249,7 +248,7 @@ func SetupTestEnv(t *testing.T, c TestConfig) TestEnv { }) require.NoError(t, err) // extract the MCMS address - r, err := kslib.GetContractSets(lggr, &kslib.GetContractSetsRequest{ + r, err := internal.GetContractSets(lggr, &internal.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) @@ -311,7 +310,7 @@ func validateInitialChainState(t *testing.T, env deployment.Environment, registr } containsForwarder := false for _, tv := range chainAddrs { - if tv.Type == keystone.KeystoneForwarder { + if tv.Type == internal.KeystoneForwarder { containsForwarder = true break } @@ -331,7 +330,7 @@ func validateNodes(t *testing.T, gotRegistry *kcr.CapabilitiesRegistry, nodes ma } // validateDon checks that the don exists and has the expected capabilities -func validateDon(t *testing.T, gotRegistry *kcr.CapabilitiesRegistry, nodes map[string]memory.Node, don kslib.DonCapabilities) { +func validateDon(t *testing.T, gotRegistry *kcr.CapabilitiesRegistry, nodes map[string]memory.Node, don internal.DonCapabilities) { gotDons, err := gotRegistry.GetDONs(nil) require.NoError(t, err) wantP2PID := sortedHash(p2pIDs(t, maps.Keys(nodes))) @@ -370,7 +369,7 @@ func p2pIDs(t *testing.T, vals []string) [][32]byte { return out } -func expectedHashedCapabilities(t *testing.T, registry *kcr.CapabilitiesRegistry, don kslib.DonCapabilities) [][32]byte { +func expectedHashedCapabilities(t *testing.T, registry *kcr.CapabilitiesRegistry, don internal.DonCapabilities) [][32]byte { out := make([][32]byte, len(don.Capabilities)) var err error for i, cap := range don.Capabilities { diff --git a/deployment/keystone/changeset/update_don.go b/deployment/keystone/changeset/update_don.go index fd1312448ef..5b381a4e498 100644 --- a/deployment/keystone/changeset/update_don.go +++ b/deployment/keystone/changeset/update_don.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" @@ -100,7 +99,7 @@ func appendRequest(r *UpdateDonRequest) *AppendNodeCapabilitiesRequest { } func updateDonRequest(env deployment.Environment, r *UpdateDonRequest) (*internal.UpdateDonRequest, error) { - resp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + resp, err := internal.GetContractSets(env.Logger, &internal.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/update_node_capabilities.go b/deployment/keystone/changeset/update_node_capabilities.go index c386228b4a2..8c4d01159ed 100644 --- a/deployment/keystone/changeset/update_node_capabilities.go +++ b/deployment/keystone/changeset/update_node_capabilities.go @@ -11,7 +11,6 @@ import ( "github.com/smartcontractkit/ccip-owner-contracts/pkg/proposal/timelock" "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" kcr "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" @@ -84,7 +83,7 @@ func (req *MutateNodeCapabilitiesRequest) updateNodeCapabilitiesImplRequest(e de if !ok { return nil, fmt.Errorf("registry chain selector %d does not exist in environment", req.RegistryChainSel) } - resp, err := kslib.GetContractSets(e.Logger, &kslib.GetContractSetsRequest{ + resp, err := internal.GetContractSets(e.Logger, &internal.GetContractSetsRequest{ Chains: map[uint64]deployment.Chain{req.RegistryChainSel: registryChain}, AddressBook: e.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/update_nodes.go b/deployment/keystone/changeset/update_nodes.go index bb12f32cb94..10a7ad4e441 100644 --- a/deployment/keystone/changeset/update_nodes.go +++ b/deployment/keystone/changeset/update_nodes.go @@ -10,7 +10,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/p2pkey" ) @@ -50,7 +49,7 @@ func UpdateNodes(env deployment.Environment, req *UpdateNodesRequest) (deploymen if !ok { return deployment.ChangesetOutput{}, fmt.Errorf("registry chain selector %d does not exist in environment", req.RegistryChainSel) } - cresp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + cresp, err := internal.GetContractSets(env.Logger, &internal.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/view.go b/deployment/keystone/changeset/view.go index 417484ed6aa..9c8678d8778 100644 --- a/deployment/keystone/changeset/view.go +++ b/deployment/keystone/changeset/view.go @@ -8,14 +8,14 @@ import ( "github.com/smartcontractkit/chainlink/deployment" commonview "github.com/smartcontractkit/chainlink/deployment/common/view" - "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal" "github.com/smartcontractkit/chainlink/deployment/keystone/view" ) var _ deployment.ViewState = ViewKeystone func ViewKeystone(e deployment.Environment) (json.Marshaler, error) { - state, err := keystone.GetContractSets(e.Logger, &keystone.GetContractSetsRequest{ + state, err := internal.GetContractSets(e.Logger, &internal.GetContractSetsRequest{ Chains: e.Chains, AddressBook: e.ExistingAddresses, }) diff --git a/deployment/keystone/changeset/view_test.go b/deployment/keystone/changeset/view_test.go index 023b4462549..5b32699fd89 100644 --- a/deployment/keystone/changeset/view_test.go +++ b/deployment/keystone/changeset/view_test.go @@ -26,7 +26,7 @@ func TestKeystoneView(t *testing.T) { require.NoError(t, err) require.NotNil(t, resp) require.NoError(t, env.ExistingAddresses.Merge(resp.AddressBook)) - resp, err = DeployForwarder(env, registryChain) + resp, err = DeployForwarder(env, DeployForwarderRequest{}) require.NoError(t, err) require.NotNil(t, resp) require.NoError(t, env.ExistingAddresses.Merge(resp.AddressBook)) diff --git a/deployment/keystone/changeset/workflowregistry/deploy.go b/deployment/keystone/changeset/workflowregistry/deploy.go index 352336dd168..e55484aa711 100644 --- a/deployment/keystone/changeset/workflowregistry/deploy.go +++ b/deployment/keystone/changeset/workflowregistry/deploy.go @@ -4,7 +4,6 @@ import ( "fmt" "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" ) var _ deployment.ChangeSet[uint64] = Deploy @@ -16,7 +15,7 @@ func Deploy(env deployment.Environment, registrySelector uint64) (deployment.Cha return deployment.ChangesetOutput{}, fmt.Errorf("chain not found in environment") } ab := deployment.NewMemoryAddressBook() - wrResp, err := kslib.DeployWorkflowRegistry(chain, ab) + wrResp, err := deployWorkflowRegistry(chain, ab) if err != nil { return deployment.ChangesetOutput{}, fmt.Errorf("failed to deploy CapabilitiesRegistry: %w", err) } diff --git a/deployment/keystone/changeset/workflowregistry/setup_test.go b/deployment/keystone/changeset/workflowregistry/setup_test.go new file mode 100644 index 00000000000..78e7d852080 --- /dev/null +++ b/deployment/keystone/changeset/workflowregistry/setup_test.go @@ -0,0 +1,54 @@ +package workflowregistry + +import ( + "testing" + + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/environment/memory" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" + workflow_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/workflow/generated/workflow_registry_wrapper" + "github.com/stretchr/testify/require" +) + +type SetupTestWorkflowRegistryResponse struct { + Registry *workflow_registry.WorkflowRegistry + Chain deployment.Chain + RegistrySelector uint64 + AddressBook deployment.AddressBook +} + +func SetupTestWorkflowRegistry(t *testing.T, lggr logger.Logger, chainSel uint64) *SetupTestWorkflowRegistryResponse { + chain := testChain(t) + + deployer, err := newWorkflowRegistryDeployer() + require.NoError(t, err) + resp, err := deployer.Deploy(changeset.DeployRequest{Chain: chain}) + require.NoError(t, err) + + addressBook := deployment.NewMemoryAddressBookFromMap( + map[uint64]map[string]deployment.TypeAndVersion{ + chainSel: map[string]deployment.TypeAndVersion{ + resp.Address.Hex(): resp.Tv, + }, + }, + ) + + return &SetupTestWorkflowRegistryResponse{ + Registry: deployer.Contract(), + Chain: chain, + RegistrySelector: chain.Selector, + AddressBook: addressBook, + } +} + +func testChain(t *testing.T) deployment.Chain { + chains, _ := memory.NewMemoryChains(t, 1, 5) + var chain deployment.Chain + for _, c := range chains { + chain = c + break + } + require.NotEmpty(t, chain) + return chain +} diff --git a/deployment/keystone/changeset/workflowregistry/strategies.go b/deployment/keystone/changeset/workflowregistry/strategies.go index f799092d4ce..617d6e6e8dc 100644 --- a/deployment/keystone/changeset/workflowregistry/strategies.go +++ b/deployment/keystone/changeset/workflowregistry/strategies.go @@ -13,7 +13,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" ) @@ -40,7 +39,7 @@ type mcmsTransaction struct { Description string Address common.Address ChainSel uint64 - ContractSet *kslib.ContractSet + ContractSet *changeset.ContractSet } func (m *mcmsTransaction) Apply(callFn func(opts *bind.TransactOpts) (*types.Transaction, error)) (deployment.ChangesetOutput, error) { diff --git a/deployment/keystone/changeset/workflowregistry/update_allowed_dons.go b/deployment/keystone/changeset/workflowregistry/update_allowed_dons.go index b07414221dd..5001370b552 100644 --- a/deployment/keystone/changeset/workflowregistry/update_allowed_dons.go +++ b/deployment/keystone/changeset/workflowregistry/update_allowed_dons.go @@ -9,7 +9,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" workflow_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/workflow/generated/workflow_registry_wrapper" ) @@ -37,7 +36,7 @@ func UpdateAllowedDons(env deployment.Environment, req *UpdateAllowedDonsRequest return deployment.ChangesetOutput{}, err } - resp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + resp, err := changeset.GetContractSets(env.Logger, &changeset.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) @@ -74,7 +73,7 @@ func UpdateAllowedDons(env deployment.Environment, req *UpdateAllowedDonsRequest return s.Apply(func(opts *bind.TransactOpts) (*types.Transaction, error) { tx, err := registry.UpdateAllowedDONs(opts, req.DonIDs, req.Allowed) if err != nil { - err = kslib.DecodeErr(workflow_registry.WorkflowRegistryABI, err) + err = deployment.DecodeErr(workflow_registry.WorkflowRegistryABI, err) } return tx, err }) diff --git a/deployment/keystone/changeset/workflowregistry/update_allowed_dons_test.go b/deployment/keystone/changeset/workflowregistry/update_allowed_dons_test.go index bb17a85b1aa..f24db609553 100644 --- a/deployment/keystone/changeset/workflowregistry/update_allowed_dons_test.go +++ b/deployment/keystone/changeset/workflowregistry/update_allowed_dons_test.go @@ -15,7 +15,6 @@ import ( commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" - kstest "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal/test" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/test" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/workflowregistry" ) @@ -24,7 +23,7 @@ func TestUpdateAllowedDons(t *testing.T) { lggr := logger.Test(t) chainSel := chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector - resp := kstest.SetupTestWorkflowRegistry(t, lggr, chainSel) + resp := workflowregistry.SetupTestWorkflowRegistry(t, lggr, chainSel) registry := resp.Registry dons, err := registry.GetAllAllowedDONs(&bind.CallOpts{}) diff --git a/deployment/keystone/changeset/workflowregistry/update_authorized_addresses.go b/deployment/keystone/changeset/workflowregistry/update_authorized_addresses.go index f05c6cd58c9..b2d5ffcce1e 100644 --- a/deployment/keystone/changeset/workflowregistry/update_authorized_addresses.go +++ b/deployment/keystone/changeset/workflowregistry/update_authorized_addresses.go @@ -10,7 +10,6 @@ import ( "github.com/smartcontractkit/chainlink/deployment" - kslib "github.com/smartcontractkit/chainlink/deployment/keystone" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" workflow_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/workflow/generated/workflow_registry_wrapper" ) @@ -35,7 +34,7 @@ func (r *UpdateAuthorizedAddressesRequest) Validate() error { } func getWorkflowRegistry(env deployment.Environment, chainSel uint64) (*workflow_registry.WorkflowRegistry, error) { - resp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + resp, err := changeset.GetContractSets(env.Logger, &changeset.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) @@ -57,7 +56,7 @@ func UpdateAuthorizedAddresses(env deployment.Environment, req *UpdateAuthorized return deployment.ChangesetOutput{}, err } - resp, err := kslib.GetContractSets(env.Logger, &kslib.GetContractSetsRequest{ + resp, err := changeset.GetContractSets(env.Logger, &changeset.GetContractSetsRequest{ Chains: env.Chains, AddressBook: env.ExistingAddresses, }) @@ -99,7 +98,7 @@ func UpdateAuthorizedAddresses(env deployment.Environment, req *UpdateAuthorized return s.Apply(func(opts *bind.TransactOpts) (*types.Transaction, error) { tx, err := registry.UpdateAuthorizedAddresses(opts, addr, req.Allowed) if err != nil { - err = kslib.DecodeErr(workflow_registry.WorkflowRegistryABI, err) + err = deployment.DecodeErr(workflow_registry.WorkflowRegistryABI, err) } return tx, err }) diff --git a/deployment/keystone/changeset/workflowregistry/update_authorized_addresses_test.go b/deployment/keystone/changeset/workflowregistry/update_authorized_addresses_test.go index 36dfd4371b1..a8d969fce0c 100644 --- a/deployment/keystone/changeset/workflowregistry/update_authorized_addresses_test.go +++ b/deployment/keystone/changeset/workflowregistry/update_authorized_addresses_test.go @@ -16,7 +16,6 @@ import ( commonchangeset "github.com/smartcontractkit/chainlink/deployment/common/changeset" "github.com/smartcontractkit/chainlink/deployment/common/proposalutils" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" - kstest "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/internal/test" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/test" "github.com/smartcontractkit/chainlink/deployment/keystone/changeset/workflowregistry" ) @@ -25,7 +24,7 @@ func TestUpdateAuthorizedAddresses(t *testing.T) { lggr := logger.Test(t) chainSel := chain_selectors.ETHEREUM_TESTNET_SEPOLIA.Selector - resp := kstest.SetupTestWorkflowRegistry(t, lggr, chainSel) + resp := workflowregistry.SetupTestWorkflowRegistry(t, lggr, chainSel) registry := resp.Registry dons, err := registry.GetAllAuthorizedAddresses(&bind.CallOpts{}) diff --git a/deployment/keystone/workflow_registry_deployer.go b/deployment/keystone/changeset/workflowregistry/workflow_registry_deployer.go similarity index 50% rename from deployment/keystone/workflow_registry_deployer.go rename to deployment/keystone/changeset/workflowregistry/workflow_registry_deployer.go index 794e6ad0202..ac5bbd16cc8 100644 --- a/deployment/keystone/workflow_registry_deployer.go +++ b/deployment/keystone/changeset/workflowregistry/workflow_registry_deployer.go @@ -1,4 +1,4 @@ -package keystone +package workflowregistry import ( "fmt" @@ -8,38 +8,34 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" workflow_registry "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/workflow/generated/workflow_registry_wrapper" ) -type WorkflowRegistryDeployer struct { +type workflowRegistryDeployer struct { lggr logger.Logger contract *workflow_registry.WorkflowRegistry } -func NewWorkflowRegistryDeployer() (*WorkflowRegistryDeployer, error) { +func newWorkflowRegistryDeployer() (*workflowRegistryDeployer, error) { lggr, err := logger.New() if err != nil { return nil, err } - return &WorkflowRegistryDeployer{lggr: lggr}, nil + return &workflowRegistryDeployer{lggr: lggr}, nil } -func (c *WorkflowRegistryDeployer) Contract() *workflow_registry.WorkflowRegistry { +func (c *workflowRegistryDeployer) Contract() *workflow_registry.WorkflowRegistry { return c.contract } -func (c *WorkflowRegistryDeployer) Deploy(req DeployRequest) (*DeployResponse, error) { - est, err := estimateDeploymentGas(req.Chain.Client, workflow_registry.WorkflowRegistryABI) - if err != nil { - return nil, fmt.Errorf("failed to estimate gas: %w", err) - } - c.lggr.Debugf("WorkflowRegistry estimated gas: %d", est) +func (c *workflowRegistryDeployer) Deploy(req changeset.DeployRequest) (*changeset.DeployResponse, error) { addr, tx, wr, err := workflow_registry.DeployWorkflowRegistry( req.Chain.DeployerKey, req.Chain.Client) if err != nil { - return nil, DecodeErr(workflow_registry.WorkflowRegistryABI, err) + return nil, deployment.DecodeErr(workflow_registry.WorkflowRegistryABI, err) } _, err = req.Chain.Confirm(tx) @@ -55,7 +51,7 @@ func (c *WorkflowRegistryDeployer) Deploy(req DeployRequest) (*DeployResponse, e if err != nil { return nil, fmt.Errorf("failed to parse type and version from %s: %w", tvStr, err) } - resp := &DeployResponse{ + resp := &changeset.DeployResponse{ Address: addr, Tx: tx.Hash(), Tv: tv, @@ -63,3 +59,18 @@ func (c *WorkflowRegistryDeployer) Deploy(req DeployRequest) (*DeployResponse, e c.contract = wr return resp, nil } + +// deployWorkflowRegistry deploys the WorkflowRegistry contract to the chain +// and saves the address in the address book. This mutates the address book. +func deployWorkflowRegistry(chain deployment.Chain, ab deployment.AddressBook) (*changeset.DeployResponse, error) { + deployer, err := newWorkflowRegistryDeployer() + resp, err := deployer.Deploy(changeset.DeployRequest{Chain: chain}) + if err != nil { + return nil, fmt.Errorf("failed to deploy WorkflowRegistry: %w", err) + } + err = ab.Save(chain.Selector, resp.Address.String(), resp.Tv) + if err != nil { + return nil, fmt.Errorf("failed to save WorkflowRegistry: %w", err) + } + return resp, nil +} diff --git a/deployment/keystone/deprecated.go b/deployment/keystone/deprecated.go new file mode 100644 index 00000000000..0e85cbedb17 --- /dev/null +++ b/deployment/keystone/deprecated.go @@ -0,0 +1,127 @@ +package keystone + +import "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" + +//TODO: delete this after the downstream migration is done + +// DEPRECATED: Use changeset package instead +// OracleConfig is the configuration for an oracle +type OracleConfig = changeset.OracleConfig + +// DEPRECATED: Use changeset package instead +// OCR3OnchainConfig is the onchain configuration of an OCR2 contract +type OCR2OracleConfig = changeset.OCR3OnchainConfig + +// DEPRECATED: Use changeset package instead +// NodeKeys is a set of public keys for a node +type NodeKeys = changeset.NodeKeys + +// DEPRECATED: Use changeset package instead +// TopLevelConfigSource is the top level configuration source +type TopLevelConfigSource = changeset.TopLevelConfigSource + +// DEPRECATED: Use changeset package instead +// GenerateOCR3Config generates an OCR3 config +var GenerateOCR3Config = changeset.GenerateOCR3Config + +// DEPRECATED: Use changeset package instead +// FeedConsumer is a feed consumer contract type +var FeedConsumer = changeset.FeedConsumer + +// DEPRECATED: Use changeset package instead +// KeystoneForwarder is a keystone forwarder contract type +var KeystoneForwarder = changeset.KeystoneForwarder + +// DEPRECATED: Use changeset package instead +// GetContractSetsRequest is a request to get contract sets +type GetContractSetsRequest = changeset.GetContractSetsRequest + +// DEPRECATED: Use changeset package instead +// GetContractSetsResponse is a response to get contract sets +type GetContractSetsResponse = changeset.GetContractSetsResponse + +// DEPRECATED: Use changeset package instead +// GetContractSets gets contract sets +var GetContractSets = changeset.GetContractSets + +// DEPRECATED: Use changeset package instead +// RegisterCapabilitiesRequest is a request to register capabilities +type RegisterCapabilitiesRequest = changeset.RegisterCapabilitiesRequest + +// DEPRECATED: Use changeset package instead +// RegisterCapabilitiesResponse is a response to register capabilities +type RegisterCapabilitiesResponse = changeset.RegisterCapabilitiesResponse + +// DEPRECATED: Use changeset package instead +// RegisterCapabilities registers capabilities +var RegisterCapabilities = changeset.RegisterCapabilities + +// DEPRECATED: Use changeset package instead +// RegisterNOPSRequest is a request to register NOPS +type RegisterNOPSRequest = changeset.RegisterNOPSRequest + +// DEPRECATED: Use changeset package instead +// RegisterNOPSResponse is a response to register NOPS +type RegisterNOPSResponse = changeset.RegisterNOPSResponse + +// DEPRECATED: Use changeset package instead +// RegisterNOPS registers NOPS +var RegisterNOPS = changeset.RegisterNOPS + +// DEPRECATED: Use changeset package instead +// RegisterNodesRequest is a request to register nodes with the capabilities registry +type RegisterNodesRequest = changeset.RegisterNodesRequest + +// DEPRECATED: Use changeset package instead +// RegisterNodesResponse is a response to register nodes with the capabilities registry +type RegisterNodesResponse = changeset.RegisterNodesResponse + +// DEPRECATED: Use changeset package instead +// RegisterNodes registers nodes with the capabilities registry +var RegisterNodes = changeset.RegisterNodes + +// DEPRECATED: Use changeset package instead +// RegisteredCapability is a wrapper of a capability and its ID +type RegisteredCapability = changeset.RegisteredCapability + +// DEPRECATED: Use changeset package instead +// FromCapabilitiesRegistryCapability converts a capabilities registry capability to a registered capability +var FromCapabilitiesRegistryCapability = changeset.FromCapabilitiesRegistryCapability + +// DEPRECATED: Use changeset package instead +// RegisterDonsRequest is a request to register Dons with the capabilities registry +type RegisterDonsRequest = changeset.RegisterDonsRequest + +// DEPRECATED: Use changeset package instead +// RegisterDonsResponse is a response to register Dons with the capabilities registry +type RegisterDonsResponse = changeset.RegisterDonsResponse + +// DEPRECATED: Use changeset package instead +// RegisterDons registers Dons with the capabilities registry +var RegisterDons = changeset.RegisterDons + +// DEPRECATED: Use changeset package instead +// DONToRegister is the minimal information needed to register a DON with the capabilities registry +type DONToRegister = changeset.DONToRegister + +// DEPRECATED: Use changeset package instead +// ConfigureContractsRequest is a request to configure ALL the contracts +type ConfigureContractsRequest = changeset.ConfigureContractsRequest + +// DEPRECATED: Use changeset package instead +// ConfigureContractsResponse is a response to configure ALL the contracts +type ConfigureContractsResponse = changeset.ConfigureContractsResponse + +// DEPRECATED: Use changeset package instead +// DonCapabilities is a set of capabilities hosted by a set of node operators +// in is in a convenient form to handle the CLO representation of the nop data +type DonCapabilities = changeset.DonCapabilities + +// DEPRECATED: Use changeset package instead +type DeployRequest = changeset.DeployRequest + +// DEPRECATED: Use changeset package instead +type DeployResponse = changeset.DeployResponse + +// DEPRECATED: Use changeset package instead +type ContractSet = changeset.ContractSet diff --git a/deployment/keystone/test/changeset/capability_registry.go b/deployment/keystone/test/changeset/capability_registry.go index dad41415510..98f1e752f5a 100644 --- a/deployment/keystone/test/changeset/capability_registry.go +++ b/deployment/keystone/test/changeset/capability_registry.go @@ -7,8 +7,9 @@ import ( chainsel "github.com/smartcontractkit/chain-selectors" "github.com/smartcontractkit/chainlink/deployment" + "github.com/smartcontractkit/chainlink/deployment/common/view/v1_0" - "github.com/smartcontractkit/chainlink/deployment/keystone" + "github.com/smartcontractkit/chainlink/deployment/keystone/changeset" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/keystone/generated/capabilities_registry_1_1_0" ) @@ -33,7 +34,7 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env return nil, fmt.Errorf("failed to deploy contract: %w", err) } - resp, err := keystone.GetContractSets(env.Logger, &keystone.GetContractSetsRequest{ + resp, err := changeset.GetContractSets(env.Logger, &changeset.GetContractSetsRequest{ Chains: env.Chains, AddressBook: changesetOutput.AddressBook, }) @@ -49,13 +50,13 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env nopsParams := v.NopsToNopsParams() tx, err := deployedContract.AddNodeOperators(chain.DeployerKey, nopsParams) - if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { + if _, err = deployment.ConfirmIfNoError(chain, tx, deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add node operators: %w", err) } capabilitiesParams := v.CapabilitiesToCapabilitiesParams() tx, err = deployedContract.AddCapabilities(chain.DeployerKey, capabilitiesParams) - if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { + if _, err = deployment.ConfirmIfNoError(chain, tx, deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add capabilities: %w", err) } @@ -64,7 +65,7 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env return nil, fmt.Errorf("failed to convert nodes to nodes params: %w", err) } tx, err = deployedContract.AddNodes(chain.DeployerKey, nodesParams) - if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { + if _, err = deployment.ConfirmIfNoError(chain, tx, deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add nodes: %w", err) } @@ -78,7 +79,7 @@ func HydrateCapabilityRegistry(t *testing.T, v v1_0.CapabilityRegistryView, env peerIds = append(peerIds, id) } tx, err = deployedContract.AddDON(chain.DeployerKey, peerIds, cfgs, don.IsPublic, don.AcceptsWorkflows, don.F) - if _, err = deployment.ConfirmIfNoError(chain, tx, keystone.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { + if _, err = deployment.ConfirmIfNoError(chain, tx, deployment.DecodeErr(capabilities_registry.CapabilitiesRegistryABI, err)); err != nil { return nil, fmt.Errorf("failed to add don: %w", err) } } From 30b857bf1bcd0c6234716d9aa1bf8f81feb9e956 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Fri, 20 Dec 2024 14:42:29 -0500 Subject: [PATCH 04/19] [TT-1834] Adds Splunk Flakeguard uploads (#15718) * Adds Splunk Flakeguard uploads * Fix data path * Secrets * Proper secrets * Add proper splunk events * Fix JQ * Better debugging for failing calls * Properly format for Splunk events * Fix flakeguard decoding * Compact and debug * Updated go version * Input splunk params * Update event types * Fix typo * Batch splunk sends * Fix if triggers * Use success failure * Revert name change * Fix splunk event --- .github/workflows/ci-core.yml | 5 +++ .github/workflows/flakeguard-nightly.yml | 3 +- .github/workflows/flakeguard-on-demand.yml | 3 +- .github/workflows/flakeguard.yml | 44 +++++++++++++++------- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index 882d40425eb..cf9d525a846 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -561,6 +561,8 @@ jobs: secrets: SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} + FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} trigger-flaky-test-detection-for-deployment-project: name: Flakeguard Deployment Project @@ -580,6 +582,9 @@ jobs: secrets: SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} + FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} + clean: name: Clean Go Tidy & Generate diff --git a/.github/workflows/flakeguard-nightly.yml b/.github/workflows/flakeguard-nightly.yml index 178d43d809a..025cca6d0a0 100644 --- a/.github/workflows/flakeguard-nightly.yml +++ b/.github/workflows/flakeguard-nightly.yml @@ -21,4 +21,5 @@ jobs: secrets: SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} + FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} diff --git a/.github/workflows/flakeguard-on-demand.yml b/.github/workflows/flakeguard-on-demand.yml index 4508da30e6b..f6df40616f7 100644 --- a/.github/workflows/flakeguard-on-demand.yml +++ b/.github/workflows/flakeguard-on-demand.yml @@ -69,4 +69,5 @@ jobs: secrets: SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - \ No newline at end of file + FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} + FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} diff --git a/.github/workflows/flakeguard.yml b/.github/workflows/flakeguard.yml index 3951c356a3b..93f380606b0 100644 --- a/.github/workflows/flakeguard.yml +++ b/.github/workflows/flakeguard.yml @@ -6,6 +6,7 @@ on: repoUrl: required: true type: string + default: 'https://github.com/smartcontractkit/chainlink' description: 'The URL of the repository to compare changes for detecting flaky tests.' projectPath: required: true @@ -54,6 +55,12 @@ on: required: false GH_TOKEN: required: true + FLAKEGUARD_SPLUNK_ENDPOINT: + description: "The Splunk HTTP Event Collector (HEC) endpoint." + required: true + FLAKEGUARD_SPLUNK_HEC: + description: "The Splunk HTTP Event Collector (HEC) token." + required: true env: GIT_BASE_REF: ${{ inputs.baseRef }} @@ -116,14 +123,15 @@ jobs: echo "git_base_sha=" >> $GITHUB_OUTPUT fi - - name: Set up Go 1.21.9 - uses: actions/setup-go@v5.0.2 + - name: Setup Go + uses: ./.github/actions/setup-go with: - cache: false + restore-build-cache-only: "true" - name: Install flakeguard + if: ${{ inputs.runAllTests == false }} shell: bash - run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@ea4ffd8c51ce02efebf5ea6bca503fe10b6cee92 # flakguard@0.1.0 + run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@7c45cff27ac6b0d4244754660661cdbfcfaf2f9e # flakguard@0.1.0 - name: Find new or updated test packages if: ${{ inputs.runAllTests == false }} @@ -282,7 +290,7 @@ jobs: - name: Install flakeguard shell: bash - run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@ea4ffd8c51ce02efebf5ea6bca503fe10b6cee92 # flakguard@0.1.0 + run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@7c45cff27ac6b0d4244754660661cdbfcfaf2f9e # flakguard@0.1.0 - name: Run tests with flakeguard shell: bash @@ -310,6 +318,10 @@ jobs: uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 with: ref: ${{ env.GIT_HEAD_REF }} + - name: Setup Go + uses: ./.github/actions/setup-go + with: + restore-build-cache-only: "true" - name: Set Pretty Project Path id: set_project_path_pretty @@ -329,7 +341,7 @@ jobs: - name: Install flakeguard shell: bash - run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@ea4ffd8c51ce02efebf5ea6bca503fe10b6cee92 # flakguard@0.1.0 + run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/flakeguard@7c45cff27ac6b0d4244754660661cdbfcfaf2f9e # flakguard@0.1.0 - name: Aggregate Flakeguard Results id: results @@ -354,7 +366,11 @@ jobs: --repo-url "${{ inputs.repoUrl }}" \ --base-sha "${{ needs.get-tests.outputs.git_base_sha }}" \ --head-sha "${{ needs.get-tests.outputs.git_head_sha }}" \ - --github-workflow-name "${{ github.workflow }}" + --github-workflow-name "${{ github.workflow }}" \ + --github-workflow-run-url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + --splunk-url "${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }}" \ + --splunk-token "${{ secrets.FLAKEGUARD_SPLUNK_HEC }}" \ + --splunk-event "${{ github.event }}" # Print out the summary file echo -e "\nFlakeguard Summary:" @@ -365,7 +381,7 @@ jobs: echo "summary=$summary" >> $GITHUB_OUTPUT - name: Upload All Test Results as Artifact - if: ${{ fromJSON(steps.results.outputs.summary).total_tests > 0 }} + if: ${{ (success() || failure()) && fromJSON(steps.results.outputs.summary).total_tests > 0 }} uses: actions/upload-artifact@v4.4.3 with: path: ./flakeguard-report/all-test-results.json @@ -373,7 +389,7 @@ jobs: retention-days: 90 - name: Upload Failed Test Results as Artifact - if: ${{ fromJSON(steps.results.outputs.summary).failed_runs > 0 }} + if: ${{ (success() || failure()) && fromJSON(steps.results.outputs.summary).failed_runs > 0 }} uses: actions/upload-artifact@v4.4.3 with: path: ./flakeguard-report/failed-test-results.json @@ -381,7 +397,7 @@ jobs: retention-days: 90 - name: Upload Failed Test Results With Logs as Artifact - if: ${{ fromJSON(steps.results.outputs.summary).failed_runs > 0 }} + if: ${{ (success() || failure()) && fromJSON(steps.results.outputs.summary).failed_runs > 0 }} uses: actions/upload-artifact@v4.4.3 with: path: ./flakeguard-report/failed-test-results-with-logs.json @@ -390,6 +406,7 @@ jobs: - name: Generate Flakeguard Reports shell: bash + if: success() || failure() env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} run: | @@ -432,6 +449,7 @@ jobs: fi - name: Add Github Summary + if: (success() || failure()) run: | FILE_SIZE=$(wc -c < ./flakeguard-report/all-test-summary.md) echo "File size: $FILE_SIZE bytes" @@ -446,7 +464,7 @@ jobs: fi - name: Post comment on PR if flaky tests found - if: ${{ fromJSON(steps.results.outputs.summary).flaky_tests > 0 && github.event_name == 'pull_request' }} + if: ${{ (success() || failure()) && fromJSON(steps.results.outputs.summary).flaky_tests > 0 && github.event_name == 'pull_request' }} uses: actions/github-script@v7 continue-on-error: true with: @@ -463,7 +481,7 @@ jobs: }); - name: Send Slack message for failed tests - if: ${{ inputs.slackNotificationAfterTestsChannelId != '' && fromJSON(steps.results.outputs.summary).flaky_tests > 0 }} + if: ${{ (success() || failure()) && inputs.slackNotificationAfterTestsChannelId != '' && fromJSON(steps.results.outputs.summary).flaky_tests > 0 }} uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0 env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} @@ -516,7 +534,7 @@ jobs: - name: Send general Slack message uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0 - if: ${{ inputs.slackNotificationAfterTestsChannelId != '' && fromJSON(steps.results.outputs.summary).flaky_tests == 0 && fromJSON(steps.results.outputs.summary).total_tests > 0 }} + if: ${{ (success() || failure()) && inputs.slackNotificationAfterTestsChannelId != '' && fromJSON(steps.results.outputs.summary).flaky_tests == 0 && fromJSON(steps.results.outputs.summary).total_tests > 0 }} id: slack env: SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} From 7314c07dfc3035400e14d0ea0be5d00537d68e0c Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 20 Dec 2024 17:13:50 -0500 Subject: [PATCH 05/19] Revert "core/internal/features/ocr2: parallelize subtests; extend timeouts (#14754)" (#15792) This reverts commit ec35d77281f8df4d3021c7c94124cc32a2ac5f92. --- core/capabilities/compute/compute_test.go | 2 -- core/internal/cltest/cltest.go | 6 ++---- core/internal/features/ocr2/features_ocr2_helper.go | 10 +++------- core/internal/features/ocr2/features_ocr2_test.go | 9 +++------ 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/core/capabilities/compute/compute_test.go b/core/capabilities/compute/compute_test.go index 1b1b6e643e8..3e5f501fa61 100644 --- a/core/capabilities/compute/compute_test.go +++ b/core/capabilities/compute/compute_test.go @@ -77,7 +77,6 @@ func setup(t *testing.T, config Config) testHarness { } func TestComputeStartAddsToRegistry(t *testing.T) { - t.Parallel() th := setup(t, defaultConfig) require.NoError(t, th.compute.Start(tests.Context(t))) @@ -110,7 +109,6 @@ func TestComputeExecuteMissingConfig(t *testing.T) { } func TestComputeExecuteMissingBinary(t *testing.T) { - t.Parallel() th := setup(t, defaultConfig) require.NoError(t, th.compute.Start(tests.Context(t))) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index b8b34919b6e..a55c57cc9a2 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -999,7 +999,7 @@ func WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns t.Helper() var pr []pipeline.Run - if !gomega.NewWithT(t).Eventually(func() bool { + gomega.NewWithT(t).Eventually(func() bool { prs, _, err := jo.PipelineRuns(testutils.Context(t), &jobID, 0, 1000) require.NoError(t, err) @@ -1029,9 +1029,7 @@ func WaitForPipeline(t testing.TB, nodeID int, jobID int32, expectedPipelineRuns jobID, len(pr), ), - ) { - t.Fatal() - } + ) return pr } diff --git a/core/internal/features/ocr2/features_ocr2_helper.go b/core/internal/features/ocr2/features_ocr2_helper.go index 76056d7d23d..9287d0df5b1 100644 --- a/core/internal/features/ocr2/features_ocr2_helper.go +++ b/core/internal/features/ocr2/features_ocr2_helper.go @@ -35,7 +35,6 @@ import ( ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config" - "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/services/ocr2/testhelpers" "github.com/smartcontractkit/chainlink/v2/core/services/ocrbootstrap" @@ -202,7 +201,6 @@ func RunTestIntegrationOCR2(t *testing.T) { } { test := test t.Run(test.name, func(t *testing.T) { - t.Parallel() owner, b, ocrContractAddress, ocrContract := SetupOCR2Contracts(t) lggr := logger.TestLogger(t) @@ -558,7 +556,7 @@ updateInterval = "1m" return } // Want at least 2 runs so we see all the metadata. - pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], len(completedRuns)+2, 7, apps[ic].JobORM(), tests.WaitTimeout(t), 5*time.Second) + pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], len(completedRuns)+2, 7, apps[ic].JobORM(), 2*time.Minute, 5*time.Second) jb, err2 := pr[0].Outputs.MarshalJSON() if !assert.NoError(t, err2) { return @@ -570,13 +568,11 @@ updateInterval = "1m" // Trail #1: 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). // Trial #2: 4 oracles reporting 0, 20, 40, 60. Answer should be 40 (results[4/2]). - if !gomega.NewGomegaWithT(t).Eventually(func() string { + gomega.NewGomegaWithT(t).Eventually(func() string { answer, err2 := ocrContract.LatestAnswer(nil) require.NoError(t, err2) return answer.String() - }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal(strconv.Itoa(2 * retVal))) { - t.Fatal() - } + }, 1*time.Minute, 200*time.Millisecond).Should(gomega.Equal(strconv.Itoa(2 * retVal))) for _, app := range apps { jobs, _, err2 := app.JobORM().FindJobs(ctx, 0, 1000) diff --git a/core/internal/features/ocr2/features_ocr2_test.go b/core/internal/features/ocr2/features_ocr2_test.go index a8a8886c50c..01c269d19e3 100644 --- a/core/internal/features/ocr2/features_ocr2_test.go +++ b/core/internal/features/ocr2/features_ocr2_test.go @@ -27,7 +27,6 @@ import ( confighelper2 "github.com/smartcontractkit/libocr/offchainreporting2plus/confighelper" ocrtypes2 "github.com/smartcontractkit/libocr/offchainreporting2plus/types" - "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/bridges" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -225,7 +224,7 @@ updateInterval = "1m" go func() { defer wg.Done() // Want at least 2 runs so we see all the metadata. - pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], 2, 7, apps[ic].JobORM(), tests.WaitTimeout(t), 5*time.Second) + pr := cltest.WaitForPipelineComplete(t, ic, jids[ic], 2, 7, apps[ic].JobORM(), 2*time.Minute, 5*time.Second) jb, err := pr[0].Outputs.MarshalJSON() require.NoError(t, err) assert.Equal(t, []byte(fmt.Sprintf("[\"%d\"]", 10*ic)), jb, "pr[0] %+v pr[1] %+v", pr[0], pr[1]) @@ -235,13 +234,11 @@ updateInterval = "1m" wg.Wait() // 4 oracles reporting 0, 10, 20, 30. Answer should be 20 (results[4/2]). - if !gomega.NewGomegaWithT(t).Eventually(func() string { + gomega.NewGomegaWithT(t).Eventually(func() string { answer, err := ocrContract.LatestAnswer(nil) require.NoError(t, err) return answer.String() - }, tests.WaitTimeout(t), 200*time.Millisecond).Should(gomega.Equal("20")) { - t.Fatal() - } + }, 1*time.Minute, 200*time.Millisecond).Should(gomega.Equal("20")) for _, app := range apps { jobs, _, err := app.JobORM().FindJobs(ctx, 0, 1000) From c1e92afb86595ec1d4610974a1566417fa9ee316 Mon Sep 17 00:00:00 2001 From: Silas Lenihan <32529249+silaslenihan@users.noreply.github.com> Date: Mon, 23 Dec 2024 15:15:19 -0500 Subject: [PATCH 06/19] Fixed flakes and added parallelization to ChainComponents tests (#15537) * Fixed flakes and added parallelization to ChainComponents tests * Refactored test interface to enable parallelization --- .changeset/fresh-lobsters-fly.md | 5 + core/scripts/go.mod | 6 +- core/scripts/go.sum | 20 +- .../relay/evm/chain_components_test.go | 95 ++++++++- .../chain_components_interface_tester.go | 186 +++++------------- .../relay/evm/evmtesting/run_tests.go | 119 +++++------ deployment/go.mod | 4 +- deployment/go.sum | 18 +- go.mod | 4 +- go.sum | 20 +- integration-tests/go.mod | 4 +- integration-tests/go.sum | 18 +- integration-tests/load/go.mod | 4 +- integration-tests/load/go.sum | 18 +- 14 files changed, 282 insertions(+), 239 deletions(-) create mode 100644 .changeset/fresh-lobsters-fly.md diff --git a/.changeset/fresh-lobsters-fly.md b/.changeset/fresh-lobsters-fly.md new file mode 100644 index 00000000000..12b9c317dcb --- /dev/null +++ b/.changeset/fresh-lobsters-fly.md @@ -0,0 +1,5 @@ +--- +"chainlink": minor +--- + +#internal Refactored ChainComponents tests to run in parallel diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 1e230f3da91..bdb57a41c01 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -13,7 +13,7 @@ replace github.com/smartcontractkit/chainlink/deployment => ../../deployment // creating potential merge conflicts. require ( github.com/smartcontractkit/chainlink/deployment v0.0.0-20241206210521-125d98cdaf66 - github.com/smartcontractkit/chainlink/v2 v2.0.0-20241206210521-125d98cdaf66 + github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20241106193309-5560cd76211a ) require ( @@ -33,7 +33,7 @@ require ( github.com/prometheus/client_golang v1.20.5 github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v0.8.1 - github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 + github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 @@ -309,7 +309,7 @@ require ( github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 // indirect github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 // indirect - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 744ad724688..4ecc3609b2d 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -160,6 +160,8 @@ github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.54.19 h1:tyWV+07jagrNiCcGRzRhdtVjQs7Vy41NwsuOcl0IbVI= github.com/aws/aws-sdk-go v1.54.19/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -189,6 +191,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bytecodealliance/wasmtime-go/v23 v23.0.0 h1:NJvU4S8KEk1GnF6+FvlnzMD/8wXTj/mYJSG6Q4yu3Pw= @@ -407,6 +411,8 @@ github.com/gagliardetto/solana-go v1.8.4 h1:vmD/JmTlonyXGy39bAo0inMhmbdAwV7rXZtL github.com/gagliardetto/solana-go v1.8.4/go.mod h1:i+7aAyNDTHG0jK8GZIBSI4OVvDqkt2Qx+LklYclRNG8= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= +github.com/gagliardetto/utilz v0.1.1 h1:/etW4hl607emKg6R6Lj9jRJ9d6ue2AQOyjhuAwjzs1U= +github.com/gagliardetto/utilz v0.1.1/go.mod h1:b+rGFkRHz3HWJD0RYMzat47JyvbTtpE0iEcYTRJTLLA= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ= @@ -668,6 +674,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.16.1 h1:V8TxTnImoPD5cj0U9Spl0TUxcytjcbbJeADFF07KdHg= @@ -917,6 +925,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs= +github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= @@ -1105,6 +1115,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -1150,8 +1162,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 h1:6Zzr/R1j6P7bbvcUlt5WUIbItvrrGdGzIsiAzQezcwo= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 h1:lB5A3TP0zOVuu1n0kEm6d8/o/4Knh6HLvsU/GChk+sI= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 h1:rRs74zjDJ7do5aYEXSU/sOnLnlbYCNqM8BrvEx/0NH8= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e/go.mod h1:mUh5/woemsVaHgTorA080hrYmO3syBCmPdnWc/5dOqk= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 h1:aeiBdBHGY8QNftps+VqrIk6OnfeeOD5z4jrAabW4ZSc= @@ -1162,8 +1174,8 @@ github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 h1:0ewLMbAz3 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2LpSQR9U1gEbRV6PfAkiFdINmQ8nVnXIAQ= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 h1:AIIiwrZ5T4nEjFT33aLZKoXwD63JSMu72wWe/rUdfm0= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3/go.mod h1:ARILnIgKelP0YkVzxXO111S9j0b4uKyt7iLpYjOkCtU= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce h1:Mvpbr/Fi2IdU2EcmqCxhlCzs5ncnx+BwV80YweA4DZs= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce/go.mod h1:qq+nW0JDnCCGMf2c38ZHjH8xgkAQnXKighjJr5JdDNE= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0= github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 h1:T0kbw07Vb6xUyA9MIJZfErMgWseWi1zf7cYvRpoq7ug= diff --git a/core/services/relay/evm/chain_components_test.go b/core/services/relay/evm/chain_components_test.go index 1e8c47c51ec..006236c060a 100644 --- a/core/services/relay/evm/chain_components_test.go +++ b/core/services/relay/evm/chain_components_test.go @@ -9,6 +9,7 @@ import ( "math/big" "os" "strconv" + "sync" "testing" "time" @@ -27,11 +28,11 @@ import ( commontestutils "github.com/smartcontractkit/chainlink-common/pkg/loop/testutils" clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" - "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" htMocks "github.com/smartcontractkit/chainlink/v2/common/headtracker/mocks" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" + "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" lpMocks "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller/mocks" evmtxmgr "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" @@ -50,6 +51,7 @@ import ( ) const commonGasLimitOnEvms = uint64(4712388) +const finalityDepth = 4 func TestContractReaderEventsInitValidation(t *testing.T) { tests := []struct { @@ -228,17 +230,51 @@ func TestChainReader_HealthReport(t *testing.T) { } func TestChainComponents(t *testing.T) { - tests.SkipFlakey(t, "https://smartcontract-it.atlassian.net/browse/BCFR-1083") t.Parallel() - it := &EVMChainComponentsInterfaceTester[*testing.T]{Helper: &helper{}} - // TODO, generated binding tests are broken - it.DisableTests([]string{interfacetests.ContractReaderGetLatestValue}) - it.Init(t) - + // shared helper so all tests can run efficiently in parallel + helper := &helper{} + helper.Init(t) + deployLock := sync.Mutex{} // add new subtests here so that it can be run on real chains too - RunChainComponentsEvmTests(t, it) - RunChainComponentsInLoopEvmTests[*testing.T](t, commontestutils.WrapContractReaderTesterForLoop(it)) - RunChainComponentsInLoopEvmTests(t, WrapContractReaderTesterWithBindings(t, it)) + t.Run("RunChainComponentsEvmTests", func(t *testing.T) { + t.Parallel() + it := &EVMChainComponentsInterfaceTester[*testing.T]{Helper: helper, DeployLock: &deployLock} + // These tests are broken in develop as well, so disable them for now + it.DisableTests([]string{ + interfacetests.ContractReaderQueryKeysReturnsDataTwoEventTypes, + interfacetests.ContractReaderQueryKeysReturnsDataAsValuesDotValue, + interfacetests.ContractReaderQueryKeysCanFilterWithValueComparator, + }) + it.Setup(t) + + RunChainComponentsEvmTests(t, it) + }) + + t.Run("RunChainComponentsInLoopEvmTests", func(t *testing.T) { + t.Parallel() + it := &EVMChainComponentsInterfaceTester[*testing.T]{Helper: helper, DeployLock: &deployLock} + wrapped := commontestutils.WrapContractReaderTesterForLoop(it) + // These tests are broken in develop as well, so disable them for now + wrapped.DisableTests([]string{ + interfacetests.ContractReaderQueryKeysReturnsDataTwoEventTypes, + interfacetests.ContractReaderQueryKeysReturnsDataAsValuesDotValue, + interfacetests.ContractReaderQueryKeysCanFilterWithValueComparator, + }) + wrapped.Setup(t) + + RunChainComponentsInLoopEvmTests[*testing.T](t, wrapped, true) + }) + + t.Run("RunChainComponentsInLoopEvmTestsWithBindings", func(t *testing.T) { + t.Parallel() + it := &EVMChainComponentsInterfaceTester[*testing.T]{Helper: helper, DeployLock: &deployLock} + wrapped := WrapContractReaderTesterWithBindings(t, it) + // TODO, generated binding tests are broken + wrapped.DisableTests([]string{interfacetests.ContractReaderGetLatestValue}) + wrapped.Setup(t) + // generated tests are not compatible with parallel running atm + RunChainComponentsInLoopEvmTests(t, wrapped, false) + }) } type helper struct { @@ -249,6 +285,40 @@ type helper struct { txm evmtxmgr.TxManager client client.Client db *sqlx.DB + lp logpoller.LogPoller + ht logpoller.HeadTracker +} + +func getLPOpts() logpoller.Opts { + return logpoller.Opts{ + PollPeriod: time.Millisecond, + FinalityDepth: finalityDepth, + BackfillBatchSize: 1, + RpcBatchSize: 1, + KeepFinalizedBlocksDepth: 10000, + } +} + +func (h *helper) LogPoller(t *testing.T) logpoller.LogPoller { + if h.lp != nil { + return h.lp + } + ctx := testutils.Context(t) + lggr := logger.NullLogger + db := h.Database() + + h.lp = logpoller.NewLogPoller(logpoller.NewORM(h.ChainID(), db, lggr), h.Client(t), lggr, h.HeadTracker(t), getLPOpts()) + require.NoError(t, h.lp.Start(ctx)) + return h.lp +} + +func (h *helper) HeadTracker(t *testing.T) logpoller.HeadTracker { + if h.ht != nil { + return h.ht + } + lpOpts := getLPOpts() + h.ht = headtracker.NewSimulatedHeadTracker(h.Client(t), lpOpts.UseFinalityTag, lpOpts.FinalityDepth) + return h.ht } func (h *helper) Init(t *testing.T) { @@ -260,6 +330,7 @@ func (h *helper) Init(t *testing.T) { h.Backend() h.client = h.Client(t) + h.LogPoller(t) h.txm = h.TXM(t, h.client) } @@ -320,6 +391,10 @@ func (h *helper) ChainID() *big.Int { return testutils.SimulatedChainID } +func (h *helper) Database() *sqlx.DB { + return h.db +} + func (h *helper) NewSqlxDB(t *testing.T) *sqlx.DB { return pgtest.NewSqlxDB(t) } diff --git a/core/services/relay/evm/evmtesting/chain_components_interface_tester.go b/core/services/relay/evm/evmtesting/chain_components_interface_tester.go index 71bd94f0e9f..642a4350a64 100644 --- a/core/services/relay/evm/evmtesting/chain_components_interface_tester.go +++ b/core/services/relay/evm/evmtesting/chain_components_interface_tester.go @@ -2,8 +2,8 @@ package evmtesting import ( "context" - "encoding/json" "math/big" + "sync" "time" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -15,13 +15,12 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-common/pkg/codec" + "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" clcommontypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/gas" - "github.com/smartcontractkit/chainlink/v2/core/chains/evm/headtracker" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/logpoller" evmtxmgr "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" @@ -40,14 +39,13 @@ const ( triggerWithAllTopics = "TriggeredWithFourTopics" triggerWithAllTopicsWithHashed = "TriggeredWithFourTopicsWithHashed" staticBytesEventName = "StaticBytes" - finalityDepth = 4 ) type EVMChainComponentsInterfaceTesterHelper[T TestingT[T]] interface { - Init(t T) Client(t T) client.Client Commit() Backend() bind.ContractBackend + Database() *sqlx.DB ChainID() *big.Int Context(t T) context.Context NewSqlxDB(t T) *sqlx.DB @@ -58,67 +56,21 @@ type EVMChainComponentsInterfaceTesterHelper[T TestingT[T]] interface { // To enable the historical wrappers required for Simulated Backend tests. ChainReaderEVMClient(ctx context.Context, t T, ht logpoller.HeadTracker, conf types.ChainReaderConfig) client.Client WrappedChainWriter(cw clcommontypes.ContractWriter, client client.Client) clcommontypes.ContractWriter + LogPoller(t T) logpoller.LogPoller + HeadTracker(t T) logpoller.HeadTracker } type EVMChainComponentsInterfaceTester[T TestingT[T]] struct { TestSelectionSupport Helper EVMChainComponentsInterfaceTesterHelper[T] + DeployLock *sync.Mutex client client.Client - address string - address2 string - contractTesters map[string]*chain_reader_tester.ChainReaderTester - chainReaderConfig types.ChainReaderConfig - chainWriterConfig types.ChainWriterConfig - deployerAuth *bind.TransactOpts - senderAuth *bind.TransactOpts - cr evm.ChainReaderService - cw evm.ChainWriterService - dirtyContracts bool - txm evmtxmgr.TxManager - gasEstimator gas.EvmFeeEstimator chainReaderConfigSupplier func(t T) types.ChainReaderConfig chainWriterConfigSupplier func(t T) types.ChainWriterConfig - dirtyConfig bool } -func (it *EVMChainComponentsInterfaceTester[T]) Setup(t T) { - t.Cleanup(func() { - // DB may be closed by the test already, ignore errors - if it.cr != nil { - _ = it.cr.Close() - } - it.cr = nil - - if it.dirtyContracts { - it.contractTesters = nil - } - - if it.cw != nil { - _ = it.cw.Close() - } - it.cw = nil - }) - - // can re-use the same chain for tests, just make new contract for each test - if it.client != nil && !it.dirtyConfig { - it.deployNewContracts(t) - return - } - - // Need to separate accounts to ensure the nonce doesn't get misaligned after the - // contract deployments. - accounts := it.Helper.Accounts(t) - it.deployerAuth = accounts[0] - it.senderAuth = accounts[1] - - it.chainReaderConfig = it.chainReaderConfigSupplier(t) - it.GetContractReader(t) - - it.txm = it.Helper.TXM(t, it.client) - it.chainWriterConfig = it.chainWriterConfigSupplier(t) - - it.deployNewContracts(t) - it.dirtyConfig = false +func (it *EVMChainComponentsInterfaceTester[T]) GetBindings(t T) []clcommontypes.BoundContract { + return it.deployNewContracts(t) } func (it *EVMChainComponentsInterfaceTester[T]) getChainReaderConfig(t T) types.ChainReaderConfig { @@ -357,138 +309,94 @@ func (it *EVMChainComponentsInterfaceTester[T]) GetAccountString(i int) string { func (it *EVMChainComponentsInterfaceTester[T]) GetContractReader(t T) clcommontypes.ContractReader { ctx := it.Helper.Context(t) - if it.cr != nil { - return it.cr - } - lggr := logger.NullLogger - db := it.Helper.NewSqlxDB(t) - lpOpts := logpoller.Opts{ - PollPeriod: time.Millisecond, - FinalityDepth: finalityDepth, - BackfillBatchSize: 1, - RpcBatchSize: 1, - KeepFinalizedBlocksDepth: 10000, - } - ht := headtracker.NewSimulatedHeadTracker(it.Helper.Client(t), lpOpts.UseFinalityTag, lpOpts.FinalityDepth) - lp := logpoller.NewLogPoller(logpoller.NewORM(it.Helper.ChainID(), db, lggr), it.Helper.Client(t), lggr, ht, lpOpts) - require.NoError(t, lp.Start(ctx)) - // encode and decode the config to ensure the test covers type issues - confBytes, err := json.Marshal(it.chainReaderConfig) + cr, err := evm.NewChainReaderService(ctx, lggr, it.Helper.LogPoller(t), it.Helper.HeadTracker(t), it.client, it.chainReaderConfigSupplier(t)) require.NoError(t, err) + servicetest.Run(t, cr) - conf, err := types.ChainReaderConfigFromBytes(confBytes) - require.NoError(t, err) - - cwh := it.Helper.ChainReaderEVMClient(ctx, t, ht, conf) - it.client = cwh - - cr, err := evm.NewChainReaderService(ctx, lggr, lp, ht, it.client, conf) - require.NoError(t, err) - require.NoError(t, cr.Start(ctx)) - it.cr = cr return cr } -// This function is no longer necessary for Simulated Backend or Testnet tests. -func (it *EVMChainComponentsInterfaceTester[T]) GenerateBlocksTillConfidenceLevel(t T, contractName, readName string, confidenceLevel primitives.ConfidenceLevel) { -} - func (it *EVMChainComponentsInterfaceTester[T]) GetContractWriter(t T) clcommontypes.ContractWriter { - ctx := it.Helper.Context(t) - if it.cw != nil { - return it.cw - } - - cw, err := evm.NewChainWriterService(logger.NullLogger, it.client, it.txm, it.gasEstimator, it.chainWriterConfig) + cw, err := evm.NewChainWriterService(logger.NullLogger, it.client, it.Helper.TXM(t, it.client), nil, it.chainWriterConfigSupplier(t)) require.NoError(t, err) - it.cw = it.Helper.WrappedChainWriter(cw, it.client) + + cw = it.Helper.WrappedChainWriter(cw, it.client) require.NoError(t, err) - require.NoError(t, cw.Start(ctx)) - return it.cw + + servicetest.Run(t, cw) + + return cw } -func (it *EVMChainComponentsInterfaceTester[T]) GetBindings(_ T) []clcommontypes.BoundContract { - return []clcommontypes.BoundContract{ - {Name: AnyContractName, Address: it.address}, - {Name: AnySecondContractName, Address: it.address2}, - } +// This function is no longer necessary for Simulated Backend or Testnet tests. +func (it *EVMChainComponentsInterfaceTester[T]) GenerateBlocksTillConfidenceLevel(t T, contractName, readName string, confidenceLevel primitives.ConfidenceLevel) { } func (it *EVMChainComponentsInterfaceTester[T]) DirtyContracts() { - it.dirtyContracts = true } func (it *EVMChainComponentsInterfaceTester[T]) GetAuthWithGasSet(t T) *bind.TransactOpts { - gasPrice, err := it.client.SuggestGasPrice(it.Helper.Context(t)) + auth := *it.Helper.Accounts(t)[0] + gasPrice, err := it.Helper.Client(t).SuggestGasPrice(it.Helper.Context(t)) require.NoError(t, err) extra := new(big.Int).Mul(gasPrice, big.NewInt(it.Helper.GasPriceBufferPercent())) extra = extra.Div(extra, big.NewInt(100)) - it.deployerAuth.GasPrice = gasPrice.Add(gasPrice, extra) - return it.deployerAuth -} - -func (it *EVMChainComponentsInterfaceTester[T]) IncNonce() { - if it.deployerAuth.Nonce == nil { - it.deployerAuth.Nonce = big.NewInt(1) - } else { - it.deployerAuth.Nonce = it.deployerAuth.Nonce.Add(it.deployerAuth.Nonce, big.NewInt(1)) - } + auth.GasPrice = gasPrice.Add(gasPrice, extra) + auth.GasLimit = 10552800 + nonce, err := it.client.PendingNonceAt(it.Helper.Context(t), auth.From) + require.NoError(t, err) + auth.Nonce = new(big.Int).SetUint64(nonce) + return &auth } func (it *EVMChainComponentsInterfaceTester[T]) AwaitTx(t T, tx *gethtypes.Transaction) { ctx := it.Helper.Context(t) - receipt, err := bind.WaitMined(ctx, it.client, tx) + receipt, err := bind.WaitMined(ctx, it.Helper.Client(t), tx) require.NoError(t, err) require.Equal(t, gethtypes.ReceiptStatusSuccessful, receipt.Status) } -func (it *EVMChainComponentsInterfaceTester[T]) deployNewContracts(t T) { - // First test deploy both contracts, otherwise only deploy contracts if cleanup decides that we need to. - if it.address == "" || it.contractTesters == nil { - it.contractTesters = make(map[string]*chain_reader_tester.ChainReaderTester, 2) - address, ts1 := it.deployNewContract(t) - address2, ts2 := it.deployNewContract(t) - it.address, it.address2 = address, address2 - it.contractTesters[it.address] = ts1 - it.contractTesters[it.address2] = ts2 - it.dirtyContracts = false +func (it *EVMChainComponentsInterfaceTester[T]) deployNewContracts(t T) []clcommontypes.BoundContract { + it.DeployLock.Lock() + defer it.DeployLock.Unlock() + address := it.deployNewContract(t) + address2 := it.deployNewContract(t) + return []clcommontypes.BoundContract{ + {Name: AnyContractName, Address: address}, + {Name: AnySecondContractName, Address: address2}, } } -func (it *EVMChainComponentsInterfaceTester[T]) deployNewContract(t T) (string, *chain_reader_tester.ChainReaderTester) { - // 105528 was in the error: gas too low: have 0, want 105528 - // Not sure if there's a better way to get it. - it.deployerAuth.GasLimit = 10552800 - - address, tx, ts, err := chain_reader_tester.DeployChainReaderTester(it.GetAuthWithGasSet(t), it.Helper.Backend()) +func (it *EVMChainComponentsInterfaceTester[T]) deployNewContract(t T) string { + address, tx, _, err := chain_reader_tester.DeployChainReaderTester(it.GetAuthWithGasSet(t), it.Helper.Backend()) require.NoError(t, err) - it.Helper.Commit() - it.IncNonce() it.AwaitTx(t, tx) - return address.String(), ts + return address.String() } func (it *EVMChainComponentsInterfaceTester[T]) MaxWaitTimeForEvents() time.Duration { return it.Helper.MaxWaitTimeForEvents() } -func (it *EVMChainComponentsInterfaceTester[T]) Init(t T) { - it.Helper.Init(t) - it.chainWriterConfigSupplier = func(t T) types.ChainWriterConfig { return it.getChainWriterConfig(t) } - it.chainReaderConfigSupplier = func(t T) types.ChainReaderConfig { return it.getChainReaderConfig(t) } +func (it *EVMChainComponentsInterfaceTester[T]) Setup(t T) { + if it.chainReaderConfigSupplier == nil { + it.chainReaderConfigSupplier = func(t T) types.ChainReaderConfig { return it.getChainReaderConfig(t) } + } + if it.chainWriterConfigSupplier == nil { + it.chainWriterConfigSupplier = func(t T) types.ChainWriterConfig { return it.getChainWriterConfig(t) } + } + it.client = it.Helper.ChainReaderEVMClient(it.Helper.Context(t), t, it.Helper.HeadTracker(t), it.chainReaderConfigSupplier(t)) } func (it *EVMChainComponentsInterfaceTester[T]) SetChainReaderConfigSupplier(chainReaderConfigSupplier func(t T) types.ChainReaderConfig) { - it.dirtyConfig = true it.chainReaderConfigSupplier = chainReaderConfigSupplier } func (it *EVMChainComponentsInterfaceTester[T]) SetChainWriterConfigSupplier(chainWriterConfigSupplier func(t T) types.ChainWriterConfig) { - it.dirtyConfig = true it.chainWriterConfigSupplier = chainWriterConfigSupplier } diff --git a/core/services/relay/evm/evmtesting/run_tests.go b/core/services/relay/evm/evmtesting/run_tests.go index b6abffdcb2f..469cc3594b8 100644 --- a/core/services/relay/evm/evmtesting/run_tests.go +++ b/core/services/relay/evm/evmtesting/run_tests.go @@ -37,31 +37,31 @@ func RunChainComponentsEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterf // Add ChainWriter tests here } -func RunChainComponentsInLoopEvmTests[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T]) { - RunContractReaderInLoopTests[T](t, it) +func RunChainComponentsInLoopEvmTests[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T], parallel bool) { + RunContractReaderInLoopTests[T](t, it, parallel) // Add ChainWriter tests here } func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T]) { - RunContractReaderInterfaceTests[T](t, it, false) + RunContractReaderInterfaceTests[T](t, it, false, true) testCases := []Testcase[T]{ { Name: ContractReaderDynamicTypedTopicsFilterAndCorrectReturn, Test: func(t T) { - it.Setup(t) + cr := it.GetContractReader(t) + cw := it.GetContractWriter(t) + bindings := it.GetBindings(t) anyString := "foo" ctx := it.Helper.Context(t) - cr := it.GetContractReader(t) - bindings := it.GetBindings(t) require.NoError(t, cr.Bind(ctx, bindings)) type DynamicEvent struct { Field string } - SubmitTransactionToCW(t, it, "triggerEventWithDynamicTopic", DynamicEvent{Field: anyString}, bindings[0], types.Unconfirmed) + SubmitTransactionToCW(t, it, cw, "triggerEventWithDynamicTopic", DynamicEvent{Field: anyString}, bindings[0], types.Unconfirmed) input := struct{ Field string }{Field: anyString} tp := cr.(clcommontypes.ContractTypeProvider) @@ -88,17 +88,17 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa { Name: ContractReaderMultipleTopicCanFilterTogether, Test: func(t T) { - it.Setup(t) - ctx := it.Helper.Context(t) cr := it.GetContractReader(t) + cw := it.GetContractWriter(t) bindings := it.GetBindings(t) + ctx := it.Helper.Context(t) require.NoError(t, cr.Bind(ctx, bindings)) - triggerFourTopics(t, it, int32(1), int32(2), int32(3)) - triggerFourTopics(t, it, int32(2), int32(2), int32(3)) - triggerFourTopics(t, it, int32(1), int32(3), int32(3)) - triggerFourTopics(t, it, int32(1), int32(2), int32(4)) + triggerFourTopics(t, it, cw, bindings, int32(1), int32(2), int32(3)) + triggerFourTopics(t, it, cw, bindings, int32(2), int32(2), int32(3)) + triggerFourTopics(t, it, cw, bindings, int32(1), int32(3), int32(3)) + triggerFourTopics(t, it, cw, bindings, int32(1), int32(2), int32(4)) var bound types.BoundContract for idx := range bindings { @@ -121,17 +121,17 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa { Name: ContractReaderFilteringCanBeDoneOnHashedIndexedTopics, Test: func(t T) { - it.Setup(t) - cr := it.GetContractReader(t) - ctx := it.Helper.Context(t) + cw := it.GetContractWriter(t) bindings := it.GetBindings(t) + ctx := it.Helper.Context(t) + require.NoError(t, cr.Bind(ctx, bindings)) - triggerFourTopicsWithHashed(t, it, "1", [32]uint8{2}, [32]byte{5}) - triggerFourTopicsWithHashed(t, it, "2", [32]uint8{2}, [32]byte{3}) - triggerFourTopicsWithHashed(t, it, "1", [32]uint8{3}, [32]byte{3}) + triggerFourTopicsWithHashed(t, it, cw, bindings, "1", [32]uint8{2}, [32]byte{5}) + triggerFourTopicsWithHashed(t, it, cw, bindings, "2", [32]uint8{2}, [32]byte{3}) + triggerFourTopicsWithHashed(t, it, cw, bindings, "1", [32]uint8{3}, [32]byte{3}) var bound types.BoundContract for idx := range bindings { @@ -158,10 +158,9 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa { Name: ContractReaderBindReturnsErrorOnMissingContractAtAddress, Test: func(t T) { - it.Setup(t) + reader := it.GetContractReader(t) addr := common.BigToAddress(big.NewInt(42)) - reader := it.GetContractReader(t) ctx := it.Helper.Context(t) err := reader.Bind(ctx, []clcommontypes.BoundContract{{Name: AnyContractName, Address: addr.Hex()}}) @@ -170,29 +169,29 @@ func RunContractReaderEvmTests[T TestingT[T]](t T, it *EVMChainComponentsInterfa }, }, } - RunTests(t, it, testCases) + RunTestsInParallel(t, it, testCases) } -func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T]) { - RunContractReaderInterfaceTests[T](t, it, false) +func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T], parallel bool) { + RunContractReaderInterfaceTests[T](t, it, false, parallel) testCases := []Testcase[T]{ { Name: ContractReaderQueryKeyFilterOnDataWordsWithValueComparator, Test: func(t T) { - ctx := tests.Context(t) cr := it.GetContractReader(t) - require.NoError(t, cr.Bind(ctx, it.GetBindings(t))) + cw := it.GetContractWriter(t) bindings := it.GetBindings(t) - boundContract := BindingsByName(bindings, AnyContractName)[0] + ctx := tests.Context(t) require.NoError(t, cr.Bind(ctx, bindings)) + boundContract := BindingsByName(bindings, AnyContractName)[0] ts1 := CreateTestStruct[T](0, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts1, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts1, boundContract, types.Unconfirmed) ts2 := CreateTestStruct[T](15, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts2, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts2, boundContract, types.Unconfirmed) ts3 := CreateTestStruct[T](35, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts3, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts3, boundContract, types.Unconfirmed) ts := &TestStruct{} assert.Eventually(t, func() bool { sequences, err := cr.QueryKey(ctx, boundContract, query.KeyFilter{ @@ -211,19 +210,20 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac { Name: ContractReaderQueryKeyOnDataWordsWithValueComparatorOnNestedField, Test: func(t T) { - ctx := tests.Context(t) cr := it.GetContractReader(t) - require.NoError(t, cr.Bind(ctx, it.GetBindings(t))) + cw := it.GetContractWriter(t) bindings := it.GetBindings(t) + ctx := tests.Context(t) + boundContract := BindingsByName(bindings, AnyContractName)[0] require.NoError(t, cr.Bind(ctx, bindings)) ts1 := CreateTestStruct[T](0, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts1, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts1, boundContract, types.Unconfirmed) ts2 := CreateTestStruct[T](15, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts2, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts2, boundContract, types.Unconfirmed) ts3 := CreateTestStruct[T](35, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts3, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts3, boundContract, types.Unconfirmed) ts := &TestStruct{} assert.Eventually(t, func() bool { sequences, err := cr.QueryKey(ctx, boundContract, query.KeyFilter{ @@ -247,19 +247,19 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac { Name: ContractReaderQueryKeyFilterOnDataWordsWithValueComparatorOnDynamicField, Test: func(t T) { - ctx := tests.Context(t) cr := it.GetContractReader(t) - require.NoError(t, cr.Bind(ctx, it.GetBindings(t))) + cw := it.GetContractWriter(t) bindings := it.GetBindings(t) - boundContract := BindingsByName(bindings, AnyContractName)[0] + ctx := tests.Context(t) require.NoError(t, cr.Bind(ctx, bindings)) + boundContract := BindingsByName(bindings, AnyContractName)[0] ts1 := CreateTestStruct[T](0, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts1, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts1, boundContract, types.Unconfirmed) ts2 := CreateTestStruct[T](15, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts2, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts2, boundContract, types.Unconfirmed) ts3 := CreateTestStruct[T](35, it) - _ = SubmitTransactionToCW(t, it, MethodTriggeringEvent, ts3, boundContract, types.Unconfirmed) + _ = SubmitTransactionToCW(t, it, cw, MethodTriggeringEvent, ts3, boundContract, types.Unconfirmed) ts := &TestStruct{} assert.Eventually(t, func() bool { sequences, err := cr.QueryKey(ctx, boundContract, query.KeyFilter{ @@ -283,12 +283,12 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac { Name: ContractReaderQueryKeyFilteringOnDataWordsUsingValueComparatorsOnFieldsWithManualIndex, Test: func(t T) { - ctx := tests.Context(t) cr := it.GetContractReader(t) - require.NoError(t, cr.Bind(ctx, it.GetBindings(t))) + cw := it.GetContractWriter(t) bindings := it.GetBindings(t) - boundContract := BindingsByName(bindings, AnyContractName)[0] + ctx := tests.Context(t) require.NoError(t, cr.Bind(ctx, bindings)) + boundContract := BindingsByName(bindings, AnyContractName)[0] empty12Bytes := [12]byte{} val1, val2, val3, val4 := uint32(1), uint32(2), uint32(3), uint64(4) val5, val6, val7 := [32]byte{}, [32]byte{6}, [32]byte{7} @@ -313,10 +313,10 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac wrapExpectedRes := eventResAsStruct{Message: &resExpected} // emit the one we want to search for and a couple of random ones to confirm that filtering works - triggerStaticBytes(t, it, val1, val2, val3, val4, val5, val6, val7, raw) - triggerStaticBytes(t, it, 1337, 7331, 4747, val4, val5, val6, val7, raw) - triggerStaticBytes(t, it, 7331, 4747, 1337, val4, val5, val6, val7, raw) - triggerStaticBytes(t, it, 4747, 1337, 7331, val4, val5, val6, val7, raw) + triggerStaticBytes(t, it, cw, bindings, val1, val2, val3, val4, val5, val6, val7, raw) + triggerStaticBytes(t, it, cw, bindings, 1337, 7331, 4747, val4, val5, val6, val7, raw) + triggerStaticBytes(t, it, cw, bindings, 7331, 4747, 1337, val4, val5, val6, val7, raw) + triggerStaticBytes(t, it, cw, bindings, 4747, 1337, 7331, val4, val5, val6, val7, raw) assert.Eventually(t, func() bool { sequences, err := cr.QueryKey(ctx, boundContract, query.KeyFilter{ @@ -333,31 +333,33 @@ func RunContractReaderInLoopTests[T TestingT[T]](t T, it ChainComponentsInterfac }, }, } - RunTests(t, it, testCases) + if parallel { + RunTestsInParallel(t, it, testCases) + } else { + RunTests(t, it, testCases) + } } -func triggerFourTopics[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], i1, i2, i3 int32) { +func triggerFourTopics[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], cw clcommontypes.ContractWriter, bindings []clcommontypes.BoundContract, i1, i2, i3 int32) { type DynamicEvent struct { Field1 int32 Field2 int32 Field3 int32 } - contracts := it.GetBindings(t) - SubmitTransactionToCW(t, it, "triggerWithFourTopics", DynamicEvent{Field1: i1, Field2: i2, Field3: i3}, contracts[0], types.Unconfirmed) + SubmitTransactionToCW(t, it, cw, "triggerWithFourTopics", DynamicEvent{Field1: i1, Field2: i2, Field3: i3}, bindings[0], types.Unconfirmed) } -func triggerFourTopicsWithHashed[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], i1 string, i2 [32]uint8, i3 [32]byte) { +func triggerFourTopicsWithHashed[T TestingT[T]](t T, it *EVMChainComponentsInterfaceTester[T], cw clcommontypes.ContractWriter, bindings []clcommontypes.BoundContract, i1 string, i2 [32]uint8, i3 [32]byte) { type DynamicEvent struct { Field1 string Field2 [32]uint8 Field3 [32]byte } - contracts := it.GetBindings(t) - SubmitTransactionToCW(t, it, "triggerWithFourTopicsWithHashed", DynamicEvent{Field1: i1, Field2: i2, Field3: i3}, contracts[0], types.Unconfirmed) + SubmitTransactionToCW(t, it, cw, "triggerWithFourTopicsWithHashed", DynamicEvent{Field1: i1, Field2: i2, Field3: i3}, bindings[0], types.Unconfirmed) } // triggerStaticBytes emits a staticBytes events and returns the expected event bytes. -func triggerStaticBytes[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T], val1, val2, val3 uint32, val4 uint64, val5, val6, val7 [32]byte, raw []byte) { +func triggerStaticBytes[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T], cw clcommontypes.ContractWriter, bindings []clcommontypes.BoundContract, val1, val2, val3 uint32, val4 uint64, val5, val6, val7 [32]byte, raw []byte) { type StaticBytesEvent struct { Val1 uint32 Val2 uint32 @@ -369,8 +371,7 @@ func triggerStaticBytes[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T] Raw []byte } - contracts := it.GetBindings(t) - SubmitTransactionToCW(t, it, "triggerStaticBytes", + SubmitTransactionToCW(t, it, cw, "triggerStaticBytes", StaticBytesEvent{ Val1: val1, Val2: val2, @@ -381,5 +382,5 @@ func triggerStaticBytes[T TestingT[T]](t T, it ChainComponentsInterfaceTester[T] Val7: val7, Raw: raw, }, - contracts[0], types.Unconfirmed) + bindings[0], types.Unconfirmed) } diff --git a/deployment/go.mod b/deployment/go.mod index 9eb3a02d573..25c1284cef1 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -29,7 +29,7 @@ require ( github.com/smartcontractkit/ccip-owner-contracts v0.0.0-salt-fix github.com/smartcontractkit/chain-selectors v1.0.34 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 - github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 + github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 @@ -411,7 +411,7 @@ require ( github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 // indirect github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 // indirect - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.5 // indirect diff --git a/deployment/go.sum b/deployment/go.sum index cc0176b90a8..40532becf5a 100644 --- a/deployment/go.sum +++ b/deployment/go.sum @@ -247,6 +247,8 @@ github.com/aws/jsii-runtime-go v1.104.0 h1:651Sh6J2FtatfnVzlOQ3/Ye1WWPAseZ6E/tSQ github.com/aws/jsii-runtime-go v1.104.0/go.mod h1:7ZmQXxV0AAhhvv/GaHX4n6zbgA1tSRVdnQYAJbIhXHk= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0= @@ -284,6 +286,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bxcodec/faker v2.0.1+incompatible h1:P0KUpUw5w6WJXwrPfv35oc91i4d8nf40Nwln+M/+faA= @@ -543,6 +547,8 @@ github.com/gagliardetto/solana-go v1.8.4 h1:vmD/JmTlonyXGy39bAo0inMhmbdAwV7rXZtL github.com/gagliardetto/solana-go v1.8.4/go.mod h1:i+7aAyNDTHG0jK8GZIBSI4OVvDqkt2Qx+LklYclRNG8= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= +github.com/gagliardetto/utilz v0.1.1 h1:/etW4hl607emKg6R6Lj9jRJ9d6ue2AQOyjhuAwjzs1U= +github.com/gagliardetto/utilz v0.1.1/go.mod h1:b+rGFkRHz3HWJD0RYMzat47JyvbTtpE0iEcYTRJTLLA= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ= @@ -835,6 +841,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.29.2 h1:aYyRn8EdE2mSfG14S1+L9Qkjtz8RzmaWh6AcNGRNwPw= github.com/hashicorp/consul/api v1.29.2/go.mod h1:0YObcaLNDSbtlgzIRtmRXI1ZkeuK0trCBxwZQ4MYnIk= @@ -1362,6 +1370,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -1417,8 +1427,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 h1:6Zzr/R1j6P7bbvcUlt5WUIbItvrrGdGzIsiAzQezcwo= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 h1:lB5A3TP0zOVuu1n0kEm6d8/o/4Knh6HLvsU/GChk+sI= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 h1:rRs74zjDJ7do5aYEXSU/sOnLnlbYCNqM8BrvEx/0NH8= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e/go.mod h1:mUh5/woemsVaHgTorA080hrYmO3syBCmPdnWc/5dOqk= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 h1:aeiBdBHGY8QNftps+VqrIk6OnfeeOD5z4jrAabW4ZSc= @@ -1429,8 +1439,8 @@ github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 h1:0ewLMbAz3 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2LpSQR9U1gEbRV6PfAkiFdINmQ8nVnXIAQ= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 h1:AIIiwrZ5T4nEjFT33aLZKoXwD63JSMu72wWe/rUdfm0= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3/go.mod h1:ARILnIgKelP0YkVzxXO111S9j0b4uKyt7iLpYjOkCtU= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce h1:Mvpbr/Fi2IdU2EcmqCxhlCzs5ncnx+BwV80YweA4DZs= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce/go.mod h1:qq+nW0JDnCCGMf2c38ZHjH8xgkAQnXKighjJr5JdDNE= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0= github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 h1:T0kbw07Vb6xUyA9MIJZfErMgWseWi1zf7cYvRpoq7ug= diff --git a/go.mod b/go.mod index 4bfc5964ff7..06007701a33 100644 --- a/go.mod +++ b/go.mod @@ -79,12 +79,12 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.34 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 - github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 + github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 github.com/smartcontractkit/chainlink-feeds v0.1.1 github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de diff --git a/go.sum b/go.sum index c6f5b4a29e8..94291d9ae9d 100644 --- a/go.sum +++ b/go.sum @@ -167,6 +167,8 @@ github.com/aws/aws-sdk-go v1.22.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.23.20/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.54.19 h1:tyWV+07jagrNiCcGRzRhdtVjQs7Vy41NwsuOcl0IbVI= github.com/aws/aws-sdk-go v1.54.19/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -196,6 +198,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bytecodealliance/wasmtime-go/v23 v23.0.0 h1:NJvU4S8KEk1GnF6+FvlnzMD/8wXTj/mYJSG6Q4yu3Pw= @@ -406,6 +410,8 @@ github.com/gagliardetto/solana-go v1.8.4 h1:vmD/JmTlonyXGy39bAo0inMhmbdAwV7rXZtL github.com/gagliardetto/solana-go v1.8.4/go.mod h1:i+7aAyNDTHG0jK8GZIBSI4OVvDqkt2Qx+LklYclRNG8= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= +github.com/gagliardetto/utilz v0.1.1 h1:/etW4hl607emKg6R6Lj9jRJ9d6ue2AQOyjhuAwjzs1U= +github.com/gagliardetto/utilz v0.1.1/go.mod h1:b+rGFkRHz3HWJD0RYMzat47JyvbTtpE0iEcYTRJTLLA= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ= @@ -654,6 +660,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.16.0 h1:SE9m0W6DEfgIVCJX7xU+iv/hUl4m/nxqMTnCdMxDpJ8= @@ -905,6 +913,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY= github.com/mfridman/interpolate v0.0.2/go.mod h1:p+7uk6oE07mpE/Ik1b8EckO0O4ZXiGAfshKBWLUM9Xg= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.61 h1:nLxbwF3XxhwVSm8g9Dghm9MHPaUZuqhPiGL+675ZmEs= +github.com/miekg/dns v1.1.61/go.mod h1:mnAarhS3nWaW+NVP2wTkYVIZyHNJ098SJZUki3eykwQ= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= @@ -1096,6 +1106,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -1139,8 +1151,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 h1:6Zzr/R1j6P7bbvcUlt5WUIbItvrrGdGzIsiAzQezcwo= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 h1:lB5A3TP0zOVuu1n0kEm6d8/o/4Knh6HLvsU/GChk+sI= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 h1:rRs74zjDJ7do5aYEXSU/sOnLnlbYCNqM8BrvEx/0NH8= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e/go.mod h1:mUh5/woemsVaHgTorA080hrYmO3syBCmPdnWc/5dOqk= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 h1:aeiBdBHGY8QNftps+VqrIk6OnfeeOD5z4jrAabW4ZSc= @@ -1149,8 +1161,8 @@ github.com/smartcontractkit/chainlink-feeds v0.1.1 h1:JzvUOM/OgGQA1sOqTXXl52R6An github.com/smartcontractkit/chainlink-feeds v0.1.1/go.mod h1:55EZ94HlKCfAsUiKUTNI7QlE/3d3IwTlsU3YNa/nBb4= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2LpSQR9U1gEbRV6PfAkiFdINmQ8nVnXIAQ= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 h1:AIIiwrZ5T4nEjFT33aLZKoXwD63JSMu72wWe/rUdfm0= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3/go.mod h1:ARILnIgKelP0YkVzxXO111S9j0b4uKyt7iLpYjOkCtU= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce h1:Mvpbr/Fi2IdU2EcmqCxhlCzs5ncnx+BwV80YweA4DZs= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce/go.mod h1:qq+nW0JDnCCGMf2c38ZHjH8xgkAQnXKighjJr5JdDNE= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 86b89b82582..420e6d03432 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -47,7 +47,7 @@ require ( github.com/smartcontractkit/chain-selectors v1.0.34 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 - github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 + github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.19 @@ -428,7 +428,7 @@ require ( github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 // indirect github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 // indirect - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index b2101edcd73..2e9c9ea678c 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -241,6 +241,8 @@ github.com/aws/jsii-runtime-go v1.104.0 h1:651Sh6J2FtatfnVzlOQ3/Ye1WWPAseZ6E/tSQ github.com/aws/jsii-runtime-go v1.104.0/go.mod h1:7ZmQXxV0AAhhvv/GaHX4n6zbgA1tSRVdnQYAJbIhXHk= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0= @@ -276,6 +278,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bxcodec/faker v2.0.1+incompatible h1:P0KUpUw5w6WJXwrPfv35oc91i4d8nf40Nwln+M/+faA= @@ -545,6 +549,8 @@ github.com/gagliardetto/solana-go v1.8.4 h1:vmD/JmTlonyXGy39bAo0inMhmbdAwV7rXZtL github.com/gagliardetto/solana-go v1.8.4/go.mod h1:i+7aAyNDTHG0jK8GZIBSI4OVvDqkt2Qx+LklYclRNG8= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= +github.com/gagliardetto/utilz v0.1.1 h1:/etW4hl607emKg6R6Lj9jRJ9d6ue2AQOyjhuAwjzs1U= +github.com/gagliardetto/utilz v0.1.1/go.mod h1:b+rGFkRHz3HWJD0RYMzat47JyvbTtpE0iEcYTRJTLLA= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ= @@ -840,6 +846,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.29.2 h1:aYyRn8EdE2mSfG14S1+L9Qkjtz8RzmaWh6AcNGRNwPw= github.com/hashicorp/consul/api v1.29.2/go.mod h1:0YObcaLNDSbtlgzIRtmRXI1ZkeuK0trCBxwZQ4MYnIk= @@ -1379,6 +1387,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -1438,8 +1448,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 h1:6Zzr/R1j6P7bbvcUlt5WUIbItvrrGdGzIsiAzQezcwo= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 h1:lB5A3TP0zOVuu1n0kEm6d8/o/4Knh6HLvsU/GChk+sI= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 h1:rRs74zjDJ7do5aYEXSU/sOnLnlbYCNqM8BrvEx/0NH8= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e/go.mod h1:mUh5/woemsVaHgTorA080hrYmO3syBCmPdnWc/5dOqk= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 h1:aeiBdBHGY8QNftps+VqrIk6OnfeeOD5z4jrAabW4ZSc= @@ -1450,8 +1460,8 @@ github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 h1:0ewLMbAz3 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2LpSQR9U1gEbRV6PfAkiFdINmQ8nVnXIAQ= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 h1:AIIiwrZ5T4nEjFT33aLZKoXwD63JSMu72wWe/rUdfm0= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3/go.mod h1:ARILnIgKelP0YkVzxXO111S9j0b4uKyt7iLpYjOkCtU= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce h1:Mvpbr/Fi2IdU2EcmqCxhlCzs5ncnx+BwV80YweA4DZs= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce/go.mod h1:qq+nW0JDnCCGMf2c38ZHjH8xgkAQnXKighjJr5JdDNE= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0= github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2 h1:GDGrC5OGiV0RyM1znYWehSQXyZQWTOzrEeJRYmysPCE= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 2467d35684b..7713ba8e30a 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -27,7 +27,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.33.0 github.com/slack-go/slack v0.15.0 - github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 + github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.19 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 @@ -412,7 +412,7 @@ require ( github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 // indirect github.com/smartcontractkit/chainlink-feeds v0.1.1 // indirect github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 // indirect - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 // indirect + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 // indirect github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index bb187d252b5..93e6a9dde44 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -245,6 +245,8 @@ github.com/aws/jsii-runtime-go v1.104.0 h1:651Sh6J2FtatfnVzlOQ3/Ye1WWPAseZ6E/tSQ github.com/aws/jsii-runtime-go v1.104.0/go.mod h1:7ZmQXxV0AAhhvv/GaHX4n6zbgA1tSRVdnQYAJbIhXHk= github.com/aws/smithy-go v1.22.0 h1:uunKnWlcoL3zO7q+gG2Pk53joueEOsnNB28QdMsmiMM= github.com/aws/smithy-go v1.22.0/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 h1:WWB576BN5zNSZc/M9d/10pqEx5VHNhaQ/yOVAkmj5Yo= +github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk= github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg= github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df h1:GSoSVRLoBaFpOOds6QyY1L8AX7uoY+Ln3BHc22W40X0= @@ -280,6 +282,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129 h1:gfAMKE626QEuKG3si0pdTRcr/YEbBoxY+3GOH3gWvl4= +github.com/buger/goterm v0.0.0-20200322175922-2f3e71b85129/go.mod h1:u9UyCz2eTrSGy6fbupqJ54eY5c4IC8gREQ1053dK12U= github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs= github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= github.com/bxcodec/faker v2.0.1+incompatible h1:P0KUpUw5w6WJXwrPfv35oc91i4d8nf40Nwln+M/+faA= @@ -539,6 +543,8 @@ github.com/gagliardetto/solana-go v1.8.4 h1:vmD/JmTlonyXGy39bAo0inMhmbdAwV7rXZtL github.com/gagliardetto/solana-go v1.8.4/go.mod h1:i+7aAyNDTHG0jK8GZIBSI4OVvDqkt2Qx+LklYclRNG8= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= github.com/gagliardetto/treeout v0.1.4/go.mod h1:loUefvXTrlRG5rYmJmExNryyBRh8f89VZhmMOyCyqok= +github.com/gagliardetto/utilz v0.1.1 h1:/etW4hl607emKg6R6Lj9jRJ9d6ue2AQOyjhuAwjzs1U= +github.com/gagliardetto/utilz v0.1.1/go.mod h1:b+rGFkRHz3HWJD0RYMzat47JyvbTtpE0iEcYTRJTLLA= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 h1:f6D9Hr8xV8uYKlyuj8XIruxlh9WjVjdh1gIicAS7ays= github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gedex/inflector v0.0.0-20170307190818-16278e9db813 h1:Uc+IZ7gYqAf/rSGFplbWBSHaGolEQlNLgMgSE3ccnIQ= @@ -838,6 +844,8 @@ github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026 h1:BpJ2o0OR5FV7vrkDYfXYVJQeMNWa8RhklZOpW2ITAIQ= +github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026/go.mod h1:5Scbynm8dF1XAPwIwkGPqzkM/shndPm79Jd1003hTjE= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/api v1.29.2 h1:aYyRn8EdE2mSfG14S1+L9Qkjtz8RzmaWh6AcNGRNwPw= github.com/hashicorp/consul/api v1.29.2/go.mod h1:0YObcaLNDSbtlgzIRtmRXI1ZkeuK0trCBxwZQ4MYnIk= @@ -1369,6 +1377,8 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= @@ -1429,8 +1439,8 @@ github.com/smartcontractkit/chainlink-automation v0.8.1 h1:sTc9LKpBvcKPc1JDYAmgB github.com/smartcontractkit/chainlink-automation v0.8.1/go.mod h1:Iij36PvWZ6blrdC5A/nrQUBuf3MH3JvsBB9sSyc9W08= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000 h1:6Zzr/R1j6P7bbvcUlt5WUIbItvrrGdGzIsiAzQezcwo= github.com/smartcontractkit/chainlink-ccip v0.0.0-20241218114855-f74219171000/go.mod h1:ncjd6mPZSRlelEqH/2KeLE1pU3UlqzBSn8RYkEoECzY= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760 h1:lB5A3TP0zOVuu1n0kEm6d8/o/4Knh6HLvsU/GChk+sI= -github.com/smartcontractkit/chainlink-common v0.4.1-0.20241217120918-bbe318cd0760/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 h1:rRs74zjDJ7do5aYEXSU/sOnLnlbYCNqM8BrvEx/0NH8= +github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550/go.mod h1:yti7e1+G9hhkYhj+L5sVUULn9Bn3bBL5/AxaNqdJ5YQ= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e h1:PRoeby6ZlTuTkv2f+7tVU4+zboTfRzI+beECynF4JQ0= github.com/smartcontractkit/chainlink-cosmos v0.5.2-0.20241202195413-82468150ac1e/go.mod h1:mUh5/woemsVaHgTorA080hrYmO3syBCmPdnWc/5dOqk= github.com/smartcontractkit/chainlink-data-streams v0.1.1-0.20241216163550-fa030d178ba3 h1:aeiBdBHGY8QNftps+VqrIk6OnfeeOD5z4jrAabW4ZSc= @@ -1441,8 +1451,8 @@ github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 h1:0ewLMbAz3 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0/go.mod h1:/dVVLXrsp+V0AbcYGJo3XMzKg3CkELsweA/TTopCsKE= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 h1:ZBat8EBvE2LpSQR9U1gEbRV6PfAkiFdINmQ8nVnXIAQ= github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0/go.mod h1:m/A3lqD7ms/RsQ9BT5P2uceYY0QX5mIt4KQxT2G6qEo= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3 h1:AIIiwrZ5T4nEjFT33aLZKoXwD63JSMu72wWe/rUdfm0= -github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241219173444-150f7443fdd3/go.mod h1:ARILnIgKelP0YkVzxXO111S9j0b4uKyt7iLpYjOkCtU= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce h1:Mvpbr/Fi2IdU2EcmqCxhlCzs5ncnx+BwV80YweA4DZs= +github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce/go.mod h1:qq+nW0JDnCCGMf2c38ZHjH8xgkAQnXKighjJr5JdDNE= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 h1:tNS7U9lrxkFvEuyxQv11HHOiV9LPDGC9wYEy+yM/Jv4= github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0= github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2 h1:GDGrC5OGiV0RyM1znYWehSQXyZQWTOzrEeJRYmysPCE= From 59cdff75cf5e91f3014b6d17fb80884083625aa3 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Tue, 24 Dec 2024 09:11:25 -0500 Subject: [PATCH 07/19] fix: potential CI injections (#15720) * fix: persist-credentials false for actions/checkout * fix: possible template injection in CI --- .github/actions/golangci-lint/action.yml | 2 + .../goreleaser-build-sign-publish/README.md | 2 + .../workflows/automation-ondemand-tests.yml | 35 +++++++---- .github/workflows/bash-scripts.yml | 4 ++ .../workflows/build-publish-develop-pr.yml | 20 +++++-- .../workflows/build-publish-goreleaser.yml | 4 ++ .github/workflows/build-publish.yml | 6 ++ .github/workflows/chain-selectors-check.yml | 2 + .github/workflows/changeset.yml | 3 + .github/workflows/changesets-preview-pr.yml | 2 + .github/workflows/ci-core-partial.yml | 8 +++ .github/workflows/ci-core.yml | 17 +++++- .github/workflows/ci-protobuf.yml | 2 + .../workflows/client-compatibility-tests.yml | 50 +++++++++++----- .github/workflows/codeql-analysis.yml | 3 + .github/workflows/crib-integration-test.yml | 4 ++ .github/workflows/delete-caches.yml | 4 +- .github/workflows/delete-deployments.yml | 2 + .github/workflows/dependency-check.yml | 2 + .github/workflows/flakeguard.yml | 60 +++++++++++++------ .github/workflows/go-mod-cache.yml | 2 + .../workflows/integration-in-memory-tests.yml | 2 + .../workflows/integration-tests-publish.yml | 2 + .github/workflows/integration-tests.yml | 16 ++++- .github/workflows/lint-gh-workflows.yml | 2 + .../on-demand-vrfv2-performance-test.yml | 10 +++- .../workflows/on-demand-vrfv2-smoke-tests.yml | 10 +++- .../on-demand-vrfv2plus-performance-test.yml | 10 +++- .../on-demand-vrfv2plus-smoke-tests.yml | 10 +++- .github/workflows/operator-ui-ci.yml | 2 + .../workflows/solidity-foundry-artifacts.yml | 11 +++- .github/workflows/solidity-foundry.yml | 10 ++++ .github/workflows/solidity-hardhat.yml | 4 ++ .github/workflows/solidity-traceability.yml | 4 ++ .github/workflows/solidity-wrappers.yml | 4 ++ .github/workflows/solidity.yml | 18 ++++++ ...evelop-from-smartcontractkit-chainlink.yml | 1 + 37 files changed, 279 insertions(+), 71 deletions(-) diff --git a/.github/actions/golangci-lint/action.yml b/.github/actions/golangci-lint/action.yml index 22a35682c2d..8fa3e1775d0 100644 --- a/.github/actions/golangci-lint/action.yml +++ b/.github/actions/golangci-lint/action.yml @@ -26,12 +26,14 @@ runs: # Only do a full checkout on merge_groups if: github.event_name == 'merge_group' with: + persist-credentials: false fetch-depth: 0 - name: Checkout repo uses: actions/checkout@v4.2.1 if: github.event_name != 'merge_group' with: + persist-credentials: false fetch-depth: 1 - name: Setup Go diff --git a/.github/actions/goreleaser-build-sign-publish/README.md b/.github/actions/goreleaser-build-sign-publish/README.md index afea60e1203..9b520c1741a 100644 --- a/.github/actions/goreleaser-build-sign-publish/README.md +++ b/.github/actions/goreleaser-build-sign-publish/README.md @@ -24,6 +24,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Configure aws credentials uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1 with: diff --git a/.github/workflows/automation-ondemand-tests.yml b/.github/workflows/automation-ondemand-tests.yml index eef02dcddb2..ee917da0e56 100644 --- a/.github/workflows/automation-ondemand-tests.yml +++ b/.github/workflows/automation-ondemand-tests.yml @@ -52,45 +52,56 @@ jobs: outputs: test_list: ${{ steps.set-tests.outputs.test_list }} require_chainlink_image_versions_in_qa_ecr: ${{ steps.determine-chainlink-image-check.outputs.require_chainlink_image_versions_in_qa_ecr }} + env: + GH_INPUTS_CHAINLINK_IMAGE: ${{ inputs.chainlinkImage }} + GH_INPUTS_CHAINLINK_IMAGE_UPDATE: ${{ inputs.chainlinkImageUpdate }} + GH_INPUTS_CHAINLINK_VERSION: ${{ inputs.chainlinkVersion }} + GH_INPUTS_CHAINLINK_VERSION_UPDATE: ${{ inputs.chainlinkVersionUpdate }} steps: - name: Determine build to use id: determine-build shell: bash run: | - if [[ "${{ inputs.chainlinkImage }}" == "QA_ECR" ]]; then + if [[ "$GH_INPUTS_CHAINLINK_IMAGE" == "QA_ECR" ]]; then echo "image='{{ env.QA_CHAINLINK_IMAGE }}'" >> $GITHUB_ENV else - echo "image=${{ inputs.chainlinkImage }}" >> $GITHUB_ENV + echo "image=$GH_INPUTS_CHAINLINK_IMAGE" >> $GITHUB_ENV fi - if [[ "${{ inputs.chainlinkImageUpdate }}" == "QA_ECR" ]]; then + if [[ "$GH_INPUTS_CHAINLINK_IMAGE_UPDATE" == "QA_ECR" ]]; then echo "upgrade_image='{{ env.QA_CHAINLINK_IMAGE }}'" >> $GITHUB_ENV else - echo "upgrade_image=${{ inputs.chainlinkImageUpdate }}" >> $GITHUB_ENV + echo "upgrade_image=$GH_INPUTS_CHAINLINK_IMAGE_UPDATE" >> $GITHUB_ENV fi - if [[ -z "${{ inputs.chainlinkVersion }}" ]] && [[ "${{ inputs.chainlinkImage }}" == "QA_ECR" ]]; then + if [[ -z "$GH_INPUTS_CHAINLINK_VERSION" ]] && [[ "$CHAINLINK_IMAGE" == "QA_ECR" ]]; then echo "version=${{ github.sha }}" >> $GITHUB_ENV else - echo "version=${{ inputs.chainlinkVersion }}" >> $GITHUB_ENV + echo "version=$GH_INPUTS_CHAINLINK_VERSION" >> $GITHUB_ENV fi - if [[ -z "${{ inputs.chainlinkVersionUpdate }}" ]] && [[ "${{ inputs.chainlinkImageUpdate }}" == "QA_ECR" ]]; then + if [[ -z "$GH_INPUTS_CHAINLINK_VERSION_UPDATE" ]] && [[ "$GH_INPUTS_CHAINLINK_IMAGE_UPDATE" == "QA_ECR" ]]; then echo "upgrade_version=${{ github.sha }}" >> $GITHUB_ENV else - echo "upgrade_version=${{ inputs.chainlinkVersionUpdate }}" >> $GITHUB_ENV + echo "upgrade_version=$GH_INPUTS_CHAINLINK_VERSION_UPDATE" >> $GITHUB_ENV fi - name: Check if chainlink image check required id: determine-chainlink-image-check shell: bash + env: + CHAINLKINK_IMAGE: ${{ github.event.inputs.chainlinkImage }} + CHAINLINK_IMAGE_UPDATE: ${{ github.event.inputs.chainlinkImageUpdate }} run: | chainlink_image_versions="" - if [ "${{ github.event.inputs.chainlinkImage }}" = "QA_ECR" ]; then + if [ "$CHAINLKINK_IMAGE" = "QA_ECR" ]; then chainlink_image_versions+="${{ env.version }}," fi - if [ "${{ github.event.inputs.chainlinkImageUpdate }}" = "QA_ECR" ]; then + if [ "$CHAINLINK_IMAGE_UPDATE" = "QA_ECR" ]; then chainlink_image_versions+="${{ env.upgrade_version }}" fi echo "require_chainlink_image_versions_in_qa_ecr=$chainlink_image_versions" >> $GITHUB_OUTPUT - name: Set tests to run id: set-tests + env: + GH_EVENT_INPUTS_ENABLE_REORG: ${{ github.event.inputs.enableReorg }} + GH_EVENT_INPUTS_ENABLE_CHAOS: ${{ github.event.inputs.enableChaos }} run: | # Always run upgrade tests @@ -118,7 +129,7 @@ jobs: EOF # Run reorg tests if enabled - if [[ "${{ github.event.inputs.enableReorg }}" == 'true' ]]; then + if [[ "$GH_EVENT_INPUTS_ENABLE_REORG" == 'true' ]]; then cat >> test_list.yaml <> test_list.yaml <> $GITHUB_OUTPUT elif [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then - if [ -n "${{ github.event.inputs.base64TestList }}" ]; then + if [ -n "$GH_EVENT_INPUTS_BASE64_TEST_LIST" ]; then echo "Base64-ed Test Input provided, ignoring EVM implementations" else - echo "Will test following EVM implementations: ${{ github.event.inputs.evmImplementations }}" - echo "evm_implementations=${{ github.event.inputs.evmImplementations }}" >> $GITHUB_OUTPUT + echo "Will test following EVM implementations: $GH_EVENT_INPUTS_EVM_IMPLEMENTATIONS" + echo "evm_implementations=$GH_EVENT_INPUTS_EVM_IMPLEMENTATIONS" >> $GITHUB_OUTPUT fi else echo "Will test all EVM implementations" @@ -196,6 +202,12 @@ jobs: fi - name: Select Chainlink version id: select-chainlink-version + env: + GH_EVENT_INPUTS_CHAINLINK_VERSION: ${{ github.event.inputs.chainlinkVersion }} + GH_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }} + GH_EVENT_MERGE_GROUP_HEAD_SHA: ${{ github.event.merge_group.head_sha }} + GH_REF_NAME: ${{ github.ref_name }} + GH_SHA: ${{ github.sha }} run: | PATH=$PATH:$(go env GOPATH)/bin export PATH @@ -209,9 +221,9 @@ jobs: cl_ref_path="releases" elif [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then echo "Fetching Chainlink version from input" - if [ -n "${{ github.event.inputs.chainlinkVersion }}" ]; then + if [ -n "$GH_EVENT_INPUTS_CHAINLINK_VERSION" ]; then echo "Chainlink version provided in input" - chainlink_version="${{ github.event.inputs.chainlinkVersion }}" + chainlink_version="$GH_EVENT_INPUTS_CHAINLINK_VERSION" if [[ "$chainlink_version" =~ ^[0-9a-f]{40}$ ]]; then cl_ref_path="commit" chainlink_image_version=$chainlink_version @@ -222,23 +234,23 @@ jobs: fi else echo "Chainlink version not provided in input. Using latest commit SHA." - chainlink_version=${{ github.sha }} + chainlink_version=$GH_SHA chainlink_image_version=$chainlink_version cl_ref_path="commit" fi elif [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then echo "Fetching Chainlink version from PR's head commit" - chainlink_version="${{ github.event.pull_request.head.sha }}" + chainlink_version="$GH_EVENT_PULL_REQUEST_HEAD_SHA" chainlink_image_version=$chainlink_version cl_ref_path="commit" elif [ "$GITHUB_EVENT_NAME" = "merge_queue" ]; then echo "Fetching Chainlink version from merge queue's head commit" - chainlink_version="${{ github.event.merge_group.head_sha }}" + chainlink_version="$GH_EVENT_MERGE_GROUP_HEAD_SHA" chainlink_image_version=$chainlink_version cl_ref_path="commit" elif [ "$GITHUB_REF_TYPE" = "tag" ]; then echo "Fetching Chainlink version from tag" - chainlink_version="${{ github.ref_name }}" + chainlink_version="$GH_REF_NAME" # strip the 'v' from the version, because we tag our Docker images without it chainlink_image_version="${chainlink_version#v}" cl_ref_path="releases" @@ -253,13 +265,16 @@ jobs: echo "cl_ref_path=$cl_ref_path" >> $GITHUB_OUTPUT - name: Get image count id: get-image-count + env: + GH_EVENT_INPUTS_BASE64_TEST_LIST: ${{ github.event.inputs.base64TestList }} + GH_EVENT_INPUTS_LATEST_VERSIONS_NUMBER: ${{ github.event.inputs.latestVersionsNumber }} run: | if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then echo "Fetching latest image count from input" - if [ -n "${{ github.event.inputs.base64TestList }}" ]; then + if [ -n "$GH_EVENT_INPUTS_BASE64_TEST_LIST" ]; then echo "Base64-ed Test Input provided, ignoring latest image count" else - image_count="${{ github.event.inputs.latestVersionsNumber }}" + image_count="$GH_EVENT_INPUTS_LATEST_VERSIONS_NUMBER" echo "image_count=$image_count" >> $GITHUB_OUTPUT fi else @@ -326,6 +341,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ needs.select-versions.outputs.chainlink_version }} - name: Build Chainlink Image uses: ./.github/actions/build-chainlink-image @@ -595,6 +611,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ needs.select-versions.outputs.chainlink_version }} - name: Setup GAP for Grafana @@ -851,6 +868,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ needs.select-versions.outputs.chainlink_version }} - name: Get test results for ${{ matrix.product }} id: get-product-results diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d90139e5292..c0294645465 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,6 +23,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes @@ -55,6 +56,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Set up Go if: ${{ matrix.type.language == 'go' && matrix.type.should-run == 'true' }} diff --git a/.github/workflows/crib-integration-test.yml b/.github/workflows/crib-integration-test.yml index a6f995d57ba..4592bdbb70a 100644 --- a/.github/workflows/crib-integration-test.yml +++ b/.github/workflows/crib-integration-test.yml @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 with: @@ -93,6 +95,8 @@ jobs: product-image: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/chainlink product-image-tag: develop - uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Set up Go uses: ./.github/actions/setup-go with: diff --git a/.github/workflows/delete-caches.yml b/.github/workflows/delete-caches.yml index 64b9e799665..aa714d38815 100644 --- a/.github/workflows/delete-caches.yml +++ b/.github/workflows/delete-caches.yml @@ -21,7 +21,9 @@ jobs: PR_NUMBER: ${{ github.event.pull_request.number }} steps: - name: Check out code - uses: actions/checkout@v4.1.2 + uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup gh-actions-cache extension env: diff --git a/.github/workflows/delete-deployments.yml b/.github/workflows/delete-deployments.yml index 547b29bceec..ff24db42229 100644 --- a/.github/workflows/delete-deployments.yml +++ b/.github/workflows/delete-deployments.yml @@ -12,6 +12,8 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Clean up integration environment uses: ./.github/actions/delete-deployments diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index 4b2a2f32f79..0b09747f509 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -26,6 +26,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Set up Go if: needs.changes.outputs.src == 'true' diff --git a/.github/workflows/flakeguard.yml b/.github/workflows/flakeguard.yml index 93f380606b0..e1c7bbb5f36 100644 --- a/.github/workflows/flakeguard.yml +++ b/.github/workflows/flakeguard.yml @@ -91,8 +91,9 @@ jobs: git_base_sha: ${{ steps.get_commit_sha.outputs.git_base_sha }} steps: - name: Checkout repository - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@v4.2.1 with: + persist-credentials: false fetch-depth: 0 ref: ${{ env.GIT_HEAD_REF }} @@ -140,11 +141,14 @@ jobs: env: # Needed to run go test -list CL_DATABASE_URL: postgresql://postgres@localhost:5432/chainlink_test?sslmode=disable + GH_INPUTS_PROJECT_PATH: ${{ inputs.projectPath }} + GH_INPUTS_FIND_BY_TEST_FILES_DIFF: ${{ inputs.findByTestFilesDiff }} + GH_INPUTS_FIND_BY_AFFECTED_PACKAGES: ${{ inputs.findByAffectedPackages }} run: | PATH=$PATH:$(go env GOPATH)/bin export PATH - PACKAGES=$(flakeguard find --find-by-test-files-diff=${{ inputs.findByTestFilesDiff }} --find-by-affected-packages=${{ inputs.findByAffectedPackages }} --base-ref=origin/${{ env.GIT_BASE_REF }} --project-path=${{ inputs.projectPath }}) + PACKAGES=$(flakeguard find --find-by-test-files-diff=$GH_INPUTS_FIND_BY_TEST_FILES_DIFF --find-by-affected-packages=$GH_INPUTS_FIND_BY_AFFECTED_PACKAGES --base-ref=origin/${{ env.GIT_BASE_REF }} --project-path=${GH_INPUTS_PROJECT_PATH}) echo $PACKAGES echo "packages=$PACKAGES" >> $GITHUB_OUTPUT @@ -155,19 +159,22 @@ jobs: env: # Needed to run go test -list CL_DATABASE_URL: postgresql://postgres@localhost:5432/chainlink_test?sslmode=disable + GH_INPUTS_PROJECT_PATH: ${{ inputs.projectPath }} run: | PATH=$PATH:$(go env GOPATH)/bin export PATH - TEST_FILES=$(flakeguard find --only-show-changed-test-files=true --base-ref=origin/${{ env.GIT_BASE_REF }} --project-path=${{ inputs.projectPath }}) + TEST_FILES=$(flakeguard find --only-show-changed-test-files=true --base-ref=origin/${{ env.GIT_BASE_REF }} --project-path=${GH_INPUTS_PROJECT_PATH}) echo $TEST_FILES echo "test_files=$TEST_FILES" >> $GITHUB_OUTPUT - name: Split test packages into groups id: split-packages shell: bash + env: + GH_INPUTS_RUN_ALL_TESTS: ${{ inputs.runAllTests }} run: | - if [[ "${{ inputs.runAllTests }}" == "true" ]]; then + if [[ "$GH_INPUTS_RUN_ALL_TESTS" == "true" ]]; then # Use ALL_TESTS_RUNNER for a specified number of groups, each with "./..." to run all tests ALL_TESTS_RUNNER_COUNT=${{ env.ALL_TESTS_RUNNER_COUNT }} @@ -235,8 +242,9 @@ jobs: DB_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable steps: - name: Checkout repository - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ env.GIT_HEAD_REF }} - name: Setup NodeJS @@ -280,8 +288,10 @@ jobs: - name: Go mod tidy shell: bash + env: + GH_INPUTS_PROJECT_PATH: ${{ inputs.projectPath }} run: | - cd ${{ inputs.projectPath }} + cd $GH_INPUTS_PROJECT_PATH go mod tidy - name: Generate random id @@ -294,9 +304,11 @@ jobs: - name: Run tests with flakeguard shell: bash - run: flakeguard run --project-path=${{ inputs.projectPath }} --test-packages=${{ matrix.testPackages }} --run-count=${{ env.TEST_REPEAT_COUNT }} --max-pass-ratio=${{ inputs.maxPassRatio }} --race=${{ env.RUN_WITH_RACE }} --shuffle=${{ env.RUN_WITH_SHUFFLE }} --shuffle-seed=${{ env.SHUFFLE_SEED }} --skip-tests=${{ env.SKIPPED_TESTS }} --output-json=test-result.json --omit-test-outputs-on-success=${{ env.OMIT_TEST_OUTPUTS_ON_SUCCESS }} env: + GH_INPUTS_PROJECT_PATH: ${{ inputs.projectPath }} + GH_INPUTS_MAX_PASS_RATIO: ${{ inputs.maxPassRatio }} CL_DATABASE_URL: ${{ env.DB_URL }} + run: flakeguard run --project-path=$GH_INPUTS_PROJECT_PATH} --test-packages=${{ matrix.testPackages }} --run-count=${{ env.TEST_REPEAT_COUNT }} --max-pass-ratio=$GH_INPUTS_MAX_PASS_RATIO --race=${{ env.RUN_WITH_RACE }} --shuffle=${{ env.RUN_WITH_SHUFFLE }} --shuffle-seed=${{ env.SHUFFLE_SEED }} --skip-tests=${{ env.SKIPPED_TESTS }} --output-json=test-result.json --omit-test-outputs-on-success=${{ env.OMIT_TEST_OUTPUTS_ON_SUCCESS }} - name: Upload test result as artifact if: always() @@ -315,8 +327,9 @@ jobs: test_results: ${{ steps.results.outputs.results }} steps: - name: Checkout repository - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ env.GIT_HEAD_REF }} - name: Setup Go uses: ./.github/actions/setup-go @@ -325,11 +338,13 @@ jobs: - name: Set Pretty Project Path id: set_project_path_pretty + env: + GH_INPUTS_PROJECT_PATH: ${{ inputs.projectPath }} run: | - if [ "${{ inputs.projectPath }}" = "." ]; then + if [ "$GH_INPUTS_PROJECT_PATH" = "." ]; then echo "path=github.com/${{ github.repository }}" >> $GITHUB_OUTPUT else - echo "path=github.com/${{ github.repository }}/${{ inputs.projectPath }}" >> $GITHUB_OUTPUT + echo "path=github.com/${{ github.repository }}/${GH_INPUTS_PROJECT_PATH}" >> $GITHUB_OUTPUT fi - name: Download all test result artifacts @@ -346,6 +361,9 @@ jobs: - name: Aggregate Flakeguard Results id: results shell: bash + env: + GH_INPUTS_REPO_URL: ${{ inputs.repoUrl }} + GH_INPUTS_MAX_PASS_RATIO: ${{ inputs.maxPassRatio }} run: | set -e # Exit immediately if a command exits with a non-zero status. @@ -362,8 +380,8 @@ jobs: --output-path ./flakeguard-report \ --repo-path "${{ github.workspace }}" \ --codeowners-path "${{ github.workspace }}/.github/CODEOWNERS" \ - --max-pass-ratio "${{ inputs.maxPassRatio }}" \ - --repo-url "${{ inputs.repoUrl }}" \ + --max-pass-ratio "$GH_INPUTS_MAX_PASS_RATIO" \ + --repo-url "$GH_INPUTS_REPO_URL" \ --base-sha "${{ needs.get-tests.outputs.git_base_sha }}" \ --head-sha "${{ needs.get-tests.outputs.git_head_sha }}" \ --github-workflow-name "${{ github.workflow }}" \ @@ -409,6 +427,10 @@ jobs: if: success() || failure() env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + GH_INPUTS_MAX_PASS_RATIO: ${{ inputs.maxPassRatio }} + GH_EVENT_NAME: ${{ github.event_name }} + GH_EVENT_PULL_REQUEST_BASE_REF: ${{ github.event.pull_request.base.ref }} + GH_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }} run: | set -e # Exit immediately if a command exits with a non-zero status. @@ -417,7 +439,7 @@ jobs: export PATH # Check if the event is a pull request - if [ "${{ github.event_name }}" = "pull_request" ]; then + if [ "$GH_EVENT_NAME" = "pull_request" ]; then flakeguard generate-report \ --aggregated-results-path ./flakeguard-report/all-test-results.json \ --summary-path ./flakeguard-report/all-test-summary.json \ @@ -426,12 +448,12 @@ jobs: --github-run-id "${{ github.run_id }}" \ --failed-tests-artifact-name "failed-test-results-with-logs.json" \ --generate-pr-comment \ - --base-branch "${{ github.event.pull_request.base.ref }}" \ + --base-branch "$GH_EVENT_PULL_REQUEST_BASE_REF" \ --current-branch "${{ github.head_ref }}" \ - --current-commit-sha "${{ github.event.pull_request.head.sha }}" \ + --current-commit-sha "$GH_EVENT_PULL_REQUEST_HEAD_SHA" \ --repo-url "https://github.com/${{ github.repository }}" \ --action-run-id "${{ github.run_id }}" \ - --max-pass-ratio "${{ inputs.maxPassRatio }}" + --max-pass-ratio "$GH_INPUTS_MAX_PASS_RATIO" else flakeguard generate-report \ --aggregated-results-path ./flakeguard-report/all-test-results.json \ @@ -440,12 +462,12 @@ jobs: --github-repository "${{ github.repository }}" \ --github-run-id "${{ github.run_id }}" \ --failed-tests-artifact-name "failed-test-results-with-logs.json" \ - --base-branch "${{ github.event.pull_request.base.ref }}" \ + --base-branch "$GH_EVENT_PULL_REQUEST_BASE_REF" \ --current-branch "${{ github.head_ref }}" \ - --current-commit-sha "${{ github.event.pull_request.head.sha }}" \ + --current-commit-sha "$GH_EVENT_PULL_REQUEST_HEAD_SHA" \ --repo-url "https://github.com/${{ github.repository }}" \ --action-run-id "${{ github.run_id }}" \ - --max-pass-ratio "${{ inputs.maxPassRatio }}" + --max-pass-ratio "$GH_INPUTS_MAX_PASS_RATIO" fi - name: Add Github Summary diff --git a/.github/workflows/go-mod-cache.yml b/.github/workflows/go-mod-cache.yml index 3caac1eff3f..e90e6a9f285 100644 --- a/.github/workflows/go-mod-cache.yml +++ b/.github/workflows/go-mod-cache.yml @@ -31,6 +31,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup Go uses: ./.github/actions/setup-go diff --git a/.github/workflows/integration-in-memory-tests.yml b/.github/workflows/integration-in-memory-tests.yml index 341d66f641e..e124b12eb28 100644 --- a/.github/workflows/integration-in-memory-tests.yml +++ b/.github/workflows/integration-in-memory-tests.yml @@ -33,6 +33,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref }} - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 @@ -134,6 +135,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref }} diff --git a/.github/workflows/integration-tests-publish.yml b/.github/workflows/integration-tests-publish.yml index df07cc1e231..523974b4aed 100644 --- a/.github/workflows/integration-tests-publish.yml +++ b/.github/workflows/integration-tests-publish.yml @@ -23,6 +23,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ github.event.pull_request.head.sha || github.sha }} - name: Setup Other Tags If Not Workflow Dispatch id: tags @@ -68,6 +69,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ github.sha }} - name: Build Chainlink Image uses: ./.github/actions/build-chainlink-image diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e79956cc253..33bb7721d77 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -54,6 +54,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref }} - name: Check Merge Group Condition @@ -88,6 +89,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref }} - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 @@ -140,6 +142,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Setup Github Token @@ -386,6 +389,7 @@ jobs: if: ${{ github.event_name == 'pull_request' }} uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref }} @@ -405,6 +409,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Download All Artifacts @@ -429,6 +434,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink ref: ${{ inputs.cl_ref || github.event.pull_request.head.sha || github.event.merge_group.head_sha }} - name: Setup Go @@ -449,6 +455,7 @@ jobs: - name: Checkout solana uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink-solana ref: develop fetch-depth: 0 @@ -476,6 +483,7 @@ jobs: - name: Checkout the solana repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink-solana ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Get ProjectSerum Version @@ -524,6 +532,7 @@ jobs: - name: Checkout the solana repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink-solana ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Build contracts @@ -558,6 +567,7 @@ jobs: if: (needs.changes.outputs.core_changes == 'true' || github.event_name == 'workflow_dispatch') && needs.solana-test-image-exists.outputs.exists == 'false' uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink-solana ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Download Artifacts @@ -606,6 +616,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/chainlink-solana ref: ${{ needs.get_solana_sha.outputs.sha }} - name: Run Setup @@ -646,10 +657,13 @@ jobs: yarn --cwd ./gauntlet build yarn --cwd ./gauntlet gauntlet - name: Generate config overrides + env: + GH_INPUTS_EVM_REF: ${{ inputs.evm-ref }} + GH_SHA: ${{ github.sha }} run: | # https://github.com/smartcontractkit/chainlink-testing-framework/lib/blob/main/config/README.md cat << EOF > config.toml [ChainlinkImage] - version="${{ inputs.evm-ref || github.sha }}" + version="${{ env.evm-ref || env.GH_SHA }}" [Common] user="${{ github.actor }}" internal_docker_repo = "${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com" diff --git a/.github/workflows/lint-gh-workflows.yml b/.github/workflows/lint-gh-workflows.yml index 9897c023576..a3aaacb1abe 100644 --- a/.github/workflows/lint-gh-workflows.yml +++ b/.github/workflows/lint-gh-workflows.yml @@ -8,5 +8,7 @@ jobs: steps: - name: Check out Code uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Run actionlint uses: reviewdog/action-actionlint@c6ee1eb0a5d47b2af53a203652b5dac0b6c4016e # v1.43.0 diff --git a/.github/workflows/on-demand-vrfv2-performance-test.yml b/.github/workflows/on-demand-vrfv2-performance-test.yml index f9aeaa0fa1f..2f3ea12cbe2 100644 --- a/.github/workflows/on-demand-vrfv2-performance-test.yml +++ b/.github/workflows/on-demand-vrfv2-performance-test.yml @@ -34,13 +34,17 @@ jobs: runs-on: ubuntu-latest outputs: test_list: ${{ steps.set-tests.outputs.test_list }} + env: + GH_INPUTS_TEST_LIST_REGEX: ${{ inputs.test_list_regex }} + GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH: ${{ inputs.test_config_override_path }} + GH_INPUTS_PERFORMANCE_TEST_TYPE: ${{ inputs.performanceTestType }} steps: - name: Generate Test List JSON id: set-tests run: | - TEST_CMD='cd integration-tests/load && go test -v -count=1 -timeout 24h -run "${{ inputs.test_list_regex }}" ./vrfv2' - TEST_CONFIG_OVERRIDE_PATH=${{ inputs.test_config_override_path }} - TEST_TYPE=${{ inputs.performanceTestType }} + TEST_CMD='cd integration-tests/load && go test -v -count=1 -timeout 24h -run "$GH_INPUTS_TEST_LIST_REGEX" ./vrfv2' + TEST_CONFIG_OVERRIDE_PATH=$GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH + TEST_TYPE=$GH_INPUTS_PERFORMANCE_TEST_TYPE TEST_LIST=$(jq -n -c \ --arg test_cmd "$TEST_CMD" \ diff --git a/.github/workflows/on-demand-vrfv2-smoke-tests.yml b/.github/workflows/on-demand-vrfv2-smoke-tests.yml index ad616dea744..db242c1aae2 100644 --- a/.github/workflows/on-demand-vrfv2-smoke-tests.yml +++ b/.github/workflows/on-demand-vrfv2-smoke-tests.yml @@ -41,13 +41,17 @@ jobs: steps: - name: Generate Test List JSON id: set-tests + env: + GH_INPUTS_TEST_SUITE: ${{ inputs.test_suite }} + GH_INPUTS_TEST_LIST_REGEX: ${{ inputs.test_list_regex }} + GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH: ${{ inputs.test_config_override_path }} run: | - if [[ "${{ inputs.test_suite }}" == "All Tests" ]]; then + if [[ "$GH_INPUTS_TEST_SUITE" == "All Tests" ]]; then TEST_CMD="cd integration-tests/smoke && go test vrfv2_test.go -test.parallel=1 -timeout 3h -count=1 -json -v" else - TEST_CMD='cd integration-tests/smoke && go test -test.run "${{ inputs.test_list_regex }}" -test.parallel=1 -timeout 2h -count=1 -json -v' + TEST_CMD='cd integration-tests/smoke && go test -test.run "$GH_INPUTS_TEST_LIST_REGEX" -test.parallel=1 -timeout 2h -count=1 -json -v' fi - TEST_CONFIG_OVERRIDE_PATH=${{ inputs.test_config_override_path }} + TEST_CONFIG_OVERRIDE_PATH=$GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH TEST_LIST=$(jq -n -c \ --arg test_cmd "$TEST_CMD" \ diff --git a/.github/workflows/on-demand-vrfv2plus-performance-test.yml b/.github/workflows/on-demand-vrfv2plus-performance-test.yml index b3a820e25a0..66878c552fd 100644 --- a/.github/workflows/on-demand-vrfv2plus-performance-test.yml +++ b/.github/workflows/on-demand-vrfv2plus-performance-test.yml @@ -34,13 +34,17 @@ jobs: runs-on: ubuntu-latest outputs: test_list: ${{ steps.set-tests.outputs.test_list }} + env: + GH_INPUTS_TEST_LIST_REGEX: ${{ inputs.test_list_regex }} + GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH: ${{ inputs.test_config_override_path }} + GH_INPUTS_PERFORMANCE_TEST_TYPE: ${{ inputs.performanceTestType }} steps: - name: Generate Test List JSON id: set-tests run: | - TEST_CMD='cd integration-tests/load && go test -v -count=1 -timeout 24h -run "${{ inputs.test_list_regex }}" ./vrfv2plus' - TEST_CONFIG_OVERRIDE_PATH=${{ inputs.test_config_override_path }} - TEST_TYPE=${{ inputs.performanceTestType }} + TEST_CMD='cd integration-tests/load && go test -v -count=1 -timeout 24h -run "$GH_INPUTS_TEST_LIST_REGEX" ./vrfv2plus' + TEST_CONFIG_OVERRIDE_PATH=$GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH + TEST_TYPE=$GH_INPUTS_PERFORMANCE_TEST_TYPE TEST_LIST=$(jq -n -c \ --arg test_cmd "$TEST_CMD" \ diff --git a/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml b/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml index 8561034b103..51c80af9bfa 100644 --- a/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml +++ b/.github/workflows/on-demand-vrfv2plus-smoke-tests.yml @@ -41,13 +41,17 @@ jobs: steps: - name: Generate Test List JSON id: set-tests + env: + GH_INPUTS_TEST_SUITE: ${{ inputs.test_suite }} + GH_INPUTS_TEST_LIST_REGEX: ${{ inputs.test_list_regex }} + GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH: ${{ inputs.test_config_override_path }} run: | - if [[ "${{ inputs.test_suite }}" == "All Tests" ]]; then + if [[ "$GH_INPUTS_TEST_SUITE" == "All Tests" ]]; then TEST_CMD="cd integration-tests/smoke && go test vrfv2plus_test.go -test.parallel=1 -timeout 3h -count=1 -json -v" else - TEST_CMD='cd integration-tests/smoke && go test -test.run "${{ inputs.test_list_regex }}" -test.parallel=1 -timeout 2h -count=1 -json -v' + TEST_CMD='cd integration-tests/smoke && go test -test.run "$GH_INPUTS_TEST_LIST_REGEX" -test.parallel=1 -timeout 2h -count=1 -json -v' fi - TEST_CONFIG_OVERRIDE_PATH=${{ inputs.test_config_override_path }} + TEST_CONFIG_OVERRIDE_PATH=$GH_INPUTS_TEST_CONFIG_OVERRIDE_PATH TEST_LIST=$(jq -n -c \ --arg test_cmd "$TEST_CMD" \ diff --git a/.github/workflows/operator-ui-ci.yml b/.github/workflows/operator-ui-ci.yml index 9bce18f8cff..7ea1cd8327b 100644 --- a/.github/workflows/operator-ui-ci.yml +++ b/.github/workflows/operator-ui-ci.yml @@ -33,6 +33,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Get operator-ui tag id: get-operator-ui-tag diff --git a/.github/workflows/solidity-foundry-artifacts.yml b/.github/workflows/solidity-foundry-artifacts.yml index dbf31a4b442..460e3dfa7be 100644 --- a/.github/workflows/solidity-foundry-artifacts.yml +++ b/.github/workflows/solidity-foundry-artifacts.yml @@ -50,6 +50,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ env.head_ref }} - name: Find modified contracts uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 @@ -86,8 +87,10 @@ jobs: - name: Transform modified files id: changes-transform shell: bash + env: + GH_INPUTS_PRODUCT: ${{ inputs.product }} run: | - if [ "${{ inputs.product }}" = "shared" ]; then + if [ "$GH_INPUTS_PRODUCT" = "shared" ]; then echo "::debug:: Product is shared, transforming changes" if [[ "${{ steps.changes-dorny.outputs.product }}" == "true" && "${{ steps.changes-dorny.outputs.other_shared }}" == "true" ]]; then echo "::debug:: Changes were found in 'shared' folder and in 'interfaces' and root folders" @@ -128,6 +131,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Extract Foundry version id: extract-foundry-version @@ -137,8 +142,10 @@ jobs: - name: Should skip code coverage report id: skip-code-coverage + env: + GH_INPUTS_PRODUCT: ${{ inputs.product }} run: | - if [[ "${{ inputs.product }}" = "automation" || "${{ inputs.product }}" = "vrf" || "${{ inputs.product }}" = "functions" ]]; then + if [[ "$GH_INPUTS_PRODUCT" = "automation" || "$GH_INPUTS_PRODUCT" = "vrf" || "$GH_INPUTS_PRODUCT" = "functions" ]]; then echo "generate_code_coverage=false" >> $GITHUB_OUTPUT else echo "generate_code_coverage=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index 5c6889beaf8..618ab046e28 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -48,6 +48,8 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Extract Foundry version id: extract-foundry-version @@ -69,6 +71,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Detect changes uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes @@ -154,6 +158,7 @@ jobs: || needs.changes.outputs.non_src_changes == 'true' }} uses: actions/checkout@v4.2.1 with: + persist-credentials: false submodules: recursive # Only needed because we use the NPM versions of packages @@ -327,10 +332,13 @@ jobs: steps: - name: Checkout this repository uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Checkout .github repository uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/.github ref: b6e37806737eef87e8c9137ceeb23ef0bff8b1db # validate-solidity-artifacts@0.1.0 path: ./dot_github @@ -415,6 +423,7 @@ jobs: if: needs.changes.outputs.sol_mod_only == 'true' uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ github.base_ref }} - name: Download Slither scripts @@ -608,6 +617,7 @@ jobs: if: ${{ (contains(fromJson(needs.changes.outputs.all_changes), matrix.product.name) || needs.changes.outputs.non_src_changes == 'true') && matrix.product.setup.run-forge-fmt }} uses: actions/checkout@v4.2.1 with: + persist-credentials: false submodules: recursive - name: Setup NodeJS diff --git a/.github/workflows/solidity-hardhat.yml b/.github/workflows/solidity-hardhat.yml index 6f27f8ca2f8..e2da95eae6e 100644 --- a/.github/workflows/solidity-hardhat.yml +++ b/.github/workflows/solidity-hardhat.yml @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes with: @@ -40,6 +42,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup NodeJS uses: ./.github/actions/setup-nodejs - name: Setup Hardhat diff --git a/.github/workflows/solidity-traceability.yml b/.github/workflows/solidity-traceability.yml index caa233ea8bb..a894175f6f3 100644 --- a/.github/workflows/solidity-traceability.yml +++ b/.github/workflows/solidity-traceability.yml @@ -23,6 +23,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Filter paths uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 @@ -59,6 +61,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: ${{ github.event.pull_request.head.sha }} - name: Assume role capable of dispatching action @@ -94,6 +97,7 @@ jobs: - name: Checkout .Github repository uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: smartcontractkit/.github ref: 6781e048ecc1aadf7d605722c32e8068a5f829ce # jira-tracing@0.3.0 path: ./dot_github diff --git a/.github/workflows/solidity-wrappers.yml b/.github/workflows/solidity-wrappers.yml index b2acdf6ca5e..941a3e2f196 100644 --- a/.github/workflows/solidity-wrappers.yml +++ b/.github/workflows/solidity-wrappers.yml @@ -24,6 +24,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Detect changes id: ch uses: ./.github/actions/detect-solidity-file-changes @@ -41,6 +43,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup Go uses: ./.github/actions/setup-go diff --git a/.github/workflows/solidity.yml b/.github/workflows/solidity.yml index 605b3f2e325..c162380940f 100644 --- a/.github/workflows/solidity.yml +++ b/.github/workflows/solidity.yml @@ -17,6 +17,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Detect readonly solidity file changes id: ch uses: ./.github/actions/detect-solidity-readonly-file-changes @@ -29,6 +31,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Detect changes id: ch uses: ./.github/actions/detect-solidity-file-changes @@ -44,6 +48,8 @@ jobs: pre-release-version: ${{ steps.release-tag-check.outputs.pre-release-version }} steps: - uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Check release tag id: release-tag-check uses: smartcontractkit/chainlink-github-actions/release/release-tag-check@5dd916d08c03cb5f9a97304f4f174820421bb946 # v2.3.11 @@ -62,6 +68,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup NodeJS uses: ./.github/actions/setup-nodejs - name: Run Prepublish test @@ -77,11 +85,13 @@ jobs: - name: Checkout the repo uses: actions/checkout@v4.2.1 with: + persist-credentials: false path: chainlink - name: Checkout diff-so-fancy uses: actions/checkout@v4.2.1 with: + persist-credentials: false repository: so-fancy/diff-so-fancy ref: a673cb4d2707f64d92b86498a2f5f71c8e2643d5 # v1.4.3 path: diff-so-fancy @@ -128,6 +138,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup NodeJS uses: ./.github/actions/setup-nodejs - name: Run pnpm lint @@ -148,6 +160,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup NodeJS uses: ./.github/actions/setup-nodejs - name: Run prettier check @@ -162,6 +176,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup NodeJS uses: ./.github/actions/setup-nodejs @@ -191,6 +207,8 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4.2.1 + with: + persist-credentials: false - name: Setup NodeJS uses: ./.github/actions/setup-nodejs diff --git a/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml b/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml index e635ce40922..061db3ae7f3 100644 --- a/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml +++ b/.github/workflows/sync-develop-from-smartcontractkit-chainlink.yml @@ -12,6 +12,7 @@ jobs: steps: - uses: actions/checkout@v4.2.1 with: + persist-credentials: false ref: develop if: env.GITHUB_REPOSITORY != 'smartcontractkit/chainlink' - name: Sync From 498b0b8579ad52a8c394fe3cbf55d3a86a8e29a0 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Thu, 26 Dec 2024 06:54:36 -0600 Subject: [PATCH 08/19] bump libocr to e5b78d8e3919 (#15806) --- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 ++-- deployment/go.mod | 2 +- deployment/go.sum | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- integration-tests/load/go.mod | 2 +- integration-tests/load/go.sum | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index bdb57a41c01..a9e5130db2c 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -34,7 +34,7 @@ require ( github.com/shopspring/decimal v1.4.0 github.com/smartcontractkit/chainlink-automation v0.8.1 github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 - github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 + github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 github.com/spf13/cobra v1.8.1 github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 4ecc3609b2d..7b004d6eae7 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1182,8 +1182,8 @@ github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 h1:T0kbw07V github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13/go.mod h1:1CKUOzoK+Ga19WuhRH9pxZ+qUUnrlIx108VEA6qSzeQ= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 h1:IpGoPTXpvllN38kT2z2j13sifJMz4nbHglidvop7mfg= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de h1:n0w0rKF+SVM+S3WNlup6uabXj2zFlFNfrlsKCMMb/co= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o= github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc= diff --git a/deployment/go.mod b/deployment/go.mod index 25c1284cef1..34fbc7fd21d 100644 --- a/deployment/go.mod +++ b/deployment/go.mod @@ -32,7 +32,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.4.1-0.20241223143929-db7919d60550 github.com/smartcontractkit/chainlink-protos/job-distributor v0.6.0 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.13 - github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 + github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 github.com/stretchr/testify v1.9.0 github.com/test-go/testify v1.1.4 github.com/testcontainers/testcontainers-go v0.34.0 diff --git a/deployment/go.sum b/deployment/go.sum index 40532becf5a..a364fc9b1ec 100644 --- a/deployment/go.sum +++ b/deployment/go.sum @@ -1453,8 +1453,8 @@ github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 h1:7bCdbTUW github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2/go.mod h1:MltlNu3jcXm/DyLN98I5TFNtu/o1NNAcaPAFKMXWk70= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 h1:IpGoPTXpvllN38kT2z2j13sifJMz4nbHglidvop7mfg= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de h1:n0w0rKF+SVM+S3WNlup6uabXj2zFlFNfrlsKCMMb/co= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o= github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc= diff --git a/go.mod b/go.mod index 06007701a33..8c3d465bfba 100644 --- a/go.mod +++ b/go.mod @@ -86,7 +86,7 @@ require ( github.com/smartcontractkit/chainlink-protos/orchestrator v0.4.0 github.com/smartcontractkit/chainlink-solana v1.1.1-0.20241223151630-eac4f1508dce github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8 - github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 + github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de github.com/smartcontractkit/wsrpc v0.8.3 diff --git a/go.sum b/go.sum index 94291d9ae9d..c185e1ad1d2 100644 --- a/go.sum +++ b/go.sum @@ -1167,8 +1167,8 @@ github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2 github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20241202202529-2033490e77b8/go.mod h1:EBrEgcdIbwepqguClkv8Ohy7CbyWSJaE4EC9aBJlQK0= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 h1:IpGoPTXpvllN38kT2z2j13sifJMz4nbHglidvop7mfg= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de h1:n0w0rKF+SVM+S3WNlup6uabXj2zFlFNfrlsKCMMb/co= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o= github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 420e6d03432..1c63ac6738e 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -54,7 +54,7 @@ require ( github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9 github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 - github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 + github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 github.com/subosito/gotenv v1.6.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 2e9c9ea678c..1baff05f3f1 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1476,8 +1476,8 @@ github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 h1:7bCdbTUW github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2/go.mod h1:MltlNu3jcXm/DyLN98I5TFNtu/o1NNAcaPAFKMXWk70= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 h1:IpGoPTXpvllN38kT2z2j13sifJMz4nbHglidvop7mfg= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de h1:n0w0rKF+SVM+S3WNlup6uabXj2zFlFNfrlsKCMMb/co= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o= github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc= diff --git a/integration-tests/load/go.mod b/integration-tests/load/go.mod index 7713ba8e30a..04f9b07f93b 100644 --- a/integration-tests/load/go.mod +++ b/integration-tests/load/go.mod @@ -417,7 +417,7 @@ require ( github.com/smartcontractkit/chainlink-testing-framework/havoc v1.50.2 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect - github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 // indirect + github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de // indirect github.com/smartcontractkit/wsrpc v0.8.3 // indirect github.com/soheilhy/cmux v0.1.5 // indirect diff --git a/integration-tests/load/go.sum b/integration-tests/load/go.sum index 93e6a9dde44..48bdf1cb5b1 100644 --- a/integration-tests/load/go.sum +++ b/integration-tests/load/go.sum @@ -1467,8 +1467,8 @@ github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2 h1:7bCdbTUW github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.2/go.mod h1:MltlNu3jcXm/DyLN98I5TFNtu/o1NNAcaPAFKMXWk70= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= -github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919 h1:IpGoPTXpvllN38kT2z2j13sifJMz4nbHglidvop7mfg= +github.com/smartcontractkit/libocr v0.0.0-20241223215956-e5b78d8e3919/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de h1:n0w0rKF+SVM+S3WNlup6uabXj2zFlFNfrlsKCMMb/co= github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20241009055228-33d0c0bf38de/go.mod h1:Sl2MF/Fp3fgJIVzhdGhmZZX2BlnM0oUUyBP4s4xYb6o= github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20241009055228-33d0c0bf38de h1:66VQxXx3lvTaAZrMBkIcdH9VEjujUEvmBQdnyOJnkOc= From b5c671e0dd5f518a48151c7f1261c0f8fc148237 Mon Sep 17 00:00:00 2001 From: chainchad <96362174+chainchad@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:42:17 -0500 Subject: [PATCH 09/19] Launch CRIBs on pre-release tags (#15805) * Refactor to use composite action * Fix bug to get only tagged image * Launch CRIB on pre-release tags * Use pinned sha versions for actions * Use released version of action * Fix k8s api endpoint input for crib action * Fix conditional with input prefix * Revert to previously working setup-gap actions * Add required env vars back for integration tests * Add GAP URL for integration tests --- .../build-sign-publish-chainlink/action.yml | 6 +- .github/actions/crib/action.yml | 156 ++++++++++++++++++ .github/workflows/build-publish.yml | 40 +++++ .github/workflows/crib-integration-test.yml | 107 ++---------- 4 files changed, 213 insertions(+), 96 deletions(-) create mode 100644 .github/actions/crib/action.yml diff --git a/.github/actions/build-sign-publish-chainlink/action.yml b/.github/actions/build-sign-publish-chainlink/action.yml index b0e70b742d5..24d9884d7f7 100644 --- a/.github/actions/build-sign-publish-chainlink/action.yml +++ b/.github/actions/build-sign-publish-chainlink/action.yml @@ -210,12 +210,12 @@ runs: IMAGES_NAME_RAW=${{ fromJSON(steps.buildpush-nonroot.outputs.metadata)['image.name'] }} IMAGE_DIGEST=${{ fromJSON(steps.buildpush-nonroot.outputs.metadata)['containerimage.digest'] }} IMAGE_NAME=$(echo "$IMAGES_NAME_RAW" | cut -d"," -f1) - IMAGE_TAG=$(echo "$IMAGES_NAME_RAW" | cut -d":" -f2) + IMAGE_TAG=$(echo "$IMAGE_NAME" | cut -d":" -f2) echo "nonroot_image_name=${IMAGE_NAME}" >> $GITHUB_ENV echo "nonroot_image_digest=${IMAGE_DIGEST}" >> $GITHUB_ENV echo '### Docker Image' >> $GITHUB_STEP_SUMMARY - echo "Image Name: ${IMAGE_NAME}" >> $GITHUB_STEP_SUMMARY - echo "Image Digest: ${IMAGE_DIGEST}" >> $GITHUB_STEP_SUMMARY + echo "Image Name: ${IMAGE_NAME}" >> $GITHUB_STEP_SUMMARY + echo "Image Digest: ${IMAGE_DIGEST}" >> $GITHUB_STEP_SUMMARY echo "image-tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT echo "image-digest=${IMAGE_DIGEST}" >> $GITHUB_OUTPUT diff --git a/.github/actions/crib/action.yml b/.github/actions/crib/action.yml new file mode 100644 index 00000000000..79715cca0d2 --- /dev/null +++ b/.github/actions/crib/action.yml @@ -0,0 +1,156 @@ +name: "CRIB Action" +description: "Spin up a CRIB environment. Optionally run tests and tear it down." + +inputs: + aws-role-duration-seconds: + description: "Duration in seconds for AWS role" + required: false + default: "3600" + aws-role-arn: + description: "AWS Role ARN for CRIB" + required: true + aws-region: + description: "AWS Region" + required: true + aws-account-id: + description: "AWS Account ID" + required: true + api-gw-host-crib: + description: "API Gateway Host for CRIB" + required: true + api-gw-host-k8s: + description: "API Gateway Host for K8s" + required: true + k8s-api-endpoint: + description: "Kubernetes API endpoint" + required: true + k8s-cluster-name: + description: "Kubernetes cluster name" + required: true + aws-token-issuer-role-arn: + description: "AWS Role ARN for token issuer" + required: true + aws-token-issuer-lambda-url: + description: "AWS Lambda URL for token issuer" + required: true + ingress-base-domain: + description: "Ingress base domain" + required: true + k8s-staging-ingress-suffix: + description: "K8S staging ingress suffix" + required: true + gap-url-integration-tests: + description: "GAP URL for integration tests" + required: true + crib-alert-slack-webhook: + description: "CRIB alert Slack webhook" + required: true + crib-chainlink-docker-image-name: + description: "Docker image name" + required: true + crib-chainlink-docker-image-tag: + description: "Docker image tag" + required: true + crib-cleanup-ttl: + # See: https://kyverno.io/docs/writing-policies/cleanup/ + description: "Time to keep environment up for before destroying it. Examples: 15m, 1h, 3d" + required: false + default: "1h" + crib-destroy-environment: + description: "Whether to destroy the CRIB environment after testing" + required: false + default: "true" + integration-tests-run: + description: "Whether to run integration tests" + required: false + default: "true" + +runs: + using: "composite" + steps: + - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 + with: + nix_path: nixpkgs=channel:nixos-unstable + + - name: setup-gap crib + uses: smartcontractkit/.github/actions/setup-gap@00b58566e0ee2761e56d9db0ea72b783fdb89b8d # setup-gap@0.4.0 + with: + aws-role-duration-seconds: ${{ inputs.aws-role-duration-seconds }} + aws-role-arn: ${{ inputs.aws-role-arn }} + api-gateway-host: ${{ inputs.api-gw-host-crib }} + aws-region: ${{ inputs.aws-region }} + ecr-private-registry: ${{ inputs.aws-account-id }} + k8s-cluster-name: ${{ inputs.k8s-cluster-name }} + gap-name: crib + use-private-ecr-registry: true + use-tls: true + proxy-port: 8080 + + - name: setup-gap k8s + uses: smartcontractkit/.github/actions/setup-gap@00b58566e0ee2761e56d9db0ea72b783fdb89b8d # setup-gap@0.4.0 + with: + aws-role-duration-seconds: ${{ inputs.aws-role-duration-seconds }} + aws-role-arn: ${{ inputs.aws-role-arn }} + api-gateway-host: ${{ inputs.api-gw-host-k8s }} + aws-region: ${{ inputs.aws-region }} + ecr-private-registry: ${{ inputs.aws-account-id }} + k8s-cluster-name: ${{ inputs.k8s-cluster-name }} + gap-name: k8s + use-private-ecr-registry: true + use-k8s: true + proxy-port: 8443 + + - name: Setup GitHub token using GATI + id: token + uses: smartcontractkit/.github/actions/setup-github-token@ef78fa97bf3c77de6563db1175422703e9e6674f # setup-github-token@0.2.1 + with: + aws-role-arn: ${{ inputs.aws-token-issuer-role-arn }} + aws-lambda-url: ${{ inputs.aws-token-issuer-lambda-url }} + aws-region: ${{ inputs.aws-region }} + aws-role-duration-seconds: "1800" + + - name: Deploy and validate CRIB Environment for Core + uses: smartcontractkit/.github/actions/crib-deploy-environment@815e0d550527897746e889441407926d7e28169c # crib-deploy-environment@7.4.0 + id: deploy-crib + with: + github-token: ${{ steps.token.outputs.access-token }} + aws-ecr-private-registry: ${{ inputs.aws-account-id }} + aws-region: ${{ inputs.aws-region }} + aws-role-arn: ${{ inputs.aws-role-arn }} + ingress-base-domain: ${{ inputs.ingress-base-domain }} + k8s-api-endpoint: ${{ inputs.k8s-api-endpoint }} + k8s-cluster-name: ${{ inputs.k8s-cluster-name }} + chainlink-team: releng + chainlink-product: crib + command: "core-dev-simulated-core-ocr1" + crib-alert-slack-webhook: ${{ inputs.crib-alert-slack-webhook }} + product-image: ${{ inputs.crib-chainlink-docker-image-name }} + product-image-tag: ${{ inputs.crib-chainlink-docker-image-tag }} + ns-ttl: ${{ inputs.crib-cleanup-ttl }} + + - name: Set up Go + uses: ./.github/actions/setup-go + with: + go-version-file: "go.mod" + + - name: Run CRIB integration test + if: inputs.integration-tests-run == 'true' + shell: bash + working-directory: integration-tests/crib + env: + K8S_STAGING_INGRESS_SUFFIX: ${{ inputs.k8s-staging-ingress-suffix }} + CRIB_NAMESPACE: ${{ steps.deploy-crib.outputs.devspace-namespace }} + CRIB_NETWORK: geth + CRIB_NODES: 5 + GAP_URL: ${{ inputs.gap-url-integration-tests }} + SETH_LOG_LEVEL: info + TEST_PERSISTENCE: true + E2E_TEST_CHAINLINK_IMAGE: public.ecr.aws/chainlink/chainlink + E2E_TEST_CHAINLINK_VERSION: latest + run: go test -v -run TestCRIBChaos + + - name: Destroy CRIB Environment + if: inputs.crib-destroy-environment == 'true' && always() && steps.deploy-crib.outputs.devspace-namespace != '' + uses: smartcontractkit/.github/actions/crib-purge-environment@142671bc21953c8cc3edbd21848c50b5ec201c2a # crib-purge-environment@0.3.0 + with: + namespace: ${{ steps.deploy-crib.outputs.devspace-namespace }} diff --git a/.github/workflows/build-publish.yml b/.github/workflows/build-publish.yml index 06ba1daead1..80efa0f3b71 100644 --- a/.github/workflows/build-publish.yml +++ b/.github/workflows/build-publish.yml @@ -15,6 +15,8 @@ jobs: outputs: git-tag-type: ${{ steps.check-git-tag-type.outputs.git-tag-type }} ecr-image-name: ${{ steps.check-git-tag-type.outputs.ecr-image-name }} + is-release: ${{ steps.release-tag-check.outputs.is-release }} + is-pre-release: ${{ steps.release-tag-check.outputs.is-pre-release }} steps: - name: Checkout repository uses: actions/checkout@v4.2.1 @@ -38,6 +40,9 @@ jobs: echo "git-tag-type=core" | tee -a "$GITHUB_OUTPUT" echo "ecr-image-name=chainlink/chainlink" | tee -a "$GITHUB_OUTPUT" fi + - name: Check release tag + id: release-tag-check + uses: smartcontractkit/.github/actions/release-tag-check@c5c4a8186da4218cff6cac8184e47dd3dec69ba3 # release-tag-check@0.1.0 - name: Fail if CCIP release has wrong version if: ${{ steps.check-git-tag-type.outputs.git-tag-type == 'ccip' }} run: | @@ -136,3 +141,38 @@ jobs: github.ref_type == 'tag' && needs.build-sign-publish-chainlink.outputs.docker-image-digest || '' }} + crib: + needs: [checks, build-sign-publish-chainlink] + # Only spin up CRIB on pre-releases (beta, rc). + if: needs.checks.outputs.is-pre-release == 'true' + runs-on: ubuntu-latest + environment: integration + permissions: + id-token: write + contents: read + actions: read + steps: + - name: Checkout repository + uses: actions/checkout@v4.2.1 + with: + persist-credentials: false + + - name: Run Core CRIB Integration Tests + uses: ./.github/actions/crib + with: + aws-role-arn: ${{ secrets.AWS_OIDC_CRIB_ROLE_ARN_STAGE }} + aws-region: ${{ secrets.AWS_REGION }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID_PROD }} + api-gw-host-crib: ${{ secrets.AWS_API_GW_HOST_CRIB_STAGE }} + api-gw-host-k8s: ${{ secrets.AWS_API_GW_HOST_K8S_STAGE }} + k8s-api-endpoint: ${{ secrets.GAP_HOST_K8S_STAGE }} + k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} + aws-token-issuer-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} + aws-token-issuer-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} + ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} + k8s-staging-ingress-suffix: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} + gap-url-integration-tests: ${{ secrets.GAP_URL }} + crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} + crib-chainlink-docker-image-name: ${{ format('{0}/{1}', env.ECR_HOSTNAME, needs.checks.outputs.ecr-image-name) }} + crib-chainlink-docker-image-tag: ${{ needs.build-sign-publish-chainlink.outputs.docker-image-tag}} + crib-cleanup-ttl: "3d" diff --git a/.github/workflows/crib-integration-test.yml b/.github/workflows/crib-integration-test.yml index 4592bdbb70a..df29b2e1b6a 100644 --- a/.github/workflows/crib-integration-test.yml +++ b/.github/workflows/crib-integration-test.yml @@ -6,9 +6,11 @@ on: schedule: - cron: "0 1 * * *" workflow_call: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + jobs: test: runs-on: ubuntu-latest @@ -23,102 +25,21 @@ jobs: with: persist-credentials: false - - uses: cachix/install-nix-action@ba0dd844c9180cbf77aa72a116d6fbc515d0e87b # v27 - with: - nix_path: nixpkgs=channel:nixos-unstable - - - name: setup-gap crib - uses: smartcontractkit/.github/actions/setup-gap@00b58566e0ee2761e56d9db0ea72b783fdb89b8d # setup-gap@0.4.0 - with: - aws-role-duration-seconds: 3600 # 1 hour - aws-role-arn: ${{ secrets.AWS_OIDC_CRIB_ROLE_ARN_STAGE }} - api-gateway-host: ${{ secrets.AWS_API_GW_HOST_CRIB_STAGE }} - aws-region: ${{ secrets.AWS_REGION }} - ecr-private-registry: ${{ secrets.AWS_ACCOUNT_ID_PROD }} - k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} - gap-name: crib - use-private-ecr-registry: true - use-tls: true - proxy-port: 8080 - metrics-job-name: "test" - gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }} - gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} - - - name: setup-gap k8s - uses: smartcontractkit/.github/actions/setup-gap@00b58566e0ee2761e56d9db0ea72b783fdb89b8d # setup-gap@0.4.0 + - name: Run CRIB Integration Tests + uses: ./.github/actions/crib with: - aws-role-duration-seconds: 3600 # 1 hour aws-role-arn: ${{ secrets.AWS_OIDC_CRIB_ROLE_ARN_STAGE }} - api-gateway-host: ${{ secrets.AWS_API_GW_HOST_K8S_STAGE }} aws-region: ${{ secrets.AWS_REGION }} - ecr-private-registry: ${{ secrets.AWS_ACCOUNT_ID_PROD }} - k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} - gap-name: k8s - use-private-ecr-registry: true - use-k8s: true - proxy-port: 8443 - metrics-job-name: "test" - gc-basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - gc-host: ${{ secrets.GRAFANA_INTERNAL_HOST }} - gc-org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} - - - name: Setup GitHub token using GATI - id: token - uses: smartcontractkit/.github/actions/setup-github-token@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # main - with: - aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} - aws-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} - aws-region: ${{ secrets.AWS_REGION }} - aws-role-duration-seconds: "1800" - - name: Debug workspace dir - shell: bash - run: | - echo ${{ github.workspace }} - echo $GITHUB_WORKSPACE - - - name: Deploy and validate CRIB Environment for Core - uses: smartcontractkit/.github/actions/crib-deploy-environment@815e0d550527897746e889441407926d7e28169c # crib-deploy-environment@7.4.0 - id: deploy-crib - with: - github-token: ${{ steps.token.outputs.access-token }} - aws-ecr-private-registry: ${{ secrets.AWS_ACCOUNT_ID_PROD }} - aws-region: ${{ secrets.AWS_REGION }} - aws-role-arn: ${{ secrets.AWS_OIDC_CRIB_ROLE_ARN_STAGE }} - ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} + aws-account-id: ${{ secrets.AWS_ACCOUNT_ID_PROD }} + api-gw-host-crib: ${{ secrets.AWS_API_GW_HOST_CRIB_STAGE }} + api-gw-host-k8s: ${{ secrets.AWS_API_GW_HOST_K8S_STAGE }} k8s-api-endpoint: ${{ secrets.GAP_HOST_K8S_STAGE }} k8s-cluster-name: ${{ secrets.AWS_K8S_CLUSTER_NAME_STAGE }} - chainlink-team: releng - chainlink-product: crib - command: "core-dev-simulated-core-ocr1" + aws-token-issuer-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }} + aws-token-issuer-lambda-url: ${{ secrets.AWS_INFRA_RELENG_TOKEN_ISSUER_LAMBDA_URL }} + ingress-base-domain: ${{ secrets.INGRESS_BASE_DOMAIN_STAGE }} + k8s-staging-ingress-suffix: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} + gap-url-integration-tests: ${{ secrets.GAP_URL }} crib-alert-slack-webhook: ${{ secrets.CRIB_ALERT_SLACK_WEBHOOK }} - product-image: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/chainlink - product-image-tag: develop - - uses: actions/checkout@v4.2.1 - with: - persist-credentials: false - - name: Set up Go - uses: ./.github/actions/setup-go - with: - go-version-file: "go.mod" - - name: Run CRIB integration test - working-directory: integration-tests/crib - env: - K8S_STAGING_INGRESS_SUFFIX: ${{ secrets.K8S_STAGING_INGRESS_SUFFIX }} - CRIB_NAMESPACE: ${{ steps.deploy-crib.outputs.devspace-namespace }} - CRIB_NETWORK: geth - CRIB_NODES: 5 - GAP_URL: ${{ secrets.GAP_URL }} - SETH_LOG_LEVEL: info - # RESTY_DEBUG: true - TEST_PERSISTENCE: true - E2E_TEST_CHAINLINK_IMAGE: public.ecr.aws/chainlink/chainlink - E2E_TEST_CHAINLINK_VERSION: latest - run: |- - go test -v -run TestCRIBChaos - - name: Destroy CRIB Environment - id: destroy - if: always() && steps.deploy-crib.outputs.devspace-namespace != '' - uses: smartcontractkit/.github/actions/crib-purge-environment@c0b38e6c40d72d01b8d2f24f92623a2538b3dedb # crib-purge-environment@0.1.0 - with: - namespace: ${{ steps.deploy-crib.outputs.devspace-namespace }} + crib-chainlink-docker-image-name: ${{ secrets.AWS_SDLC_ECR_HOSTNAME }}/chainlink + crib-chainlink-docker-image-tag: develop From 180784b58b052ab05c0634b400cfcb1b29f2e742 Mon Sep 17 00:00:00 2001 From: Lukasz <120112546+lukaszcl@users.noreply.github.com> Date: Mon, 30 Dec 2024 18:39:48 +0100 Subject: [PATCH 10/19] Fix flakeguard run (#15809) --- .github/workflows/flakeguard.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/flakeguard.yml b/.github/workflows/flakeguard.yml index e1c7bbb5f36..0b3adb95fe7 100644 --- a/.github/workflows/flakeguard.yml +++ b/.github/workflows/flakeguard.yml @@ -308,7 +308,7 @@ jobs: GH_INPUTS_PROJECT_PATH: ${{ inputs.projectPath }} GH_INPUTS_MAX_PASS_RATIO: ${{ inputs.maxPassRatio }} CL_DATABASE_URL: ${{ env.DB_URL }} - run: flakeguard run --project-path=$GH_INPUTS_PROJECT_PATH} --test-packages=${{ matrix.testPackages }} --run-count=${{ env.TEST_REPEAT_COUNT }} --max-pass-ratio=$GH_INPUTS_MAX_PASS_RATIO --race=${{ env.RUN_WITH_RACE }} --shuffle=${{ env.RUN_WITH_SHUFFLE }} --shuffle-seed=${{ env.SHUFFLE_SEED }} --skip-tests=${{ env.SKIPPED_TESTS }} --output-json=test-result.json --omit-test-outputs-on-success=${{ env.OMIT_TEST_OUTPUTS_ON_SUCCESS }} + run: flakeguard run --project-path=$GH_INPUTS_PROJECT_PATH --test-packages=${{ matrix.testPackages }} --run-count=${{ env.TEST_REPEAT_COUNT }} --max-pass-ratio=$GH_INPUTS_MAX_PASS_RATIO --race=${{ env.RUN_WITH_RACE }} --shuffle=${{ env.RUN_WITH_SHUFFLE }} --shuffle-seed=${{ env.SHUFFLE_SEED }} --skip-tests=${{ env.SKIPPED_TESTS }} --output-json=test-result.json --omit-test-outputs-on-success=${{ env.OMIT_TEST_OUTPUTS_ON_SUCCESS }} - name: Upload test result as artifact if: always() From e13f07c08a4a2ee0184073fafd327081428119ac Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Mon, 30 Dec 2024 16:21:29 -0500 Subject: [PATCH 11/19] chore: update actions/cache to v4 (#15622) --- .github/actions/setup-go/action.yml | 8 ++++---- .github/actions/setup-hardhat/action.yaml | 4 ++-- .github/actions/setup-solana/action.yml | 2 +- .github/actions/setup-wasmd/action.yml | 2 +- .github/workflows/build-publish-develop-pr.yml | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-go/action.yml b/.github/actions/setup-go/action.yml index e1b15c2b183..9d395795764 100644 --- a/.github/actions/setup-go/action.yml +++ b/.github/actions/setup-go/action.yml @@ -69,7 +69,7 @@ runs: # If multiple jobs call actions/cache, then only one will get priority to create upon a cache miss. # We will only restore the cache by default (by calling actions/cache/restore) and let the # `go-mod-cache.yml` workflow handle the creation. - - uses: actions/cache/restore@v4.1.1 + - uses: actions/cache/restore@v4 if: ${{ inputs.restore-module-cache-only == 'true' }} name: Cache Go Modules with: @@ -83,7 +83,7 @@ runs: # If this is called, then it will create the cache entry upon a cache miss. # The cache is created after a cache miss, and after job completes successfully. - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4 if: ${{ inputs.restore-module-cache-only != 'true' }} name: Cache Go Modules with: @@ -95,7 +95,7 @@ runs: restore-keys: | ${{ runner.os }}-gomod-${{ inputs.cache-version }}- - - uses: actions/cache/restore@v4.1.1 + - uses: actions/cache/restore@v4 name: Cache Go Build Outputs (restore) # For certain events, we don't necessarily want to create a build cache, but we will benefit from restoring from one. if: ${{ inputs.only-modules == 'false' && (github.event_name == 'merge_group' || inputs.restore-build-cache-only == 'true') }} @@ -109,7 +109,7 @@ runs: ${{ runner.os }}-gobuild-${{ inputs.build-cache-version || inputs.cache-version }}- ${{ runner.os }}-gobuild-${{ inputs.cache-version }}- - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4 # don't save cache on merge queue events if: ${{ inputs.only-modules == 'false' && (github.event_name != 'merge_group' && inputs.restore-build-cache-only == 'false') }} name: Cache Go Build Outputs diff --git a/.github/actions/setup-hardhat/action.yaml b/.github/actions/setup-hardhat/action.yaml index a61e61bb5c7..03b7fef90bb 100644 --- a/.github/actions/setup-hardhat/action.yaml +++ b/.github/actions/setup-hardhat/action.yaml @@ -11,13 +11,13 @@ runs: using: composite steps: - name: Cache Compilers - uses: actions/cache@v4.1.1 + uses: actions/cache@v4 with: path: ~/.cache/hardhat-nodejs/ key: contracts-compilers-${{ runner.os }}-${{ inputs.cache-version }}-${{ hashFiles('contracts/pnpm-lock.yaml', 'contracts/hardhat.config.ts') }} - name: Cache contracts build outputs - uses: actions/cache@v4.1.1 + uses: actions/cache@v4 with: path: | contracts/cache/ diff --git a/.github/actions/setup-solana/action.yml b/.github/actions/setup-solana/action.yml index de7c4331abc..e353636f805 100644 --- a/.github/actions/setup-solana/action.yml +++ b/.github/actions/setup-solana/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: composite steps: - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4 id: cache name: Cache solana CLI with: diff --git a/.github/actions/setup-wasmd/action.yml b/.github/actions/setup-wasmd/action.yml index d95e8129260..c1969e82652 100644 --- a/.github/actions/setup-wasmd/action.yml +++ b/.github/actions/setup-wasmd/action.yml @@ -8,7 +8,7 @@ inputs: runs: using: composite steps: - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4 id: cache name: Cache wasmd-build with: diff --git a/.github/workflows/build-publish-develop-pr.yml b/.github/workflows/build-publish-develop-pr.yml index c8bb60aa66f..85f29a15cb0 100644 --- a/.github/workflows/build-publish-develop-pr.yml +++ b/.github/workflows/build-publish-develop-pr.yml @@ -105,7 +105,7 @@ jobs: role-session-name: "split-${{ matrix.goarch }}" - id: cache - uses: actions/cache@v4.1.1 + uses: actions/cache@v4 with: path: dist/${{ matrix.dist_name }} key: chainlink-${{ matrix.goarch }}-${{ github.sha }} @@ -142,13 +142,13 @@ jobs: mask-aws-account-id: true role-session-name: "merge" - - uses: actions/cache/restore@v4.1.1 + - uses: actions/cache/restore@v4 with: path: dist/linux_amd64_v1 key: chainlink-amd64-${{ github.sha }} fail-on-cache-miss: true - - uses: actions/cache/restore@v4.1.1 + - uses: actions/cache/restore@v4 with: path: dist/linux_arm64_v8.0 key: chainlink-arm64-${{ github.sha }} From 945c706956765673adbbd828339a8cd0de3b3a72 Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Thu, 2 Jan 2025 10:12:59 -0800 Subject: [PATCH 12/19] chore: cleanup ci-core (#15779) * chore: cleanup ci-core * chore: rename Flakeguard workflow --- .github/workflows/ci-core.yml | 189 ++++------------------------ .github/workflows/ci-flakeguard.yml | 70 +++++++++++ 2 files changed, 93 insertions(+), 166 deletions(-) create mode 100644 .github/workflows/ci-flakeguard.yml diff --git a/.github/workflows/ci-core.yml b/.github/workflows/ci-core.yml index b0627bb9e51..62187edfce4 100644 --- a/.github/workflows/ci-core.yml +++ b/.github/workflows/ci-core.yml @@ -15,17 +15,6 @@ on: pull_request: schedule: - cron: "0 0,6,12,18 * * *" - workflow_dispatch: - inputs: - distinct_run_name: - description: "A unique identifier for this run, used when running from other repos" - required: false - type: string - evm-ref: - description: The chainlink-evm reference to use when testing against a specific version for compatibliity - required: false - default: "" - type: string jobs: filter: @@ -33,11 +22,27 @@ jobs: permissions: pull-requests: read outputs: - affected-packages: ${{ steps.resolved-modules.outputs.module_names }} + affected-modules: ${{ steps.resolved-modules.outputs.module_names }} deployment-changes: ${{ steps.match-some.outputs.deployment == 'true' }} scripts-changes: ${{ steps.match-some.outputs.scripts == 'true' }} - should-run-ci-core: ${{ steps.match-some.outputs.core-ci == 'true' || steps.match-every.outputs.non-ignored == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} - should-run-golangci: ${{ steps.match-some.outputs.golang-ci == 'true' || steps.match-every.outputs.non-ignored == 'true' || github.event_name == 'workflow_dispatch' }} + should-run-ci-core: >- + ${{ + steps.match-some.outputs.core-ci == 'true' || + steps.match-every.outputs.non-ignored == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' + }} + should-run-golangci: >- + ${{ + steps.match-some.outputs.golang-ci == 'true' || + steps.match-every.outputs.non-ignored == 'true' + }} + should-run-scripts-test: >- + ${{ + steps.match-some.outputs.scripts == 'true' || + github.event_name == 'schedule' || + github.event_name == 'workflow_dispatch' + }} runs-on: ubuntu-latest steps: - name: Checkout the repo @@ -126,7 +131,7 @@ jobs: strategy: fail-fast: false matrix: - modules: ${{ fromJson(needs.filter.outputs.affected-packages) }} + modules: ${{ fromJson(needs.filter.outputs.affected-modules) }} steps: - name: Checkout uses: actions/checkout@v4.2.1 @@ -151,8 +156,6 @@ jobs: golangci-matrix-results-validation: name: lint needs: [golangci] - # We don't directly merge dependabot PRs to not waste the resources. - if: ${{ (github.event_name == 'pull_request' || github.event_name == 'schedule') && github.actor != 'dependabot[bot]' }} runs-on: ubuntu-latest steps: - name: Check Golangci-lint Matrix Results @@ -217,13 +220,6 @@ jobs: restore-build-cache-only: ${{ matrix.type.cmd == 'go_core_fuzz' }} build-cache-version: ${{ matrix.type.cmd }} - - name: Replace chainlink-evm deps - if: ${{ needs.filter.outputs.should-run-ci-core == 'true' && inputs.evm-ref != ''}} - env: - GH_INPUTS_EVM_REF: ${{ inputs.evm-ref }} - shell: bash - run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@$GH_INPUTS_EVM_REF - - name: Setup Solana if: ${{ needs.filter.outputs.should-run-ci-core == 'true' }} uses: ./.github/actions/setup-solana @@ -336,7 +332,7 @@ jobs: name: test-scripts needs: [filter] runs-on: ubuntu-latest - if: ${{ github.event_name == 'schedule' || needs.filter.outputs.scripts-changes == 'true' }} + if: ${{ needs.filter.outputs.should-run-scripts-test == 'true' }} steps: - name: Checkout uses: actions/checkout@v4.2.1 @@ -353,7 +349,7 @@ jobs: run: ./tools/bin/go_core_scripts_tests ./... - name: Store test report artifacts - if: ${{ always() && needs.filter.outputs.should-run-ci-core == 'true' }} + if: ${{ always() }} uses: actions/upload-artifact@v4.4.3 with: name: go_core_scripts_tests_logs @@ -362,98 +358,6 @@ jobs: ./coverage.txt retention-days: 7 - detect-flakey-tests: - needs: [filter, core, core-scripts-tests] - name: Flakey Test Detection - runs-on: ubuntu-latest - if: always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') - env: - CL_DATABASE_URL: postgresql://postgres:postgres@localhost:5432/chainlink_test?sslmode=disable - permissions: - id-token: write - contents: read - steps: - - name: Checkout the repo - uses: actions/checkout@v4.2.1 - with: - persist-credentials: false - - - name: Setup node - uses: actions/setup-node@v4.0.4 - - - name: Setup NodeJS - uses: ./.github/actions/setup-nodejs - with: - prod: "true" - - - name: Setup Go - uses: ./.github/actions/setup-go - - - name: Setup Postgres - uses: ./.github/actions/setup-postgres - - - name: Touching core/web/assets/index.html - run: mkdir -p core/web/assets && touch core/web/assets/index.html - - - name: Download Go vendor packages - run: go mod download - - - name: Replace chainlink-evm deps - if: ${{ github.event_name == 'workflow_dispatch' && inputs.evm-ref != ''}} - env: - GH_INPUTS_EVM_REF: ${{ inputs.evm-ref }} - shell: bash - run: go get github.com/smartcontractkit/chainlink-integrations/evm/relayer@$GH_INPUTS_EVM_REF - - - name: Build binary - run: go build -o chainlink.test . - - - name: Setup DB - run: ./chainlink.test local db preparetest - - - name: Load test outputs - uses: actions/download-artifact@v4.1.8 - with: - name: go_core_tests_logs - path: ./artifacts - - - name: Delete go_core_tests_logs/coverage.txt - shell: bash - run: | - # Need to delete coverage.txt so the disk doesn't fill up - rm -f ./artifacts/go_core_tests_logs/coverage.txt - - - name: Build flakey test runner - run: go build ./tools/flakeytests/cmd/runner - - - name: Re-run tests - env: - GRAFANA_INTERNAL_BASIC_AUTH: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} - GRAFANA_INTERNAL_HOST: ${{ secrets.GRAFANA_INTERNAL_HOST }} - GITHUB_EVENT_PATH: ${{ github.event_path }} - GITHUB_EVENT_NAME: ${{ github.event_name }} - GITHUB_REPO: ${{ github.repository }} - GITHUB_RUN_ID: ${{ github.run_id }} - run: | - ./runner \ - -grafana_auth=$GRAFANA_INTERNAL_BASIC_AUTH \ - -grafana_host=$GRAFANA_INTERNAL_HOST \ - -gh_sha=$GITHUB_SHA \ - -gh_event_path=$GITHUB_EVENT_PATH \ - -gh_event_name=$GITHUB_EVENT_NAME \ - -gh_run_id=$GITHUB_RUN_ID \ - -gh_repo=$GITHUB_REPO \ - -command=./tools/bin/go_core_tests \ - `ls -R ./artifacts/output.txt` - - name: Store logs artifacts - if: ${{ always() }} - uses: actions/upload-artifact@v4.4.3 - with: - name: flakey_test_runner_logs - path: | - ./output.txt - retention-days: 7 - scan: name: SonarQube Scan needs: [golangci, core, core-scripts-tests] @@ -556,61 +460,14 @@ jobs: SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} SONAR_SCANNER_OPTS: "-Xms6g -Xmx8g" - trigger-flaky-test-detection-for-root-project: - name: Flakeguard Root Project - uses: ./.github/workflows/flakeguard.yml - if: ${{ github.event_name == 'pull_request' }} - with: - repoUrl: 'https://github.com/smartcontractkit/chainlink' - projectPath: '.' - baseRef: ${{ github.base_ref }} - headRef: ${{ github.head_ref }} - maxPassRatio: '1.0' - findByTestFilesDiff: true - findByAffectedPackages: false - slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications - extraArgs: '{ "skipped_tests": "TestChainComponents", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }' - secrets: - SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} - FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} - - trigger-flaky-test-detection-for-deployment-project: - name: Flakeguard Deployment Project - uses: ./.github/workflows/flakeguard.yml - needs: [filter] - if: ${{ github.event_name == 'pull_request' && needs.filter.outputs.deployment-changes == 'true'}} - with: - repoUrl: 'https://github.com/smartcontractkit/chainlink' - projectPath: 'deployment' - baseRef: ${{ github.base_ref }} - headRef: ${{ github.head_ref }} - maxPassRatio: '1.0' - findByTestFilesDiff: true - findByAffectedPackages: false - slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications - extraArgs: '{ "skipped_tests": "TestAddLane", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }' - secrets: - SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} - FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} - - clean: name: Clean Go Tidy & Generate - if: ${{ !contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') && github.actor != 'dependabot[bot]' }} + if: ${{ github.actor != 'dependabot[bot]' }} runs-on: ubuntu22.04-8cores-32GB defaults: run: shell: bash steps: - - name: Check for Skip Tests Label - if: contains(join(github.event.pull_request.labels.*.name, ' '), 'skip-smoke-tests') - run: | - echo "## \`skip-smoke-tests\` label is active, skipping E2E smoke tests" >>$GITHUB_STEP_SUMMARY - exit 0 - uses: actions/checkout@v4.2.1 with: persist-credentials: false diff --git a/.github/workflows/ci-flakeguard.yml b/.github/workflows/ci-flakeguard.yml new file mode 100644 index 00000000000..caf6a62a3fb --- /dev/null +++ b/.github/workflows/ci-flakeguard.yml @@ -0,0 +1,70 @@ +name: Flakeguard CI Core + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +# Run on key branches to make sure integration is good, otherwise run on all PR's +on: + pull_request: + +jobs: + + detect-changes: + name: Detect Changes + permissions: + pull-requests: read + outputs: + deployment-changes: ${{ steps.some.outputs.deployment == 'true' }} + runs-on: ubuntu-latest + steps: + - name: Checkout the repo + uses: actions/checkout@v4.2.1 + with: + persist-credentials: false + - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: some + with: + filters: | + deployment: + - 'deployment/**' + + trigger-flaky-test-detection-for-root-project: + name: Flakeguard Root Project + uses: ./.github/workflows/flakeguard.yml + with: + repoUrl: 'https://github.com/smartcontractkit/chainlink' + projectPath: '.' + baseRef: ${{ github.base_ref }} + headRef: ${{ github.head_ref }} + maxPassRatio: '1.0' + findByTestFilesDiff: true + findByAffectedPackages: false + slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications + extraArgs: '{ "skipped_tests": "TestChainComponents", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }' + secrets: + SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} + FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} + + trigger-flaky-test-detection-for-deployment-project: + name: Flakeguard Deployment Project + uses: ./.github/workflows/flakeguard.yml + needs: [detect-changes] + if: ${{ needs.detect-changes.outputs.deployment-changes == 'true'}} + with: + repoUrl: 'https://github.com/smartcontractkit/chainlink' + projectPath: 'deployment' + baseRef: ${{ github.base_ref }} + headRef: ${{ github.head_ref }} + maxPassRatio: '1.0' + findByTestFilesDiff: true + findByAffectedPackages: false + slackNotificationAfterTestsChannelId: 'C07TRF65CNS' #flaky-test-detector-notifications + extraArgs: '{ "skipped_tests": "TestAddLane", "run_with_race": "true", "print_failed_tests": "true", "test_repeat_count": "3", "omit_test_outputs_on_success": "true" }' + secrets: + SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FLAKEGUARD_SPLUNK_ENDPOINT: ${{ secrets.FLAKEGUARD_SPLUNK_ENDPOINT }} + FLAKEGUARD_SPLUNK_HEC: ${{ secrets.FLAKEGUARD_SPLUNK_HEC }} From 42d02c2433a7952fc329c256c2b05be959f5b3a1 Mon Sep 17 00:00:00 2001 From: Brandon West <3317895+Bwest981@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:57:04 -0500 Subject: [PATCH 13/19] Merge release/2.19.0 to develop (#15824) * Bump version and update CHANGELOG for core v2.19.0 Signed-off-by: bwest981 <3317895+Bwest981@users.noreply.github.com> * [Keystone] Disable remote calls to RegisterToWorkflow (#15352) * [Keystone] Disable remote calls to RegisterToWorkflow * Remove failing test --------- Co-authored-by: Cedric Cordenier * [KS-490] Support per-step timeout overrides in the Engine (#15367) * testdata/scripts/nodes/evm/list: add test; common/client: fix names in multinode state map [v2.19] (#15372) (cherry picked from commit 0cabe54f8535a466a5404bac67396071ec058d94) Co-authored-by: Brandon West <3317895+Bwest981@users.noreply.github.com> * Consume latest changeset and update changelog (#15431) * Consume latest changeset and update changelog * Update CHANGELOG.md * bumping wsrpc (#15549) (#15550) * bumping wsrpc (#15549) * Update go.mod * make gomodtidy --------- Co-authored-by: Patrick * Finalizer fix (#15457) (#15577) * Finalizer fix * Add changeset * Update changeset to include clearing txs bugfix (#15578) * Finalize date on changelog for 2.19.0 (#15670) Signed-off-by: bwest981 <3317895+Bwest981@users.noreply.github.com> --------- Signed-off-by: bwest981 <3317895+Bwest981@users.noreply.github.com> Co-authored-by: Bolek <1416262+bolekk@users.noreply.github.com> Co-authored-by: Cedric Cordenier Co-authored-by: Jordan Krage Co-authored-by: Patrick Co-authored-by: Dimitris Grigoriou Co-authored-by: chainchad <96362174+chainchad@users.noreply.github.com> --- .changeset/brave-frogs-greet.md | 5 -- .changeset/breezy-suits-float.md | 5 -- .changeset/cool-feet-happen.md | 5 -- .changeset/cool-owls-laugh.md | 5 -- .changeset/cyan-hairs-obey.md | 5 -- .changeset/famous-ligers-heal.md | 5 -- .changeset/few-sloths-explain.md | 5 -- .changeset/forty-foxes-watch.md | 5 -- .changeset/four-kangaroos-appear.md | 5 -- .changeset/fresh-boxes-taste.md | 5 -- .changeset/fuzzy-dodos-travel.md | 5 -- .changeset/giant-cats-run.md | 5 -- .changeset/good-chairs-boil.md | 5 -- .changeset/good-roses-smash.md | 5 -- .changeset/great-spiders-greet.md | 5 -- .changeset/happy-tips-nail.md | 5 -- .changeset/healthy-shirts-remain.md | 5 -- .changeset/hip-clocks-joke.md | 5 -- .changeset/honest-bugs-grin.md | 7 -- .changeset/hot-mice-yell.md | 5 -- .changeset/hot-pants-clean.md | 5 -- .changeset/late-windows-clean.md | 11 --- .changeset/lemon-ads-fix.md | 5 -- .changeset/lovely-glasses-film.md | 5 -- .changeset/many-carrots-share.md | 5 -- .changeset/metal-forks-arrive.md | 5 -- .changeset/neat-singers-notice.md | 5 -- .changeset/nine-stingrays-march.md | 5 -- .changeset/perfect-peaches-work.md | 5 -- .changeset/purple-seas-help.md | 5 -- .changeset/purple-shrimps-invent.md | 5 -- .changeset/rotten-timers-give.md | 6 -- .changeset/rude-geckos-switch.md | 5 -- .changeset/seven-schools-invent.md | 5 -- .changeset/short-gifts-eat.md | 5 -- .changeset/silent-goats-jog.md | 5 -- .changeset/six-wombats-shake.md | 5 -- .changeset/sixty-queens-wait.md | 5 -- .changeset/small-gifts-play.md | 5 -- .changeset/strange-radios-teach.md | 5 -- .changeset/swift-fireants-compare.md | 5 -- .changeset/tame-tomatoes-refuse.md | 5 -- .changeset/tasty-years-behave.md | 5 -- .changeset/tender-colts-return.md | 5 -- .changeset/thick-chefs-deliver.md | 5 -- .changeset/three-mayflies-learn.md | 5 -- .changeset/tricky-candles-matter.md | 5 -- .changeset/two-spies-arrive.md | 5 -- .changeset/weak-weeks-grin.md | 5 -- CHANGELOG.md | 118 +++++++++++++++++++++++++++ package.json | 2 +- 51 files changed, 119 insertions(+), 255 deletions(-) delete mode 100644 .changeset/brave-frogs-greet.md delete mode 100644 .changeset/breezy-suits-float.md delete mode 100644 .changeset/cool-feet-happen.md delete mode 100644 .changeset/cool-owls-laugh.md delete mode 100644 .changeset/cyan-hairs-obey.md delete mode 100644 .changeset/famous-ligers-heal.md delete mode 100644 .changeset/few-sloths-explain.md delete mode 100644 .changeset/forty-foxes-watch.md delete mode 100644 .changeset/four-kangaroos-appear.md delete mode 100644 .changeset/fresh-boxes-taste.md delete mode 100644 .changeset/fuzzy-dodos-travel.md delete mode 100644 .changeset/giant-cats-run.md delete mode 100644 .changeset/good-chairs-boil.md delete mode 100644 .changeset/good-roses-smash.md delete mode 100644 .changeset/great-spiders-greet.md delete mode 100644 .changeset/happy-tips-nail.md delete mode 100644 .changeset/healthy-shirts-remain.md delete mode 100644 .changeset/hip-clocks-joke.md delete mode 100644 .changeset/honest-bugs-grin.md delete mode 100644 .changeset/hot-mice-yell.md delete mode 100644 .changeset/hot-pants-clean.md delete mode 100644 .changeset/late-windows-clean.md delete mode 100644 .changeset/lemon-ads-fix.md delete mode 100644 .changeset/lovely-glasses-film.md delete mode 100644 .changeset/many-carrots-share.md delete mode 100644 .changeset/metal-forks-arrive.md delete mode 100644 .changeset/neat-singers-notice.md delete mode 100644 .changeset/nine-stingrays-march.md delete mode 100644 .changeset/perfect-peaches-work.md delete mode 100644 .changeset/purple-seas-help.md delete mode 100644 .changeset/purple-shrimps-invent.md delete mode 100644 .changeset/rotten-timers-give.md delete mode 100644 .changeset/rude-geckos-switch.md delete mode 100644 .changeset/seven-schools-invent.md delete mode 100644 .changeset/short-gifts-eat.md delete mode 100644 .changeset/silent-goats-jog.md delete mode 100644 .changeset/six-wombats-shake.md delete mode 100644 .changeset/sixty-queens-wait.md delete mode 100644 .changeset/small-gifts-play.md delete mode 100644 .changeset/strange-radios-teach.md delete mode 100644 .changeset/swift-fireants-compare.md delete mode 100644 .changeset/tame-tomatoes-refuse.md delete mode 100644 .changeset/tasty-years-behave.md delete mode 100644 .changeset/tender-colts-return.md delete mode 100644 .changeset/thick-chefs-deliver.md delete mode 100644 .changeset/three-mayflies-learn.md delete mode 100644 .changeset/tricky-candles-matter.md delete mode 100644 .changeset/two-spies-arrive.md delete mode 100644 .changeset/weak-weeks-grin.md diff --git a/.changeset/brave-frogs-greet.md b/.changeset/brave-frogs-greet.md deleted file mode 100644 index 907e8f1ee75..00000000000 --- a/.changeset/brave-frogs-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -update plugin and evm chainwriter to remove evmConfig dependency #updated diff --git a/.changeset/breezy-suits-float.md b/.changeset/breezy-suits-float.md deleted file mode 100644 index 60e061223d8..00000000000 --- a/.changeset/breezy-suits-float.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#added address book remove feature diff --git a/.changeset/cool-feet-happen.md b/.changeset/cool-feet-happen.md deleted file mode 100644 index 8d4aa22e79c..00000000000 --- a/.changeset/cool-feet-happen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Ensure RPCClient with enabled polling respects health check flag #internal diff --git a/.changeset/cool-owls-laugh.md b/.changeset/cool-owls-laugh.md deleted file mode 100644 index a3667ed20e0..00000000000 --- a/.changeset/cool-owls-laugh.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Bump to start the next version diff --git a/.changeset/cyan-hairs-obey.md b/.changeset/cyan-hairs-obey.md deleted file mode 100644 index 8bff6c8aad0..00000000000 --- a/.changeset/cyan-hairs-obey.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#added support enable and disable feed manager diff --git a/.changeset/famous-ligers-heal.md b/.changeset/famous-ligers-heal.md deleted file mode 100644 index e469ea85785..00000000000 --- a/.changeset/famous-ligers-heal.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Set `NodePool.EnforceRepeatableRead = true` by default for all chains. This forces Core to stop using RPCs behind on the latest finalized block. #changed #nops diff --git a/.changeset/few-sloths-explain.md b/.changeset/few-sloths-explain.md deleted file mode 100644 index 78efd6cc7f3..00000000000 --- a/.changeset/few-sloths-explain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#updated ignoring tx type 126 on celo diff --git a/.changeset/forty-foxes-watch.md b/.changeset/forty-foxes-watch.md deleted file mode 100644 index cb118d50021..00000000000 --- a/.changeset/forty-foxes-watch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Updated Solana TXM's in-memory storage to track statuses across the Solana transaction lifecycle. Added a method to translate Solana transaction statuses into states expected by the ChainWriter interface. Made the duration transactions are retained in storage after finality or error configurable using `TxRetentionTimeout`. #added diff --git a/.changeset/four-kangaroos-appear.md b/.changeset/four-kangaroos-appear.md deleted file mode 100644 index b8ef32ff69e..00000000000 --- a/.changeset/four-kangaroos-appear.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Add config validation so it requires ws url when http polling disabled #bugfix diff --git a/.changeset/fresh-boxes-taste.md b/.changeset/fresh-boxes-taste.md deleted file mode 100644 index ab68bdb5cfc..00000000000 --- a/.changeset/fresh-boxes-taste.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Implement secrets interpolation with dummy workflow registry syncer #internal diff --git a/.changeset/fuzzy-dodos-travel.md b/.changeset/fuzzy-dodos-travel.md deleted file mode 100644 index 8c79beb73d4..00000000000 --- a/.changeset/fuzzy-dodos-travel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#changed UI(chainconfig): make admin address optional diff --git a/.changeset/giant-cats-run.md b/.changeset/giant-cats-run.md deleted file mode 100644 index 22a0cde247d..00000000000 --- a/.changeset/giant-cats-run.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#internal Add tokenDestGasOverhead to CalculateMessageMaxGas diff --git a/.changeset/good-chairs-boil.md b/.changeset/good-chairs-boil.md deleted file mode 100644 index ead73f68103..00000000000 --- a/.changeset/good-chairs-boil.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#added Enable and Disable Feeds Manager mutations diff --git a/.changeset/good-roses-smash.md b/.changeset/good-roses-smash.md deleted file mode 100644 index 3efa2dd439f..00000000000 --- a/.changeset/good-roses-smash.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#internal Fix Contract Reader data word index calculation and change ccip contract reader config for more optimal querying. diff --git a/.changeset/great-spiders-greet.md b/.changeset/great-spiders-greet.md deleted file mode 100644 index cd8e20a32a6..00000000000 --- a/.changeset/great-spiders-greet.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Fixed outdated headtracker config doc. #internal diff --git a/.changeset/happy-tips-nail.md b/.changeset/happy-tips-nail.md deleted file mode 100644 index ad42dc47beb..00000000000 --- a/.changeset/happy-tips-nail.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#updated bump CTF to v1.50.13, more robust ethereum client compatibility pipeline diff --git a/.changeset/healthy-shirts-remain.md b/.changeset/healthy-shirts-remain.md deleted file mode 100644 index 0ce310e1ce3..00000000000 --- a/.changeset/healthy-shirts-remain.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#removed Remove unused deprecated key interfaces. diff --git a/.changeset/hip-clocks-joke.md b/.changeset/hip-clocks-joke.md deleted file mode 100644 index 21f53718b22..00000000000 --- a/.changeset/hip-clocks-joke.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#internal OracleFactory error handling change diff --git a/.changeset/honest-bugs-grin.md b/.changeset/honest-bugs-grin.md deleted file mode 100644 index 7d3ff3c7848..00000000000 --- a/.changeset/honest-bugs-grin.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"chainlink": minor ---- - -#updated -update ethkeys, ethtransactions to handle duplicate chain id in different network -introduce network arg input to Chain graphql query to allow better lookup based on network and chain id diff --git a/.changeset/hot-mice-yell.md b/.changeset/hot-mice-yell.md deleted file mode 100644 index 9d170e1f15c..00000000000 --- a/.changeset/hot-mice-yell.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Relocation of the deployment directory into a direct subdir of the root. #internal diff --git a/.changeset/hot-pants-clean.md b/.changeset/hot-pants-clean.md deleted file mode 100644 index efd9a85baa3..00000000000 --- a/.changeset/hot-pants-clean.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Minor fixes to the CCIPChainReader enabling proper serialization #internal diff --git a/.changeset/late-windows-clean.md b/.changeset/late-windows-clean.md deleted file mode 100644 index 261747efa6c..00000000000 --- a/.changeset/late-windows-clean.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -"chainlink": minor ---- - -#internal Updated the TXM confirmation logic to use the mined transaction count to identify re-org'd or confirmed transactions. - -- Confirmer uses the mined transaction count to determine if transactions have been re-org'd or confirmed. -- Confirmer no longer sets transaction states to `confirmed_missing_receipt`. This state is maintained in queries for backwards compatibility. -- Finalizer now responsible for fetching and storing receipts for confirmed transactions. -- Finalizer now responsible for resuming pending task runs. -- Finalizer now responsible for marking old transactions without receipts broadcasted before the finalized head as fatal. diff --git a/.changeset/lemon-ads-fix.md b/.changeset/lemon-ads-fix.md deleted file mode 100644 index f7f3438eb23..00000000000 --- a/.changeset/lemon-ads-fix.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#added Handle Hex String in EA Telemetry diff --git a/.changeset/lovely-glasses-film.md b/.changeset/lovely-glasses-film.md deleted file mode 100644 index 2289c2c0a67..00000000000 --- a/.changeset/lovely-glasses-film.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Use correct OCR2OracleSpecID when setting up RequestedRoundTracker #bugfix diff --git a/.changeset/many-carrots-share.md b/.changeset/many-carrots-share.md deleted file mode 100644 index da22ac6ed4f..00000000000 --- a/.changeset/many-carrots-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#internal Update ccip contract reader cfg for ccip message sent to use output codec wrapper modifier diff --git a/.changeset/metal-forks-arrive.md b/.changeset/metal-forks-arrive.md deleted file mode 100644 index 21b99b3ddb1..00000000000 --- a/.changeset/metal-forks-arrive.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Adds new custom calldata DA oracle #added diff --git a/.changeset/neat-singers-notice.md b/.changeset/neat-singers-notice.md deleted file mode 100644 index 6eff83c0c15..00000000000 --- a/.changeset/neat-singers-notice.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Added multiple blocks history estimator feature and config for Solana TXM. #added diff --git a/.changeset/nine-stingrays-march.md b/.changeset/nine-stingrays-march.md deleted file mode 100644 index c2f88d95663..00000000000 --- a/.changeset/nine-stingrays-march.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Add don_id to Mercury Enhanced EA telemetry #added diff --git a/.changeset/perfect-peaches-work.md b/.changeset/perfect-peaches-work.md deleted file mode 100644 index 9a3b461e1c9..00000000000 --- a/.changeset/perfect-peaches-work.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Fix flaky WS test server #internal diff --git a/.changeset/purple-seas-help.md b/.changeset/purple-seas-help.md deleted file mode 100644 index 01f8b0049b6..00000000000 --- a/.changeset/purple-seas-help.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#removed unused key files and move public_key test file. diff --git a/.changeset/purple-shrimps-invent.md b/.changeset/purple-shrimps-invent.md deleted file mode 100644 index 3db195434de..00000000000 --- a/.changeset/purple-shrimps-invent.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Upgrade go-ethereum to v1.14.11 #internal diff --git a/.changeset/rotten-timers-give.md b/.changeset/rotten-timers-give.md deleted file mode 100644 index ef474a17d56..00000000000 --- a/.changeset/rotten-timers-give.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"chainlink": minor ---- - -Support multiple chains evm clients for TXM gas estimator to fetch L1 gas oracle -#added diff --git a/.changeset/rude-geckos-switch.md b/.changeset/rude-geckos-switch.md deleted file mode 100644 index 866b1c40c63..00000000000 --- a/.changeset/rude-geckos-switch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#bugfix Update Log.Level and MaxSize configs description in the docs diff --git a/.changeset/seven-schools-invent.md b/.changeset/seven-schools-invent.md deleted file mode 100644 index 81b6ce44b99..00000000000 --- a/.changeset/seven-schools-invent.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Integration tests for USDC token transfer #internal diff --git a/.changeset/short-gifts-eat.md b/.changeset/short-gifts-eat.md deleted file mode 100644 index afc171715d4..00000000000 --- a/.changeset/short-gifts-eat.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -use last mined nonce instead of pending nonce to recover from occasional nonce gap issues within nonce tracker. #internal diff --git a/.changeset/silent-goats-jog.md b/.changeset/silent-goats-jog.md deleted file mode 100644 index 3428ee20b17..00000000000 --- a/.changeset/silent-goats-jog.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Fix HeadTracker tests caused by simulated client update #internal diff --git a/.changeset/six-wombats-shake.md b/.changeset/six-wombats-shake.md deleted file mode 100644 index 448cf03bd51..00000000000 --- a/.changeset/six-wombats-shake.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -CCIP token transfer integration tests #internal diff --git a/.changeset/sixty-queens-wait.md b/.changeset/sixty-queens-wait.md deleted file mode 100644 index cd9fc9ea65c..00000000000 --- a/.changeset/sixty-queens-wait.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#updated chain config: allow chain id and account address to be manually provided when no selections are available diff --git a/.changeset/small-gifts-play.md b/.changeset/small-gifts-play.md deleted file mode 100644 index a9486a033ef..00000000000 --- a/.changeset/small-gifts-play.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#updated Operator UI to support StreamSpec job definition diff --git a/.changeset/strange-radios-teach.md b/.changeset/strange-radios-teach.md deleted file mode 100644 index ea84bfbf359..00000000000 --- a/.changeset/strange-radios-teach.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Merge raw configs correctly #bugfix diff --git a/.changeset/swift-fireants-compare.md b/.changeset/swift-fireants-compare.md deleted file mode 100644 index b11c516e7c3..00000000000 --- a/.changeset/swift-fireants-compare.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -Add CSA authentication support to Beholder #added diff --git a/.changeset/tame-tomatoes-refuse.md b/.changeset/tame-tomatoes-refuse.md deleted file mode 100644 index 530f9d2b519..00000000000 --- a/.changeset/tame-tomatoes-refuse.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#added feat: support creating solana chain config in job distributor page diff --git a/.changeset/tasty-years-behave.md b/.changeset/tasty-years-behave.md deleted file mode 100644 index 08019e3dafa..00000000000 --- a/.changeset/tasty-years-behave.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Modify release changelog generation format #internal diff --git a/.changeset/tender-colts-return.md b/.changeset/tender-colts-return.md deleted file mode 100644 index 16c0b2da1ff..00000000000 --- a/.changeset/tender-colts-return.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#updated celo alfajores config diff --git a/.changeset/thick-chefs-deliver.md b/.changeset/thick-chefs-deliver.md deleted file mode 100644 index 67d68d22792..00000000000 --- a/.changeset/thick-chefs-deliver.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Enable AutoPurge feature on all affected chains #nops diff --git a/.changeset/three-mayflies-learn.md b/.changeset/three-mayflies-learn.md deleted file mode 100644 index 1ea4fad3924..00000000000 --- a/.changeset/three-mayflies-learn.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": minor ---- - -#updated Update few incorrect occurences of the password for notreal@fakeemail.ch. diff --git a/.changeset/tricky-candles-matter.md b/.changeset/tricky-candles-matter.md deleted file mode 100644 index 0dc7806703a..00000000000 --- a/.changeset/tricky-candles-matter.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#bugfix Memory leak fix on promwrapper diff --git a/.changeset/two-spies-arrive.md b/.changeset/two-spies-arrive.md deleted file mode 100644 index cb46c46bce6..00000000000 --- a/.changeset/two-spies-arrive.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -#updated Use labelers from `chainlink-common` diff --git a/.changeset/weak-weeks-grin.md b/.changeset/weak-weeks-grin.md deleted file mode 100644 index df03df2303c..00000000000 --- a/.changeset/weak-weeks-grin.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"chainlink": patch ---- - -Bump Solana to include MultiNode integration. #added diff --git a/CHANGELOG.md b/CHANGELOG.md index 544cf09e5b4..d5b6332c5a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,122 @@ # Changelog Chainlink Core +## 2.19.0 - 2024-12-12 + +### Minor Changes + +- [#15126](https://github.com/smartcontractkit/chainlink/pull/15126) [`bf9b08c331`](https://github.com/smartcontractkit/chainlink/commit/bf9b08c33119d14a34c4914a3a7cc94ea6cb5481) - update plugin and evm chainwriter to remove evmConfig dependency #updated + +- [#15148](https://github.com/smartcontractkit/chainlink/pull/15148) [`07a2cec532`](https://github.com/smartcontractkit/chainlink/commit/07a2cec532704aebe413a9fa29edc04bd9063677) - #added address book remove feature + +- [#14898](https://github.com/smartcontractkit/chainlink/pull/14898) [`a417740359`](https://github.com/smartcontractkit/chainlink/commit/a41774035961ce88be2fed7c6759758a7f00881d) - Bump to start the next version + +- [#15010](https://github.com/smartcontractkit/chainlink/pull/15010) [`c162226424`](https://github.com/smartcontractkit/chainlink/commit/c1622264243c2ee83ff7ba54989cfe789a8da53c) - #added support enable and disable feed manager + +- [#15104](https://github.com/smartcontractkit/chainlink/pull/15104) [`cf7db16483`](https://github.com/smartcontractkit/chainlink/commit/cf7db164832ea95354a3c953126c2fd32a59afd7) - Updated Solana TXM's in-memory storage to track statuses across the Solana transaction lifecycle. Added a method to translate Solana transaction statuses into states expected by the ChainWriter interface. Made the duration transactions are retained in storage after finality or error configurable using `TxRetentionTimeout`. #added + +- [#14880](https://github.com/smartcontractkit/chainlink/pull/14880) [`af8132361b`](https://github.com/smartcontractkit/chainlink/commit/af8132361b3fbd6858a792c4814d144582e6467b) - Implement secrets interpolation with dummy workflow registry syncer #internal + +- [#14993](https://github.com/smartcontractkit/chainlink/pull/14993) [`883d993dc6`](https://github.com/smartcontractkit/chainlink/commit/883d993dc6f58b561787c0e287ed121a08ce550d) - #changed UI(chainconfig): make admin address optional + +- [#14937](https://github.com/smartcontractkit/chainlink/pull/14937) [`3ad089f664`](https://github.com/smartcontractkit/chainlink/commit/3ad089f6644ed54cb21421e84a01b9628c15e205) - #added Enable and Disable Feeds Manager mutations + +- [#14935](https://github.com/smartcontractkit/chainlink/pull/14935) [`c042b627f1`](https://github.com/smartcontractkit/chainlink/commit/c042b627f1fb3a8e6009314c4c2e4daa3c7659c7) - #internal Fix Contract Reader data word index calculation and change ccip contract reader config for more optimal querying. + +- [#15210](https://github.com/smartcontractkit/chainlink/pull/15210) [`7ff9cf9916`](https://github.com/smartcontractkit/chainlink/commit/7ff9cf9916ae1648ccc3475c86e45c9df6ab8d1f) - #removed Remove unused deprecated key interfaces. + +- [#14791](https://github.com/smartcontractkit/chainlink/pull/14791) [`090063799c`](https://github.com/smartcontractkit/chainlink/commit/090063799cd2fd62646c383bf2d2e42d25225c40) - #updated + update ethkeys, ethtransactions to handle duplicate chain id in different network + introduce network arg input to Chain graphql query to allow better lookup based on network and chain id + +- [#14405](https://github.com/smartcontractkit/chainlink/pull/14405) [`03115e8038`](https://github.com/smartcontractkit/chainlink/commit/03115e80382dc02a7bce66dc16d8bae5bd7de132) - #internal Updated the TXM confirmation logic to use the mined transaction count to identify re-org'd or confirmed transactions. + + - Confirmer uses the mined transaction count to determine if transactions have been re-org'd or confirmed. + - Confirmer no longer sets transaction states to `confirmed_missing_receipt`. This state is maintained in queries for backwards compatibility. + - Finalizer now responsible for fetching and storing receipts for confirmed transactions. + - Finalizer now responsible for resuming pending task runs. + - Finalizer now responsible for marking old transactions without receipts broadcasted before the finalized head as fatal. + +- [#14912](https://github.com/smartcontractkit/chainlink/pull/14912) [`bb6a20a882`](https://github.com/smartcontractkit/chainlink/commit/bb6a20a8825d9f374b99238097b4c9f701336a0c) - Use correct OCR2OracleSpecID when setting up RequestedRoundTracker #bugfix + +- [#15029](https://github.com/smartcontractkit/chainlink/pull/15029) [`99241ec680`](https://github.com/smartcontractkit/chainlink/commit/99241ec68098d818b97b046a1f9b4f5c8f0c5366) - Added multiple blocks history estimator feature and config for Solana TXM. #added + +- [#15197](https://github.com/smartcontractkit/chainlink/pull/15197) [`3b3b86ceae`](https://github.com/smartcontractkit/chainlink/commit/3b3b86ceaed419fa3890be17c8699a3416081fb9) - Add don_id to Mercury Enhanced EA telemetry #added + +- [#15266](https://github.com/smartcontractkit/chainlink/pull/15266) [`a9d6a3f05c`](https://github.com/smartcontractkit/chainlink/commit/a9d6a3f05c2ca8f8efbd909179f06788c356429e) - #removed unused key files and move public_key test file. + +- [#14781](https://github.com/smartcontractkit/chainlink/pull/14781) [`bfd9a3ffe1`](https://github.com/smartcontractkit/chainlink/commit/bfd9a3ffe11484f3dc413bb77a709f2c4bb281b0) - Support multiple chains evm clients for TXM gas estimator to fetch L1 gas oracle + #added + +- [#15244](https://github.com/smartcontractkit/chainlink/pull/15244) [`827e003a0c`](https://github.com/smartcontractkit/chainlink/commit/827e003a0c8c0212c6de0cb330e1f27a9c583dab) - #bugfix Update Log.Level and MaxSize configs description in the docs + +- [#15296](https://github.com/smartcontractkit/chainlink/pull/15296) [`de9868df2c`](https://github.com/smartcontractkit/chainlink/commit/de9868df2c8869bcaf641b06e77dcaa720506263) - #updated chain config: allow chain id and account address to be manually provided when no selections are available + +- [#15160](https://github.com/smartcontractkit/chainlink/pull/15160) [`816dcf814a`](https://github.com/smartcontractkit/chainlink/commit/816dcf814aff1ab5ca043eb47849162a61bc184b) - Add CSA authentication support to Beholder #added + +- [#15237](https://github.com/smartcontractkit/chainlink/pull/15237) [`1f9c07de61`](https://github.com/smartcontractkit/chainlink/commit/1f9c07de618ecfa3f23b8259ce0558941b5c357f) - #added feat: support creating solana chain config in job distributor page + +- [#15299](https://github.com/smartcontractkit/chainlink/pull/15299) [`a2c3da471c`](https://github.com/smartcontractkit/chainlink/commit/a2c3da471cc344a14003f53c2c2f09c937c204c1) - #updated Update few incorrect occurences of the password for notreal@fakeemail.ch. + +### Patch Changes + +- [#14896](https://github.com/smartcontractkit/chainlink/pull/14896) [`38ef1799dc`](https://github.com/smartcontractkit/chainlink/commit/38ef1799dc8dade6882acbafda3f49e942483f6f) - Ensure RPCClient with enabled polling respects health check flag #internal + +- [#14978](https://github.com/smartcontractkit/chainlink/pull/14978) [`65351c3a6f`](https://github.com/smartcontractkit/chainlink/commit/65351c3a6fffcff03d249e64cae223daabd86e3c) - Set `NodePool.EnforceRepeatableRead = true` by default for all chains. This forces Core to stop using RPCs behind on the latest finalized block. #changed #nops + +- [#14875](https://github.com/smartcontractkit/chainlink/pull/14875) [`101fbbc75a`](https://github.com/smartcontractkit/chainlink/commit/101fbbc75a76893d2ebe0c24fa61773876007d76) - #updated ignoring tx type 126 on celo + +- [#14929](https://github.com/smartcontractkit/chainlink/pull/14929) [`da5910eda9`](https://github.com/smartcontractkit/chainlink/commit/da5910eda98882f8a1b9ccc52b99afa223fb3997) - Add config validation so it requires ws url when http polling disabled #bugfix + +- [#14964](https://github.com/smartcontractkit/chainlink/pull/14964) [`7a80f364f9`](https://github.com/smartcontractkit/chainlink/commit/7a80f364f902c46a958021777336d6f6de9203c3) - #internal Add tokenDestGasOverhead to CalculateMessageMaxGas + +- [#15115](https://github.com/smartcontractkit/chainlink/pull/15115) [`f8a6218727`](https://github.com/smartcontractkit/chainlink/commit/f8a62187273bac1f12eeee0fe33355fe1b4faebb) - Fixed outdated headtracker config doc. #internal + +- [#14955](https://github.com/smartcontractkit/chainlink/pull/14955) [`1b8819e518`](https://github.com/smartcontractkit/chainlink/commit/1b8819e5189459a557a981ab115813253cdda919) - #updated bump CTF to v1.50.13, more robust ethereum client compatibility pipeline + +- [#14950](https://github.com/smartcontractkit/chainlink/pull/14950) [`0cd0867140`](https://github.com/smartcontractkit/chainlink/commit/0cd086714086b2a788c54de9aea13d58316518dd) - #internal OracleFactory error handling change + +- [#14893](https://github.com/smartcontractkit/chainlink/pull/14893) [`e116f744b2`](https://github.com/smartcontractkit/chainlink/commit/e116f744b222b7d664a8501566093ca1c1c63aa9) - Relocation of the deployment directory into a direct subdir of the root. #internal + +- [#15024](https://github.com/smartcontractkit/chainlink/pull/15024) [`6b29cdb7f3`](https://github.com/smartcontractkit/chainlink/commit/6b29cdb7f349b370581822ec6f54713faa7ca49e) - Minor fixes to the CCIPChainReader enabling proper serialization #internal + +- [#14827](https://github.com/smartcontractkit/chainlink/pull/14827) [`a9f86b51bf`](https://github.com/smartcontractkit/chainlink/commit/a9f86b51bf8d3a8548d4870c91f3e82669f5f21a) - #added Handle Hex String in EA Telemetry + +- [#15137](https://github.com/smartcontractkit/chainlink/pull/15137) [`7bd35dcea0`](https://github.com/smartcontractkit/chainlink/commit/7bd35dcea04b02ceb2e46a0431eca61ab3b78889) - #internal Update ccip contract reader cfg for ccip message sent to use output codec wrapper modifier + +- [#14710](https://github.com/smartcontractkit/chainlink/pull/14710) [`12174c79c4`](https://github.com/smartcontractkit/chainlink/commit/12174c79c4d1746149d7c89e41e67f9dc6525c18) - Adds new custom calldata DA oracle #added + +- [#14891](https://github.com/smartcontractkit/chainlink/pull/14891) [`12e2eb251c`](https://github.com/smartcontractkit/chainlink/commit/12e2eb251c406b601b2f954ed25ccad369421403) - Fix flaky WS test server #internal + +- [#11809](https://github.com/smartcontractkit/chainlink/pull/11809) [`2e8e16820b`](https://github.com/smartcontractkit/chainlink/commit/2e8e16820b02a9ca83aa46e7ae2deac31eaf08aa) - Upgrade go-ethereum to v1.14.11 #internal + +- [#15279](https://github.com/smartcontractkit/chainlink/pull/15279) [`276d1f3255`](https://github.com/smartcontractkit/chainlink/commit/276d1f3255aeafb1767ee84f697fc4746890a9a6) - Integration tests for USDC token transfer #internal + +- [#14984](https://github.com/smartcontractkit/chainlink/pull/14984) [`1738332823`](https://github.com/smartcontractkit/chainlink/commit/173833282344857b5e7d95863d8dab211db71ad7) - use last mined nonce instead of pending nonce to recover from occasional nonce gap issues within nonce tracker. #internal + +- [#11809](https://github.com/smartcontractkit/chainlink/pull/11809) [`2e8e16820b`](https://github.com/smartcontractkit/chainlink/commit/2e8e16820b02a9ca83aa46e7ae2deac31eaf08aa) - Fix HeadTracker tests caused by simulated client update #internal + +- [#15130](https://github.com/smartcontractkit/chainlink/pull/15130) [`4f0491483c`](https://github.com/smartcontractkit/chainlink/commit/4f0491483c089ee2fd5e7875b0d58b65b304b111) - CCIP token transfer integration tests #internal + +- [#15150](https://github.com/smartcontractkit/chainlink/pull/15150) [`68bff71f20`](https://github.com/smartcontractkit/chainlink/commit/68bff71f201c8d40219aeadea08a49a19f1ba6f1) - #updated Operator UI to support StreamSpec job definition + +- [#14433](https://github.com/smartcontractkit/chainlink/pull/14433) [`340a6bfdf5`](https://github.com/smartcontractkit/chainlink/commit/340a6bfdf54745dd1c6d9f322d9c9515c97060bb) - Merge raw configs correctly #bugfix + +- [#15060](https://github.com/smartcontractkit/chainlink/pull/15060) [`239b3a95d1`](https://github.com/smartcontractkit/chainlink/commit/239b3a95d14dd872a7192de461c33fdc143fb163) - Modify release changelog generation format #internal + +- [#15019](https://github.com/smartcontractkit/chainlink/pull/15019) [`039777ffb8`](https://github.com/smartcontractkit/chainlink/commit/039777ffb8994e0af3a133dd02d9852f4d0a0ae1) - #updated celo alfajores config + +- [#15157](https://github.com/smartcontractkit/chainlink/pull/15157) [`12986aa461`](https://github.com/smartcontractkit/chainlink/commit/12986aa461a86a593dbce422725abf7e05f05332) - Enable AutoPurge feature on all affected chains #nops + +- [#14800](https://github.com/smartcontractkit/chainlink/pull/14800) [`7bac85fdb3`](https://github.com/smartcontractkit/chainlink/commit/7bac85fdb37ed15eb42357b0a0ce06e4febd7494) - #bugfix Memory leak fix on promwrapper + +- [#14867](https://github.com/smartcontractkit/chainlink/pull/14867) [`2d28b4eb9d`](https://github.com/smartcontractkit/chainlink/commit/2d28b4eb9d8635215d953b4f5d256791a9941035) - #updated Use labelers from `chainlink-common` + +- [#15284](https://github.com/smartcontractkit/chainlink/pull/15284) [`7cd17d687a`](https://github.com/smartcontractkit/chainlink/commit/7cd17d687a11fcfe36ad78d6279dc642b6186eaa) - Bump Solana to include MultiNode integration. #added + +- [#15372](https://github.com/smartcontractkit/chainlink/pull/15372) [`d3fa330b1b`](https://github.com/smartcontractkit/chainlink/commit/d3fa330b1b3c275c48ea7ec962b4b8457f940fcd) - fix reported evm node states + +- [#15577](https://github.com/smartcontractkit/chainlink/pull/15577) [`6da84b21c1`](https://github.com/smartcontractkit/chainlink/commit/6da84b21c16f680f86f640df7ac4cfefab5b942e) - Fixes a race condition with the Finalizer when clearing txs #bugfix + ## 2.18.0 - 2024-11-01 ### Minor Changes @@ -50,6 +167,7 @@ Reduced Generics: Significantly less bulky code! #updated #changed #internal + - [#14629](https://github.com/smartcontractkit/chainlink/pull/14629) [`4928e60ddf`](https://github.com/smartcontractkit/chainlink/commit/4928e60ddfe375e4a0c644cb210802b4c4db5dbd) Thanks [@huangzhen1997](https://github.com/huangzhen1997)! - Support Zircuit fraud transactions detection and zk overflow detection #added - [#14334](https://github.com/smartcontractkit/chainlink/pull/14334) [`0ad624673f`](https://github.com/smartcontractkit/chainlink/commit/0ad624673f6f1a8e155fc43c67a8ae6caddefa90) Thanks [@krehermann](https://github.com/krehermann)! - #added keystone contract deployment - [#14709](https://github.com/smartcontractkit/chainlink/pull/14709) [`1560aa9167`](https://github.com/smartcontractkit/chainlink/commit/1560aa9167a812abe3a8370c033b3290dcbcb261) Thanks [@KuphJr](https://github.com/KuphJr)! - Add encryptionPublicKey to CapabilitiesRegistry.sol diff --git a/package.json b/package.json index 67ad90e3e6d..8a0b5a3ed5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chainlink", - "version": "2.18.0", + "version": "2.19.0", "description": "node of the decentralized oracle network, bridging on and off-chain computation", "main": "index.js", "scripts": { From b7ced6e14cd9b6623e83b816224009414bb5e92c Mon Sep 17 00:00:00 2001 From: Erik Burton Date: Fri, 3 Jan 2025 11:21:53 -0800 Subject: [PATCH 14/19] chore: increase timeouts in workflow_syncer_test (#15818) * chore: increase timeouts in workflow_syncer_test * fix: lower check interval to 1s --- .../workflows/syncer/workflow_syncer_test.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/services/relay/evm/capabilities/workflows/syncer/workflow_syncer_test.go b/core/services/relay/evm/capabilities/workflows/syncer/workflow_syncer_test.go index 6b3f7c7018d..48b805295ff 100644 --- a/core/services/relay/evm/capabilities/workflows/syncer/workflow_syncer_test.go +++ b/core/services/relay/evm/capabilities/workflows/syncer/workflow_syncer_test.go @@ -22,6 +22,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink-common/pkg/workflows" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/workflow/generated/workflow_registry_wrapper" coretestutils "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -151,7 +152,7 @@ func Test_EventHandlerStateSync(t *testing.T) { require.Eventually(t, func() bool { numEvents := len(testEventHandler.GetEvents()) return numEvents == numberWorkflows - }, 5*time.Second, time.Second) + }, tests.WaitTimeout(t), time.Second) for _, event := range testEventHandler.GetEvents() { assert.Equal(t, syncer.WorkflowRegisteredEvent, event.GetEventType()) @@ -216,7 +217,7 @@ func Test_EventHandlerStateSync(t *testing.T) { } return false - }, 50*time.Second, time.Second) + }, tests.WaitTimeout(t), time.Second) } func Test_InitialStateSync(t *testing.T) { @@ -276,7 +277,7 @@ func Test_InitialStateSync(t *testing.T) { require.Eventually(t, func() bool { return len(testEventHandler.GetEvents()) == numberWorkflows - }, 5*time.Second, time.Second) + }, tests.WaitTimeout(t), time.Second) for _, event := range testEventHandler.GetEvents() { assert.Equal(t, syncer.WorkflowRegisteredEvent, event.GetEventType()) @@ -380,7 +381,7 @@ func Test_SecretsWorker(t *testing.T) { lggr.Debugf("got secrets %v", secrets) require.NoError(t, err) return secrets == wantContents - }, 15*time.Second, time.Second) + }, tests.WaitTimeout(t), time.Second) } func Test_RegistrySyncer_WorkflowRegistered_InitiallyPaused(t *testing.T) { @@ -459,7 +460,7 @@ func Test_RegistrySyncer_WorkflowRegistered_InitiallyPaused(t *testing.T) { owner := strings.ToLower(backendTH.ContractsOwner.From.Hex()[2:]) _, err := orm.GetWorkflowSpec(ctx, owner, "test-wf") return err == nil - }, 15*time.Second, time.Second) + }, tests.WaitTimeout(t), time.Second) } type mockService struct{} @@ -567,7 +568,7 @@ func Test_RegistrySyncer_WorkflowRegistered_InitiallyActivated(t *testing.T) { owner := strings.ToLower(backendTH.ContractsOwner.From.Hex()[2:]) _, err = orm.GetWorkflowSpec(ctx, owner, "test-wf") return err == nil - }, 15*time.Second, time.Second) + }, tests.WaitTimeout(t), time.Second) } func updateAuthorizedAddress( From 742eb8f424832e68112e3f0ecf2db8e4c7a087a7 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Fri, 3 Jan 2025 14:06:59 -0600 Subject: [PATCH 15/19] core/chains/evm/client: fix test race (#15702) --- GNUmakefile | 2 +- core/chains/evm/client/rpc_client_test.go | 15 ++++++++------- core/internal/testutils/testutils.go | 14 +------------- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 08324b1fec4..bb200cc2cb9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -183,7 +183,7 @@ modgraph: .PHONY: test-short test-short: ## Run 'go test -short' and suppress uninteresting output - go test -short ./... | grep -v "no test files" | grep -v "\(cached\)" + go test -short ./... | grep -v "\[no test files\]" | grep -v "\(cached\)" help: @echo "" diff --git a/core/chains/evm/client/rpc_client_test.go b/core/chains/evm/client/rpc_client_test.go index 109a49d6e2f..d5286e9acf0 100644 --- a/core/chains/evm/client/rpc_client_test.go +++ b/core/chains/evm/client/rpc_client_test.go @@ -8,6 +8,7 @@ import ( "math/big" "net/url" "sync" + "sync/atomic" "testing" "time" @@ -400,7 +401,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { lggr := logger.Test(t) type rpcServer struct { - Head *evmtypes.Head + Head atomic.Pointer[evmtypes.Head] URL *url.URL } createRPCServer := func() *rpcServer { @@ -408,7 +409,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { server.URL = testutils.NewWSServer(t, chainId, func(method string, params gjson.Result) (resp testutils.JSONRPCResponse) { assert.Equal(t, "eth_getBlockByNumber", method) if assert.True(t, params.IsArray()) && assert.Equal(t, "finalized", params.Array()[0].String()) { - head := server.Head + head := server.Head.Load() jsonHead, err := json.Marshal(head) if err != nil { panic(fmt.Errorf("failed to marshal head: %w", err)) @@ -426,7 +427,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { rpc := client.NewRPCClient(nodePoolCfg, lggr, server.URL, nil, "rpc", 1, chainId, commonclient.Primary, commonclient.QueryTimeout, commonclient.QueryTimeout, "") require.NoError(t, rpc.Dial(ctx)) defer rpc.Close() - server.Head = &evmtypes.Head{Number: 128} + server.Head.Store(&evmtypes.Head{Number: 128}) // updates chain info _, err := rpc.LatestFinalizedBlock(ctx) require.NoError(t, err) @@ -439,7 +440,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { assert.Equal(t, int64(128), latest.FinalizedBlockNumber) // lower block number does not update highestUserObservations - server.Head = &evmtypes.Head{Number: 127} + server.Head.Store(&evmtypes.Head{Number: 127}) _, err = rpc.LatestFinalizedBlock(ctx) require.NoError(t, err) latest, highestUserObservations = rpc.GetInterceptedChainInfo() @@ -451,7 +452,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { assert.Equal(t, int64(127), latest.FinalizedBlockNumber) // health check flg prevents change in highestUserObservations - server.Head = &evmtypes.Head{Number: 256} + server.Head.Store(&evmtypes.Head{Number: 256}) _, err = rpc.LatestFinalizedBlock(commonclient.CtxAddHealthCheckFlag(ctx)) require.NoError(t, err) latest, highestUserObservations = rpc.GetInterceptedChainInfo() @@ -463,7 +464,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { assert.Equal(t, int64(256), latest.FinalizedBlockNumber) // subscription updates chain info - server.Head = &evmtypes.Head{Number: 512} + server.Head.Store(&evmtypes.Head{Number: 512}) ch, sub, err := rpc.SubscribeToFinalizedHeads(ctx) require.NoError(t, err) defer sub.Unsubscribe() @@ -479,7 +480,7 @@ func TestRPCClient_LatestFinalizedBlock(t *testing.T) { // health check subscription only updates latest sub.Unsubscribe() // close previous one - server.Head = &evmtypes.Head{Number: 1024} + server.Head.Store(&evmtypes.Head{Number: 1024}) ch, sub, err = rpc.SubscribeToFinalizedHeads(commonclient.CtxAddHealthCheckFlag(ctx)) require.NoError(t, err) defer sub.Unsubscribe() diff --git a/core/internal/testutils/testutils.go b/core/internal/testutils/testutils.go index 53b555c0e8b..c2f7351186e 100644 --- a/core/internal/testutils/testutils.go +++ b/core/internal/testutils/testutils.go @@ -126,19 +126,7 @@ func WaitTimeout(t *testing.T) time.Duration { // Context returns a context with the test's deadline, if available. func Context(tb testing.TB) context.Context { - ctx := context.Background() - var cancel func() - switch t := tb.(type) { - case *testing.T: - if d, ok := t.Deadline(); ok { - ctx, cancel = context.WithDeadline(ctx, d) - } - } - if cancel == nil { - ctx, cancel = context.WithCancel(ctx) - } - tb.Cleanup(cancel) - return ctx + return tests.Context(tb) } // MustParseURL parses the URL or fails the test From 75643421c652b83c2723414ea81fe5dfa78d0cb7 Mon Sep 17 00:00:00 2001 From: joaoluisam Date: Fri, 3 Jan 2025 21:36:49 +0000 Subject: [PATCH 16/19] Add sonic configs (#15822) * add mantle, soneium and sonic core configs * add l1 orcale config * Add sonic configs --- .../config/toml/defaults/Sonic_Mainnet.toml | 28 +++ .../config/toml/defaults/Sonic_testnet.toml | 28 +++ docs/CONFIG.md | 208 ++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 core/chains/evm/config/toml/defaults/Sonic_Mainnet.toml create mode 100644 core/chains/evm/config/toml/defaults/Sonic_testnet.toml diff --git a/core/chains/evm/config/toml/defaults/Sonic_Mainnet.toml b/core/chains/evm/config/toml/defaults/Sonic_Mainnet.toml new file mode 100644 index 00000000000..2483c736830 --- /dev/null +++ b/core/chains/evm/config/toml/defaults/Sonic_Mainnet.toml @@ -0,0 +1,28 @@ +ChainId = '146' +FinalityDepth = 10 +FinalityTagEnabled = false +LogPollInterval = "1s" #1s block rate +MinIncomingConfirmations = 5 +RPCBlockQueryDelay = 10 +RPCDefaultBatchSize = 100 + +[GasEstimator] +Mode = 'FeeHistory' +EIP1559DynamicFees = true +BumpPercent = 10 +LimitDefault = 8000000 # default ccip value + +[GasEstimator.FeeHistory] +CacheTimeout = '2s' + +[GasEstimator.BlockHistory] +BlockHistorySize = 100 + +[HeadTracker] +HistoryDepth = 50 + +[NodePool] +SyncThreshold = 10 + +[Transactions] +MaxQueued = 500 diff --git a/core/chains/evm/config/toml/defaults/Sonic_testnet.toml b/core/chains/evm/config/toml/defaults/Sonic_testnet.toml new file mode 100644 index 00000000000..83cd6c018a1 --- /dev/null +++ b/core/chains/evm/config/toml/defaults/Sonic_testnet.toml @@ -0,0 +1,28 @@ +ChainId = '57054' +FinalityDepth = 10 +FinalityTagEnabled = false +LogPollInterval = "1s" #1s block rate +MinIncomingConfirmations = 5 +RPCBlockQueryDelay = 10 +RPCDefaultBatchSize = 100 + +[GasEstimator] +Mode = 'FeeHistory' +EIP1559DynamicFees = true +BumpPercent = 10 +LimitDefault = 8000000 # default ccip value + +[GasEstimator.FeeHistory] +CacheTimeout = '2s' + +[GasEstimator.BlockHistory] +BlockHistorySize = 100 + +[HeadTracker] +HistoryDepth = 50 + +[NodePool] +SyncThreshold = 10 + +[Transactions] +MaxQueued = 500 diff --git a/docs/CONFIG.md b/docs/CONFIG.md index f624016b354..13ab1548e00 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -3589,6 +3589,110 @@ GasLimitDefault = 400000

+
Sonic Mainnet (146)

+ +```toml +AutoCreateKey = true +BlockBackfillDepth = 10 +BlockBackfillSkip = false +FinalityDepth = 10 +FinalityTagEnabled = false +LogBackfillBatchSize = 1000 +LogPollInterval = '1s' +LogKeepBlocksDepth = 100000 +LogPrunePageSize = 0 +BackupLogPollerBlockDelay = 100 +MinIncomingConfirmations = 5 +MinContractPayment = '0.00001 link' +NonceAutoSync = true +NoNewHeadsThreshold = '3m0s' +LogBroadcasterEnabled = true +RPCDefaultBatchSize = 100 +RPCBlockQueryDelay = 10 +FinalizedBlockOffset = 0 +NoNewFinalizedHeadsThreshold = '0s' + +[Transactions] +Enabled = true +ForwardersEnabled = false +MaxInFlight = 16 +MaxQueued = 500 +ReaperInterval = '1h0m0s' +ReaperThreshold = '168h0m0s' +ResendAfterThreshold = '1m0s' + +[Transactions.AutoPurge] +Enabled = false + +[BalanceMonitor] +Enabled = true + +[GasEstimator] +Mode = 'FeeHistory' +PriceDefault = '20 gwei' +PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' +PriceMin = '1 gwei' +LimitDefault = 8000000 +LimitMax = 500000 +LimitMultiplier = '1' +LimitTransfer = 21000 +EstimateLimit = false +BumpMin = '5 gwei' +BumpPercent = 10 +BumpThreshold = 3 +EIP1559DynamicFees = true +FeeCapDefault = '100 gwei' +TipCapDefault = '1 wei' +TipCapMin = '1 wei' + +[GasEstimator.BlockHistory] +BatchSize = 25 +BlockHistorySize = 100 +CheckInclusionBlocks = 12 +CheckInclusionPercentile = 90 +TransactionPercentile = 60 + +[GasEstimator.FeeHistory] +CacheTimeout = '2s' + +[HeadTracker] +HistoryDepth = 50 +MaxBufferSize = 3 +SamplingInterval = '1s' +MaxAllowedFinalityDepth = 10000 +FinalityTagBypass = true +PersistenceEnabled = true + +[NodePool] +PollFailureThreshold = 5 +PollInterval = '10s' +SelectionMode = 'HighestHead' +SyncThreshold = 10 +LeaseDuration = '0s' +NodeIsSyncingEnabled = false +FinalizedBlockPollInterval = '5s' +EnforceRepeatableRead = true +DeathDeclarationDelay = '1m0s' +NewHeadsPollInterval = '0s' + +[OCR] +ContractConfirmations = 4 +ContractTransmitterTransmitTimeout = '10s' +DatabaseTimeout = '10s' +DeltaCOverride = '168h0m0s' +DeltaCJitterOverride = '1h0m0s' +ObservationGracePeriod = '1s' + +[OCR2] +[OCR2.Automation] +GasLimit = 5400000 + +[Workflow] +GasLimitDefault = 400000 +``` + +

+
XLayer Sepolia (195)

```toml @@ -7867,6 +7971,110 @@ GasLimitDefault = 400000

+
Sonic testnet (57054)

+ +```toml +AutoCreateKey = true +BlockBackfillDepth = 10 +BlockBackfillSkip = false +FinalityDepth = 10 +FinalityTagEnabled = false +LogBackfillBatchSize = 1000 +LogPollInterval = '1s' +LogKeepBlocksDepth = 100000 +LogPrunePageSize = 0 +BackupLogPollerBlockDelay = 100 +MinIncomingConfirmations = 5 +MinContractPayment = '0.00001 link' +NonceAutoSync = true +NoNewHeadsThreshold = '3m0s' +LogBroadcasterEnabled = true +RPCDefaultBatchSize = 100 +RPCBlockQueryDelay = 10 +FinalizedBlockOffset = 0 +NoNewFinalizedHeadsThreshold = '0s' + +[Transactions] +Enabled = true +ForwardersEnabled = false +MaxInFlight = 16 +MaxQueued = 500 +ReaperInterval = '1h0m0s' +ReaperThreshold = '168h0m0s' +ResendAfterThreshold = '1m0s' + +[Transactions.AutoPurge] +Enabled = false + +[BalanceMonitor] +Enabled = true + +[GasEstimator] +Mode = 'FeeHistory' +PriceDefault = '20 gwei' +PriceMax = '115792089237316195423570985008687907853269984665.640564039457584007913129639935 tether' +PriceMin = '1 gwei' +LimitDefault = 8000000 +LimitMax = 500000 +LimitMultiplier = '1' +LimitTransfer = 21000 +EstimateLimit = false +BumpMin = '5 gwei' +BumpPercent = 10 +BumpThreshold = 3 +EIP1559DynamicFees = true +FeeCapDefault = '100 gwei' +TipCapDefault = '1 wei' +TipCapMin = '1 wei' + +[GasEstimator.BlockHistory] +BatchSize = 25 +BlockHistorySize = 100 +CheckInclusionBlocks = 12 +CheckInclusionPercentile = 90 +TransactionPercentile = 60 + +[GasEstimator.FeeHistory] +CacheTimeout = '2s' + +[HeadTracker] +HistoryDepth = 50 +MaxBufferSize = 3 +SamplingInterval = '1s' +MaxAllowedFinalityDepth = 10000 +FinalityTagBypass = true +PersistenceEnabled = true + +[NodePool] +PollFailureThreshold = 5 +PollInterval = '10s' +SelectionMode = 'HighestHead' +SyncThreshold = 10 +LeaseDuration = '0s' +NodeIsSyncingEnabled = false +FinalizedBlockPollInterval = '5s' +EnforceRepeatableRead = true +DeathDeclarationDelay = '1m0s' +NewHeadsPollInterval = '0s' + +[OCR] +ContractConfirmations = 4 +ContractTransmitterTransmitTimeout = '10s' +DatabaseTimeout = '10s' +DeltaCOverride = '168h0m0s' +DeltaCJitterOverride = '1h0m0s' +ObservationGracePeriod = '1s' + +[OCR2] +[OCR2.Automation] +GasLimit = 5400000 + +[Workflow] +GasLimitDefault = 400000 +``` + +

+
Linea Goerli (59140)

```toml From 0fb754617727e72b31956d7a089b98f3d3417c64 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Fri, 3 Jan 2025 16:48:17 -0600 Subject: [PATCH 17/19] core/services/relay/evm/capabilities: extend timeout for TestLogEventTriggerEVMHappyPath flake (#15836) --- .../services/relay/evm/capabilities/log_event_trigger_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/services/relay/evm/capabilities/log_event_trigger_test.go b/core/services/relay/evm/capabilities/log_event_trigger_test.go index d248dbdc87f..c74f171a6c6 100644 --- a/core/services/relay/evm/capabilities/log_event_trigger_test.go +++ b/core/services/relay/evm/capabilities/log_event_trigger_test.go @@ -3,7 +3,6 @@ package logevent_test import ( "math/big" "testing" - "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -13,6 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/services/servicetest" commontypes "github.com/smartcontractkit/chainlink-common/pkg/types" commonmocks "github.com/smartcontractkit/chainlink-common/pkg/types/core/mocks" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" "github.com/smartcontractkit/chainlink/v2/core/capabilities/triggers/logevent" coretestutils "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/services/relay/evm/capabilities/testutils" @@ -135,7 +135,7 @@ func emitLogTxnAndWaitForLog(t *testing.T, for _, expectedLogVal := range expectedLogVals { // Wait for logs with a timeout - _, output, err := testutils.WaitForLog(th.BackendTH.Lggr, log1Ch, 15*time.Second) + _, output, err := testutils.WaitForLog(th.BackendTH.Lggr, log1Ch, tests.WaitTimeout(t)) require.NoError(t, err) th.BackendTH.Lggr.Infow("EmitLog", "output", output) From d27deaaeaf9bcb27ab641bdef9d37ac895c88e1d Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 6 Jan 2025 06:49:49 -0500 Subject: [PATCH 18/19] Quieten enhanced telem (#15793) --- core/services/ocrcommon/telemetry.go | 13 +------------ core/services/ocrcommon/telemetry_test.go | 15 ++++----------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/core/services/ocrcommon/telemetry.go b/core/services/ocrcommon/telemetry.go index 5e4a65180d5..3872955e5a3 100644 --- a/core/services/ocrcommon/telemetry.go +++ b/core/services/ocrcommon/telemetry.go @@ -261,13 +261,11 @@ func hexStringToDecimal(hexString string) (decimal.Decimal, bool) { func (e *EnhancedTelemetryService[T]) getObservation(finalResult *pipeline.FinalResult) int64 { singularResult, err := finalResult.SingularResult() if err != nil { - e.lggr.Warnf("cannot get singular result, job %d", e.job.ID) return 0 } finalResultDecimal, err := utils.ToDecimal(singularResult.Value) if err != nil { - e.lggr.Warnf("cannot parse singular result from bridge task, job %d", e.job.ID) return 0 } @@ -277,7 +275,6 @@ func (e *EnhancedTelemetryService[T]) getObservation(finalResult *pipeline.Final func (e *EnhancedTelemetryService[T]) getParsedValue(trrs *pipeline.TaskRunResults, trr pipeline.TaskRunResult) float64 { parsedValue := getJsonParsedValue(trr, trrs) if parsedValue == nil { - e.lggr.Warnf("cannot get json parse value, job %d, id %s", e.job.ID, trr.Task.DotID()) return 0 } return *parsedValue @@ -302,23 +299,16 @@ func (e *EnhancedTelemetryService[T]) collectAndSend(trrs *pipeline.TaskRunResul if trr.Task.Type() != pipeline.TaskTypeBridge { continue } - var bridgeName string - if b, is := trr.Task.(*pipeline.BridgeTask); is { - bridgeName = b.Name - } if trr.Result.Error != nil { - e.lggr.Warnw(fmt.Sprintf("cannot get bridge response from bridge task, job=%d, id=%s, name=%q", e.job.ID, trr.Task.DotID(), bridgeName), "err", trr.Result.Error, "jobID", e.job.ID, "dotID", trr.Task.DotID(), "bridgeName", bridgeName) continue } bridgeRawResponse, ok := trr.Result.Value.(string) if !ok { - e.lggr.Warnw(fmt.Sprintf("cannot parse bridge response from bridge task, job=%d, id=%s, name=%q: expected string, got: %v (type %T)", e.job.ID, trr.Task.DotID(), bridgeName, trr.Result.Value, trr.Result.Value), "jobID", e.job.ID, "dotID", trr.Task.DotID(), "bridgeName", bridgeName) continue } eaTelem, err := parseEATelemetry([]byte(bridgeRawResponse)) if err != nil { - e.lggr.Warnw(fmt.Sprintf("cannot parse EA telemetry, job=%d, id=%s, name=%q", e.job.ID, trr.Task.DotID(), bridgeName), "err", err, "jobID", e.job.ID, "dotID", trr.Task.DotID(), "bridgeName", bridgeName) continue } value := e.getParsedValue(trrs, trr) @@ -635,12 +625,11 @@ func getPricesFromBridgeTaskByTelemetryField(lggr logger.Logger, bridgeTask pipe func parsePriceFromTask(lggr logger.Logger, trr pipeline.TaskRunResult) float64 { var val float64 if trr.Result.Error != nil { - lggr.Warnw(fmt.Sprintf("got error on EA telemetry price task, id %s: %s", trr.Task.DotID(), trr.Result.Error), "err", trr.Result.Error) return 0 } val, err := getResultFloat64(&trr) if err != nil { - lggr.Warnw(fmt.Sprintf("cannot parse EA telemetry price to float64, DOT id %s", trr.Task.DotID()), "task_type", trr.Task.Type(), "task_tags", trr.Task.TaskTags(), "err", err) + return 0 } return val } diff --git a/core/services/ocrcommon/telemetry_test.go b/core/services/ocrcommon/telemetry_test.go index 4c8f0eb1127..1059d653b62 100644 --- a/core/services/ocrcommon/telemetry_test.go +++ b/core/services/ocrcommon/telemetry_test.go @@ -385,8 +385,7 @@ func TestGetObservation(t *testing.T) { obs := e.getObservation(&pipeline.FinalResult{}) assert.Equal(t, obs, int64(0)) - assert.Equal(t, logs.Len(), 1) - assert.Contains(t, logs.All()[0].Message, "cannot get singular result") + assert.Equal(t, 0, logs.Len()) finalResult := &pipeline.FinalResult{ Values: []interface{}{"123456"}, @@ -457,8 +456,7 @@ func TestCollectAndSend(t *testing.T) { } wg.Wait() - assert.Equal(t, logs.Len(), 2) - assert.Contains(t, logs.All()[0].Message, "cannot parse bridge response from bridge task") + assert.Equal(t, 0, logs.Len()) badTrrs = &pipeline.TaskRunResults{ pipeline.TaskRunResult{ @@ -475,9 +473,7 @@ func TestCollectAndSend(t *testing.T) { RepTimestamp: observationTimestamp, } wg.Wait() - assert.Equal(t, 2, logs.Len()) - assert.Contains(t, logs.All()[0].Message, "cannot parse bridge response from bridge task") - assert.Contains(t, logs.All()[1].Message, "cannot get json parse value") + assert.Equal(t, 0, logs.Len()) doneCh <- struct{}{} } @@ -707,10 +703,7 @@ func TestGetPricesFromBridgeTaskByOrder(t *testing.T) { require.Equal(t, benchmarkPrice, float64(0)) require.Equal(t, bid, float64(0)) require.Equal(t, ask, float64(0)) - require.Equal(t, 3, logs.Len()) - require.Contains(t, logs.All()[0].Message, "cannot parse EA telemetry price to float64, DOT id ds1_benchmark") - require.Contains(t, logs.All()[1].Message, "cannot parse EA telemetry price to float64, DOT id ds2_bid") - require.Contains(t, logs.All()[2].Message, "cannot parse EA telemetry price to float64, DOT id ds3_ask") + require.Equal(t, 0, logs.Len()) benchmarkPrice, bid, ask = getPricesFromBridgeTask(lggr, trrsMercuryV1[0], trrsMercuryV2, 2) require.Equal(t, 123456.123456, benchmarkPrice) From eb8bb6cd5a158ce785e1693626b16b21e6695d11 Mon Sep 17 00:00:00 2001 From: Rens Rooimans Date: Mon, 6 Jan 2025 14:40:19 +0100 Subject: [PATCH 19/19] single action to install foundry (#15843) --- .../install-solidity-foundry/action.yml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/actions/install-solidity-foundry/action.yml diff --git a/.github/actions/install-solidity-foundry/action.yml b/.github/actions/install-solidity-foundry/action.yml new file mode 100644 index 00000000000..aabd874826e --- /dev/null +++ b/.github/actions/install-solidity-foundry/action.yml @@ -0,0 +1,31 @@ +name: 'Install Foundry version in GNUmakefile' +description: 'Install Foundry version in GNUmakefile' +inputs: + working-directory: + description: 'The GNUmakefile directory' + required: false + default: 'contracts' +outputs: + foundry-version: + description: 'Foundry version found in GNUmakefile' + value: ${{ steps.extract-foundry-version.outputs.foundry-version }} +runs: + using: 'composite' + steps: + - name: Extract Foundry version + id: extract-foundry-version + shell: bash + working-directory: ${{ inputs.working-directory }} + run: | + foundry_version=$(grep -Eo "foundryup --version [^ ]+" GNUmakefile | awk '{print $3}') + if [ -z "$foundry_version" ]; then + echo "::error::Foundry version not found in GNUmakefile" + exit 1 + fi + echo "Foundry version found: $foundry_version" + echo "foundry-version=$foundry_version" >> $GITHUB_OUTPUT + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@8f1998e9878d786675189ef566a2e4bf24869773 # v1.2.0 + with: + version: ${{ steps.extract-foundry-version.outputs.foundry-version }}