Giter Club home page Giter Club logo

kurtosis-pos-devnet's Introduction

Kurtosis Polygon PoS Devnet

This is a Kurtosis package that will spin up a private Polygon PoS devnet over Docker or Kubernetes. The package is designed to be used for testing, validation and development of Polygon PoS clients. It is not intended for production use.

Deploy the devnet

$ kurtosis run --enclave pos-devnet github.com/leovct/kurtosis-pos-devnet
# equivalent: kurtosis run --enclave pos-devnet .
# equivalent: kurtosis run --enclave pos-devnet --args-file ./config/config_with_custom_rootchain.yml .
...
Starlark code successfully run. No output was returned.

Made with Kurtosis - https://kurtosis.com
INFO[2024-02-29T19:44:42+01:00] ===================================================
INFO[2024-02-29T19:44:42+01:00] ||          Created enclave: pos-devnet          ||
INFO[2024-02-29T19:44:42+01:00] ===================================================
Name:            pos-devnet
UUID:            89266da1faaa
Status:          RUNNING
Creation Time:   Thu, 29 Feb 2024 19:41:33 CET
Flags:

========================================= Files Artifacts =========================================
UUID           Name
276ea945bdd3   bor-0-config
3f41278b3ad0   bor-1-config
2dac344c4aca   bor-2-config
1ff172dd36bc   bor-3-config
04dde35e14d5   bor-genesis
9e2e5a6088b9   bor-genesis-generator-config
a9a8d2bd2411   heimdall-0-config
6574e2e25d18   heimdall-1-config
458228b35765   heimdall-2-config
1bebaa4bc453   heimdall-3-config
3bae05d2f121   rootchain-db
803c4431e52e   validator-keys

========================================== User Services ==========================================
UUID           Name                          Ports                                                Status
495e0b1cbaa7   bor-0                         http_rpc: 8545/tcp -> http://127.0.0.1:58424         RUNNING
58e95fe1929e   bor-1                         http_rpc: 8545/tcp -> http://127.0.0.1:58427         RUNNING
f63e3a77fdd1   bor-2                         http_rpc: 8545/tcp -> http://127.0.0.1:58430         RUNNING
cdc0dc84616f   bor-3                         http_rpc: 8545/tcp -> http://127.0.0.1:58433         RUNNING
60030471b1e7   heimdall-0                    tendermint_p2p: 26656/tcp -> tcp://127.0.0.1:58423   RUNNING
                                             tendermint_rpc: 1317/tcp -> http://127.0.0.1:58422
a030764f9e4c   heimdall-1                    tendermint_p2p: 26656/tcp -> tcp://127.0.0.1:58426   RUNNING
                                             tendermint_rpc: 1317/tcp -> http://127.0.0.1:58425
a939df5ca331   heimdall-2                    tendermint_p2p: 26656/tcp -> tcp://127.0.0.1:58429   RUNNING
                                             tendermint_rpc: 1317/tcp -> http://127.0.0.1:58428
035a03fb23ba   heimdall-3                    tendermint_p2p: 26656/tcp -> tcp://127.0.0.1:58431   RUNNING
                                             tendermint_rpc: 1317/tcp -> http://127.0.0.1:58432
11d9ec7f15b5   rabbitmq-0                    amqp: 5672/tcp -> amqp://127.0.0.1:58352             RUNNING
7b4f7cc8ef1c   rabbitmq-1                    amqp: 5672/tcp -> amqp://127.0.0.1:58374             RUNNING
19687d2f6c60   rabbitmq-2                    amqp: 5672/tcp -> amqp://127.0.0.1:58381             RUNNING
7c975c4c5798   rabbitmq-3                    amqp: 5672/tcp -> amqp://127.0.0.1:58400             RUNNING
89f8b6addaeb   rootchain                     http_rpc: 8545/tcp -> http://127.0.0.1:58315         RUNNING

kurtosis-pos-devnet's People

Contributors

leovct avatar

Stargazers

Trading23 avatar

Watchers

 avatar

kurtosis-pos-devnet's Issues

Bor nodes are not peering

Bor nodes are trying to peer with each other but somehow it fails and the peer count stays at zero.

INFO [02-29|18:31:49.158] Looking for peers                        peercount=0 tried=1 static=1
INFO [02-29|18:32:24.159] Looking for peers                        peercount=0 tried=1 static=1
INFO [02-29|18:32:59.160] Looking for peers                        peercount=0 tried=1 static=1

Each bor node lists all the other bor nodes as static-peers in their config.toml file.

// config.toml
[p2p]
  ...
  [p2p.discovery]
    ...
    static-nodes = ["enode://83da94ab446aed017d319ee745da5b30d4d6affcec5a7bcd9fb613ef01306faac16df77ef18b98f6252e574ff9aa4a0d45b18c170c16ccd344d3c6920054be90@172.16.0.11:30303"]

Deploy MATIC contracts on Bor

Deploy MATIC contracts on Bor side chain and update the values of the registry on the rootchain. This should allow bridging ERC20 and ERC721 tokens from rootcahin to sidechain and vice versa.

Update heimdall genesis

The genesis file that is being generated for Heimdall is not complete or accurate. For example, the bor_chain_id is hardcoded and set to 15001. The validator set does not include all the validators, etc.

For reference: https://github.com/maticnetwork/polygon-devnets/blob/main/docker/pos/init.sh#L169

TODOs:

  • Add a new module to manipulate heimdall genesis data.
  • Define functions to generate dividends, validators, proposer, etc.
  • Define a main function that updates the genesis file accordingly.
  • Make sure it handles well value such as false and null. It may need a final sed command to remove quotes.
$ diff tmp/heimdall/kurtosis-genesis.json tmp/heimdall/docker-genesis.json                                                                                                      
2c2
<   "genesis_time": "2024-02-29T12:22:16.46214851Z",
---
>   "genesis_time": "2024-02-29T12:15:21.604179943Z",
33c33
<           "address": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>           "address": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
43a44,82
>         },
>         {
>           "address": "0x125fb391ba829e0865963d3b91711610049a9e78",
>           "coins": [
>             {
>               "denom": "matic",
>               "amount": "1000000000000000000000"
>             }
>           ],
>           "sequence_number": "0",
>           "account_number": "0",
>           "module_name": "",
>           "module_permissions": null
>         },
>         {
>           "address": "0x964ec59d0e05db08440c822d7c588e63bbde8c4e",
>           "coins": [
>             {
>               "denom": "matic",
>               "amount": "1000000000000000000000"
>             }
>           ],
>           "sequence_number": "0",
>           "account_number": "0",
>           "module_name": "",
>           "module_permissions": null
>         },
>         {
>           "address": "0x62210af667d8c4b15ab07c88541b562426d41604",
>           "coins": [
>             {
>               "denom": "matic",
>               "amount": "1000000000000000000000"
>             }
>           ],
>           "sequence_number": "0",
>           "account_number": "0",
>           "module_name": "",
>           "module_permissions": null
52,53c91,92
<         "sprint_duration": "64",
<         "span_duration": "6400",
---
>         "sprint_duration": "16",
>         "span_duration": "128",
64c103
<                 "ID": "0",
---
>                 "ID": "1",
68,70c107,109
<                 "power": "1",
<                 "pubKey": "0x04dd60cb4576516c97af3efb4b852b2baa85ec9ef890db3d2d10b073aa0dfe2af476424c420a4667cd774ad654a9a61512c61cfe11d516e77d70740f4ad49255e1",
<                 "signer": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>                 "power": "10000",
>                 "pubKey": "0x04507cf9a75e053cda6922467721ddb10412da9bec30620347d9529cc77fca24334a4cf59685be4a2fdeabf4e7753350e42d2d3a20250fd9dc554d226463c8a3d5",
>                 "signer": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
73a113,148
>               },
>               {
>                 "ID": "2",
>                 "startEpoch": "0",
>                 "endEpoch": "0",
>                 "nonce": "1",
>                 "power": "10000",
>                 "pubKey": "0x048429adbc21ce5a6b1247aa331eca007fe87e285059ddd457727e2ff4193309399c6f18ab9132365d1286b60fc67b3e3da2277fdb034a52d5f697613894063382",
>                 "signer": "0x125fb391ba829e0865963d3b91711610049a9e78",
>                 "last_updated": "",
>                 "jailed": false,
>                 "accum": "0"
>               },
>               {
>                 "ID": "3",
>                 "startEpoch": "0",
>                 "endEpoch": "0",
>                 "nonce": "1",
>                 "power": "10000",
>                 "pubKey": "0x04ff2a9f1e172536cc12168e64cf34b5c6fddda5763418cad2216262add91018f74bf843ccb38ce710f11203e5c5170eb4337fb803e77e22368a854c957e3059e9",
>                 "signer": "0x964ec59d0e05db08440c822d7c588e63bbde8c4e",
>                 "last_updated": "",
>                 "jailed": false,
>                 "accum": "0"
>               },
>               {
>                 "ID": "4",
>                 "startEpoch": "0",
>                 "endEpoch": "0",
>                 "nonce": "1",
>                 "power": "10000",
>                 "pubKey": "0x04c89fd561af56029c1120a0948993751322b26501ce682b713b02d0cc5d9bcc4428858bd70512940e50bd3e296ef11171af23eea439ed3ed8e9d0ec671846705c",
>                 "signer": "0x62210af667d8c4b15ab07c88541b562426d41604",
>                 "last_updated": "",
>                 "jailed": false,
>                 "accum": "0"
77c152
<               "ID": "0",
---
>               "ID": "1",
81,83c156,158
<               "power": "1",
<               "pubKey": "0x04dd60cb4576516c97af3efb4b852b2baa85ec9ef890db3d2d10b073aa0dfe2af476424c420a4667cd774ad654a9a61512c61cfe11d516e77d70740f4ad49255e1",
<               "signer": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>               "power": "10000",
>               "pubKey": "0x04507cf9a75e053cda6922467721ddb10412da9bec30620347d9529cc77fca24334a4cf59685be4a2fdeabf4e7753350e42d2d3a20250fd9dc554d226463c8a3d5",
>               "signer": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
91c166
<               "ID": "0",
---
>               "ID": "1",
95,97c170,172
<               "power": "1",
<               "pubKey": "0x04dd60cb4576516c97af3efb4b852b2baa85ec9ef890db3d2d10b073aa0dfe2af476424c420a4667cd774ad654a9a61512c61cfe11d516e77d70740f4ad49255e1",
<               "signer": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>               "power": "10000",
>               "pubKey": "0x04507cf9a75e053cda6922467721ddb10412da9bec30620347d9529cc77fca24334a4cf59685be4a2fdeabf4e7753350e42d2d3a20250fd9dc554d226463c8a3d5",
>               "signer": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
100a176,211
>             },
>             {
>               "ID": "2",
>               "startEpoch": "0",
>               "endEpoch": "0",
>               "nonce": "1",
>               "power": "10000",
>               "pubKey": "0x048429adbc21ce5a6b1247aa331eca007fe87e285059ddd457727e2ff4193309399c6f18ab9132365d1286b60fc67b3e3da2277fdb034a52d5f697613894063382",
>               "signer": "0x125fb391ba829e0865963d3b91711610049a9e78",
>               "last_updated": "",
>               "jailed": false,
>               "accum": "0"
>             },
>             {
>               "ID": "3",
>               "startEpoch": "0",
>               "endEpoch": "0",
>               "nonce": "1",
>               "power": "10000",
>               "pubKey": "0x04ff2a9f1e172536cc12168e64cf34b5c6fddda5763418cad2216262add91018f74bf843ccb38ce710f11203e5c5170eb4337fb803e77e22368a854c957e3059e9",
>               "signer": "0x964ec59d0e05db08440c822d7c588e63bbde8c4e",
>               "last_updated": "",
>               "jailed": false,
>               "accum": "0"
>             },
>             {
>               "ID": "4",
>               "startEpoch": "0",
>               "endEpoch": "0",
>               "nonce": "1",
>               "power": "10000",
>               "pubKey": "0x04c89fd561af56029c1120a0948993751322b26501ce682b713b02d0cc5d9bcc4428858bd70512940e50bd3e296ef11171af23eea439ed3ed8e9d0ec671846705c",
>               "signer": "0x62210af667d8c4b15ab07c88541b562426d41604",
>               "last_updated": "",
>               "jailed": false,
>               "accum": "0"
103c214
<           "bor_chain_id": "15001"
---
>           "bor_chain_id": "137"
112,118c223,229
<           "bor_chain_id": "15001",
<           "matic_token_address": "0x0000000000000000000000000000000000000000",
<           "staking_manager_address": "0x0000000000000000000000000000000000000000",
<           "slash_manager_address": "0x0000000000000000000000000000000000000000",
<           "root_chain_address": "0x0000000000000000000000000000000000000000",
<           "staking_info_address": "0x0000000000000000000000000000000000000000",
<           "state_sender_address": "0x0000000000000000000000000000000000000000",
---
>           "bor_chain_id": "137",
>           "matic_token_address": "0xD5B4042e357F7088f01842f1B4dEA88779496958",
>           "staking_manager_address": "0x1c537faB97840a2fef787B75D37E6F621C870Eb9",
>           "slash_manager_address": "0x311981b16534238422D301e95A42f6C27A24F346",
>           "root_chain_address": "0x0B145246eB505C1fCE2382c741B95A3A094921A3",
>           "staking_info_address": "0x642195cdd894623f5Ee48d241Dc1a512138a4B84",
>           "state_sender_address": "0x51cFDa32A220242292F26b1e7fD3BF3aD95bfe01",
180,181c291,292
<         "0": {
<           "valID": "0",
---
>         "1": {
>           "valID": "1",
183a295,309
>         },
>         "2": {
>           "valID": "2",
>           "startHeight": "0",
>           "indexOffset": "0"
>         },
>         "3": {
>           "valID": "3",
>           "startHeight": "0",
>           "indexOffset": "0"
>         },
>         "4": {
>           "valID": "4",
>           "startHeight": "0",
>           "indexOffset": "0"
194c320
<           "ID": "0",
---
>           "ID": "1",
198,200c324,326
<           "power": "1",
<           "pubKey": "0x04dd60cb4576516c97af3efb4b852b2baa85ec9ef890db3d2d10b073aa0dfe2af476424c420a4667cd774ad654a9a61512c61cfe11d516e77d70740f4ad49255e1",
<           "signer": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>           "power": "10000",
>           "pubKey": "0x04507cf9a75e053cda6922467721ddb10412da9bec30620347d9529cc77fca24334a4cf59685be4a2fdeabf4e7753350e42d2d3a20250fd9dc554d226463c8a3d5",
>           "signer": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
203a330,365
>         },
>         {
>           "ID": "2",
>           "startEpoch": "0",
>           "endEpoch": "0",
>           "nonce": "1",
>           "power": "10000",
>           "pubKey": "0x048429adbc21ce5a6b1247aa331eca007fe87e285059ddd457727e2ff4193309399c6f18ab9132365d1286b60fc67b3e3da2277fdb034a52d5f697613894063382",
>           "signer": "0x125fb391ba829e0865963d3b91711610049a9e78",
>           "last_updated": "",
>           "jailed": false,
>           "accum": "0"
>         },
>         {
>           "ID": "3",
>           "startEpoch": "0",
>           "endEpoch": "0",
>           "nonce": "1",
>           "power": "10000",
>           "pubKey": "0x04ff2a9f1e172536cc12168e64cf34b5c6fddda5763418cad2216262add91018f74bf843ccb38ce710f11203e5c5170eb4337fb803e77e22368a854c957e3059e9",
>           "signer": "0x964ec59d0e05db08440c822d7c588e63bbde8c4e",
>           "last_updated": "",
>           "jailed": false,
>           "accum": "0"
>         },
>         {
>           "ID": "4",
>           "startEpoch": "0",
>           "endEpoch": "0",
>           "nonce": "1",
>           "power": "10000",
>           "pubKey": "0x04c89fd561af56029c1120a0948993751322b26501ce682b713b02d0cc5d9bcc4428858bd70512940e50bd3e296ef11171af23eea439ed3ed8e9d0ec671846705c",
>           "signer": "0x62210af667d8c4b15ab07c88541b562426d41604",
>           "last_updated": "",
>           "jailed": false,
>           "accum": "0"
209c371
<             "ID": "0",
---
>             "ID": "1",
213,215c375,377
<             "power": "1",
<             "pubKey": "0x04dd60cb4576516c97af3efb4b852b2baa85ec9ef890db3d2d10b073aa0dfe2af476424c420a4667cd774ad654a9a61512c61cfe11d516e77d70740f4ad49255e1",
<             "signer": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>             "power": "10000",
>             "pubKey": "0x04507cf9a75e053cda6922467721ddb10412da9bec30620347d9529cc77fca24334a4cf59685be4a2fdeabf4e7753350e42d2d3a20250fd9dc554d226463c8a3d5",
>             "signer": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
218a381,416
>           },
>           {
>             "ID": "2",
>             "startEpoch": "0",
>             "endEpoch": "0",
>             "nonce": "1",
>             "power": "10000",
>             "pubKey": "0x048429adbc21ce5a6b1247aa331eca007fe87e285059ddd457727e2ff4193309399c6f18ab9132365d1286b60fc67b3e3da2277fdb034a52d5f697613894063382",
>             "signer": "0x125fb391ba829e0865963d3b91711610049a9e78",
>             "last_updated": "",
>             "jailed": false,
>             "accum": "0"
>           },
>           {
>             "ID": "3",
>             "startEpoch": "0",
>             "endEpoch": "0",
>             "nonce": "1",
>             "power": "10000",
>             "pubKey": "0x04ff2a9f1e172536cc12168e64cf34b5c6fddda5763418cad2216262add91018f74bf843ccb38ce710f11203e5c5170eb4337fb803e77e22368a854c957e3059e9",
>             "signer": "0x964ec59d0e05db08440c822d7c588e63bbde8c4e",
>             "last_updated": "",
>             "jailed": false,
>             "accum": "0"
>           },
>           {
>             "ID": "4",
>             "startEpoch": "0",
>             "endEpoch": "0",
>             "nonce": "1",
>             "power": "10000",
>             "pubKey": "0x04c89fd561af56029c1120a0948993751322b26501ce682b713b02d0cc5d9bcc4428858bd70512940e50bd3e296ef11171af23eea439ed3ed8e9d0ec671846705c",
>             "signer": "0x62210af667d8c4b15ab07c88541b562426d41604",
>             "last_updated": "",
>             "jailed": false,
>             "accum": "0"
222c420
<           "ID": "0",
---
>           "ID": "1",
226,228c424,426
<           "power": "1",
<           "pubKey": "0x04dd60cb4576516c97af3efb4b852b2baa85ec9ef890db3d2d10b073aa0dfe2af476424c420a4667cd774ad654a9a61512c61cfe11d516e77d70740f4ad49255e1",
<           "signer": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>           "power": "10000",
>           "pubKey": "0x04507cf9a75e053cda6922467721ddb10412da9bec30620347d9529cc77fca24334a4cf59685be4a2fdeabf4e7753350e42d2d3a20250fd9dc554d226463c8a3d5",
>           "signer": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
245c443
<           "user": "0x7761708dfe9fd7434c4cccd7a1c3a364632c5f4b",
---
>           "user": "0x85da99c8a7c2c95964c8efd687e95e632fc533d6",
246a445,456
>         },
>         {
>           "user": "0x125fb391ba829e0865963d3b91711610049a9e78",
>           "feeAmount": "0"
>         },
>         {
>           "user": "0x964ec59d0e05db08440c822d7c588e63bbde8c4e",
>           "feeAmount": "0"
>         },
>         {
>           "user": "0x62210af667d8c4b15ab07c88541b562426d41604",
>           "feeAmount": "0"
251c461
< }
\ No newline at end of file
---
> }

Add Heimdall/Bor configuration

Only the rootchain, mnemonic and validator_count are available in the config file. There should be ways to configure Heimdall and Bor from the configuration file too.

Clean up

  • Find a better standard for scripts. At the moment, different names are used such as init.sh for bor, start.sh for heimdall and run.sh for validator-keys-generator.
  • Address the remaining TODOs (search in the code).
  • Update the documentation.
  • Use lighter images in Dockerfiles.
  • More to come...

Deploy matic-contracts on the rootchain

It's possible to use a rootchain_rpc_url and not bother setting up a local L1 chain, but it's also possible to deploy a custom rootchain. However, this configuration currently breaks the devnet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.