diff --git a/.env.example b/.env.example index 06ec4cd..672d6f1 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,22 @@ # Use a custom docker image name # Default: quilibrium QUILIBRIUM_IMAGE_NAME= + +# Use a custom P2P port. +# Default: 8336 +QUILIBRIUM_P2P_PORT= + +# Use a custom gRPC port. +# Default: 8337 +QUILIBRIUM_GRPC_PORT= + +# Use a custom REST port. +# Default: 8338 +QUILIBRIUM_REST_PORT= + +# The public DNS name or IP address for this Quilibrium node. +NODE_PUBLIC_NAME= + +# Use a custom configuration directory. +# Default: .config +QUILIBRIUM_CONFIG_DIR= diff --git a/DOCKER-README.md b/DOCKER-README.md deleted file mode 100644 index 457ff76..0000000 --- a/DOCKER-README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Quilibrium Docker Instructions - -## Build - -The only requirements are `git` (to checkout the repository) and docker (to build the image). -Golang does not have to be installed, the docker image build process uses a build stage that provides the -correct Go environment and compiles the node down to one command. - -In the repository root folder, where the [Dockerfile.source](Dockerfile.source) file is, build the docker image: -```shell -docker build -f Dockerfile.source --build-arg GIT_COMMIT=$(git log -1 --format=%h) -t quilibrium -t quilibrium:1.4.16 . -``` - -Use latest version instead of `1.4.16`. - -The image that is built is light and safe. It is based on Alpine Linux with the Quilibrium node binary, no -source code, nor the Go development environment. The image also has the `grpcurl` tool that can be used to -query the gRPC interface. - -### Task - -You can also use the [Task](https://taskfile.dev/) tool, it is a simple build tool that takes care of extracting -parameters and building the image. The tasks are all defined in [Taskfile.yaml](Taskfile.yaml). - -You can optionally create an `.env` file, in the same repository root folder to override specific parameters. Right now -only one optional env var is supported and that is `QUILIBRIUM_IMAGE_NAME`, if you want to change the default -image name from `quilibrium` to something else. If you are pushing your images to GitHub then you have to follow the -GitHub naming convention and use a name like `ghcr.io/mscurtescu/ceremonyclient`. - -Bellow there are example interactions with `Task`. - -The node version is extracted from [node/main.go](node/main.go). This version string is used to tag the image. The git -repo, branch and commit are read through the `git` command and depend on the current state of your working -directory (on what branch and at what commit you are). These last three values are used to label the image. - -List tasks: -```shell -task -l -``` - -Show what parameters, like image name, version etc, will be used: -```shell -task status -``` - -Build the image (aka run the `build` task): -```shell -task build -``` - -## Run - -In order to run a Quilibrium node using the docker image follow the instructions in the [docker](docker) subfolder. diff --git a/Dockerfile.conntest.source b/Dockerfile.conntest.source deleted file mode 100644 index d79e0f6..0000000 --- a/Dockerfile.conntest.source +++ /dev/null @@ -1,189 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -RUN git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-static \ - --disable-shared \ - CFLAGS="-O3" && \ - make && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base AS build - -ENV GOEXPERIMENT=arenas -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -# Install grpcurl before building the node and client -# as to avoid needing to redo it on rebuilds -RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=client \ - --exclude=conntest \ - --exclude=sidecar . . - -RUN bash install-emp.sh - - -RUN cd emp-tool && sed -i 's/add_library(${NAME} SHARED ${sources})/add_library(${NAME} STATIC ${sources})/g' CMakeLists.txt && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd .. - -RUN cd emp-ot && mkdir build && cd build && cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local && cd .. && make && make install && cd .. - -RUN go mod download - -## Generate Rust bindings for channel -WORKDIR /opt/ceremonyclient/channel - -RUN go mod download - -RUN ./generate.sh - - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN go mod download - -RUN ./generate.sh - - -## Generate Rust bindings for Ferret -WORKDIR /opt/ceremonyclient/ferret - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for BLS48581 -WORKDIR /opt/ceremonyclient/bls48581 - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for RPM -WORKDIR /opt/ceremonyclient/rpm - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for VerEnc -WORKDIR /opt/ceremonyclient/verenc - -RUN go mod download - -RUN ./generate.sh - -## Generate Rust bindings for Bulletproofs -WORKDIR /opt/ceremonyclient/bulletproofs - -RUN go mod download - -RUN ./generate.sh - -FROM build AS build-conntest - -# Build and install conntest -COPY ./conntest /opt/ceremonyclient/conntest -WORKDIR /opt/ceremonyclient/conntest - -ENV GOPROXY=direct -RUN ./build.sh && cp conntest /usr/bin - -# Allows exporting single binary -FROM scratch AS conntest -COPY --from=build-conntest /usr/bin/conntest /conntest -ENTRYPOINT [ "/conntest" ] - -FROM ubuntu:24.04 - -RUN apt-get update && apt-get install libflint-dev -y - -ARG NODE_VERSION -ARG GIT_REPO -ARG GIT_BRANCH -ARG GIT_COMMIT - -ENV GOEXPERIMENT=arenas - -LABEL org.opencontainers.image.title="Quilibrium Network Node connection test" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -RUN apt-get update && apt-get install -y ca-certificates - -COPY --from=build-conntest /usr/bin/conntest /usr/local/bin - -WORKDIR /root - -ENTRYPOINT ["conntest"] diff --git a/Dockerfile.vdf.source b/Dockerfile.vdf.source deleted file mode 100644 index 54870f6..0000000 --- a/Dockerfile.vdf.source +++ /dev/null @@ -1,141 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH} \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH} \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-static \ - --disable-shared \ - CFLAGS="-O3" && \ - make && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base AS build - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH} \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH} \ - ./generate.sh - - -FROM build AS build-node - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH} \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH} \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf -COPY --from=build-node /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] diff --git a/Dockerfile.vdf.sourceavx512 b/Dockerfile.vdf.sourceavx512 deleted file mode 100644 index 8dc4e1a..0000000 --- a/Dockerfile.vdf.sourceavx512 +++ /dev/null @@ -1,143 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base-avx512 - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -# Build FLINT from source with AVX-512 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-avx512 \ - --enable-static \ - --disable-shared \ - CFLAGS="-march=skylake-avx512 -mtune=skylake-avx512 -O3" && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base-avx512 AS build-avx512 - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-avx512 \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-avx512 \ - ./generate.sh - - -FROM build-avx512 AS build-node-avx512 - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-avx512 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-avx512 \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf-avx512 -COPY --from=build-node-avx512 /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node-avx512 /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] \ No newline at end of file diff --git a/Dockerfile.vdf.sourcezen3 b/Dockerfile.vdf.sourcezen3 deleted file mode 100644 index a3d6a51..0000000 --- a/Dockerfile.vdf.sourcezen3 +++ /dev/null @@ -1,143 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base-zen3 - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -# Build FLINT from source with AVX-512 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-avx2 \ - --enable-static \ - --disable-shared \ - CFLAGS="-march=znver3 -mtune=znver3 -O3" && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base-zen3 AS build-zen3 - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen3 \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen3 \ - ./generate.sh - - -FROM build-zen3 AS build-node-zen3 - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen3 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen3 \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf-zen3 -COPY --from=build-node-zen3 /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node-zen3 /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] diff --git a/Dockerfile.vdf.sourcezen4 b/Dockerfile.vdf.sourcezen4 deleted file mode 100644 index 808165f..0000000 --- a/Dockerfile.vdf.sourcezen4 +++ /dev/null @@ -1,143 +0,0 @@ -# syntax=docker.io/docker/dockerfile:1.7-labs -FROM --platform=${TARGETPLATFORM} ubuntu:24.04 AS base-zen4 - -ENV PATH="${PATH}:/root/.cargo/bin/" - -ARG TARGETOS -ARG TARGETARCH - -# Install GMP 6.2 (6.3 which MacOS is using only available on Debian unstable) -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ - apt-get update && apt-get install -y \ - build-essential \ - curl \ - git \ - cmake \ - libgmp-dev \ - libmpfr-dev \ - libmpfr6 \ - wget \ - m4 \ - pkg-config \ - gcc \ - g++ \ - make \ - autoconf \ - automake \ - libtool \ - libssl-dev \ - python3 \ - python-is-python3 \ - && rm -rf /var/lib/apt/lists/* - -ARG GO_VERSION=1.23.5 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - apt update && apt install -y wget && \ - ARCH=$(dpkg --print-architecture) && \ - case ${ARCH} in \ - amd64) GOARCH=amd64 ;; \ - arm64) GOARCH=arm64 ;; \ - *) echo "Unsupported architecture: ${ARCH}" && exit 1 ;; \ - esac && \ - wget https://go.dev/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm -rf /usr/local/go && \ - tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \ - rm go${GO_VERSION}.linux-${GOARCH}.tar.gz - -ENV PATH=$PATH:/usr/local/go/bin - -# Build FLINT from source with AVX-512 -RUN --mount=type=cache,target=/usr/local,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - git clone https://github.com/flintlib/flint.git && \ - cd flint && \ - git checkout flint-3.0 && \ - ./bootstrap.sh && \ - ./configure \ - --prefix=/usr/local \ - --with-gmp=/usr/local \ - --with-mpfr=/usr/local \ - --enable-avx2 \ - --enable-static \ - --disable-shared \ - CFLAGS="-march=znver4 -mtune=znver4 -O3" && \ - make -j$(nproc) && \ - make install && \ - cd .. && \ - rm -rf flint - -COPY docker/rustup-init.sh /opt/rustup-init.sh - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - /opt/rustup-init.sh -y --profile minimal - -# Install uniffi-bindgen-go -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - cargo install uniffi-bindgen-go --git https://github.com/NordSecurity/uniffi-bindgen-go --tag v0.2.1+v0.25.0 - -FROM base-zen4 AS build-zen4 - -ENV QUILIBRIUM_SIGNATURE_CHECK=false - -WORKDIR /opt/ceremonyclient - -# Copy everything except node and client so as to avoid -# invalidating the cache at this point on client or node rebuilds - -COPY --exclude=node \ - --exclude=client \ - --exclude=sidecar . . - -## Generate Rust bindings for VDF -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen4 \ - go mod download - -RUN --mount=type=cache,target=/root/.cargo,id=cargo-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen4 \ - ./generate.sh - - -FROM build-zen4 AS build-node-zen4 - -WORKDIR /opt/ceremonyclient/vdf - -RUN --mount=type=cache,target=/usr/local/,id=usr-local-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/opt/ceremonyclient/target/,id=target-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/go/pkg/mod,id=go-mod-${TARGETOS}-${TARGETARCH}-zen4 \ - --mount=type=cache,target=/root/.cache/go-build,id=go-build-${TARGETOS}-${TARGETARCH}-zen4 \ - ./build-test.sh -o vdf-test perftest/main.go && cp vdf-test /usr/bin - -# Allows exporting single binary -FROM scratch AS vdf-zen4 -COPY --from=build-node-zen4 /usr/bin/vdf-test /vdf-test -ENTRYPOINT [ "/vdf-test" ] - -LABEL org.opencontainers.image.title="Quilibrium Network Node" -LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers." -LABEL org.opencontainers.image.version=$NODE_VERSION -LABEL org.opencontainers.image.vendor=Quilibrium -LABEL org.opencontainers.image.url=https://quilibrium.com/ -LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs -LABEL org.opencontainers.image.source=$GIT_REPO -LABEL org.opencontainers.image.ref.name=$GIT_BRANCH -LABEL org.opencontainers.image.revision=$GIT_COMMIT - -COPY --from=build-node-zen4 /usr/bin/vdf-test /usr/local/vdf-test - -WORKDIR /root - -ENTRYPOINT ["vdf-test"] diff --git a/Taskfile.yaml b/Taskfile.yaml index aab32bd..4c32de2 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -1,9 +1,9 @@ # https://taskfile.dev -version: '3' +version: "3" dotenv: - - '.env' + - ".env" env: DOCKER_BUILDKIT: '1' @@ -30,7 +30,7 @@ tasks: - echo -n "Commit :" && echo " {{.GIT_COMMIT}}" - echo -n "Max Key ID:" && echo " {{.MAX_KEY_ID}}" silent: true - + build_node_arm64_macos: desc: Build the Quilibrium node binary for MacOS ARM. Assumes it's ran from the same platform. Outputs to node/build. cmds: @@ -55,67 +55,108 @@ tasks: - rpm/generate.sh - client/build.sh -o build/arm64_macos/qclient + backup: + desc: Create a backup file with the critical configuration files. + prompt: You will be prompted for root access. Make sure you verify the generated backup file. Continue? + preconditions: + - sh: 'test -d .config' + msg: '.config does not exists!' + - sh: 'test -f .config/config.yml' + msg: '.config/config.yml does not exists!' + - sh: 'test -f .config/keys.yml' + msg: '.config/keys.yml does not exists!' + - sh: '! test -f backup.tar.gz' + msg: 'A previous backup.tar.gz found in the current folder!' + sources: + - '.config/config.yml' + - '.config/keys.yml' + generates: + - 'backup.tar.gz' + cmds: + - | + export TMP_DIR=$(mktemp -d) + export TASK_DIR=$(pwd) + sudo cp .config/config.yml $TMP_DIR + sudo cp .config/keys.yml $TMP_DIR + sudo chown $(whoami):$(id -gn) $TMP_DIR/* + cd $TMP_DIR + tar -czf $TASK_DIR/backup.tar.gz * + cd $TASK_DIR + sudo rm -rf $TMP_DIR + echo "Backup saved to: backup.tar.gz" + echo "Do not assume you have a backup unless you verify it!!!" + silent: true + + restore: + desc: Restores a backup file with the critical configuration files. + preconditions: + - sh: '! test -d .config' + msg: '.config already exists, restore cannot be performed safely!' + - sh: 'test -f backup.tar.gz' + msg: 'backup.tar.gz not found in the current folder!' + sources: + - 'backup.tar.gz' + generates: + - '.config/config.yml' + - '.config/keys.yml' + cmds: + - | + mkdir .config + tar -xzf backup.tar.gz -C .config + echo "Backup restored from: backup.tar.gz" + silent: true + + test:port: + desc: Test if the P2P port is visible to the world. + preconditions: + - sh: 'test -x "$(command -v nc)"' + msg: 'nc is not installed, install with "sudo apt install netcat"' + - sh: 'test -n "$NODE_PUBLIC_NAME"' + msg: 'The public DNS name or IP address of the server must be set in NODE_PUBLIC_NAME.' + cmds: + - 'nc -vzu ${NODE_PUBLIC_NAME} ${QUILIBRIUM_P2P_PORT:=8336}' + build_node_arm64_linux: desc: Build the Quilibrium node binary for ARM64 Linux. Outputs to node/build. cmds: - - docker build --platform linux/arm64 -f Dockerfile.source --output node/build/arm64_linux --target=node . + - docker build --platform linux/arm64 -f docker/Dockerfile.source --output node/build/arm64_linux --target=node . build_qclient_arm64_linux: desc: Build the QClient node binary for ARM64 Linux. Outputs to client/build. cmds: - - docker build --platform linux/arm64 -f Dockerfile.source --output client/build/arm64_linux --target=qclient . + - docker build --platform linux/arm64 -f docker/Dockerfile.source --output client/build/arm64_linux --target=qclient . build_node_amd64_linux: desc: Build the Quilibrium node binary for AMD64 Linux. Outputs to node/build. cmds: - - docker build --platform linux/amd64 -f Dockerfile.source --output node/build/amd64_linux --target=node . + - docker build --platform linux/amd64 -f docker/Dockerfile.source --output node/build/amd64_linux --target=node . build_conntest_amd64_linux: desc: Build the Quilibrium node connection test binary for AMD64 Linux. Outputs to conntest/build. cmds: - - docker build --platform linux/amd64 -f Dockerfile.conntest.source --output conntest/build/amd64_linux --target=conntest . + - docker build --platform linux/amd64 -f docker/Dockerfile.conntest.source --output conntest/build/amd64_linux --target=conntest . build_node_amd64_avx512_linux: desc: Build the Quilibrium node binary for AMD64 Linux with AVX-512 extensions. Outputs to node/build. cmds: - - docker build --platform linux/amd64 -f Dockerfile.sourceavx512 --output node/build/amd64_avx512_linux --target=node . + - docker build --platform linux/amd64 -f docker/Dockerfile.sourceavx512 --output node/build/amd64_avx512_linux --target=node . build_qclient_amd64_linux: desc: Build the QClient node binary for AMD64 Linux. Outputs to client/build. cmds: - - docker build --platform linux/amd64 -f Dockerfile.source --output client/build/amd64_linux --target=qclient . + - docker build --platform linux/amd64 -f docker/Dockerfile.source --output client/build/amd64_linux --target=qclient . build_qclient_amd64_avx512_linux: desc: Build the QClient node binary for AMD64 Linux with AVX-512 extensions. Outputs to client/build. cmds: - - docker build --platform linux/amd64 -f Dockerfile.sourceavx512 --output client/build/amd64_avx512_linux --target=qclient . - - build_vdf_perf_analysis_amd64_linux: - cmds: - - docker build --platform linux/amd64 -f Dockerfile.vdf.source --output vdf/build/amd64_linux --target=vdf --progress=plain --no-cache . - - build_vdf_perf_analysis_amd64_avx512_linux: - cmds: - - docker build --platform linux/amd64 -f Dockerfile.vdf.sourceavx512 --output vdf/build/amd64_avx512_linux --target=vdf-avx512 . - - build_vdf_perf_analysis_amd64_zen3_linux: - cmds: - - docker build --platform linux/amd64 -f Dockerfile.vdf.sourcezen3 --output vdf/build/amd64_zen3_linux --target=vdf-zen3 --progress=plain --no-cache . - - build_vdf_perf_analysis_amd64_zen4_linux: - cmds: - - docker build --platform linux/amd64 -f Dockerfile.vdf.sourcezen4 --output vdf/build/amd64_zen4_linux --target=vdf-zen4 --progress=plain --no-cache . - - build_vdf_perf_analysis_arm64_linux: - cmds: - - docker build --platform linux/arm64 -f Dockerfile.vdf.source --output vdf/build/arm64_linux --target=vdf --progress=plain --no-cache . + - docker build --platform linux/amd64 -f docker/Dockerfile.sourceavx512 --output client/build/amd64_avx512_linux --target=qclient . build:source: desc: Build the Quilibrium docker image from source. cmds: - | docker build \ - -f Dockerfile.source \ + -f docker/Dockerfile.source \ --build-arg NODE_VERSION={{.VERSION}} \ --build-arg GIT_REPO={{.GIT_REPO}} \ --build-arg GIT_BRANCH={{.GIT_BRANCH}} \ @@ -136,7 +177,7 @@ tasks: cmds: - | docker build \ - -f Dockerfile.release \ + -f docker/Dockerfile.release \ --build-arg NODE_VERSION={{.VERSION}} \ --build-arg GIT_REPO={{.GIT_REPO}} \ --build-arg GIT_BRANCH={{.GIT_BRANCH}} \ @@ -168,3 +209,34 @@ tasks: desc: Test the Quilibrium docker image. cmds: - client/test/run_tests.sh -d 'ubuntu' -v '24.04' + + config:gen: + desc: Generate configuration and keys using Go. + cmds: + - go run utils/config-gen --config {{.CONFIG_DIR | default ".config"}} + + build:node:source: + desc: Build the optimized Quilibrium node-only docker image. + cmds: + - | + docker build \ + --target node-only \ + -f docker/Dockerfile.source \ + --build-arg NODE_VERSION={{.VERSION}} \ + --build-arg GIT_REPO={{.GIT_REPO}} \ + --build-arg GIT_BRANCH={{.GIT_BRANCH}} \ + --build-arg GIT_COMMIT={{.GIT_COMMIT}} \ + -t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-node-only \ + -t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:node-only \ + . + + deploy:node: + desc: Run the Quilibrium node using host networking and external config. + cmds: + - | + docker run -d --name q-node \ + --network host \ + --restart unless-stopped \ + -v {{.CONFIG_DIR | default "$(pwd)/.config"}}:/root/.config \ + ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:node-only \ + -signature-check=false diff --git a/.dockerignore b/docker/.dockerignore similarity index 100% rename from .dockerignore rename to docker/.dockerignore diff --git a/docker/.env.example b/docker/.env.example deleted file mode 100644 index f7337ca..0000000 --- a/docker/.env.example +++ /dev/null @@ -1,18 +0,0 @@ -# Use a custom docker image name -# Default: quilibrium -QUILIBRIUM_IMAGE_NAME= - -# Use a custom P2P port. -# Default: 8336 -QUILIBRIUM_P2P_PORT= - -# Use a custom gRPC port. -# Default: 8337 -QUILIBRIUM_GRPC_PORT= - -# Use a custom REST port. -# Default: 8338 -QUILIBRIUM_REST_PORT= - -# The public DNS name or IP address for this Quilibrium node. -NODE_PUBLIC_NAME= diff --git a/Dockerfile.release b/docker/Dockerfile.release similarity index 100% rename from Dockerfile.release rename to docker/Dockerfile.release diff --git a/Dockerfile.source b/docker/Dockerfile.source similarity index 99% rename from Dockerfile.source rename to docker/Dockerfile.source index 459da3b..da4bff3 100644 --- a/Dockerfile.source +++ b/docker/Dockerfile.source @@ -127,7 +127,7 @@ COPY --from=rust-base /root/.rustup /root/.rustup ENV PATH="${PATH}:/root/.cargo/bin/" ENV GOEXPERIMENT=arenas -ENV QUILIBRIUM_SIGNATURE_CHECK=false +ENV QUILIBRIUM_SIGNATURE_CHECK=true # Install grpcurl (common tool) RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest diff --git a/Dockerfile.source.dockerignore b/docker/Dockerfile.source.dockerignore similarity index 100% rename from Dockerfile.source.dockerignore rename to docker/Dockerfile.source.dockerignore diff --git a/Dockerfile.sourceavx512 b/docker/Dockerfile.sourceavx512 similarity index 100% rename from Dockerfile.sourceavx512 rename to docker/Dockerfile.sourceavx512 diff --git a/docker/README.md b/docker/README.md index fa83b85..9c7f0e5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,165 +1,59 @@ -# Quilibrium Docker Instructions +# Quilibrium Docker Guide -## Install Docker on a Server +This folder contains the Dockerfiles and related resources for Quilibrium. All commands should be executed from the **root of the repository** using `task`. -> [!IMPORTANT] -> You have to install Docker Engine on your server, you don't want to install Docker Desktop. +## 1. System Preparation -The official Linux installation instructions start here: -https://docs.docker.com/engine/install/ +For system preparation follow the official [Quilibrium Guide](https://docs.quilibrium.com/). -For Ubuntu you can start here: -https://docs.docker.com/engine/install/ubuntu/ +## 2. Configuration -While there are several installation methods, you really want to use the apt repository, this way you get -automatic updates. +### Generating Config +The configuration directory `.config` is located at the root of the repository. -Make sure you also follow the Linux post-installation steps: -https://docs.docker.com/engine/install/linux-postinstall/ - -## Install Docker on a Desktop - -For a Linux desktop follow the server installation steps above, do not install Docker Desktop for Linux unless -you know what you are doing. - -For Mac and Windows follow the corresponding Docker Desktop installation links from the top of: -https://docs.docker.com/engine/install/ - -## Running a Node - -Copy [docker-compose.yml](docker-compose.yml) to a new folder on a server. The official -Docker image provided by Quilibrium Network will be pulled. - -A `.config/` subfolder will be created in this folder, this will hold both configuration -and the node storage. - -Optionally you can also copy [Taskfile.yaml](Taskfile.yaml) and [.env.example](.env.example) to the -server, if you are planning to use them. See below. - -### New Instance - -If you are starting a brand new node then simply run Quilibrium in a container with: -```shell -docker compose up -d +```bash +task config:gen ``` +This will generate `config.yml` and `keys.yml` in the `.config/` folder. -A `.config/` subfolder will be created under the current folder, this is mapped inside the container. +## 3. Workflow Options -> [!IMPORTANT] -> Once the node is running (the `-node-info` command shows a balance) make sure you backup -> `config.yml` and `keys.yml`. +You have two primary ways to use Docker with Quilibrium: -### Restore Previous Instance +### Option A: Build Binary via Docker (for Native Run) +If you prefer to run the node natively but don't want to set up the full Go build environment, you can use Docker to compile the binary for your specific platform. -If you have both `config.yml` and `keys.yml` backed up from a previous instance then follow these -steps to restore them: +1. **Build and Export Binary**: + Run the task corresponding to your OS/Architecture: + - **Linux AMD64**: `task build_node_amd64_linux` + - **Linux ARM64**: `task build_node_arm64_linux` + - **MacOS ARM**: `task build_node_arm64_macos` -1. Create an empty `.config/` subfolder. -2. Copy `config.yml` and `keys.yml` to `.config/`. -3. Start the node with: - ```shell - docker compose up -d +2. **Run Binary**: + The binary will be exported to `node/build/`. You can then run it directly: + ```bash + ./node/build/[platform]/node ``` -### Task +### Option B: Run Entirely via Docker +The node runs inside a Docker container. -You can also use the [Task](https://taskfile.dev/) tool, it is a simple build tool that takes care of running -complex commands and intereacting with the container. The tasks are all defined in -[Taskfile.yaml](Taskfile.yaml). +1. **Build the Image**: + ```bash + task build:node:source + ``` +2. **Deploy the Node**: + ```bash + task deploy:node + ``` -You can optionally create an `.env` file, in the same folder to override specific parameters. Right now -only one optional env var is supported with `Task` and that is `QUILIBRIUM_IMAGE_NAME`, if you want to change the -default image name from `quilibrium` to something else. If you are pushing your images to GitHub, for example, then you -have to follow the GitHub naming convention and use a name like `ghcr.io/mscurtescu/ceremonyclient`. See the -[.env.example](.env.example) sample file, and keep in mind that `.env` is shared with -[docker-compose.yml](docker-compose.yml). + and then you can use the standard docker commands to manage the node. -Bellow there are example interactions with `Task`. +## 4. Maintenance & Backup -Start the container through docker compose: -```shell -task up -``` +> [!IMPORTANT] +> Always backup your `.config/` directory. It contains your unique node identity and balance information. -Show the logs through docker compose: -```shell -task logs -``` - -Drop into a shell inside the running container: -```shell -task shell -``` - -Stop the running container(s): -```shell -task down -``` - -Backup the critical configuration: -```shell -task backup -``` - -The above command will create a `backup.tar.gz` archive in the current folder, you still have to copy this -file from the server into a safe location. The command adds the `config.yml` and `keys.yml` files from -the `.config/` subfolder to the archive, with the ownership of the current user. - - -## Customizing docker-compose.yml - -If you want to change certain parameters in [docker-compose.yml](docker-compose.yml) it is better not -to edit the file directly as new versions pushed through git would overwrite your changes. A more -flexible solution is to create another file called `docker-compose.override.yml` right next to it -and specifying the necessary overriding changes there. - -For example: -```yaml -services: - node: - image: ghcr.io/mscurtescu/ceremonyclient - restart: on-failure:7 -``` - -The above will override the image name and also the restart policy. - -You can optionally create an `.env` file, in the same folder to override specific parameters. See the -[.env.example](.env.example) sample file, and keep in mind that `.env` is shared with -[Taskfile.yaml](Taskfile.yaml). You can customize the image name and port mappings. - -To check if your overrides are being picked up run the following command: -```shell -docker compose config -``` - -This will output the merged and canonical compose file that will be used to run the container(s). - - -## Interact with a running container - -Drop into a shell inside a running container: -```shell -docker compose exec -it node sh -``` - -Watch the logs: -```shell -docker compose logs -f -``` - -Get the node related info (peer id, version, max frame and balance): -```shell -docker compose exec node node -node-info -``` - -Run the DB console: -```shell -docker compose exec node node -db-console -``` - -Run the Quilibrium client: -```shell -docker compose exec node qclient help -docker compose exec node qclient token help -docker compose exec node qclient token balance -``` +- **Backup**: `task backup` +- **Restore**: `task restore` +- **Check Status**: `task status` diff --git a/docker/Taskfile.yaml b/docker/Taskfile.yaml deleted file mode 100644 index d2115ba..0000000 --- a/docker/Taskfile.yaml +++ /dev/null @@ -1,114 +0,0 @@ -# https://taskfile.dev - -version: '3' - -dotenv: - - '.env' - -vars: - PROJECT_NAME: quilibrium - SERVICE_NAME: node - -tasks: - up: - desc: Run a new Quilibrium and related containers, through docker compose. - cmds: - - docker compose up -d - - down: - desc: Take down the Quilibrium containers, through docker compose. - cmds: - - docker compose down - - pull: - desc: Pull new Docker images corresponding to the Quilibrium containers, through docker compose. - cmds: - - docker compose pull - - update: - desc: Pull new Docker images corresponding to the Quilibrium containers, then restart all containers. - cmds: - - task: pull - - task: down - - task: up - - shell: - desc: Drop into a shell inside the running container. - cmds: - - docker compose exec -it {{.SERVICE_NAME}} sh - - logs: - desc: Print the logs of the running Quilibrium container. - cmds: - - docker compose logs -f - - logs-folder: - desc: Show where Docker stores the logs for the Quilibrium node. You need root permissions to access the folder. - cmds: - - "docker container inspect {{.PROJECT_NAME}}-{{.SERVICE_NAME}}-1 | grep LogPath | cut -d : -f 2 | cut -d '\"' -f 2 | xargs dirname" - - node-info: - desc: Displays node related info for a running node. - cmds: - - docker compose exec node node -node-info - - backup: - desc: Create a backup file with the critical configuration files. - prompt: You will be prompted for root access. Make sure you verify the generated backup file. Continue? - preconditions: - - sh: 'test -d .config' - msg: '.config does not exists!' - - sh: 'test -f .config/config.yml' - msg: '.config/config.yml does not exists!' - - sh: 'test -f .config/keys.yml' - msg: '.config/keys.yml does not exists!' - - sh: '! test -f backup.tar.gz' - msg: 'A previous backup.tar.gz found in the current folder!' - sources: - - '.config/config.yml' - - '.config/keys.yml' - generates: - - 'backup.tar.gz' - cmds: - - | - export TMP_DIR=$(mktemp -d) - export TASK_DIR=$(pwd) - sudo cp .config/config.yml $TMP_DIR - sudo cp .config/keys.yml $TMP_DIR - sudo chown $(whoami):$(id -gn) $TMP_DIR/* - cd $TMP_DIR - tar -czf $TASK_DIR/backup.tar.gz * - cd $TASK_DIR - sudo rm -rf $TMP_DIR - echo "Backup saved to: backup.tar.gz" - echo "Do not assume you have a backup unless you verify it!!!" - silent: true - - restore: - desc: Restores a backup file with the critical configuration files. - preconditions: - - sh: '! test -d .config' - msg: '.config already exists, restore cannot be performed safely!' - - sh: 'test -f backup.tar.gz' - msg: 'backup.tar.gz not found in the current folder!' - sources: - - 'backup.tar.gz' - generates: - - '.config/config.yml' - - '.config/keys.yml' - cmds: - - | - mkdir .config - tar -xzf backup.tar.gz -C .config - echo "Backup restored from: backup.tar.gz" - silent: true - - test:port: - desc: Test if the P2P port is visible to the world. - preconditions: - - sh: 'test -x "$(command -v nc)"' - msg: 'nc is not installed, install with "sudo apt install netcat"' - - sh: 'test -n "$NODE_PUBLIC_NAME"' - msg: 'The public DNS name or IP address of the server must be set in NODE_PUBLIC_NAME.' - cmds: - - 'nc -vzu ${NODE_PUBLIC_NAME} ${QUILIBRIUM_P2P_PORT:=8336}' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100644 index 816b238..0000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: quilibrium - -# See sysctl related warning in DOCKER-README.md. -# Host configuration changes are required. - -services: - node: - image: ${QUILIBRIUM_IMAGE_NAME:-quilibrium} - restart: unless-stopped - environment: - - DEFAULT_LISTEN_GRPC_MULTIADDR=/ip4/0.0.0.0/tcp/8337 - - DEFAULT_LISTEN_REST_MULTIADDR=/ip4/0.0.0.0/tcp/8338 - - DEFAULT_STATS_MULTIADDR=/dns/stats.quilibrium.com/tcp/443 - ports: - - '${QUILIBRIUM_P2P_PORT:-8336}:8336/udp' # p2p - - '127.0.0.1:${QUILIBRIUM_GRPC_PORT:-8337}:8337/tcp' # gRPC - - '127.0.0.1:${QUILIBRIUM_REST_PORT:-8338}:8338/tcp' # REST - healthcheck: - test: ["CMD", "grpcurl", "-plaintext", "localhost:8337", "list", "quilibrium.node.node.pb.NodeService"] - interval: 30s - timeout: 5s - retries: 3 - start_period: 15m - volumes: - - ./.config:/root/.config - logging: - driver: "json-file" - options: - max-file: "5" - max-size: 2048m diff --git a/utils/config-gen/go.mod b/utils/config-gen/go.mod new file mode 100644 index 0000000..e4ca447 --- /dev/null +++ b/utils/config-gen/go.mod @@ -0,0 +1,58 @@ +module config-gen + +go 1.23.2 + +replace source.quilibrium.com/quilibrium/monorepo/config => ../../config + +replace source.quilibrium.com/quilibrium/monorepo/utils => ../../utils + +replace github.com/multiformats/go-multiaddr => ../../go-multiaddr + +replace github.com/multiformats/go-multiaddr-dns => ../../go-multiaddr-dns + +replace github.com/libp2p/go-libp2p => ../../go-libp2p + +replace github.com/libp2p/go-libp2p-kad-dht => ../../go-libp2p-kad-dht + +replace source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub => ../../go-libp2p-blossomsub + +require ( + github.com/libp2p/go-libp2p v0.41.1 + source.quilibrium.com/quilibrium/monorepo/config v0.0.0-00010101000000-000000000000 +) + +require ( + github.com/cloudflare/circl v1.6.1 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect + github.com/ipfs/go-cid v0.5.0 // indirect + github.com/ipfs/go-log/v2 v2.5.1 // indirect + github.com/klauspost/cpuid/v2 v2.2.10 // indirect + github.com/libp2p/go-buffer-pool v0.1.0 // indirect + github.com/libp2p/go-msgio v0.3.0 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/minio/sha256-simd v1.0.1 // indirect + github.com/mr-tron/base58 v1.2.0 // indirect + github.com/multiformats/go-base32 v0.1.0 // indirect + github.com/multiformats/go-base36 v0.2.0 // indirect + github.com/multiformats/go-multiaddr v0.16.0 // indirect + github.com/multiformats/go-multiaddr-fmt v0.1.0 // indirect + github.com/multiformats/go-multibase v0.2.0 // indirect + github.com/multiformats/go-multicodec v0.9.1 // indirect + github.com/multiformats/go-multihash v0.2.3 // indirect + github.com/multiformats/go-multistream v0.6.1 // indirect + github.com/multiformats/go-varint v0.0.7 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/spaolacci/murmur3 v1.1.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/crypto v0.39.0 // indirect + golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect + golang.org/x/sys v0.33.0 // indirect + google.golang.org/protobuf v1.36.6 // indirect + gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + lukechampine.com/blake3 v1.4.1 // indirect + source.quilibrium.com/quilibrium/monorepo/go-libp2p-blossomsub v0.0.0-00010101000000-000000000000 // indirect + source.quilibrium.com/quilibrium/monorepo/utils v0.0.0-00010101000000-000000000000 // indirect +) diff --git a/utils/config-gen/go.sum b/utils/config-gen/go.sum new file mode 100644 index 0000000..bdca5e9 --- /dev/null +++ b/utils/config-gen/go.sum @@ -0,0 +1,341 @@ +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o= +github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= +github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= +github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= +github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= +github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 h1:NMZiJj8QnKe1LgsbDayM4UoHwbvwDRwnI3hwNaAHRnc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjYzMhyjf0LaoftYK0p+A3h40= +github.com/flynn/noise v1.1.0 h1:KjPQoQCEFdZDiP03phOvGi11+SVVhBG2wOWAorLsstg= +github.com/flynn/noise v1.1.0/go.mod h1:xbMo+0i6+IGbYdJhF31t2eR1BIU0CYc12+BNAKwUTag= +github.com/francoispqt/gojay v1.2.13 h1:d2m3sFjloqoIUQU3TsHBgj6qg/BVGlTBeHDUmyJnXKk= +github.com/francoispqt/gojay v1.2.13/go.mod h1:ehT5mTG4ua4581f1++1WLG0vPdaA9HaiDsoyrBGkyDY= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= +github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= +github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= +github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= +github.com/ipfs/go-cid v0.0.7/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I= +github.com/ipfs/go-cid v0.5.0 h1:goEKKhaGm0ul11IHA7I6p1GmKz8kEYniqFopaB5Otwg= +github.com/ipfs/go-cid v0.5.0/go.mod h1:0L7vmeNXpQpUS9vt+yEARkJ8rOg43DF3iPgn4GIN0mk= +github.com/ipfs/go-log/v2 v2.5.1 h1:1XdUzF7048prq4aBjDQQ4SL5RxftpRGdXhNRwKSAlcY= +github.com/ipfs/go-log/v2 v2.5.1/go.mod h1:prSpmC1Gpllc9UYWxDiZDreBYw7zp4Iqp1kOLU9U5UI= +github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= +github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= +github.com/jbenet/go-temp-err-catcher v0.1.0 h1:zpb3ZH6wIE8Shj2sKS+khgRvf7T7RABoLk/+KKHggpk= +github.com/jbenet/go-temp-err-catcher v0.1.0/go.mod h1:0kJRvmDZXNMIiJirNPEYfhpPwbGVtZVWC34vc5WLsDk= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/cpuid/v2 v2.0.4/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= +github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY= +github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= +github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= +github.com/koron/go-ssdp v0.0.6 h1:Jb0h04599eq/CY7rB5YEqPS83HmRfHP2azkxMN2rFtU= +github.com/koron/go-ssdp v0.0.6/go.mod h1:0R9LfRJGek1zWTjN3JUNlm5INCDYGpRDfAptnct63fI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= +github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= +github.com/libp2p/go-flow-metrics v0.2.0 h1:EIZzjmeOE6c8Dav0sNv35vhZxATIXWZg6j/C08XmmDw= +github.com/libp2p/go-flow-metrics v0.2.0/go.mod h1:st3qqfu8+pMfh+9Mzqb2GTiwrAGjIPszEjZmtksN8Jc= +github.com/libp2p/go-libp2p-asn-util v0.4.1 h1:xqL7++IKD9TBFMgnLPZR6/6iYhawHKHl950SO9L6n94= +github.com/libp2p/go-libp2p-asn-util v0.4.1/go.mod h1:d/NI6XZ9qxw67b4e+NgpQexCIiFYJjErASrYW4PFDN8= +github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= +github.com/libp2p/go-msgio v0.3.0 h1:mf3Z8B1xcFN314sWX+2vOTShIE0Mmn2TXn3YCUQGNj0= +github.com/libp2p/go-msgio v0.3.0/go.mod h1:nyRM819GmVaF9LX3l03RMh10QdOroF++NBbxAb0mmDM= +github.com/libp2p/go-netroute v0.2.2 h1:Dejd8cQ47Qx2kRABg6lPwknU7+nBnFRpko45/fFPuZ8= +github.com/libp2p/go-netroute v0.2.2/go.mod h1:Rntq6jUAH0l9Gg17w5bFGhcC9a+vk4KNXs6s7IljKYE= +github.com/libp2p/go-reuseport v0.4.0 h1:nR5KU7hD0WxXCJbmw7r2rhRYruNRl2koHw8fQscQm2s= +github.com/libp2p/go-reuseport v0.4.0/go.mod h1:ZtI03j/wO5hZVDFo2jKywN6bYKWLOy8Se6DrI2E1cLU= +github.com/libp2p/go-yamux/v5 v5.0.1 h1:f0WoX/bEF2E8SbE4c/k1Mo+/9z0O4oC/hWEA+nfYRSg= +github.com/libp2p/go-yamux/v5 v5.0.1/go.mod h1:en+3cdX51U0ZslwRdRLrvQsdayFt3TSUKvBGErzpWbU= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd h1:br0buuQ854V8u83wA0rVZ8ttrq5CpaPZdvrK0LP2lOk= +github.com/marten-seemann/tcp v0.0.0-20210406111302-dfbc87cc63fd/go.mod h1:QuCEs1Nt24+FYQEqAAncTDPJIuGs+LxK1MCiFL25pMU= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE= +github.com/miekg/dns v1.1.66/go.mod h1:jGFzBsSNbJw6z1HYut1RKBKHA9PBdxeHrZG8J+gC2WE= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b h1:z78hV3sbSMAUoyUMM0I83AUIT6Hu17AWfgjzIbtrYFc= +github.com/mikioh/tcpinfo v0.0.0-20190314235526-30a79bb1804b/go.mod h1:lxPUiZwKoFL8DUUmalo2yJJUCxbPKtm8OKfqr2/FTNU= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc h1:PTfri+PuQmWDqERdnNMiD9ZejrlswWrCpBEZgWOiTrc= +github.com/mikioh/tcpopt v0.0.0-20190314235656-172688c1accc/go.mod h1:cGKTAVKx4SxOuR/czcZ/E2RSJ3sfHs8FpHhQ5CWMf9s= +github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ= +github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM= +github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM= +github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM= +github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8= +github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8= +github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o= +github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc= +github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA= +github.com/multiformats/go-base32 v0.1.0 h1:pVx9xoSPqEIQG8o+UbAe7DNi51oej1NtK+aGkbLYxPE= +github.com/multiformats/go-base32 v0.1.0/go.mod h1:Kj3tFY6zNr+ABYMqeUNeGvkIC/UYgtWibDcT0rExnbI= +github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM= +github.com/multiformats/go-base36 v0.2.0 h1:lFsAbNOGeKtuKozrtBsAkSVhv1p9D0/qedU9rQyccr0= +github.com/multiformats/go-base36 v0.2.0/go.mod h1:qvnKE++v+2MWCfePClUEjE78Z7P2a1UV0xHgWc0hkp4= +github.com/multiformats/go-multiaddr-fmt v0.1.0 h1:WLEFClPycPkp4fnIzoFoV9FVd49/eQsuaL3/CWe167E= +github.com/multiformats/go-multiaddr-fmt v0.1.0/go.mod h1:hGtDIW4PU4BqJ50gW2quDuPVjyWNZxToGUh/HwTZYJo= +github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc= +github.com/multiformats/go-multibase v0.2.0 h1:isdYCVLvksgWlMW9OZRYJEa9pZETFivncJHmHnnd87g= +github.com/multiformats/go-multibase v0.2.0/go.mod h1:bFBZX4lKCA/2lyOFSAoKH5SS6oPyjtnzK/XTFDPkNuk= +github.com/multiformats/go-multicodec v0.9.1 h1:x/Fuxr7ZuR4jJV4Os5g444F7xC4XmyUaT/FWtE+9Zjo= +github.com/multiformats/go-multicodec v0.9.1/go.mod h1:LLWNMtyV5ithSBUo3vFIMaeDy+h3EbkMTek1m+Fybbo= +github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc= +github.com/multiformats/go-multihash v0.2.3 h1:7Lyc8XfX/IY2jWb/gI7JP+o7JEq9hOa7BFvVU9RSh+U= +github.com/multiformats/go-multihash v0.2.3/go.mod h1:dXgKXCXjBzdscBLk9JkjINiEsCKRVch90MdaGiKsvSM= +github.com/multiformats/go-multistream v0.6.1 h1:4aoX5v6T+yWmc2raBHsTvzmFhOI8WVOer28DeBBEYdQ= +github.com/multiformats/go-multistream v0.6.1/go.mod h1:ksQf6kqHAb6zIsyw7Zm+gAuVo57Qbq84E27YlYqavqw= +github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.6/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE= +github.com/multiformats/go-varint v0.0.7 h1:sWSGR+f/eu5ABZA2ZpYKBILXTTs9JWpdEM/nEGOHFS8= +github.com/multiformats/go-varint v0.0.7/go.mod h1:r8PUYw/fD/SjBCiKOoDlGF6QawOELpZAu9eioSos/OU= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 h1:onHthvaw9LFnH4t2DcNVpwGmV9E1BkGknEliJkfwQj0= +github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58/go.mod h1:DXv8WO4yhMYhSNPKjeNKa5WY9YCIEBRbNzFFPJbWO6Y= +github.com/pion/datachannel v1.5.10 h1:ly0Q26K1i6ZkGf42W7D4hQYR90pZwzFOjTq5AuCKk4o= +github.com/pion/datachannel v1.5.10/go.mod h1:p/jJfC9arb29W7WrxyKbepTU20CFgyx5oLo8Rs4Py/M= +github.com/pion/dtls/v2 v2.2.12 h1:KP7H5/c1EiVAAKUmXyCzPiQe5+bCJrpOeKg/L05dunk= +github.com/pion/dtls/v2 v2.2.12/go.mod h1:d9SYc9fch0CqK90mRk1dC7AkzzpwJj6u2GU3u+9pqFE= +github.com/pion/dtls/v3 v3.0.6 h1:7Hkd8WhAJNbRgq9RgdNh1aaWlZlGpYTzdqjy9x9sK2E= +github.com/pion/dtls/v3 v3.0.6/go.mod h1:iJxNQ3Uhn1NZWOMWlLxEEHAN5yX7GyPvvKw04v9bzYU= +github.com/pion/ice/v4 v4.0.10 h1:P59w1iauC/wPk9PdY8Vjl4fOFL5B+USq1+xbDcN6gT4= +github.com/pion/ice/v4 v4.0.10/go.mod h1:y3M18aPhIxLlcO/4dn9X8LzLLSma84cx6emMSu14FGw= +github.com/pion/interceptor v0.1.40 h1:e0BjnPcGpr2CFQgKhrQisBU7V3GXK6wrfYrGYaU6Jq4= +github.com/pion/interceptor v0.1.40/go.mod h1:Z6kqH7M/FYirg3frjGJ21VLSRJGBXB/KqaTIrdqnOic= +github.com/pion/logging v0.2.3 h1:gHuf0zpoh1GW67Nr6Gj4cv5Z9ZscU7g/EaoC/Ke/igI= +github.com/pion/logging v0.2.3/go.mod h1:z8YfknkquMe1csOrxK5kc+5/ZPAzMxbKLX5aXpbpC90= +github.com/pion/mdns/v2 v2.0.7 h1:c9kM8ewCgjslaAmicYMFQIde2H9/lrZpjBkN8VwoVtM= +github.com/pion/mdns/v2 v2.0.7/go.mod h1:vAdSYNAT0Jy3Ru0zl2YiW3Rm/fJCwIeM0nToenfOJKA= +github.com/pion/randutil v0.1.0 h1:CFG1UdESneORglEsnimhUjf33Rwjubwj6xfiOXBa3mA= +github.com/pion/randutil v0.1.0/go.mod h1:XcJrSMMbbMRhASFVOlj/5hQial/Y8oH/HVo7TBZq+j8= +github.com/pion/rtcp v1.2.15 h1:LZQi2JbdipLOj4eBjK4wlVoQWfrZbh3Q6eHtWtJBZBo= +github.com/pion/rtcp v1.2.15/go.mod h1:jlGuAjHMEXwMUHK78RgX0UmEJFV4zUKOFHR7OP+D3D0= +github.com/pion/rtp v1.8.19 h1:jhdO/3XhL/aKm/wARFVmvTfq0lC/CvN1xwYKmduly3c= +github.com/pion/rtp v1.8.19/go.mod h1:bAu2UFKScgzyFqvUKmbvzSdPr+NGbZtv6UB2hesqXBk= +github.com/pion/sctp v1.8.39 h1:PJma40vRHa3UTO3C4MyeJDQ+KIobVYRZQZ0Nt7SjQnE= +github.com/pion/sctp v1.8.39/go.mod h1:cNiLdchXra8fHQwmIoqw0MbLLMs+f7uQ+dGMG2gWebE= +github.com/pion/sdp/v3 v3.0.13 h1:uN3SS2b+QDZnWXgdr69SM8KB4EbcnPnPf2Laxhty/l4= +github.com/pion/sdp/v3 v3.0.13/go.mod h1:88GMahN5xnScv1hIMTqLdu/cOcUkj6a9ytbncwMCq2E= +github.com/pion/srtp/v3 v3.0.6 h1:E2gyj1f5X10sB/qILUGIkL4C2CqK269Xq167PbGCc/4= +github.com/pion/srtp/v3 v3.0.6/go.mod h1:BxvziG3v/armJHAaJ87euvkhHqWe9I7iiOy50K2QkhY= +github.com/pion/stun v0.6.1 h1:8lp6YejULeHBF8NmV8e2787BogQhduZugh5PdhDyyN4= +github.com/pion/stun v0.6.1/go.mod h1:/hO7APkX4hZKu/D0f2lHzNyvdkTGtIy3NDmLR7kSz/8= +github.com/pion/stun/v3 v3.0.0 h1:4h1gwhWLWuZWOJIJR9s2ferRO+W3zA/b6ijOI6mKzUw= +github.com/pion/stun/v3 v3.0.0/go.mod h1:HvCN8txt8mwi4FBvS3EmDghW6aQJ24T+y+1TKjB5jyU= +github.com/pion/transport/v2 v2.2.10 h1:ucLBLE8nuxiHfvkFKnkDQRYWYfp8ejf4YBOPfaQpw6Q= +github.com/pion/transport/v2 v2.2.10/go.mod h1:sq1kSLWs+cHW9E+2fJP95QudkzbK7wscs8yYgQToO5E= +github.com/pion/transport/v3 v3.0.7 h1:iRbMH05BzSNwhILHoBoAPxoB9xQgOaJk+591KC9P1o0= +github.com/pion/transport/v3 v3.0.7/go.mod h1:YleKiTZ4vqNxVwh77Z0zytYi7rXHl7j6uPLGhhz9rwo= +github.com/pion/turn/v4 v4.0.2 h1:ZqgQ3+MjP32ug30xAbD6Mn+/K4Sxi3SdNOTFf+7mpps= +github.com/pion/turn/v4 v4.0.2/go.mod h1:pMMKP/ieNAG/fN5cZiN4SDuyKsXtNTr0ccN7IToA1zs= +github.com/pion/webrtc/v4 v4.1.2 h1:mpuUo/EJ1zMNKGE79fAdYNFZBX790KE7kQQpLMjjR54= +github.com/pion/webrtc/v4 v4.1.2/go.mod h1:xsCXiNAmMEjIdFxAYU0MbB3RwRieJsegSB2JZsGN+8U= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= +github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4= +github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= +github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= +github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= +github.com/quic-go/qpack v0.5.1 h1:giqksBPnT/HDtZ6VhtFKgoLOWmlyo9Ei6u9PqzIMbhI= +github.com/quic-go/qpack v0.5.1/go.mod h1:+PC4XFrEskIVkcLzpEkbLqq1uCoxPhQuvK5rH1ZgaEg= +github.com/quic-go/quic-go v0.54.0 h1:6s1YB9QotYI6Ospeiguknbp2Znb/jZYjZLRXn9kMQBg= +github.com/quic-go/quic-go v0.54.0/go.mod h1:e68ZEaCdyviluZmy44P6Iey98v/Wfz6HCjQEm+l8zTY= +github.com/quic-go/webtransport-go v0.9.0 h1:jgys+7/wm6JarGDrW+lD/r9BGqBAmqY/ssklE09bA70= +github.com/quic-go/webtransport-go v0.9.0/go.mod h1:4FUYIiUc75XSsF6HShcLeXXYZJ9AGwo/xh3L8M/P1ao= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU= +github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= +github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/dig v1.19.0 h1:BACLhebsYdpQ7IROQ1AGPjrXcP5dF80U3gKoFzbaq/4= +go.uber.org/dig v1.19.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE= +go.uber.org/fx v1.24.0 h1:wE8mruvpg2kiiL1Vqd0CC+tr0/24XIB10Iwp2lLWzkg= +go.uber.org/fx v1.24.0/go.mod h1:AmDeGyS+ZARGKM4tlH4FY2Jr63VjbEDJHtqXTGP5hbo= +go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= +go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= +golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= +golang.org/x/exp v0.0.0-20230725012225-302865e7556b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4= +golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= +golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw= +golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8= +golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= +golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M= +golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= +gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +lukechampine.com/blake3 v1.1.6/go.mod h1:tkKEOtDkNtklkXtLNEOGNq5tcV90tJiA1vAA12R78LA= +lukechampine.com/blake3 v1.2.1/go.mod h1:0OFRp7fBtAylGVCO40o87sbupkyIGgbpv1+M1k1LM6k= +lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= +lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= diff --git a/utils/config-gen/main.go b/utils/config-gen/main.go new file mode 100644 index 0000000..0f19831 --- /dev/null +++ b/utils/config-gen/main.go @@ -0,0 +1,102 @@ +package main + +import ( + "crypto/rand" + "encoding/hex" + "flag" + "fmt" + "log" + "os" + "path/filepath" + "strings" + + "github.com/libp2p/go-libp2p/core/crypto" + "source.quilibrium.com/quilibrium/monorepo/config" +) + +func main() { + configDir := flag.String("config", ".config", "directory to save configuration") + proverKey := flag.String("prover-key", "", "hex-encoded proving key (optional, will generate one if empty)") + flag.Parse() + + // Robustness: if run from utils/config-gen, warn the user. + cwd, _ := os.Getwd() + if filepath.Base(cwd) == "config-gen" { + fmt.Println("WARNING: Running from utils/config-gen. It is RECOMMENDED to run this from the project root.") + fmt.Println("Example: go run utils/config-gen/main.go --config .config") + } + + // Ensure the directory exists + if err := os.MkdirAll(*configDir, 0700); err != nil { + log.Fatalf("failed to create config directory: %v", err) + } + + pk := *proverKey + if pk == "" { + fmt.Println("No proving key provided, generating a random Ed448 key...") + privkey, _, err := crypto.GenerateEd448Key(rand.Reader) + if err != nil { + log.Fatalf("failed to generate proving key: %v", err) + } + + rawKey, err := privkey.Raw() + if err != nil { + log.Fatalf("failed to get raw proving key: %v", err) + } + pk = hex.EncodeToString(rawKey) + fmt.Printf("Generated Proving Key: %s\n", pk) + fmt.Println("IMPORTANT: Save this key in a secure location!") + } + + // config.LoadConfig will generate defaults if config.yml doesn't exist. + // We pass skipGenesisCheck=true because we don't want to download the + // genesis file just for generating a local config and keys. + _, err := config.LoadConfig(*configDir, pk, true) + if err != nil { + log.Fatalf("failed to generate config: %v", err) + } + + // Path Stabilization: Load the generated config and clean up any relative paths + // that might have been created if run from a subdirectory. + confPath := filepath.Join(*configDir, "config.yml") + cfg, err := config.NewConfig(confPath) + if err != nil { + log.Fatalf("failed to load generated config for stabilization: %v", err) + } + + stabilized := false + cleanPath := func(p string) string { + if strings.HasPrefix(p, "../../") { + stabilized = true + return strings.TrimPrefix(p, "../../") + } + return p + } + + if cfg.DB != nil { + cfg.DB.Path = cleanPath(cfg.DB.Path) + cfg.DB.WorkerPathPrefix = cleanPath(cfg.DB.WorkerPathPrefix) + } + if cfg.Key != nil && cfg.Key.KeyStoreFile != nil { + cfg.Key.KeyStoreFile.Path = cleanPath(cfg.Key.KeyStoreFile.Path) + } + + // Protocol Stabilization: Ensure listenMultiaddr is UDP/QUIC-v1 for Docker compatibility. + // We want to avoid TCP 8336 if it was accidentally defaulted. + if cfg.P2P != nil { + if cfg.P2P.ListenMultiaddr == "/ip4/0.0.0.0/tcp/8336" || cfg.P2P.ListenMultiaddr == "" { + fmt.Println("Stabilizing P2P protocol to UDP/QUIC-v1...") + cfg.P2P.ListenMultiaddr = "/ip4/0.0.0.0/udp/8336/quic-v1" + stabilized = true + } + } + + if stabilized { + fmt.Println("Saving stabilized configuration to config.yml...") + if err := config.SaveConfig(*configDir, cfg); err != nil { + log.Fatalf("failed to save stabilized config: %v", err) + } + } + + fmt.Println("Configuration and keys generated successfully.") +}