Adding a Chain¶
Requirements¶
Chain Requirements¶
To integrate with connext your chain must have:
- evm compatability
ABIEncoderV2
supportEC_RECOVER
supportkeccak256
support- same math quirks as solidity (i.e. must underflow and overflow in the same way if your contract is NOT using safe math)
- blocktime/timestamp support
- solidity v7 support
If your chain meets some, but not all, of these requirements, reach out to the Connext team for more detailed integration tests.
Contract Testing¶
If there is any concern about whether your chain supports the required behavior, it is possible to run the full contract test suite against your chain:
-
Add the network information to the
hardhat.config.ts
. Specifically, include: -
a funded mnemonic
- a chainId
-
a provider url
-
Run the test suite using:
$ bash ops/test-network.sh <NETWORK_NAME> <CHAIN_PROVIDERS> <FUNDED_MNEMONIC>
# i.e. for running against matic:
# bash ops/test-network.sh "matic" '{ "80001" : "https://rpc-mumbai.matic.today" }' "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
NOTE These tests are expensive to run, and should be done against a testnet.
Integration Testing¶
To test a local trio setup against a remote chain:
- Deploy the contracts to your chain
bash ops/deploy-contracts.sh -p <PROVIDER_URL> -m <FUNDED_MNEMONIC> -a <ADDRESS_BOOK_PATH>
# the cli inputs are all optional, and if not provided will use the following defaults:
# m: "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat"
# p: "http://localhost:8545"
# a: "./address-book.json"
- Make sure there is a
node.config.json
and arouter.config.json
in the root of yourvector
directory. If one does not exist run:
make config
to create files with the preconfigured defaults for a local setup.
-
Update the
chainProviders
andchainAddresses
fields in thenode.config.json
to include the providers and deployed contract addresses for your network, respectively. Make sure to keep the formatting consistent. See the node configuration section for more information. -
Update the
rebalanceProfiles
field inrouter.config.json
to include an entry for the chain with appropriate collateralization values for the native asset. See the router configuration section for more information. Once you update therouter.config.json
delete thetrio.docker.compose
(if it exists) to ensure your changes propagate properly. -
Run the trio happy case tests with:
make test-trio