From 8f61a9593949d519aa5d5e3929fa061680b7a862 Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Wed, 17 May 2023 18:52:48 -0400 Subject: [PATCH 1/2] feat: adding some code to support directly deploying to mumbai --- ansible/group_vars/all.yml | 1 - ansible/local-extra-vars.yml | 31 ++++++++++++++++++++--- ansible/roles/edge/templates/bootstrap.sh | 17 ++++++------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index 5e0237e..e0d3a51 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -12,7 +12,6 @@ edge_user: edge is_validator: false loadtest_account: "0x85da99c8a7c2c95964c8efd687e95e632fc533d6" -rootchain_json_rpc: http://geth-001:8545 edge_grpc_port: 10000 edge_p2p_port: 10001 diff --git a/ansible/local-extra-vars.yml b/ansible/local-extra-vars.yml index 85df2ec..b995bfc 100644 --- a/ansible/local-extra-vars.yml +++ b/ansible/local-extra-vars.yml @@ -3,12 +3,37 @@ clean_deploy_title: devnet13 block_gas_limit: 50_000_000 block_time: 5 -chain_id: 2001 -polycli_tag: 0.1.20 +polycli_tag: 0.1.22 edge_tag: v0.9.0 geth_tag: v1.11.6 -go_tag: 1.19.7.linux-amd64 +go_tag: 1.19.9.linux-amd64 + +# this is the amount of value that will be transfered on the rootchain to the deployer address and the validators +# rootchain_validator_fund_amount: 100ether +# rootchain_deployer_fund_amount: 10000000ether +rootchain_deployer_fund_amount: 10ether +rootchain_validator_fund_amount: 1ether + + + +# this is the rpc url that will be used for the root chain +# rootchain_json_rpc: http://geth-001:8545 +rootchain_json_rpc: https://matic-mumbai.chainstacklabs.com + +# When our l1 is geth with an unlocked account, we'll need to send +# ether from the randomly created coinbase to our predetermined +# account. Set this to true in order to fund. Set this to false if the +# coinbase account is already funded + +# fund_rootchain_coinbase: true +fund_rootchain_coinbase: false + +# This account is just for testing purposes. Don't actually use it. If +# the L1 is NOT an unlocked test account, then you'll need some wallet +# for funding validators. The address and private key here are used for this purpose +rootchain_coinbase_address: "0xC7FDEe289150041f2c4AAEF095e8a6715223663C" +rootchain_coinbase_private_key: "0xc0ffec0ffec0ffec0ffec0ffec0ffec0ffec0ffec0ffec0ffec0ffec0ffeDEAD" ansible_ssh_private_key_file: ~/devnet_private.key ansible_ssh_common_args: > diff --git a/ansible/roles/edge/templates/bootstrap.sh b/ansible/roles/edge/templates/bootstrap.sh index 04322bc..0131a6d 100644 --- a/ansible/roles/edge/templates/bootstrap.sh +++ b/ansible/roles/edge/templates/bootstrap.sh @@ -19,18 +19,16 @@ main() { {% 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 \ - --block-gas-limit {{ block_gas_limit }} --block-time {{ block_time }}s \ + --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=$(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') + # Should the deployer be funded from an unlocked L1 chain or from a prefunded account on L1 + {% if (not fund_rootchain_coinbase) %}# {% endif %}COINBASE_ADDRESS=$(cast rpc --rpc-url {{ rootchain_json_rpc }} eth_coinbase | sed 's/"//g') + {% if (not fund_rootchain_coinbase) %}# {% endif %}cast send --rpc-url {{ rootchain_json_rpc }} --from $COINBASE_ADDRESS --value {{ rootchain_deployer_fund_amount }} $(cat rootchain-wallet.json | jq -r '.ETHAddress') --unlocked + {% if (fund_rootchain_coinbase) %}# {% endif %}cast send --rpc-url {{ rootchain_json_rpc }} --from {{ rootchain_coinbase_address }} --value {{ rootchain_deployer_fund_amount }} $(cat rootchain-wallet.json | jq -r '.ETHAddress') --private-key {{ rootchain_coinbase_private_key }} polygon-edge rootchain deploy \ --deployer-key $(cat rootchain-wallet.json | jq -r '.HexPrivateKey') \ @@ -38,7 +36,8 @@ main() { {% 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') + cast send --rpc-url {{ rootchain_json_rpc }} --from $(cat rootchain-wallet.json | jq -r '.ETHAddress') --private-key $(cat rootchain-wallet.json | jq -r '.HexPrivateKey') \ + --value {{ rootchain_validator_fund_amount }} $(cat {{ hostvars[item].tags["Name"] }}.json | jq -r '.[0].address') {% endif %} {% endfor %} @@ -59,7 +58,7 @@ main() { {% for item in hostvars %} {% if (hostvars[item].tags.Role == "validator") %} - polygon-edge polybft stake --data-dir {{ hostvars[item].tags["Name"] }} --chain-id {{ chain_id }} \ + polygon-edge polybft stake --data-dir {{ hostvars[item].tags["Name"] }} --chain-id $(cat genesis.json | jq -r '.params.chainID') \ --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') \ From bb770ffc95f11a8e4d1625535ae2032ba742fb7d Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Wed, 17 May 2023 19:22:31 -0400 Subject: [PATCH 2/2] feat: swapping back to local geth --- ansible/local-extra-vars.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/ansible/local-extra-vars.yml b/ansible/local-extra-vars.yml index b995bfc..bdc65be 100644 --- a/ansible/local-extra-vars.yml +++ b/ansible/local-extra-vars.yml @@ -10,24 +10,23 @@ geth_tag: v1.11.6 go_tag: 1.19.9.linux-amd64 # this is the amount of value that will be transfered on the rootchain to the deployer address and the validators -# rootchain_validator_fund_amount: 100ether -# rootchain_deployer_fund_amount: 10000000ether -rootchain_deployer_fund_amount: 10ether -rootchain_validator_fund_amount: 1ether +rootchain_validator_fund_amount: 100ether +rootchain_deployer_fund_amount: 10000000ether +# rootchain_deployer_fund_amount: 10ether +# rootchain_validator_fund_amount: 1ether # this is the rpc url that will be used for the root chain -# rootchain_json_rpc: http://geth-001:8545 -rootchain_json_rpc: https://matic-mumbai.chainstacklabs.com +rootchain_json_rpc: http://geth-001:8545 +# rootchain_json_rpc: https://matic-mumbai.chainstacklabs.com # When our l1 is geth with an unlocked account, we'll need to send # ether from the randomly created coinbase to our predetermined # account. Set this to true in order to fund. Set this to false if the # coinbase account is already funded - -# fund_rootchain_coinbase: true -fund_rootchain_coinbase: false +fund_rootchain_coinbase: true +# fund_rootchain_coinbase: false # This account is just for testing purposes. Don't actually use it. If # the L1 is NOT an unlocked test account, then you'll need some wallet