From f375752e85417d1c0ac1074c9a213a001c98d9ac Mon Sep 17 00:00:00 2001 From: RnkSngh Date: Mon, 29 Jul 2024 06:04:09 -0400 Subject: [PATCH] add test for fork deploy and read from process.env when using deploy scripts --- .github/workflows/bindings.yml | 17 +++++++-- .github/workflows/foundry.yml | 22 ++++++++++++ README.md | 10 +++--- bun.lockb | Bin 228448 -> 228280 bytes package.json | 2 +- specs/contracts.setup.spec.yaml | 4 +-- specs/contracts.spec.yaml | 16 ++++----- specs/evm.accounts.yaml | 7 ++-- specs/update.spec.yaml | 52 ++++++++++++++++++---------- specs/upgrade.spec.yaml | 4 +-- src/deploy.ts | 2 +- src/scripts/fork-deployment-test.ts | 2 +- src/updateContract.ts | 2 +- test/Fork/Dispatcher.deploy.t.sol | 9 +++-- test/Fork/contract-spec.yaml | 16 ++++----- 15 files changed, 106 insertions(+), 59 deletions(-) diff --git a/.github/workflows/bindings.yml b/.github/workflows/bindings.yml index d405dc19..e12b3718 100644 --- a/.github/workflows/bindings.yml +++ b/.github/workflows/bindings.yml @@ -10,7 +10,7 @@ concurrency: jobs: verify-bindings: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v4 with: @@ -23,11 +23,10 @@ jobs: go-version: "1.21.3" - name: Setup Foundry - uses: foundry-rs/foundry-toolchain@v1 + uses: foundry-rs/foundry-toolchain@v1.2.0 - name: Install Bun uses: oven-sh/setup-bun@v2 - - name: Install ABIGen run: | go install github.com/ethereum/go-ethereum/cmd/abigen@v1.13.5 @@ -44,3 +43,15 @@ jobs: echo -e "Changes in Generated Bindings:\n$changes" exit 1 fi + - name: Upload ts bindings artifact on error + if: failure() + uses: actions/upload-artifact@v2 + with: + name: ts-bindings + path: ./src/evm/contracts/ + - name: Upload go bindings artifact on error + if: failure() + uses: actions/upload-artifact@v2 + with: + name: go-bindings + path: ./bindings/ diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml index c3025828..00a7a9ce 100644 --- a/.github/workflows/foundry.yml +++ b/.github/workflows/foundry.yml @@ -20,9 +20,31 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 + + - name: Install Bun + uses: oven-sh/setup-bun@v2 + + - name: Generate Bindings + run: | + bun install --frozen-lockfile + bun run build - name: Check contract sizes run: forge build --sizes --deny-warnings - name: Tests run: forge test --no-match-contract DispatcherDeployTest + + - name: Fork Deploy Test + run: npx vibc-core-deploy-test + env: + MODULE_ROOT_PATH: "./" + RPC_URL: ${{ secrets.FORK_RPC_URL }} + CHAIN_NAME: fork-test-ci + DUMMY_DEPLOYER_PRIVATE_KEY: ${{ secrets.DUMMY_DEPLOYER_PRIVATE_KEY }} + DAPP_PRIVATE_KEY_1: ${{ secrets.DAPP_PRIVATE_KEY_1 }} + DAPP_PRIVATE_KEY_2: ${{ secrets.DAPP_PRIVATE_KEY_2 }} + DAPP_PRIVATE_KEY_3: ${{ secrets.DAPP_PRIVATE_KEY_3 }} + PolymerL2OutputOracleProxyAddress: "0xB901B810B30f4d8D179FA5e4dFA73B6EC81f2dB0" + L2OutputOracleProxyAddress: "0xB901B810B30f4d8D179FA5e4dFA73B6EC81f2dB0" + L1BlockAddress: "0x4200000000000000000000000000000000000015" \ No newline at end of file diff --git a/README.md b/README.md index d03635ea..bb7d6dc1 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ This file is read in-order, so each entry in this file should be in-order, where ### Deploying via Command Line This npm package exposes two commands - one to deploy new contacts (which automatically creates persisted deployment files), and one to send transactions to contracts from persisted artifact files. The following steps are needed to deploy contracts via the command line: -1. Ensure that your deployer account and constructor arguments are configured. This can either be done through adding contract spec yaml files located in the specs/ from the root of where this npm module is installed from (requires adding a `specs/evm.accounts.yaml` file and either a `specs/contracts.spec.yaml` or `specs/upgrade.spec.yaml`), or by setting the KEY_POLYMER, RPC_URL, DEPLOYMENT_CHAIN_ID, CHAIN_NAME environment variables. For examples of contract and account spec files, see the `/specs` folder in this repo. +1. Ensure that your deployer account and constructor arguments are configured. This can either be done through adding contract spec yaml files located in the specs/ from the root of where this npm module is installed from (requires adding a `specs/evm.accounts.yaml` file and either a `specs/contracts.spec.yaml` or `specs/upgrade.spec.yaml`), or by setting the KEY_DEPLOYER, RPC_URL, DEPLOYMENT_CHAIN_ID, CHAIN_NAME environment variables. For examples of contract and account spec files, see the `/specs` folder in this repo. 2. Pass in optional command arguments: - RPC_URL - the rpc url to submit deploy txs to, can be a local fork as well - ACCOUNTS_SPECS_PATH - the path to the accounts spec file @@ -89,8 +89,8 @@ const accountConfig = { name: "local", registry: [ { - name: "KEY_POLYMER", - privateKey: process.env.KEY_POLYMER + name: "KEY_DEPLOYER", + privateKey: process.env.KEY_DEPLOYER }, ], }; @@ -138,8 +138,8 @@ const accountConfig = { name: "local", registry: [ { - name: "KEY_POLYMER", - privateKey: process.env.KEY_POLYMER, + name: "KEY_DEPLOYER", + privateKey: process.env.KEY_DEPLOYER, }, ], }; diff --git a/bun.lockb b/bun.lockb index 857130d5fb07e07c6b5bcb214339183a01f6ae37..824697f62da45d4a421d0cc56215b0754b1b3e62 100755 GIT binary patch delta 13110 zcmeI3d6*T|orddHvnzrib|a%LNVAB5ENZ|7S!LgM5D^emzy+762p3nPQIWY5@8CLd zpD>IfYDW!jXk11lK_W4am^L~lM&pWc*LmODzt(G>juYn@|LgPc-tV06ELC;tRMqKI zMb$@5fBs?9D@SKKtsXNjtxDG4cts{NWJ8bihI*Z=k|fzBNmjh}gCuE+z7Vz&U##}u(C}5$!`0m8 z`%AO7IvNbBJ3Y+=K{bE634&S=W|<(UrstR-sHW$GTR9#KwW)i%FiEn74J;}YOOj%B z!;8TNPmTOyHGfI?svA5V^v?jpw`l|NmnI_$<%oQ(HgGQ3;PPtw8>+t|eAV*jK}oLb zFUkx3c`+%2>d0MVf}qxi>%rsyDHw{?!@UJ;^;R%^2d(bU+o)tiYr%&8Bhq)GhT7C} z>%kqn8$8T=!JwL7X@XF!4wy&5{7p%2_{Ju!jXnm3Vr`gPwy|R$b2k_AzMH1G9UDt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O_)G2#GiV diff --git a/package.json b/package.json index 28569aa1..85885abf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@open-ibc/vibc-core-smart-contracts", - "version": "2.1.12", + "version": "2.1.13", "main": "dist/index.js", "bin": { "verify-vibc-core-smart-contracts": "./dist/scripts/verify-contract-script.js", diff --git a/specs/contracts.setup.spec.yaml b/specs/contracts.setup.spec.yaml index 61f4ce85..033bd683 100644 --- a/specs/contracts.setup.spec.yaml +++ b/specs/contracts.setup.spec.yaml @@ -10,7 +10,7 @@ # args: args to make the function call with, need to be compatible with the signature - name: DispatcherClientSetup-Connection-0 description: 'Setup client for dispatcher contracts' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "setClientForConnection(string,address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" @@ -20,7 +20,7 @@ - name: DispatcherClientSetup-Connection-1 description: 'Setup client for dispatcher contracts' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "setClientForConnection(string,address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" diff --git a/specs/contracts.spec.yaml b/specs/contracts.spec.yaml index b8bf9330..fdca6212 100644 --- a/specs/contracts.spec.yaml +++ b/specs/contracts.spec.yaml @@ -20,17 +20,17 @@ - name: LightClient description: 'DummyLightClient' factoryName: 'DummyLightClient' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: Ibc description: 'IBC library' factoryName: 'Ibc' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: IbcUtils description: 'IBC utils library' factoryName: 'IbcUtils' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: Dispatcher description: 'IBC Core contract' @@ -40,12 +40,12 @@ address: '{{Ibc}}' - name: 'contracts/libs/IbcUtils.sol:IbcUtils' address: '{{IbcUtils}}' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: FeeVault description: 'FeeVault' factoryName: 'FeeVault' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: DispatcherProxy description: 'Dispatcher proxy contract' @@ -58,12 +58,12 @@ args: - 'polyibc.{{chain.chainName}}.' - '{{FeeVault}}' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: UC description: 'Universal Chanel IBC-middleware contract' factoryName: 'UniversalChannelHandler' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' libraries: - name: 'contracts/libs/IbcUtils.sol:IbcUtils' address: '{{IbcUtils}}' @@ -71,7 +71,7 @@ - name: UCProxy description: 'Universal Chanel IBC-middleware proxy' factoryName: 'ERC1967Proxy' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' deployArgs: - '{{UC}}' - '$INITARGS' diff --git a/specs/evm.accounts.yaml b/specs/evm.accounts.yaml index 1f097779..43033c46 100644 --- a/specs/evm.accounts.yaml +++ b/specs/evm.accounts.yaml @@ -1,7 +1,6 @@ # These accounts are derived from a test mnemonic by Anvil/Hardhat and used for testing purposes only. -- name: 'KEY_POLYMER' - privateKey: '{{DEPLOYER_PRIVATE_KEY}}' - +- name: 'KEY_DEPLOYER' + privateKey: '{{ DUMMY_DEPLOYER_PRIVATE_KEY }}' # Dapp accounts - name: 'KEY_DAPP1' @@ -9,4 +8,4 @@ - name: 'KEY_DAPP2' privateKey: '{{ DAPP_PRIVATE_KEY_2 }}' - name: 'KEY_DAPP3' - privateKey: '{{ DAPP_PRIVATE_KEY_2 }}' + privateKey: '{{ DAPP_PRIVATE_KEY_3 }}' diff --git a/specs/update.spec.yaml b/specs/update.spec.yaml index ee65134a..b817d4be 100644 --- a/specs/update.spec.yaml +++ b/specs/update.spec.yaml @@ -35,20 +35,36 @@ # signature: signature of method to call for this tx # args: args to make the function call with, need to be compatible with the signature -- name: LightClient +- name: OptimisticProofVerifier + description: 'OptimisticProofVerifier' + factoryName: 'OptimisticProofVerifier' + deployer: 'KEY_DEPLOYER' + deployArgs: + - '{{PolymerL2OutputOracleProxyAddress}}' + +- name: OptimisticLightClient + description: 'OptimisticLightClient' + factoryName: 'OptimisticLightClient' + deployer: 'KEY_DEPLOYER' + deployArgs: + - 0 + - '{{OptimisticProofVerifier}}' + - '{{L1BlockAddress}}' + +- name: DummyLightClient description: 'DummyLightClient' factoryName: 'DummyLightClient' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: Ibc description: 'IBC library' factoryName: 'Ibc' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: IbcUtils description: 'IBC utils library' factoryName: 'IbcUtils' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: Dispatcher description: 'IBC Core contract' @@ -58,12 +74,12 @@ address: '{{Ibc}}' - name: 'contracts/libs/IbcUtils.sol:IbcUtils' address: '{{IbcUtils}}' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: FeeVault description: 'FeeVault' factoryName: 'FeeVault' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: DispatcherProxy description: 'Dispatcher proxy contract' @@ -76,12 +92,12 @@ args: - 'polyibc.{{chain.chainName}}.' - '{{FeeVault}}' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: UC description: 'Universal Chanel IBC-middleware contract' factoryName: 'UniversalChannelHandler' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' libraries: - name: 'contracts/libs/IbcUtils.sol:IbcUtils' address: '{{IbcUtils}}' @@ -89,7 +105,7 @@ - name: UCProxy description: 'Universal Chanel IBC-middleware proxy' factoryName: 'ERC1967Proxy' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' deployArgs: - '{{UC}}' - '$INITARGS' @@ -115,7 +131,7 @@ # Contract Setup below - name: DispatcherUpgrade description: 'UUPS Upgrade for dispatcher contract implementation' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "upgradeTo(address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" @@ -124,7 +140,7 @@ - name: DispatcherUpgrade description: 'UUPS Upgrade for dispatcher contract implementation' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "upgradeTo(address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" @@ -133,7 +149,7 @@ - name: UCH Upgrade description: 'Upgrade for uch contract' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "upgradeTo(address)" address: '{{ UCProxy }}' factoryName: "UC" @@ -142,20 +158,20 @@ - name: DispatcherClientSetup-Connection-0 description: 'Setup client for dispatcher contracts' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "setClientForConnection(string,address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" args: - - 'connection-0' - - '{{LightClient}}' + - 'connection-1' + - '{{DummyLightClient}}' - name: DispatcherClientSetup-Connection-1 description: 'Setup client for dispatcher contracts' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "setClientForConnection(string,address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" args: - - 'connection-2' - - '{{LightClient}}' \ No newline at end of file + - 'connection-3' + - '{{DummyLightClient}}' \ No newline at end of file diff --git a/specs/upgrade.spec.yaml b/specs/upgrade.spec.yaml index 96cead6d..f2972c09 100644 --- a/specs/upgrade.spec.yaml +++ b/specs/upgrade.spec.yaml @@ -18,7 +18,7 @@ - name: DispatcherUpgrade description: 'UUPS Upgrade for dispatcher contract implementation' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "upgradeTo(address)" address: '{{DispatcherProxy}}' factoryName: "Dispatcher" @@ -27,7 +27,7 @@ - name: UCH Upgrade description: 'Upgrade for uch contract' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' signature: "upgradeTo(address)" address: '{{ UCProxy }}' factoryName: "UC" diff --git a/src/deploy.ts b/src/deploy.ts index 90e3db5a..eb1b469d 100644 --- a/src/deploy.ts +++ b/src/deploy.ts @@ -187,7 +187,7 @@ export async function deployToChain( } // @ts-ignore - const env: StringToStringMap = { chain }; + const env: StringToStringMap = {...process.env , chain , }; if (!forceDeployNewContracts) { // Only read from existing contract files if we want to deploy new ones await readDeploymentFilesIntoEnv(env, chain); diff --git a/src/scripts/fork-deployment-test.ts b/src/scripts/fork-deployment-test.ts index 2568e577..308a6151 100644 --- a/src/scripts/fork-deployment-test.ts +++ b/src/scripts/fork-deployment-test.ts @@ -44,8 +44,8 @@ const main = async () => { env = await readDeploymentFilesIntoEnv(env, chain); // Read deployment files from non-forked chain to get live addresses $.env = { - ...env, ...process.env, + ...env, }; await $`cd ${MODULE_ROOT_PATH} && forge test --match-contract DispatcherDeployTest --fork-url ${anvilUrl} -vvvv `.pipe( diff --git a/src/updateContract.ts b/src/updateContract.ts index c534b2f6..586705cd 100644 --- a/src/updateContract.ts +++ b/src/updateContract.ts @@ -41,7 +41,7 @@ export async function updateContractsForChain( // @ts-ignore let env = await readDeploymentFilesIntoEnv({}, chain); // Read from existing deployment files first, then overwrite with explicitly given contract addresses - env = { chain, ...existingContractAddresses, ...env }; + env = {...process.env, chain, ...existingContractAddresses, ...env }; if (!forceDeployNewContracts) { // Only read from existing contract files if we want to deploy new ones await readDeploymentFilesIntoEnv(env, chain); diff --git a/test/Fork/Dispatcher.deploy.t.sol b/test/Fork/Dispatcher.deploy.t.sol index f9f623db..472495f9 100644 --- a/test/Fork/Dispatcher.deploy.t.sol +++ b/test/Fork/Dispatcher.deploy.t.sol @@ -42,7 +42,7 @@ struct ChainAddresses { IUniversalChannelHandler uch; ILightClient dummyLightClient; ILightClient optimisticLightClient; - bytes32 ownerKey; // Owner Address of dispatcher + address owner; // Owner Address of dispatcher } contract DispatcherDeployTest is ChannelHandShakeUpgradeUtil, UpgradeTestUtils { @@ -57,17 +57,16 @@ contract DispatcherDeployTest is ChannelHandShakeUpgradeUtil, UpgradeTestUtils { IUniversalChannelHandler(vm.envAddress("UCProxy")), ILightClient(vm.envAddress("DummyLightClient")), ILightClient(vm.envAddress("OptimisticLightClient")), - vm.envBytes32("OWNER_KEY") + vm.envAddress("OwnerAddress") ); opLightClient = addresses.optimisticLightClient; // Need to set this so that when we call load_proof, it loads // the proof to the right address - address owner = vm.addr(uint256(addresses.ownerKey)); mars = Mars(payable(targetMarsAddress)); dispatcherProxy = addresses.dispatcherProxy; - vm.prank(owner); + vm.prank(addresses.owner); // For now, we need to change the portPrefix to that of the one which was used to generate the proof. We also // have to set that for the connectionHop to light client mapping. @@ -80,7 +79,7 @@ contract DispatcherDeployTest is ChannelHandShakeUpgradeUtil, UpgradeTestUtils { connectionHops0 = ["connection-0", "connection-3"]; connectionHops1 = ["connection-2", "connection-1"]; - vm.startPrank(owner); // Only sender should have permission + vm.startPrank(addresses.owner); // Only sender should have permission dispatcherProxy.setClientForConnection("connection-0", opLightClient); dispatcherProxy.setClientForConnection("connection-2", opLightClient); diff --git a/test/Fork/contract-spec.yaml b/test/Fork/contract-spec.yaml index b8bf9330..fdca6212 100644 --- a/test/Fork/contract-spec.yaml +++ b/test/Fork/contract-spec.yaml @@ -20,17 +20,17 @@ - name: LightClient description: 'DummyLightClient' factoryName: 'DummyLightClient' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: Ibc description: 'IBC library' factoryName: 'Ibc' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: IbcUtils description: 'IBC utils library' factoryName: 'IbcUtils' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: Dispatcher description: 'IBC Core contract' @@ -40,12 +40,12 @@ address: '{{Ibc}}' - name: 'contracts/libs/IbcUtils.sol:IbcUtils' address: '{{IbcUtils}}' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: FeeVault description: 'FeeVault' factoryName: 'FeeVault' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: DispatcherProxy description: 'Dispatcher proxy contract' @@ -58,12 +58,12 @@ args: - 'polyibc.{{chain.chainName}}.' - '{{FeeVault}}' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' - name: UC description: 'Universal Chanel IBC-middleware contract' factoryName: 'UniversalChannelHandler' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' libraries: - name: 'contracts/libs/IbcUtils.sol:IbcUtils' address: '{{IbcUtils}}' @@ -71,7 +71,7 @@ - name: UCProxy description: 'Universal Chanel IBC-middleware proxy' factoryName: 'ERC1967Proxy' - deployer: 'KEY_POLYMER' + deployer: 'KEY_DEPLOYER' deployArgs: - '{{UC}}' - '$INITARGS'