Skip to content

Commit

Permalink
Merge branch 'main' into documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ermyas committed Mar 25, 2024
2 parents df0a81b + 562270d commit 293389e
Show file tree
Hide file tree
Showing 112 changed files with 8,014 additions and 1,973 deletions.
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
WITHDRAWAL_DELAY=1
DEPLOYMENTS=MAINNET,TESTNET
MAINNET_BRIDGE_ADDRESS=0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6
MAINNET_FLOW_RATED_TOKENS=0x0000000000000000000000000000000000000Eee,0xF57e7e7C23978C3cAEC3C3548E3D615c346e79fF,0xdAC17F958D2ee523a2206206994597C13D831ec7,0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599,0xccC8cb5229B0ac8069C51fd58367Fd1e622aFD97,0x9AB7bb7FdC60f4357ECFef43986818A2A3569c62
MAINNET_RPC_URL=
TESTNET_RPC_URL=
TESTNET_FLOW_RATED_TOKENS=0x0000000000000000000000000000000000000Eee,0xe2629e08f4125d14e446660028bd98ee60ee69f2
TESTNET_BRIDGE_ADDRESS=0x0D3C59c779Fd552C27b23F723E80246c840100F5
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ jobs:
build:
name: End to End Test
runs-on: ubuntu-latest
timeout-minutes: 15
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

- name: Set Node.js 18.x
- name: Set Node.js 18.18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
node-version: 18.18.x

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crytic/[email protected].0
- uses: crytic/[email protected].1
with:
fail-on: high
slither-args: --filter-paths "./lib|./test"
Expand Down
53 changes: 48 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,28 @@ env:

jobs:
check:
env:
DEPLOYMENTS: ${{ vars.DEPLOYMENTS }}
MAINNET_BRIDGE_ADDRESS: ${{ vars.MAINNET_BRIDGE_ADDRESS }}
MAINNET_FLOW_RATED_TOKENS: ${{ vars.MAINNET_FLOW_RATED_TOKENS }}
TESTNET_BRIDGE_ADDRESS: ${{ vars.TESTNET_BRIDGE_ADDRESS }}
TESTNET_FLOW_RATED_TOKENS: ${{ vars.TESTNET_FLOW_RATED_TOKENS }}
MAINNET_RPC_URL: ${{ secrets.MAINNET_RPC_URL }}
TESTNET_RPC_URL: ${{ secrets.TESTNET_RPC_URL }}
strategy:
fail-fast: true

name: Foundry project
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Set Node.js 18.18.x
uses: actions/setup-node@v3
with:
node-version: 18.18.x

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
Expand All @@ -28,7 +40,38 @@ jobs:
forge build --sizes
id: build

- name: Run Forge tests
- name: Run install
uses: borales/actions-yarn@v4
with:
cmd: install

- name: Run build
uses: borales/actions-yarn@v4
with:
cmd: build

- name: Run Unit Tests
run: |
forge test --match-path "test/unit/**" -vvv
id: unit_test

- name: Run Integration Tests
run: |
forge test --match-path "test/integration/**" -vvv
id: integration_test

- name: Run Fuzz Tests
run: |
forge test --match-path "test/fuzz/**" -vvv
id: fuzz_test

- name: Run Fork Tests
run: |
forge test --match-path "test/fork/**" -vvvvv
id: fork_test

- name: Run Invariant Tests
run: |
forge test -vvv
id: test
yarn local:testchain
forge test --match-path "test/invariant/**" -vvvvv
id: invariant_test
7 changes: 7 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extensions": ["ts"],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
]
}
187 changes: 155 additions & 32 deletions README.md

Large diffs are not rendered by default.

Binary file added audits/Trail-of-Bits-2023-12-14.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions deployments/devnet/child-chain-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"CHILD_PROXY_ADMIN": "",
"CHILD_BRIDGE_IMPL_ADDRESS": "",
"CHILD_BRIDGE_PROXY_ADDRESS": "",
"CHILD_BRIDGE_ADDRESS": "",
"CHILD_ADAPTOR_IMPL_ADDRESS": "",
"CHILD_ADAPTOR_PROXY_ADDRESS": "",
"CHILD_ADAPTOR_ADDRESS": "",
"CHILD_TOKEN_TEMPLATE": "",
"WRAPPED_IMX_ADDRESS": "",
"CHILD_TEST_CUSTOM_TOKEN": ""
}
11 changes: 11 additions & 0 deletions deployments/devnet/root-chain-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ROOT_PROXY_ADMIN": "",
"ROOT_BRIDGE_IMPL_ADDRESS": "",
"ROOT_BRIDGE_PROXY_ADDRESS": "",
"ROOT_BRIDGE_ADDRESS": "",
"ROOT_ADAPTOR_IMPL_ADDRESS": "",
"ROOT_ADAPTOR_PROXY_ADDRESS": "",
"ROOT_ADAPTOR_ADDRESS": "",
"ROOT_TOKEN_TEMPLATE": "",
"ROOT_TEST_CUSTOM_TOKEN": ""
}
12 changes: 12 additions & 0 deletions deployments/mainnet/child-chain-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"CHILD_PROXY_ADMIN": "0xdE2BCd3F0297d29c25e83228E5A33C0b43b51Ec8",
"CHILD_BRIDGE_IMPL_ADDRESS": "0xb4c3597e6b090A2f6117780cEd103FB16B071A84",
"CHILD_BRIDGE_PROXY_ADDRESS": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
"CHILD_BRIDGE_ADDRESS": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
"CHILD_ADAPTOR_IMPL_ADDRESS": "0x1d49c44dc4BbDE68D8D51a9C5732f3a24e48EFA6",
"CHILD_ADAPTOR_PROXY_ADDRESS": "0x4f49B53928A71E553bB1B0F66a5BcB54Fd4E8932",
"CHILD_ADAPTOR_ADDRESS": "0x4f49B53928A71E553bB1B0F66a5BcB54Fd4E8932",
"CHILD_TOKEN_TEMPLATE": "0x8804A8aA1F18f23aE8A456dD73806FdA3219FaD1",
"WRAPPED_IMX_ADDRESS": "0x3A0C2Ba54D6CBd3121F01b96dFd20e99D1696C9D",
"CHILD_TEST_CUSTOM_TOKEN": ""
}
11 changes: 11 additions & 0 deletions deployments/mainnet/root-chain-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ROOT_PROXY_ADMIN": "0xdE2BCd3F0297d29c25e83228E5A33C0b43b51Ec8",
"ROOT_BRIDGE_IMPL_ADDRESS": "0x177EaFe0f1F3359375B1728dae0530a75C83E154",
"ROOT_BRIDGE_PROXY_ADDRESS": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
"ROOT_BRIDGE_ADDRESS": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
"ROOT_ADAPTOR_IMPL_ADDRESS": "0xE2E91C1Ae2873720C3b975a8034e887A35323345",
"ROOT_ADAPTOR_PROXY_ADDRESS": "0x4f49B53928A71E553bB1B0F66a5BcB54Fd4E8932",
"ROOT_ADAPTOR_ADDRESS": "0x4f49B53928A71E553bB1B0F66a5BcB54Fd4E8932",
"ROOT_TOKEN_TEMPLATE": "0x8804A8aA1F18f23aE8A456dD73806FdA3219FaD1",
"ROOT_TEST_CUSTOM_TOKEN": "0xA060151cF8c803202d3A6182bDfEF019C8d836e2"
}
12 changes: 12 additions & 0 deletions deployments/testnet/child-chain-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"CHILD_PROXY_ADMIN": "0x8841Bfb811e30c791E262B7900Ab1Ff60e939282",
"CHILD_BRIDGE_IMPL_ADDRESS": "0xA554Cf58b9524d43F1dee2fE1b0C928f18A93FE9",
"CHILD_BRIDGE_PROXY_ADDRESS": "0x0D3C59c779Fd552C27b23F723E80246c840100F5",
"CHILD_BRIDGE_ADDRESS": "0x0D3C59c779Fd552C27b23F723E80246c840100F5",
"CHILD_ADAPTOR_IMPL_ADDRESS": "0xac88a57943b5BBa1ecd931F8494cAd0B7F717590",
"CHILD_ADAPTOR_PROXY_ADDRESS": "0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab",
"CHILD_ADAPTOR_ADDRESS": "0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab",
"CHILD_TOKEN_TEMPLATE": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
"WRAPPED_IMX_ADDRESS": "0x1CcCa691501174B4A623CeDA58cC8f1a76dc3439",
"CHILD_TEST_CUSTOM_TOKEN": ""
}
11 changes: 11 additions & 0 deletions deployments/testnet/root-chain-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"ROOT_PROXY_ADMIN": "0x8841Bfb811e30c791E262B7900Ab1Ff60e939282",
"ROOT_BRIDGE_IMPL_ADDRESS": "0xac88a57943b5BBa1ecd931F8494cAd0B7F717590",
"ROOT_BRIDGE_PROXY_ADDRESS": "0x0D3C59c779Fd552C27b23F723E80246c840100F5",
"ROOT_BRIDGE_ADDRESS": "0x0D3C59c779Fd552C27b23F723E80246c840100F5",
"ROOT_ADAPTOR_IMPL_ADDRESS": "0xe9ec55e1fC90AB69B2Fb4C029d24a4622B94042e",
"ROOT_ADAPTOR_PROXY_ADDRESS": "0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab",
"ROOT_ADAPTOR_ADDRESS": "0x6328Ac88ba8D466a0F551FC7C42C61d1aC7f92ab",
"ROOT_TOKEN_TEMPLATE": "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
"ROOT_TEST_CUSTOM_TOKEN": ""
}
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"test": "forge test",
"lint": "forge fmt",
"local:start": "cd scripts/localdev; ./start.sh",
"local:setup": "cd scripts/localdev; ./deploy.sh",
"local:test": "cd scripts/localdev; npx mocha --require mocha-suppress-logs ../e2e/",
"local:ci": "cd scripts/localdev; ./ci.sh && ./deploy.sh && npx mocha --require mocha-suppress-logs ../e2e/ && ./stop.sh",
"local:setup": "cd scripts/localdev; rm -rf .child.bridge.contracts.json .root.bridge.contracts.json; ./deploy.sh",
"local:test": "cd scripts/localdev; AXELAR_API_URL=skip npx mocha ../e2e/e2e.ts",
"local:ci": "cd scripts/localdev; rm -rf .child.bridge.contracts.json .root.bridge.contracts.json; ./ci.sh && ./deploy.sh && AXELAR_API_URL=skip npx mocha --require mocha-suppress-logs ../e2e/e2e.ts && ./stop.sh",
"local:chainonly": "cd scripts/localdev; LOCAL_CHAIN_ONLY=true ./start.sh",
"local:axelaronly": "cd scripts/localdev; node axelar_setup.js",
"local:axelaronly": "cd scripts/localdev; npx ts-node axelar_setup.ts",
"local:testchain": "cd scripts/localdev; ./chains.sh",
"stop": "cd scripts/localdev; ./stop.sh"
},
"author": "",
Expand All @@ -27,7 +28,10 @@
"@axelar-network/axelar-local-dev": "^2.1.1-alpha.2",
"@axelar-network/axelarjs-sdk": "^0.12.8",
"@ethersproject/hardware-wallets": "^5.7.0",
"@ledgerhq/hw-app-eth": "^6.35.0",
"@ledgerhq/hw-transport-node-hid": "^6.28.0",
"@openzeppelin/contracts": "^4.5.0",
"@types/chai-as-promised": "^7.1.8",
"axios": "^0.27.2",
"bip39": "^3.0.4",
"config": "^3.3.9",
Expand Down
98 changes: 42 additions & 56 deletions scripts/bootstrap/.env.example
Original file line number Diff line number Diff line change
@@ -1,74 +1,56 @@
# Set prior to 1_deployer_funding.js
# Set prior to 0_pre_validation.js
# Name of the child chain MUST match Axelar's definition.
CHILD_CHAIN_NAME=
# The RPC URL of child chain.
CHILD_RPC_URL=
# The chain ID of the child chain.
CHILD_CHAIN_ID=
# Name of the root chain MUST match Axelar's definition.
ROOT_CHAIN_NAME=
# The RPC URL of root chain.
ROOT_RPC_URL=
# The chain ID of the root chain.
ROOT_CHAIN_ID=
## The admin EOA address on the child chain.
CHILD_ADMIN_ADDR=
## The private key for the admin EOA or "ledger" if using hardware wallet.
CHILD_ADMIN_EOA_SECRET=
## The deployer address on child chain.
CHILD_DEPLOYER_ADDR=
## The private key for the deployer on child chain or "ledger" if using hardware wallet.
CHILD_DEPLOYER_SECRET=
## The amount of fund deployer required on L2, unit is in IMX or 10^18 Wei.
CHILD_DEPLOYER_FUND=
## The deployer address on root chain.
ROOT_DEPLOYER_ADDR=
## The private key for the deployer on root chain or "ledger" if using hardware wallet.
ROOT_DEPLOYER_SECRET=
## The private key for rate admin or "ledger" if using hardware wallet.
ROOT_BRIDGE_RATE_ADMIN_SECRET=
## The deployer address on child & root chains.
DEPLOYER_ADDR=
## The private key for the deployer on child & root chains or "ledger" if using hardware wallet.
DEPLOYER_SECRET=
## The ledger index for the deployer on child & root chains, required if using ledger.
DEPLOYER_LEDGER_INDEX=
## The nonce reserved deployer address on child & root chains.
NONCE_RESERVED_DEPLOYER_ADDR=
## The nonce reserved deployer, or "ledger" if using hardware wallet.
NONCE_RESERVED_DEPLOYER_SECRET=
## The ledger index for the nonce reserved deployer.
NONCE_RESERVED_DEPLOYER_INDEX=
## The reserved nonce for token template deployment.
NONCE_RESERVED=
## The IMX token address on root chain.
ROOT_IMX_ADDR=
## The Wrapped ETH token address on the root chain.
ROOT_WETH_ADDR=
## The Axelar address for receive initial funding on the child chain.
## The Axelar address to receive initial funding on the child chain.
AXELAR_EOA=
## The passport nonce reserver
PASSPORT_NONCE_RESERVER_ADDR=
## The amount of fund Axelar requested, unit is in IMX or 10^18 Wei.
AXELAR_FUND=
## The amount of fund deployer to be left with after bootstrapping on L2, unit is in IMX or 10^18 Wei.
CHILD_DEPLOYER_FUND=
## The amount of fund nonce reserved deployer required on L2, unit is in IMX or 10^18 Wei.
CHILD_NONCE_RESERVED_DEPLOYER_FUND=
## The amount of fund passport reserver required on L2, unit is in IMX or 10^18 Wei.
PASSPORT_NONCE_RESERVER_FUND=
## The maximum amount of IMX that can be deposited to L2, unit is in IMX or 10^18 Wei.
IMX_DEPOSIT_LIMIT=
## The address to perform child bridge upgrade.
CHILD_PROXY_ADMIN=
## The address to be assigned with DEFAULT_ADMIN_ROLE in child bridge.
CHILD_BRIDGE_DEFAULT_ADMIN=
## The address to be assigned with PAUSER_ROLE in child bridge.
CHILD_BRIDGE_PAUSER=
## The address to be assigned with UNPAUSER_ROLE in child bridge.
CHILD_BRIDGE_UNPAUSER=
## The address to be assigned with ADAPTOR_MANAGER_ROLE in child bridge.
CHILD_BRIDGE_ADAPTOR_MANAGER=
## The address to be assigned with DEFAULT_ADMIN_ROLE in child adaptor.
CHILD_ADAPTOR_DEFAULT_ADMIN=
## The address to be assigned with BRIDGE_MANAGER_ROLE in child adaptor.
CHILD_ADAPTOR_BRIDGE_MANAGER=
## The address to be assigned with GAS_SERVICE_MANAGER_ROLE in child adaptor.
CHILD_ADAPTOR_GAS_SERVICE_MANAGER=
## The address to be assigned with TARGET_MANAGER_ROLE in child adaptor.
CHILD_ADAPTOR_TARGET_MANAGER=
## The address to perform root adaptor upgrade.
ROOT_PROXY_ADMIN=
## The address to be assigned with DEFAULT_ADMIN_ROLE in root bridge.
ROOT_BRIDGE_DEFAULT_ADMIN=
## The address to be assigned with PAUSER_ROLE in root bridge.
ROOT_BRIDGE_PAUSER=
## The address to be assigned with UNPAUSER_ROLE in root bridge.
ROOT_BRIDGE_UNPAUSER=
## The address to be assigned with VARIABLE_MANAGER_ROLE in root bridge.
ROOT_BRIDGE_VARIABLE_MANAGER=
## The address to be assigned with ADAPTOR_MANAGER_ROLE in root bridge.
ROOT_BRIDGE_ADAPTOR_MANAGER=
## The address to be assigned with DEFAULT_ADMIN_ROLE in root adaptor.
ROOT_ADAPTOR_DEFAULT_ADMIN=
## The address to be assigned with BRIDGE_MANAGER_ROLE in root adaptor.
ROOT_ADAPTOR_BRIDGE_MANAGER=
## The address to be assigned with GAS_SERVICE_MANAGER_ROLE in root adaptor.
ROOT_ADAPTOR_GAS_SERVICE_MANAGER=
## The address to be assigned with TARGET_MANAGER_ROLE in root adaptor.
ROOT_ADAPTOR_TARGET_MANAGER=
## The privileged transaction Multisig address on the root chain.
ROOT_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the root chain.
ROOT_BREAKGLASS_ADDR=
## The privileged transaction Multisig address on the child chain.
CHILD_PRIVILEGED_MULTISIG_ADDR=
# The break glass signer address on the child chain.
CHILD_BREAKGLASS_ADDR=
## The capacity of the rate limit policy of IMX token, unit is in 10^18.
RATE_LIMIT_IMX_CAPACITY=
## The refill rate of the rate limit policy of IMX token, unit is in 10^18.
Expand Down Expand Up @@ -120,6 +102,10 @@ CHILD_GAS_SERVICE_ADDRESS=
MULTISIG_CONTRACT_ADDRESS=
ROOT_GATEWAY_ADDRESS=
ROOT_GAS_SERVICE_ADDRESS=
## (Optional) to verify child contract after deployment
CHILD_CHAIN_BLOCKSCOUT_API_URL=
## (Optional) to verify root contract after deployment
ROOT_CHAIN_ETHERSCAN_API_KEY=

# Set prior to bridge testing
TEST_ACCOUNT_SECRET=
Loading

0 comments on commit 293389e

Please sign in to comment.