Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raunak/addNpmTesting #150

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:

jobs:
verify-bindings:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -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/[email protected]
Expand All @@ -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/
23 changes: 23 additions & 0 deletions .github/workflows/foundry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,32 @@ 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: set Owner Address
run: echo "OwnerAddress=$(cast wallet address ${{ secrets.DUMMY_DEPLOYER_PRIVATE_KEY }})" >> $GITHUB_ENV
- 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"
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
},
],
};
Expand Down Expand Up @@ -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,
},
],
};
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions specs/contracts.setup.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 13.

-  deployer: 'KEY_DEPLOYER' 
+  deployer: 'KEY_DEPLOYER'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deployer: 'KEY_DEPLOYER'
deployer: 'KEY_DEPLOYER'
Tools
yamllint

[error] 13-13: trailing spaces

(trailing-spaces)

signature: "setClientForConnection(string,address)"
address: '{{DispatcherProxy}}'
factoryName: "Dispatcher"
Expand All @@ -20,7 +20,7 @@

- name: DispatcherClientSetup-Connection-1
description: 'Setup client for dispatcher contracts'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 23.

-  deployer: 'KEY_DEPLOYER' 
+  deployer: 'KEY_DEPLOYER'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deployer: 'KEY_DEPLOYER'
deployer: 'KEY_DEPLOYER'
Tools
yamllint

[error] 23-23: trailing spaces

(trailing-spaces)

signature: "setClientForConnection(string,address)"
address: '{{DispatcherProxy}}'
factoryName: "Dispatcher"
Expand Down
16 changes: 8 additions & 8 deletions specs/contracts.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -58,20 +58,20 @@
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}}'

- name: UCProxy
description: 'Universal Chanel IBC-middleware proxy'
factoryName: 'ERC1967Proxy'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
deployArgs:
- '{{UC}}'
- '$INITARGS'
Expand Down
7 changes: 3 additions & 4 deletions specs/evm.accounts.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# 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 }}'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 3.

-  privateKey: '{{ DUMMY_DEPLOYER_PRIVATE_KEY }}' 
+  privateKey: '{{ DUMMY_DEPLOYER_PRIVATE_KEY }}'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
privateKey: '{{ DUMMY_DEPLOYER_PRIVATE_KEY }}'
privateKey: '{{ DUMMY_DEPLOYER_PRIVATE_KEY }}'


# Dapp accounts
- name: 'KEY_DAPP1'
privateKey: '{{ DAPP_PRIVATE_KEY_1 }}'
- name: 'KEY_DAPP2'
privateKey: '{{ DAPP_PRIVATE_KEY_2 }}'
- name: 'KEY_DAPP3'
privateKey: '{{ DAPP_PRIVATE_KEY_2 }}'
privateKey: '{{ DAPP_PRIVATE_KEY_3 }}'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 11.

-  privateKey: '{{ DAPP_PRIVATE_KEY_3 }}' 
+  privateKey: '{{ DAPP_PRIVATE_KEY_3 }}'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
privateKey: '{{ DAPP_PRIVATE_KEY_3 }}'
privateKey: '{{ DAPP_PRIVATE_KEY_3 }}'
Tools
yamllint

[error] 11-11: trailing spaces

(trailing-spaces)

54 changes: 35 additions & 19 deletions specs/update.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand All @@ -76,20 +92,20 @@
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}}'

- name: UCProxy
description: 'Universal Chanel IBC-middleware proxy'
factoryName: 'ERC1967Proxy'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
deployArgs:
- '{{UC}}'
- '$INITARGS'
Expand All @@ -115,7 +131,7 @@
# Contract Setup below
- name: DispatcherUpgrade
description: 'UUPS Upgrade for dispatcher contract implementation'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
RnkSngh marked this conversation as resolved.
Show resolved Hide resolved
signature: "upgradeTo(address)"
address: '{{DispatcherProxy}}'
factoryName: "Dispatcher"
Expand All @@ -124,7 +140,7 @@

- name: DispatcherUpgrade
description: 'UUPS Upgrade for dispatcher contract implementation'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
RnkSngh marked this conversation as resolved.
Show resolved Hide resolved
signature: "upgradeTo(address)"
address: '{{DispatcherProxy}}'
factoryName: "Dispatcher"
Expand All @@ -133,29 +149,29 @@

- name: UCH Upgrade
description: 'Upgrade for uch contract'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
signature: "upgradeTo(address)"
address: '{{ UC Proxy }}'
address: '{{ UCProxy }}'
RnkSngh marked this conversation as resolved.
Show resolved Hide resolved
factoryName: "UC"
args:
- '{{UC}}'

- name: DispatcherClientSetup-Connection-0
description: 'Setup client for dispatcher contracts'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
RnkSngh marked this conversation as resolved.
Show resolved Hide resolved
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}}'
- 'connection-3'
- '{{DummyLightClient}}'
6 changes: 3 additions & 3 deletions specs/upgrade.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

- name: DispatcherUpgrade
description: 'UUPS Upgrade for dispatcher contract implementation'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 21.

-  deployer: 'KEY_DEPLOYER' 
+  deployer: 'KEY_DEPLOYER'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deployer: 'KEY_DEPLOYER'
deployer: 'KEY_DEPLOYER'
Tools
yamllint

[error] 21-21: trailing spaces

(trailing-spaces)

signature: "upgradeTo(address)"
address: '{{DispatcherProxy}}'
factoryName: "Dispatcher"
Expand All @@ -27,9 +27,9 @@

- name: UCH Upgrade
description: 'Upgrade for uch contract'
deployer: 'KEY_POLYMER'
deployer: 'KEY_DEPLOYER'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 30.

-  deployer: 'KEY_DEPLOYER' 
+  deployer: 'KEY_DEPLOYER'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deployer: 'KEY_DEPLOYER'
deployer: 'KEY_DEPLOYER'
Tools
yamllint

[error] 30-30: trailing spaces

(trailing-spaces)

signature: "upgradeTo(address)"
address: '{{ UC Proxy }}'
address: '{{ UCProxy }}'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove trailing spaces.

Trailing spaces detected on line 32.

-  address: '{{ UCProxy }}' 
+  address: '{{ UCProxy }}'
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
address: '{{ UCProxy }}'
address: '{{ UCProxy }}'
Tools
yamllint

[error] 32-32: trailing spaces

(trailing-spaces)

factoryName: "UC"
args:
- '{{UC}}'
2 changes: 1 addition & 1 deletion src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading
Loading