![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@maticnetwork/matic-cli
Advanced tools
🏗 A set of CLIs, tools and tests to set up, manage and operate Polygon devnets.
The Testing Toolkit is built on top of express-cli
, an extension of matic-cli
which uses terraform
to deploy,
test and monitor any devnet on AWS stacks from any local system.
It currently supports only devnets running v0.3.x
stacks.
The express-cli
interacts with terraform
to create a fully working setup on AWS.
This setup is composed by a set of EC2 VM
instances running a specific ubuntu 22.04 ami
, mounted with gp3 disks
,
and a public-subnet
with its VPC
.
In case the infrastructure already exists, matic-cli
can be used as a standalone tool to deploy Polygon stacks on
pre-configured VMs.
Please, refer to the section of this file you are more interested in (express-cli
or matic-cli
)
express-cli
To use the express-cli
you have to execute the following steps.
node
version, v16.17.1
,
by running nvm use
from the root folderexpress-cli
and matic-cli
locally with command npm i
.pem
file)secret.tfvars.example
to secret.tfvar
with command cp secret.tfvars.example secret.tfvars
and check the commented file for detailssecret.tfvar
with addresses of the allowed IPs (as specified in secret.tfvars.example
file).env.example
to .env
with command cp .env.example .env
and check the heavily commented file for detailsPEM_FILE_PATH
points to a correct AWS key certificate, the one you downloaded in the previous stepsTF_VAR_VALIDATOR_COUNT
and TF_VAR_SENTRY_COUNT
) and adjust the DEVNET_BOR_USERS
accordinglyTF_VAR_DOCKERZIED=no
to have one VM per node, otherwise the stack will run on one VM only in a dockerized environmentTF_VAR_VM_NAME
with your own identifier (it can be any string, default is "polygon-user")TF_VAR_DISK_SIZE_GB
with your preferred disk size in GB (default is 100 GB)VERBOSE=true
prints logs from the remote machines. If set to false
, only express-cli
and matic-cli
logs will
be shownAs a prerequisite, you need to configure authentication on aws
This will create the folder ~/.aws
in your system
To do so, please run
aws configure sso
This command will interactively ask for some configs If you are a Polygon employee, please use the following
The browser will open and authorize your request. Please allow it.
In case there are multiple accounts available to you, please select
posv1-devnet
Then, the command will ask for other configs, please use
Note that it's mandatory to use CLI profile name: default
, as used by terraform
in express-cli
(for more context see this)
Here an output example
SSO session name (Recommended):
WARNING: Configuring using legacy format (e.g. without an SSO session).
Consider re-running "configure sso" command and providing a session name.
SSO start URL [None]: https://polygon-technology.awsapps.com/start#/
SSO region [None]: us-east-1
Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
https://device.sso.us-east-1.amazonaws.com/
Then enter the code:
<CODE-HERE>
There are 2 AWS accounts available to you.
Using the account ID <ACCOUNT_ID>
The only role available to you is: <AWSRole> (<AWS_ROLE_ID>)
Using the role name "<AWS_ROLE>"
CLI default client Region [None]: us-west-2
CLI default output format [None]: json
CLI profile name [<PROFILE_NAME_AND_ID>]: default
To use this profile, specify the profile name using --profile, as shown:
aws s3 ls --profile default
Now you can log into aws by running the following command. It needs to be executed every time the token expires.
aws sso login
Congrats! You're all set to use express-cli
commands.
Instructions to run express-cli
.
For the list of commands, please run express-cli --help
First off, you need to --init
terraform on your local machine, by executing the following command.
./bin/express-cli --init
devnet-<id>
where id
is a monotonically
increasing count for the devnets. Once created, you can cd deployments/devnet-<id>
and run the other commands.
This allows you to work with multiple devnets at once.
Then, a remote devnet can be created with the --start
command, as follows.../../bin/express-cli --start
.env.devnet<id>
file--start
command can be used also to target an existing AWS setup. If changes to .env.devnet<id>
file are detected, the
previous devnet will be destroyed and a new one created, reusing the same AWS VMs--destroy
command.../../bin/express-cli --destroy
The express-cli
also comes with additional utility commands, listed below. Some of them are only available for non-dockerized devnets.
../../bin/express-cli --update-all [index]
heimdall
and bor
branches defined as HEIMDALL_BRANCH
and BOR_BRANCH
in .env.devnet<id>
file,
pulls relative changes and restarts those services on the remote machines. If an integer index
is used, the job will be
performed only on the VM corresponding to that index.../../bin/express-cli --update-bor [index]
bor
branch defined as BOR_BRANCH
in .env.devnet<id>
file, pulls relative changes and restarts it on
the remote machines. If an integer index
is used, the job will be performed only on the VM corresponding to that index.../../bin/express-cli --update-heimdall [index]
heimdall
branch defined as HEIMDALL_BRANCH
in .env.devnet<id>
file, pulls relative changes and restarts it on
the remote machines. If an integer index
is used, the job will be performed only on the VM corresponding to that
index.../../bin/express-cli --restart-all [index]
bor
and heimdall
on all the remote machines. If an integer index
is used, the job will be performed
only on the VM corresponding to that index.../../bin/express-cli --restart-bor [index]
bor
on all the remote machines. If an integer index
is used, the job will be performed only on the VM
corresponding to that index.../../bin/express-cli --restart-heimdall [index]
heimdall
on all the remote machines. If an integer index
is used, the job will be performed only on
the VM corresponding to that index.../../bin/express-cli --cleanup
ganache
, bor
, heimdall
and bridge
, redeploys all the contracts and restarts all the services
The express-cli
also provides additional testing commands, listed here.../../bin/express-cli --send-state-sync
state-sync
transaction on the remote network ../../bin/express-cli --monitor [exit]
--send-state-sync
hasn't been used before, only checkpoints will be detected. Monitor the setup.exit
string is passed the process terminates when at least one stateSync
and one checkpoint
are detected. ../../bin/express-cli --instances-stop
../../bin/express-cli --instances-start
../../bin/express-cli --stress [fund]
fund
is needed when stress tests are ran for the first time,
to fund the accounts../../bin/express-cli --setup-datadog
DD_API_KEY
env var is required for this.../../bin/express-cli --chaos [intensity]
intensity
parameter is optional and can be set from 1
to 10
. If not set, 5
is used.../../bin/express-cli --rewind [numberOfBlocks]
128
). Default numberOfBlocks
value is 100
.../../bin/express-cli --eip-1559-test [index]
matic-cli
matic-cli
has to be installed on a ubuntu
VM (host) and - through a config file - it will point to
other VMs' IPs (remotes).
bor
and heimdall
) and a layer 1 node (ganache
)Please, make sure to install the following software/packages on the VMs.
Build Essentials (host and remotes)
sudo apt update
sudo apt install build-essential
Go 1.18+ (host and remotes)
wget https://raw.githubusercontent.com/maticnetwork/node-ansible/master/go-install.sh
bash go-install.sh --remove
bash go-install.sh
Rabbitmq (host and remotes)
sudo apt install rabbitmq-server
Docker (host and remotes, only needed in case of a docker setup)
Node v16.17.1 (only host)
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
nvm install 16.17.1
Npm (only host)
sudo apt update
sudo apt install nodejs npm
Python 2 (only host)
sudo apt install python2 && alias python="/usr/bin/python2
Solc v0.5.16 (only host)
sudo snap install solc
Ganache CLI (only host)
sudo npm install -g ganache
On the host machine, please run
cd ~
git clone https://github.com/maticnetwork/matic-cli.git
cd matic-cli
npm i
mkdir devnet
cd devnet
Adjust the docker configs and run
../bin/matic-cli setup devnet -c ../configs/devnet/docker-setup-config.yaml
Once the setup is done, follow these steps for local docker deployment
Move to devnet folder
cd matic-cli/devnet
Start ganache
bash docker-ganache-start.sh
Start heimdall
instances (it will run all services - rabbitmq, heimdall, bridge, server)
bash docker-heimdall-start-all.sh
Setup bor
bash docker-bor-setup.sh
Start bor
bash docker-bor-start-all.sh
Deploy contracts on Child chain
bash ganache-deployment-bor.sh
Sync contract addresses to Main chain
bash ganache-deployment-sync.sh
Logs will be stored under logs/
folder
Note: in case of docker setup, we have provided some additional scripts which might be helpful.
Adjust the remote configs and run
../bin/matic-cli setup devnet -c ../configs/devnet/remote-setup-config.yaml
Alternatively, this step can be executed interactively with
../bin/matic-cli setup devnet -i
Once the setup is done, follow these steps for remote deployment
In this case, the stack is already running, you would just need to deploy/sync some contracts, as follows:
Move to devnet folder
cd matic-cli/devnet
Deploy contracts on Child chain
bash ganache-deployment-bor.sh
Sync contract addresses to Main chain
bash ganache-deployment-sync.sh
Stop al services, remove the matic-cli/devnet
folder, and you can start the process once again
http://<host-machine-ip>:9545
eval "$(ssh-agent -s)"
ssh-add `<.pem file>`
express-cli
, hence they should not be deleted nor any modification remotely pushed
Therefore, they are under .gitignore
, and in case you do not want those changes to be reflected in your local git
,
you can use the commandsgit update-index --assume-unchanged configs/devnet/remote-setup-config.yaml
git update-index --assume-unchanged configs/devnet/docker-setup-config.yaml
to undo, please use
git update-index --no-assume-unchanged configs/devnet/remote-setup-config.yaml
git update-index --no-assume-unchanged configs/devnet/docker-setup-config.yaml
MIT
FAQs
Testing toolkit to setup, manage and operate Polygon networks
The npm package @maticnetwork/matic-cli receives a total of 0 weekly downloads. As such, @maticnetwork/matic-cli popularity was classified as not popular.
We found that @maticnetwork/matic-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.