Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/maticnetwork/matic-cli in…
Browse files Browse the repository at this point in the history
…to raneet10/pos-499
  • Loading branch information
Raneet10 committed Dec 19, 2022
2 parents b482216 + 6dc114b commit 78bcf71
Show file tree
Hide file tree
Showing 65 changed files with 5,507 additions and 4,919 deletions.
44 changes: 23 additions & 21 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,38 @@ TF_VAR_REGION=us-west-2 # AWS region to deploy to (default is us-west-2)
PEM_FILE_PATH=/absolute/path/to/your/aws-key.pem # absolute path pointing to the certificate previously downloaded

# Polygon network based variables (see configs/README.md) for more detailed info
DEFAULT_STAKE=10000 # default stake for each validator (in matic)
DEFAULT_FEE=2000 # default amount of fee to topup heimdall validator
DEFAULT_STAKE=10000# default stake for each validator (in matic)
DEFAULT_FEE=2000# default amount of fee to topup heimdall validator
BOR_CHAIN_ID= # bor chainID (leave empty to get a random one)
HEIMDALL_CHAIN_ID= # heimdall chainID (leave empty to get a random one)
SPRINT_SIZE=64 # sprint size (number of blocks for each bor sprint)
BLOCK_NUMBER=0 # comma separated values defining the block heights of bor where block time must change
BLOCK_TIME=2 # comma separated values defining the block times for the relative BLOCK_NUMBERs
SPRINT_SIZE=64# sprint size (number of blocks for each bor sprint)
BLOCK_NUMBER=0# comma separated values defining the block heights of bor where block time must change
BLOCK_TIME=2# comma separated values defining the block times for the relative BLOCK_NUMBERs
BOR_REPO="https://github.com/maticnetwork/bor.git" # repo of bor project
BOR_BRANCH=c5569e4da9ebe0ce4e63aec571966c71234f7cfc # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved (bor branch defining the version to be used in the devnet)
BOR_BRANCH=c5569e4da9ebe0ce4e63aec571966c71234f7cfc# todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved (bor branch defining the version to be used in the devnet)
HEIMDALL_REPO="https://github.com/maticnetwork/heimdall.git" # repo of heimdall project
HEIMDALL_BRANCH=develop # heimdall branch defining the version to be used in the devnet
CONTRACTS_BRANCH=8e95fa49300894caf7e59af837d62cff20768539 # contracts branch defining the version to be used in the devnet (repo https://github.com/maticnetwork/contracts). To use node v16.x, please stick with mardizzone/node-upgrade branch. todo change to master once contracts team merges the PR
GENESIS_CONTRACTS_BRANCH=mardizzone/node-upgrade # Genesis contracts branch defining the version to be used in the devnet (repo https://github.com/maticnetwork/genesis-contracts). To use node v16.x, please stick with mardizzone/node-upgrade branch. todo change to master once contracts team merges the PR
HEIMDALL_BRANCH=develop# heimdall branch defining the version to be used in the devnet
CONTRACTS_REPO="https://github.com/maticnetwork/contracts.git" # repo of contracts project
CONTRACTS_BRANCH=2ed59de3641c407c64def1b40bcd090cb9cc048a# contracts branch defining the version to be used in the devnet. To use node v16.x, please stick with 2ed59de3641c407c64def1b40bcd090cb9cc048a branch. todo change to master once contracts team merges the PR
GENESIS_CONTRACTS_REPO="https://github.com/maticnetwork/genesis-contracts.git" # repo of genesis-contracts project
GENESIS_CONTRACTS_BRANCH=mardizzone/node-upgrade# Genesis contracts branch defining the version to be used in the devnet. To use node v16.x, please stick with mardizzone/node-upgrade branch. todo change to master once contracts team merges the PR
MATIC_CLI_REPO="https://github.com/maticnetwork/matic-cli.git" # repo of matic-cli to run a specific version remotely using express-cli
MATIC_CLI_BRANCH=master # matic-cli branch used on the remote machines to start the environment
DEVNET_BOR_USERS=ubuntu,ubuntu,ubuntu #users' names of VMs for all the nodes (comma separated). Its length must be equal to "TF_VAR_VALIDATOR_COUNT + TF_VAR_SENTRY_COUNT"
MATIC_CLI_BRANCH=master# matic-cli branch used on the remote machines to start the environment
DEVNET_BOR_USERS=ubuntu,ubuntu,ubuntu#users' names of VMs for all the nodes (comma separated). Its length must be equal to "TF_VAR_VALIDATOR_COUNT + TF_VAR_SENTRY_COUNT"
BOR_DOCKER_BUILD_CONTEXT="https://github.com/maticnetwork/bor.git#c5569e4da9ebe0ce4e63aec571966c71234f7cfc" # todo change to develop once https://polygon.atlassian.net/browse/POS-979 is solved (docker build context for bor. Used in docker setup (TF_VAR_DOCKERIZED=yes))
HEIMDALL_DOCKER_BUILD_CONTEXT="https://github.com/maticnetwork/heimdall.git#develop" # docker build context for heimdall. Used in docker setup (TF_VAR_DOCKERIZED=yes)
VERBOSE=true # if set to true will print logs also from remote machines
DD_API_KEY=DATADOG_API_KEY # Datadog API key
VERBOSE=true# if set to true will print logs also from remote machines
DD_API_KEY=DATADOG_API_KEY# Datadog API key

#Stress test variables (used to run stress tests against the remote nodes)
MNEMONIC="clock radar mass judge dismiss just intact mind resemble fringe diary casino" #random mnemonic
SPEED=200 # TPS = ~2 * SPEED (Default SPEED = 200; TPS = ~400)
MAX_ACCOUNTS=100000 # number of transactions to be sent
FUND=true # boolean flag to fund the accounts or not (use true for first time and false for subsequent runs)
STRESS_DEBUG_LOGS=false # boolean flag to enable debug logs for the stress tests
SPEED=200# TPS = ~2 * SPEED (Default SPEED = 200; TPS = ~400)
MAX_ACCOUNTS=100000# number of transactions to be sent
FUND=true# boolean flag to fund the accounts or not (use true for first time and false for subsequent runs)
STRESS_DEBUG_LOGS=false# boolean flag to enable debug logs for the stress tests

#EIP-1559 test variables
BURN_CONTRACT_ADDRESS=0x000000000000000000000000000000000000dead # Burn contract address
MAX_FEE=30000000009 # Max fee per gas
MAX_PRIORITY_FEE=30000000000 # Max priority fee per gas
COUNT=100 # Number of times to execute the test
BURN_CONTRACT_ADDRESS=0x000000000000000000000000000000000000dead# Burn contract address
MAX_FEE=30000000009# Max fee per gas
MAX_PRIORITY_FEE=30000000000# Max priority fee per gas
COUNT=100# Number of times to execute the test
22 changes: 12 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module.exports = {
"extends": "standard",
"rules": {
"space-before-function-paren": ["error", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always",
"parser": "@babel/eslint-parser"
}],
}
};
extends: 'standard',
rules: {
'space-before-function-paren': [
'error',
{
anonymous: 'always',
named: 'never',
asyncArrow: 'always'
}
]
}
}
5 changes: 3 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ Please complete this section if any breaking changes have been made, otherwise d
- [ ] I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply

# Cross repository changes

#### It should never be the case...

- [ ] This PR requires changes to bor
- [ ] This PR requires changes to bor
- In case link the PR here:
- [ ] This PR requires changes to heimdall
- In case link the PR here:
Expand All @@ -39,4 +40,4 @@ Please complete this section with the steps you performed if you ran manual test

# Additional comments

Please post additional comments in this section if you have them, otherwise delete it
Please post additional comments in this section if you have them, otherwise delete it
67 changes: 42 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,52 @@ name: CI
on:
push:
branches:
- "master"
- 'master'
pull_request:
branches:
- "**"
- '**'
types: [opened, synchronize]

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# TODO adapt the whole integration tests to use https://www.notion.so/polygontechnology/No-More-Secrets-6382754faac745aa9bd049a3ed423218
lint:
name: Prettier and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: matic-cli
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '16.17.1'

- name: Install npm dependencies
run: |
cd matic-cli
npm install --prefer-offline --no-audit --progress=false
- name: Run prettier
run: |
cd matic-cli
npm run prettier:check
- name: Run lint
run: |
cd matic-cli
npm run lint:check
integration-tests:
permissions:
id-token: write
contents: write
if: (github.event.action != 'closed' || github.event.pull_request.merged == true)
strategy:
matrix:
os: [ ubuntu-20.04 ] # list of os: https://github.com/actions/virtual-environments
os: [ubuntu-20.04] # list of os: https://github.com/actions/virtual-environments
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -31,30 +60,24 @@ jobs:
cd matic-cli
cp .env.example .env
sed -i 's,YOUR_IDENTIFIER,matic-cli-ci,' .env
sed -i 's,YOUR_AWS_ACCESS_KEY,TODO,' .env
sed -i 's,YOUR_AWS_SECRET_KEY,TODO,' .env
sed -i 's,aws-key,matic-cli-ci-key,' .env
sed -i 's,/absolute/path/to/your/,/home/runner/work/matic-cli/matic-cli/matic-cli/aws/,' .env
sed -i 's,MATIC_CLI_BRANCH=master,MATIC_CLI_BRANCH=${{ github.head_ref || github.ref_name }},' .env
sed -i 's,DATADOG_API_KEY,TODO,' .env
cat .env
- name: Setup aws
- name: Configure AWS credentials
continue-on-error: true
run: |
cd matic-cli
mkdir -p aws
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
aws configure set aws_access_key_id TODO
aws configure set aws_secret_access_key TODO
aws configure set default.region us-west-2
uses: aws-actions/configure-aws-credentials@master
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::${{ secrets.ACCOUNT_ID }}:role/GithubActionsRole
role-session-name: GithubActionsSession

- name: Create aws key pair
continue-on-error: true
run: |
cd matic-cli/aws
cd matic-cli
mkdir aws
cd aws
aws ec2 create-key-pair --key-name matic-cli-ci-key --key-type rsa --key-format pem --output text > matic-cli-ci-key.pem
chmod 600 matic-cli-ci-key.pem
Expand All @@ -63,12 +86,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: '16.17.1'
cache: 'npm'
cache-dependency-path: |
matic-cli/package-lock.json
matic-cli/devnet/code/contracts/package-lock.json
matic-cli/devnet/code/genesis-contracts/package-lock.json
matic-cli/devnet/code/genesis-contracts/matic-contracts/package-lock.json

- name: Install npm dependencies
continue-on-error: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v1
with:
node-version: "16.17.1"
node-version: '16.17.1'
registry-url: https://registry.npmjs.org/
- run: npm install
- run: npm publish
Expand Down
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
node_modules
.DS_Store
devnet
.env
.terraform*
terraform.tfstate
terraform.tfstate.backup
terraform.tfstate.*
deployments/
.idea
contractAddresses.json
signer-dump.json
/configs/devnet/docker-setup-config.yaml
/configs/devnet/remote-setup-config.yaml
.dccache
20 changes: 20 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"arrowParens": "always",
"bracketSameLine": true,
"bracketSpacing": true,
"embeddedLanguageFormatting": "auto",
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxSingleQuote": false,
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none",
"useTabs": false,
"vueIndentScriptAndStyle": false
}
Loading

0 comments on commit 78bcf71

Please sign in to comment.