erigon-pulse/p2p
Mark Holt df0699a12b
Added sentry simulator implementation (#9087)
This adds a simulator object with implements the SentryServer api but
takes objects from a pre-existing snapshot file.

If the snapshot is not available locally it will download and index the
.seg file for the header range being asked for.

It is created as follows: 

```go
sim, err := simulator.NewSentry(ctx, "mumbai", dataDir, 1, logger)
```

Where the arguments are:

* ctx - a callable context where cancel will close the simulator torrent
and file connections (it also has a Close method)
* chain - the name of the chain to take the snapshots from
* datadir - a directory potentially containing snapshot .seg files. If
not files exist in this directory they will be downloaded
 *  num peers - the number of peers the simulator should create
 *  logger - the loger to log actions to

It can be attached to a client as follows:

```go
simClient := direct.NewSentryClientDirect(66, sim)
```

At the moment only very basic functionality is implemented:

* get headers will return headers by range or hash (hash assumes a
pre-downloaded .seg as it needs an index
* the header replay semantics need to be confirmed
* eth 65 and 66(+) messaging is supported
* For details see: `simulator_test.go

More advanced peer behavior (e.g. header rewriting) can be added
Bodies/Transactions handling can be added
2023-12-27 14:56:57 +00:00
..
discover p2p: skip TestUDPv4_smallNetConvergence on Linux (#8731) (#8962) 2023-12-12 17:06:48 +07:00
dnsdisc Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
enode mdbx: hard-limit of small db's dirty_space (#8850) 2023-11-29 15:09:55 +01:00
enr go1.19 gofmt (#4988) 2022-08-10 19:04:13 +07:00
nat [devnet] separate logging p2p (#7549) 2023-05-19 23:08:45 +01:00
netutil Automation tool to automatically upload caplin's snapshot files to R2 (#8747) 2023-11-16 20:59:43 +01:00
rlpx Sentinel refactor (#8296) 2023-10-22 01:17:18 +02:00
sentry Added sentry simulator implementation (#9087) 2023-12-27 14:56:57 +00:00
simulations p2p: refactor peer errors to propagate with a DiscReason (#8089) 2023-08-31 16:45:23 +01:00
dial_integration_test.go Use go:build lines and remove obsolete +build lines (#4175) 2022-05-17 14:46:53 +07:00
dial_test.go move all packages from "internal" folder - to simplify users live (#5857) 2022-10-25 09:58:25 +07:00
dial.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
message_test.go p2p: move rlpx into separate package (#21464) 2020-10-06 14:12:09 +02:00
message.go p2p: refactor peer errors to propagate with a DiscReason (#8089) 2023-08-31 16:45:23 +01:00
metrics.go metrics: separate usage of prometheus counter and gauge interfaces (#8793) 2023-11-24 16:15:12 +01:00
node_key_config.go go1.19 gofmt (#4988) 2022-08-10 19:04:13 +07:00
peer_error.go p2p: limit ping requests from a single peer (#8113) 2023-09-06 17:56:03 +02:00
peer_test.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
peer.go metrics: separate usage of prometheus counter and gauge interfaces (#8793) 2023-11-24 16:15:12 +01:00
protocol.go p2p: refactor peer errors to propagate with a DiscReason (#8089) 2023-08-31 16:45:23 +01:00
server_test.go [devnet] separate logging - p2p (#7547) 2023-05-19 18:41:53 +01:00
server.go Discovery zero refresh timer (#8661) 2023-11-07 08:48:58 +00:00
transport_test.go moved metrics sub packages types to metrics (#8119) 2023-09-03 08:09:27 +07:00
transport.go metrics: swap remaining VictoriaMetrics usages with erigon-lib/metrics (#8762) 2023-11-20 12:23:23 +00:00
util_test.go rename (#1978) 2021-05-20 19:25:53 +01:00
util.go Avoiding leaking the popped item (#6193) 2022-12-04 11:17:02 +07:00