Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Musa Bootstrapper #878

Closed
wants to merge 55 commits into from
Closed

WIP: Musa Bootstrapper #878

wants to merge 55 commits into from

Conversation

dennis-tra
Copy link
Contributor

@dennis-tra dennis-tra commented Sep 6, 2023

This PR adds the Musa bootstrapper. It's called like that to capture the 🍌 vibes around here.

Run Jaeger with:

docker run --rm --name jaeger -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one:1.49

Then just run musa with, e.g., go run musa.go. Check out the CLI options with --help.

NAME:
   musa - a lean bootstrapper for any network

USAGE:
   musa [global options] command [command options] [arguments...]

COMMANDS:
   help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --host value          the network musa should bind on (default: "127.0.0.1") [$MUSA_HOST]
   --port value          the port on which musa should listen on (default: random) [$MUSA_PORT]
   --protocol value      the libp2p protocol for the DHT (default: "/ipfs/kad/1.0.0") [$MUSA_PROTOCOL]
   --metrics-host value  the network musa metrics should bind on (default: "127.0.0.1") [$MUSA_METRICS_HOST]
   --metrics-port value  the port on which musa metrics should listen on (default: random) [$MUSA_METRICS_PORT]
   --trace-host value    the network musa trace should be pushed to (default: "127.0.0.1") [$MUSA_TRACE_HOST]
   --trace-port value    the port to which musa should push traces (default: random) [$MUSA_TRACE_PORT]
   --help, -h            show help

Notes:

  • currently it only adds the other bootstrap peers to the routing table it could connect to. This means FIND_NODE responses will only contain those
  • it is configured with a NullDatastore. Provider/IPNS/PK records are basically piped to /dev/null

To test it I've run:

vole dht gcp zQmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D /ip4/127.0.0.1/tcp/$PORT/p2p/$MUSA_PEER_ID

zQmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D is just a random CID with multibase encoding. The $MUSA_PEER_ID is printed to the console after Musa has started.

@dennis-tra dennis-tra marked this pull request as draft September 6, 2023 15:57
v2/cmd/musa/musa.go Outdated Show resolved Hide resolved
v2/cmd/musa/musa.go Outdated Show resolved Hide resolved
v2/cmd/musa/musa.go Outdated Show resolved Hide resolved
dhtConfig.TracerProvider = traceProvider

if dhtConfig.ProtocolID == dht.ProtocolIPFS {
dhtConfig.Datastore = datastore.NewNullDatastore()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we always want a Null datastore? What's the behaviour here with a different protocol?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the protocol is the /ipfs/kad/1.0.0 protocol, the DHT v2 implementation will configure three backends for the provider, ipns, and pk records. Unless there's a datastore passed into the DHT configuration, we're using an in-memory leveldb datastore.

To mimic the behaviour of the rust bootstrapper I configured the null datastore to not store anything.

Base automatically changed from zikade-import to v2-develop September 7, 2023 16:10
dennis-tra and others added 16 commits September 8, 2023 10:01
Moved ticker initialization outside the garbage collection goroutine. There was a race condition between advancing the mocked time in TestProvidersBackend_GarbageCollection and the initialization of the ticker that triggers the garbage collection runs. It happened that we were advancing the time without the ticker being initialized. Hence, advancing the time hasn't had any effect.

In this PR, I moved the ticker initialization outside the garbage collection goroutine. This means the ticker will be registered with the MockClock object after StartGarbageCollection returns. Calls to mockClock.Add will therefore trigger the ticker.
* Increase test iterations to trigger flake

* Add failfast

* Replace routing notification channel with a RoutingNotifier type

* Remove unused code

* Remove test count
@dennis-tra dennis-tra changed the base branch from v2-develop to v2-coord-addr September 19, 2023 12:32
Base automatically changed from v2-coord-addr to v2-develop September 19, 2023 12:35
@dennis-tra
Copy link
Contributor Author

As discussed, we'll move Musa to https://github.com/plprobelab/musa. I only kept the none Musa-specific changes and deleted the v2/cmd/musa/ directory.

@dennis-tra dennis-tra marked this pull request as ready for review September 19, 2023 12:39
@dennis-tra dennis-tra requested a review from a team as a code owner September 19, 2023 12:39
@dennis-tra dennis-tra closed this Sep 19, 2023
@dennis-tra dennis-tra deleted the musa branch September 19, 2023 12:40
@dennis-tra dennis-tra added the v2 All issues related to the v2 rewrite label Sep 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 All issues related to the v2 rewrite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants