KomodoPlatform / komodo-defi-framework

This is the official Komodo DeFi Framework repository
https://komodoplatform.com/en/docs/komodo-defi-framework/
97 stars 87 forks source link

[FR] Configurable p2p network ports in MM2.json #1924

Open smk762 opened 11 months ago

smk762 commented 11 months ago

Describe the bug During testing on a netid other than 7777, it was discovered that the tcp/wss ports used for netid 7777 (i.e. 38890 & 38900) were not used for the alternative netids.

For example, netid 1111 returned

tcp        0      0 168.119.237.13:12244    0.0.0.0:*               LISTEN      2866364/mm2         
tcp        0      0 168.119.237.13:12254    0.0.0.0:*               LISTEN      2866364/mm2    

and netid 8762 returned

tcp        0      0 168.119.237.13:42855    0.0.0.0:*               LISTEN      2866580/mm2         
tcp        0      0 168.119.237.13:42845    0.0.0.0:*               LISTEN      2866580/mm2    

The algo that decides what these ports is not apparent to the user. It would be a great convenience if these ports could be defined in the MM2.json file to avoid confusion and the requirement to open additional ports when changing the netid on a seednode server.

e.g.

{
        "gui":"nogui",
        "netid": 8762,
        "userhome":"/home/atomic/",
        "passphrase":"speak friend and enter",
        "rpc_password":"gang-gang-iceCream-so-good",
        "rpc_local_only": true,
        "seednodes": ["168.119.237.13", "168.119.237.8"],
        "rpcip":"127.0.0.1",
        "rpcport":"7797",
        "wss_port": 12345,
        "tcp_port": 54321,
        "i_am_seed":true,
        "wss_certs": {
                "server_priv_key":"/etc/letsencrypt/live/seed16.defimania.live/privkey.pem", 
                "certificate":"/etc/letsencrypt/live/seed16.defimania.live/fullchain.pem"
         }
}
onur-ozkan commented 11 months ago

Thinking of it; this might be not so wise to implement such feature. When the netids are different and ports are the same nodes will need to handle incoming traffic which is unnecessary for them and this will increase the network usage for the device runs mm2.

In short, payloads will be shared across different netids when the ports are same. Which is not good.

We can print the p2p network port as an information on mm2 initialization logs, so devs/users can see what's being used and then can open that port on firewall.