diff --git a/.github/workflows/deploy.nightly.devnet.yml b/.github/workflows/deploy.nightly.devnet.yml index 6b4b66bc40..bf72bad39a 100644 --- a/.github/workflows/deploy.nightly.devnet.yml +++ b/.github/workflows/deploy.nightly.devnet.yml @@ -86,7 +86,6 @@ jobs: chmod 600 ~/devnet_private.key eval "$(ssh-agent)" ssh-add ~/devnet_private.key - terraform output -raw geth_private_ip | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -1 | tr -d '\n' > rootchain_rpc.txt - name: Install ansible / botocore / boto3 run: | python3 -m pip install --user ansible @@ -95,16 +94,14 @@ jobs: working-directory: ansible run: | echo "${{ secrets.VAULT_PASSWORD_FILE }}" > password.txt - cp local-extra-vars.yml.template local-extra-vars.yml - sed 's/devnet01/${{ secrets.TF_VAR_DEPLOYMENT_NAME }}/g' inventory/aws_ec2.yml > inventory/aws_ec2.yml.tmp && mv inventory/aws_ec2.yml.tmp inventory/aws_ec2.yml - sed 's/devnet01/${{ secrets.TF_VAR_DEPLOYMENT_NAME }}/g' local-extra-vars.yml > local-extra-vars.yml.tmp && mv local-extra-vars.yml.tmp local-extra-vars.yml - ROOTCHAIN_RPC=$(cat ../rootchain_rpc.txt) - echo "rootchain_json_rpc: http://$ROOTCHAIN_RPC:8545" >> local-extra-vars.yml + sed 's/devnet13/${{ secrets.TF_VAR_DEPLOYMENT_NAME }}/g' inventory/aws_ec2.yml > inventory/aws_ec2.yml.tmp && mv inventory/aws_ec2.yml.tmp inventory/aws_ec2.yml + sed 's/devnet13/${{ secrets.TF_VAR_DEPLOYMENT_NAME }}/g' local-extra-vars.yml > local-extra-vars.yml.tmp && mv local-extra-vars.yml.tmp local-extra-vars.yml + sed 's/edge_tag: .*/edge_tag: HEAD/g' local-extra-vars.yml > local-extra-vars.yml.tmp && mv local-extra-vars.yml.tmp local-extra-vars.yml - name: Create script file working-directory: ansible run: | cat > roles/edge/templates/bootstrap.sh <<'EOF' - #!/bin/bash + #!/bin/bash -x main() { if [[ -d "/var/lib/bootstrap" ]]; then @@ -116,60 +113,77 @@ jobs: {% for item in hostvars %} {% if (hostvars[item].tags.Role == "fullnode" or hostvars[item].tags.Role == "validator") %} - polygon-edge polybft-secrets init --data-dir {{ hostvars[item].tags["Name"] }} \ - --chain-id {{ chain_id }} \ - --json \ - --insecure > {{ hostvars[item].tags["Name"] }}.json + polygon-edge polybft-secrets --data-dir {{ hostvars[item].tags["Name"] }} --json --insecure > {{ hostvars[item].tags["Name"] }}.json {% endif %} {% endfor %} - - apt update - curl -fsSL https://deb.nodesource.com/setup_18.x | bash - - apt-get install -y nodejs - - pushd /opt/polygon-edge/ - make compile-core-contracts - cp -r /opt/polygon-edge/core-contracts /var/lib/bootstrap/core-contracts/ - popd - - polygon-edge manifest {% for item in hostvars %}{% if (hostvars[item].tags.Role == "validator") %} --validators /dns4/{{ hostvars[item].tags["Name"] }}/tcp/{{ edge_p2p_port }}/p2p/$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].node_id'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].bls_pubkey'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].bls_signature') {% endif %}{% endfor %} \ - --path ./manifest.json \ - --premine-validators 1000000000000000000000000000 \ - --chain-id {{ chain_id }} - polygon-edge genesis \ - {% for item in hostvars %}{% if (hostvars[item].tags.Role == "validator") %} --validators /dns4/{{ hostvars[item].tags["Name"] }}/tcp/{{ edge_p2p_port }}/p2p/$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].node_id'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].bls_pubkey'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].bls_signature') {% endif %}{% endfor %} \ --consensus polybft \ {% for item in hostvars %}{% if (hostvars[item].tags.Role == "fullnode" or hostvars[item].tags.Role == "validator") %} --bootnode /dns4/{{ hostvars[item].tags["Name"] }}/tcp/{{ edge_p2p_port }}/p2p/$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].node_id') {% endif %}{% endfor %} \ - {% for address in premine_address %} --premine {{ address }}:1000000000000000000000000000 {% endfor %} + {% for item in hostvars %}{% if (hostvars[item].tags.Role == "fullnode" or hostvars[item].tags.Role == "validator") %} --premine $(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address'):1000000000000000000000000 {% endif %}{% endfor %} \ + --premine {{ loadtest_account }}:1000000000000000000000000000 \ + --reward-wallet 0x0101010101010101010101010101010101010101:1000000000000000000000000000 \ + --premine 0xA39Fed214820cF843E2Bcd6cA1759257a530894B:1000000000000000000000000000 \ + --premine 0x181d9fEc79EC674DD3cB30dd9dd4188E737939FE:1000000000000000000000000000 \ --premine 0x1AB8C3df809b85012a009c0264eb92dB04eD6EFa:1000000000000000000000000000 \ - --premine 0x0000000000000000000000000000000000000000 \ - --burn-contract 0:0x0000000000000000000000000000000000000000 \ - --block-gas-limit {{ block_gas_limit }} \ - --block-time {{ block_time }}s \ - --chain-id {{ chain_id }} \ + --block-gas-limit {{ block_gas_limit }} --block-time {{ block_time }}s \ + {% for item in hostvars %}{% if (hostvars[item].tags.Role == "validator") %} --validators /dns4/{{ hostvars[item].tags["Name"] }}/tcp/{{ edge_p2p_port }}/p2p/$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].node_id'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address' | sed 's/^0x//'):$(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].bls_pubkey') {% endif %}{% endfor %} \ + --chain-id {{ chain_id }} \ --epoch-size 10 polycli wallet create --words 12 --language english | jq '.Addresses[0]' > rootchain-wallet.json - COINBASE_ADDRESS=$(curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":1}' {{ rootchain_json_rpc }} | jq -r '.result') - curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"'"$COINBASE_ADDRESS"'","to":"'"$(cat rootchain-wallet.json | jq -r '.ETHAddress')"'","value":"0x3635C9ADC5DEA00000"}],"id":1}' -H "Content-Type: application/json" {{ rootchain_json_rpc }} - sleep 5 + + COINBASE_ADDRESS=$(cast rpc --rpc-url {{ rootchain_json_rpc }} eth_coinbase | sed 's/"//g') + + cast send --rpc-url {{ rootchain_json_rpc }} --from $COINBASE_ADDRESS --value 100ether $(cat rootchain-wallet.json | jq -r '.ETHAddress') + polygon-edge rootchain deploy \ - --deployer-key $(cat rootchain-wallet.json | jq -r '.HexPrivateKey') \ - --json-rpc {{ rootchain_json_rpc }} + --deployer-key $(cat rootchain-wallet.json | jq -r '.HexPrivateKey') \ + --json-rpc {{ rootchain_json_rpc }} + + {% for item in hostvars %} + {% if (hostvars[item].tags.Role == "validator") %} + cast send --rpc-url {{ rootchain_json_rpc }} --from $COINBASE_ADDRESS --value 100ether $(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address') + {% endif %} + {% endfor %} + + polygon-edge polybft whitelist-validators \ + --private-key $(cat rootchain-wallet.json | jq -r '.HexPrivateKey') \ + --addresses $(cat validator-*.json | jq -r ".[].address" | tr "\n" ",") \ + --supernet-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr') \ + --json-rpc {{ rootchain_json_rpc }} + {% for item in hostvars %} {% if (hostvars[item].tags.Role == "validator") %} - polygon-edge rootchain fund --data-dir {{ hostvars[item].tags["Name"] }} --json-rpc {{ rootchain_json_rpc }} + polygon-edge polybft register-validator --data-dir {{ hostvars[item].tags["Name"] }} \ + --supernet-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr') \ + --json-rpc {{ rootchain_json_rpc }} {% endif %} {% endfor %} - tar czf {{ base_dn }}.tar.gz validator* fullnode* genesis.json + {% for item in hostvars %} + {% if (hostvars[item].tags.Role == "validator") %} + polygon-edge polybft stake --data-dir {{ hostvars[item].tags["Name"] }} --chain-id {{ chain_id }} \ + --amount 10 \ + --stake-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.stakeManagerAddr') \ + --native-root-token $(cat genesis.json | jq -r '.params.engine.polybft.bridge.nativeERC20Address') \ + --json-rpc {{ rootchain_json_rpc }} + {% endif %} + {% endfor %} + + polygon-edge polybft supernet --private-key $(cat rootchain-wallet.json | jq -r '.HexPrivateKey') \ + --supernet-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.customSupernetManagerAddr') \ + --stake-manager $(cat genesis.json | jq -r '.params.engine.polybft.bridge.stakeManagerAddr') \ + --finalize-genesis --enable-staking \ + --json-rpc {{ rootchain_json_rpc }} + + tar czf {{ base_dn }}.tar.gz *.json *.private popd } main + EOF - name: Run Ansible working-directory: ansible diff --git a/.github/workflows/manual.deploy.nightly.devnet.yml b/.github/workflows/manual.deploy.nightly.devnet.yml index 8aeb1d59b8..7e3908761a 100644 --- a/.github/workflows/manual.deploy.nightly.devnet.yml +++ b/.github/workflows/manual.deploy.nightly.devnet.yml @@ -5,7 +5,7 @@ name: Nightly DevNet Workflow (Manual) on: # yamllint disable-line rule:truthy # push: # branches: - # - jesse/fix-unit-test + # - jesse/fix-nightly-build workflow_call: {} workflow_dispatch: {}