A5-015/ramen

Coracle fails in scenarios where nodes aren't explicitly activated/deactivated

Opened this issue · 0 comments

Problem

sim_config.py uses node IDs generated by network_generator.py. However, since the mesh network generation is probabilistic, not the exact number of nodes are generated in the network.

So, if we want a mesh network of 5 nodes, we may actually end up with a list of node IDs in the network such as:

"nodes": [
            {
                "type": "server",
                "id": 1
            },
            {
                "type": "server",
                "id": 4
            },
            {
                "type": "server",
                "id": 5
            },
        ]

instead of

"nodes": [
            {
                "type": "server",
                "id": 1
            },
            {
                "type": "server",
                "id": 2
            },
            {
                "type": "server",
                "id": 3
            },
            {
                "type": "server",
                "id": 4
            },
            {
                "type": "server",
                "id": 5
            },
        ],

As a result, the events section will look like:

"nodes": [
                    {
                        "id": 1,
                        "active": true
                    },
                    {
                        "id": 4,
                        "active": true
                    },
                    {
                        "id": 5,
                        "active": true
                    }
                ]

but Coracle hates that and crashes when it comes across something like that. Turns out Coracle expects node IDs to be sequential and consecutive...

Potential Solutions

  1. Overwrite the node IDs so that it looks like:
"nodes": [
            {
                "type": "server",
                "id": 1
            },
            {
                "type": "server",
                "id": 2
            },
            {
                "type": "server",
                "id": 3
            },
        ]
  1. Fill in the missing nodes in the events section so that
"nodes": [
                    {
                        "id": 1,
                        "active": true
                    },
                    {
                        "id": 2,
                        "active": false
                    },
                    {
                        "id": 3,
                        "active": false
                    },
                    {
                        "id": 4,
                        "active": true
                    },
                    {
                        "id": 5,
                        "active": true
                ]