-
Notifications
You must be signed in to change notification settings - Fork 4
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
WIP - Polygon Local Devnet Setup #136
base: master
Are you sure you want to change the base?
Conversation
I must say I find this a bit messy and unsatisfying. do we need to add so much "crap" for each L2? if we really have to we can merge this. |
@dvc94ch With more 1 week of work, I can adaptate this code to run fully in a single script in rust, including create the polygon devnet dynamically, remove the static files and integrate this with existing I wasn't sure if I should spend more time in this task because I already work the whole week on this, let me know if you want me to do this changes before merge this PR. |
If it's only one week, then yes, please, let's do that. |
roger that! |
Description
Script that starts a local polygon devnet, the script is adapted from matic-cli.
Why so many files?
Most of the files are auto-generated, every time you run the matic-cli it generates a entire new network, with a different genesis, different accounts, different config, etc.. this is annoying because the
docker-compose.yml
depends of those settings, while is possible to create a script that parses the config and update thedocker-compose.yml
dynamically, that's too much work and out of the scope of this PR (which is already pretty big), this can be a future improvement. Matic-cli auto-generated artifacts are insideconfig
,data
anddevnet
folders, so you can skip while reviewing the code.How to Test
Using matic-cli you are supposed to call many shell scripts in sequence in order to start and bootstrap the network. To address this limitation, I've managed to implement one bash script which do the whole setup in one step, also keeping the same set of accounts and network. After setup the devnet starts by simply calling
docker compose up
. There's two ways to setup the testnet:Method 1 - Building from Source
1 - Install the required dependencies:
2 - run the setup script
cd ./ci/polygon ./setup.sh
Method 2 - Using docker
If you don't want to install any dependencies in your local machine, you can use Docker to setup
1 - Install the required dependencies
Start polygon devnet
This script will run
docker compose up
and deploy the matic smart-contracts.After that, the polygon node will be available at port
8595
and the layer 1 evm at9545
, heimdall.Stop polygon devnet
Solidity 0.5.12
Polygon's smart-contract requires Solidity 0.5.12+ compiler, the
solcjs
and newer versions doesn't work (I tried). The other issue I had is that there's no binary for arm64 linux (required for my docker image), to address this I adapted this CI script which compiles any solidity version from source, is the only one I've found that works both for aarch64 and x64 targets.UPDATE - 20/07
After talking to @dvc94ch, we decided to give more love to this PR in order to implement a cleaner solution for L2 networks.
Type of change
Code review prechecks: