warnet-simulations-

# Warnet simulations

pinheadmz | 2023-12-01 16:46:53 UTC | #1

![Screen Shot 2023-12-01 at 11.38.00 AM|690x306](upload://vLKJnwZDrP2f5EDbnCTCSKk4zUZ.jpeg)


node 0: `3c00d1496f (mzumsande/202308_increase_block_relay)` with Amiti's `getpeermemoryinfo` rebased on top

node 1: `1a8d64d23f (HEAD, amitiuttarwar/peer-memory)` i.e. *just* the `getpeermemoryinfo` feature

The network graph includes 248 additional v25.1 nodes that all connect to each other, then all attempt to create both full AND block-relay-only connections to both test nodes. The test nodes fill up with full connections and then get topped off by block-relay-only connections to hit their max.

node 0 ends up with 181 total inbounds, node 1 ends up with 114. The difference includes 65 block-relay-only connections.

The network activity generator can be seen [here](https://github.com/pinheadmz/warnet/blob/2f4ae7f9278a7544e67620ab84f98385d554e061/src/scenarios/block_relay.py#L56). Random transactions from random nodes to random nodes, followed by a block generated by a random node. We can see in the bottom left chart that mempool size over time between the two test nodes is about the same.

The total network bandwidth sent and received is also about the same for both nodes.

Memory usage as reported by `getpeermemoryinfo` shows a linear increase with the number of extra peers node 0 has. I took a snapshot of that RPC from both nodes and totaled up the results:

## node 0 (maxconn=200)
```
cnode_withtx: 692958
peer_withtx: 66040528
cnode_notx: 391598
peer_notx: 148256
notx_count: 73
withtx_count: 121
```

Which gives us about 5300 `CNode` bytes and about 2000 `Peer` bytes per block-relay-only connection.

## node 1 (control)
```
cnode_withtx: 660826
peer_withtx: 62619008
cnode_notx: 47742
peer_notx: 8944
notx_count: 9
withtx_count: 115
```

Which gives us about 5300 `CNode` bytes and about 1000 `Peer` bytes per block-relay-only connection.

So it may be notable that the memory used by `Peer` (per peer) in the the test node is 2x that of the control...?

I'm excited to try out different types of activity or even attacks on these test nodes!

-------------------------