@libp2p/multidim-interop
TypeScript icon, indicating that this package has built-in type declarations

2.0.31 • Public • Published

@libp2p/multidim-interop

libp2p.io Discuss codecov CI

Multidimensional interop tests

Install

$ npm i @libp2p/multidim-interop

Table of contents

Usage

The multidim interop tests use random high ports for listeners. Since you need to know which port will be listened on ahead of time to EXPOSE a port in a Docker image to the host machine, this means everything has to be run in Docker.

Build js-libp2p

This must be repeated every time you make a change to the js-libp2p source code.

node.js

$ npm run build
$ docker build . -f ./interop/Dockerfile -t js-libp2p-node

Browsers

$ npm run build
$ docker build . -f ./interop/BrowserDockerfile -t js-libp2p-browsers

Build another libp2p implementation

  1. Clone the test-plans repo somewhere
    $ git clone https://github.com/libp2p/test-plans.git
  2. (Optional) If you are running an M1 Mac you may need to override the build platform.
    • Edit /transport-interop/dockerBuildWrapper.sh
    • Add --platform linux/arm64/v8 to the docker buildx build command
      docker buildx build \
        --platform linux/arm64/v8 \    <-- add this line
        --load \
        -t $IMAGE_NAME $CACHING_OPTIONS "$@"
      
  3. (Optional) Enable some sort of debug output
    • nim-libp2p
      • edit /transport-interop/impl/nim/$VERSION/Dockerfile
      • Change -d:chronicles_log_level=WARN to -d:chronicles_log_level=DEBUG
    • rust-libp2p
      • When starting the docker container add -e RUST_LOG=debug
    • go-libp2p
      • When starting the docker container add -e GOLOG_LOG_LEVEL=debug
  4. Build the version you want to test against
    $ cd multidim-interop/impl/$IMPL/$VERSION
    $ make
    ...

Running Redis

Redis is used to allow inter-container communication, exchanging listen addresses etc. It must be started as a Docker container:

$ docker run --name redis --rm -p 6379:6379 redis:7-alpine

Start libp2p

node.js

$ docker run -e transport=tcp -e muxer=yamux -e security=noise -e is_dialer=true -e redis_addr=redis:6379 --link redis:redis js-libp2p-node

Browsers

$ docker run -e transport=webtransport -e muxer=yamux -e security=noise -e is_dialer=true -e redis_addr=redis:6379 --link redis:redis js-libp2p-browsers

Start another libp2p implementation

  • Change go-v0.29 to the implementation you wish to use.
  • Ensure one docker run has is_dialer=false and the other has is_dialer=true
  • Ensure the transport option is the same for both implementations
$ docker run -e transport=tcp -e muxer=yamux -e security=noise -e is_dialer=false -e redis_addr=redis:6379 --link redis:redis go-v0.29

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Readme

Keywords

none

Package Sidebar

Install

npm i @libp2p/multidim-interop

Weekly Downloads

469

Version

2.0.31

License

Apache-2.0 OR MIT

Unpacked Size

40.9 kB

Total Files

24

Last publish

Collaborators

  • jacobheun
  • npm-service-account-libp2p
  • alanshaw
  • vascosantos
  • achingbrain
  • daviddias