diff --git a/.github/workflows/gas-snapshot.yml b/.github/workflows/gas-snapshot.yml index a148fc20..9e573a33 100644 --- a/.github/workflows/gas-snapshot.yml +++ b/.github/workflows/gas-snapshot.yml @@ -33,7 +33,7 @@ jobs: | grep -E '^test' \ | tee .gas-snapshot.new env: - NODE_PROVIDER_BYPASS_KEY: ${{ secrets.NODE_PROVIDER_BYPASS_KEY }} + MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} - name: Check diff tolerance run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6dd5d024..93efced0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,4 +37,4 @@ jobs: forge test -vvv id: test env: - NODE_PROVIDER_BYPASS_KEY: ${{ secrets.NODE_PROVIDER_BYPASS_KEY }} + MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }} diff --git a/README.md b/README.md index c59ff5fa..18c7da40 100644 --- a/README.md +++ b/README.md @@ -32,23 +32,18 @@ Callbacks need to be explicitly turned on by Quark scripts. Specifically, this i [Quark Builder Helper](./src/builder/QuarkBuilderHelper.sol) is a contract with functions outside of constructing _Quark operations_ that might still be helpful for those using the QuarkBuilder. For example, there is a helper function to determine the bridgeability of assets on different chains. -## Fork tests and NODE_PROVIDER_BYPASS_KEY +## Fork tests and MAINNET_RPC_URL Some tests require forking mainnet, e.g. to exercise use-cases like supplying and borrowing in a comet market. -For a "fork url" we use our rate-limited node provider endpoint at -`https://node-provider.compound.finance/ethereum-mainnet`. Setting up a -fork quickly exceeds the rate limits, so we use a bypass key to allow fork -tests to exceed the rate limits. +The "fork url" is specified using the environment variable `MAINNET_RPC_URL`. +It can be any node provider for Ethereum mainnet, such as Infura or Alchemy. -A bypass key for Quark development can be found in 1Password as a -credential named "Quark Dev node-provider Bypass Key". The key can then be -set during tests via the environment variable `NODE_PROVIDER_BYPASS_KEY`, -like so: +The environment variable can be set when running tests, like so: ``` -$ NODE_PROVIDER_BYPASS_KEY=... forge test +$ MAINNET_RPC_URL=... forge test ``` ## Updating gas snapshots @@ -61,7 +56,7 @@ You can accept the diff and update the baseline if the increased gas usage is intentional. Just run the following command: ```sh -$ NODE_PROVIDER_BYPASS_KEY=... ./script/update-snapshot.sh +$ MAINNET_RPC_URL=... ./script/update-snapshot.sh ``` Then commit the updated snapshot file: diff --git a/test/ApproveAndSwap.t.sol b/test/ApproveAndSwap.t.sol index 0b06e912..d56b1659 100644 --- a/test/ApproveAndSwap.t.sol +++ b/test/ApproveAndSwap.t.sol @@ -29,9 +29,7 @@ contract ApproveAndSwapTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), // Warp to the block where the quote is valid 19121945 ); diff --git a/test/CCTPBridgeActions.t.sol b/test/CCTPBridgeActions.t.sol index 933d528c..5cae3955 100644 --- a/test/CCTPBridgeActions.t.sol +++ b/test/CCTPBridgeActions.t.sol @@ -37,9 +37,7 @@ contract CCTPBridge is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/CometClaimRewards.t.sol b/test/CometClaimRewards.t.sol index 4c0dd018..e7010064 100644 --- a/test/CometClaimRewards.t.sol +++ b/test/CometClaimRewards.t.sol @@ -36,9 +36,7 @@ contract CometClaimRewardsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/CometRepayAndWithdrawMultipleAssets.t.sol b/test/CometRepayAndWithdrawMultipleAssets.t.sol index 88e2da18..fea0d7c0 100644 --- a/test/CometRepayAndWithdrawMultipleAssets.t.sol +++ b/test/CometRepayAndWithdrawMultipleAssets.t.sol @@ -37,9 +37,7 @@ contract CometRepayAndWithdrawMultipleAssetsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/CometSupplyActions.t.sol b/test/CometSupplyActions.t.sol index e4125549..f31dfd1d 100644 --- a/test/CometSupplyActions.t.sol +++ b/test/CometSupplyActions.t.sol @@ -39,9 +39,7 @@ contract SupplyActionsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/CometSupplyMultipleAssetsAndBorrow.t.sol b/test/CometSupplyMultipleAssetsAndBorrow.t.sol index afdc7afb..45eabe2b 100644 --- a/test/CometSupplyMultipleAssetsAndBorrow.t.sol +++ b/test/CometSupplyMultipleAssetsAndBorrow.t.sol @@ -37,9 +37,7 @@ contract CometSupplyMultipleAssetsAndBorrowTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/CometWithdrawActions.t.sol b/test/CometWithdrawActions.t.sol index 2d4d3196..624d8e7e 100644 --- a/test/CometWithdrawActions.t.sol +++ b/test/CometWithdrawActions.t.sol @@ -38,9 +38,7 @@ contract WithdrawActionsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/ConditionalMulticall.t.sol b/test/ConditionalMulticall.t.sol index 6e080264..420e0379 100644 --- a/test/ConditionalMulticall.t.sol +++ b/test/ConditionalMulticall.t.sol @@ -43,9 +43,7 @@ contract ConditionalMulticallTest is Test { function setUp() public { vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/Ethcall.t.sol b/test/Ethcall.t.sol index c8eb7251..feee4bc7 100644 --- a/test/Ethcall.t.sol +++ b/test/Ethcall.t.sol @@ -41,9 +41,7 @@ contract EthcallTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); diff --git a/test/Multicall.t.sol b/test/Multicall.t.sol index 9e85fd19..7bb53245 100644 --- a/test/Multicall.t.sol +++ b/test/Multicall.t.sol @@ -53,9 +53,7 @@ contract MulticallTest is Test { function setUp() public { vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/Paycall.t.sol b/test/Paycall.t.sol index 27f92f0a..e941bfd6 100644 --- a/test/Paycall.t.sol +++ b/test/Paycall.t.sol @@ -76,9 +76,7 @@ contract PaycallTest is Test { function setUp() public { vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/Quotecall.t.sol b/test/Quotecall.t.sol index 19bf73ba..4c080f02 100644 --- a/test/Quotecall.t.sol +++ b/test/Quotecall.t.sol @@ -77,9 +77,7 @@ contract QuotecallTest is Test { function setUp() public { vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/RecurringSwap.t.sol b/test/RecurringSwap.t.sol index f7359bc6..87805fa1 100644 --- a/test/RecurringSwap.t.sol +++ b/test/RecurringSwap.t.sol @@ -53,9 +53,7 @@ contract RecurringSwapTest is Test { constructor() { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); diff --git a/test/TransferActions.t.sol b/test/TransferActions.t.sol index dad251f3..014f867c 100644 --- a/test/TransferActions.t.sol +++ b/test/TransferActions.t.sol @@ -50,9 +50,7 @@ contract TransferActionsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/UniswapFlashLoan.t.sol b/test/UniswapFlashLoan.t.sol index 52772542..5fce2c62 100644 --- a/test/UniswapFlashLoan.t.sol +++ b/test/UniswapFlashLoan.t.sol @@ -51,9 +51,7 @@ contract UniswapFlashLoanTest is Test { function setUp() public { vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/UniswapFlashSwapExactOut.t.sol b/test/UniswapFlashSwapExactOut.t.sol index 9a1f762c..5511c794 100644 --- a/test/UniswapFlashSwapExactOut.t.sol +++ b/test/UniswapFlashSwapExactOut.t.sol @@ -47,9 +47,7 @@ contract UniswapFlashSwapExactOutTest is Test { function setUp() public { vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/UniswapSwapActions.t.sol b/test/UniswapSwapActions.t.sol index 00bd16ef..38a1f0b7 100644 --- a/test/UniswapSwapActions.t.sol +++ b/test/UniswapSwapActions.t.sol @@ -42,9 +42,7 @@ contract UniswapSwapActionsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager()))); diff --git a/test/WrapperScripts.t.sol b/test/WrapperScripts.t.sol index e67b0fb7..947117a4 100644 --- a/test/WrapperScripts.t.sol +++ b/test/WrapperScripts.t.sol @@ -37,9 +37,7 @@ contract WrapperScriptsTest is Test { function setUp() public { // Fork setup vm.createSelectFork( - string.concat( - "https://node-provider.compound.finance/ethereum-mainnet/", vm.envString("NODE_PROVIDER_BYPASS_KEY") - ), + vm.envString("MAINNET_RPC_URL"), 18429607 // 2023-10-25 13:24:00 PST ); factory = new QuarkWalletProxyFactory(address(new QuarkWallet(new CodeJar(), new QuarkStateManager())));