From b113f582585fc72c62fd20d0fde4ef61ba0fc91f Mon Sep 17 00:00:00 2001 From: Dominion5254 Date: Fri, 6 Sep 2024 09:42:45 -0600 Subject: [PATCH] Update/v24.08 (#132) * update clboss to 0.13.3 * update lightning to 24.08 * fix poetry version to remove -modded flag * update lightning build for upstream changes * expose clnrest connection in Properties * extract rune from file * fix clnrest connection uri * fix split arg * remove clnrest protocol and local property * minor copy changes --- Dockerfile | 64 ++++++++++++++++--------- Makefile | 2 +- clboss | 2 +- docker_entrypoint.sh | 2 + lightning | 2 +- manifest.yaml | 9 ++-- scripts/procedures/migrations.ts | 2 +- scripts/procedures/properties.ts | 82 ++++++++++++++++++++++++-------- 8 files changed, 113 insertions(+), 52 deletions(-) diff --git a/Dockerfile b/Dockerfile index 80be3e3..5db404e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:18-bullseye as ui +FROM node:18-bullseye AS ui RUN apt-get update && apt-get install -y \ build-essential \ @@ -19,7 +19,7 @@ RUN npm install RUN npm run build RUN npm prune --omit=dev -FROM debian:bullseye-slim as downloader +FROM debian:bullseye-slim AS downloader RUN set -ex \ && apt-get update \ @@ -33,9 +33,9 @@ ARG PLATFORM ARG ARCH ARG BITCOIN_VERSION -ENV BITCOIN_TARBALL bitcoin-${BITCOIN_VERSION}-${ARCH}-linux-gnu.tar.gz -ENV BITCOIN_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL -ENV BITCOIN_ASC_URL https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS +ENV BITCOIN_TARBALL=bitcoin-${BITCOIN_VERSION}-${ARCH}-linux-gnu.tar.gz +ENV BITCOIN_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/$BITCOIN_TARBALL +ENV BITCOIN_ASC_URL=https://bitcoincore.org/bin/bitcoin-core-$BITCOIN_VERSION/SHA256SUMS RUN mkdir /opt/bitcoin && cd /opt/bitcoin \ && wget -qO $BITCOIN_TARBALL "$BITCOIN_URL" \ @@ -47,7 +47,7 @@ RUN mkdir /opt/bitcoin && cd /opt/bitcoin \ && rm $BITCOIN_TARBALL # clboss builder -FROM debian:bullseye-slim as clboss +FROM debian:bullseye-slim AS clboss RUN apt-get update -qq && \ apt-get install -qq -y --no-install-recommends \ @@ -71,11 +71,11 @@ RUN make install RUN strip /usr/local/bin/clboss # lightningd builder -FROM debian:bullseye-slim as builder +FROM debian:bullseye-slim AS builder ENV LIGHTNINGD_VERSION=master ENV RUST_PROFILE=release -ENV PATH=$PATH:/root/.cargo/bin/ +ENV PATH="/root/.cargo/bin:/root/.local/bin:$PATH" RUN apt-get update -qq && \ apt-get install -qq -y --no-install-recommends \ @@ -162,12 +162,22 @@ RUN sed -i '/^clnrest\|^wss-proxy/d' pyproject.toml && \ /root/.local/bin/poetry export -o requirements.txt --without-hashes RUN pip3 install -r requirements.txt && pip3 cache purge -RUN ./configure --prefix=/tmp/lightning_install --enable-static && \ - make && \ - /root/.local/bin/poetry run make install +# Ensure that the desired grpcio-tools & protobuf versions are installed +# https://github.com/ElementsProject/lightning/pull/7376#issuecomment-2161102381 +RUN poetry lock --no-update && poetry install + +RUN ./configure --prefix=/tmp/lightning_install --enable-static && make && poetry run make install + +# Export the requirements for the plugins so we can install them in builder-python stage +WORKDIR /opt/lightningd/plugins/clnrest +RUN poetry export -o requirements.txt --without-hashes +WORKDIR /opt/lightningd/plugins/wss-proxy +RUN poetry export -o requirements.txt --without-hashes +WORKDIR /opt/lightningd +RUN echo 'RUSTUP_INSTALL_OPTS="${RUSTUP_INSTALL_OPTS}"' > /tmp/rustup_install_opts.txt # We need to build python plugins on the target's arch because python doesn't support cross build -FROM debian:bullseye-slim as builder-python +FROM debian:bullseye-slim AS builder-python RUN apt-get update -qq && \ apt-get install -qq -y --no-install-recommends \ git \ @@ -186,19 +196,29 @@ RUN apt-get update -qq && \ rm -rf /var/lib/apt/lists/* RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1 -ENV PATH=$PATH:/root/.cargo/bin/ -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y -RUN rustup toolchain install stable --component rustfmt --allow-downgrade -WORKDIR /opt/lightningd -COPY lightning/plugins/clnrest/requirements.txt plugins/clnrest/requirements.txt -COPY lightning/plugins/wss-proxy/requirements.txt plugins/wss-proxy/requirements.txt ENV PYTHON_VERSION=3 -RUN pip3 install -r plugins/clnrest/requirements.txt && \ - pip3 install -r plugins/wss-proxy/requirements.txt && \ - pip3 cache purge +RUN pip3 install --upgrade pip setuptools wheel + +# Copy rustup_install_opts.txt file from builder +COPY --from=builder /tmp/rustup_install_opts.txt /tmp/rustup_install_opts.txt +# Setup ENV $RUSTUP_INSTALL_OPTS for this stage +RUN export $(cat /tmp/rustup_install_opts.txt) +ENV PATH="/root/.cargo/bin:$PATH" +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ${RUSTUP_INSTALL_OPTS} + +WORKDIR /opt/lightningd/plugins/clnrest +COPY --from=builder /opt/lightningd/plugins/clnrest/requirements.txt . +RUN pip3 install -r requirements.txt + +WORKDIR /opt/lightningd/plugins/wss-proxy +COPY --from=builder /opt/lightningd/plugins/wss-proxy/requirements.txt . +RUN pip3 install -r requirements.txt +RUN pip3 cache purge + +WORKDIR /opt/lightningd -FROM node:18-bullseye-slim as final +FROM node:18-bullseye-slim AS final ENV LIGHTNINGD_DATA=/root/.lightning ENV LIGHTNINGD_RPC_PORT=9835 diff --git a/Makefile b/Makefile index 5ae2f9c..9dcd539 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -BITCOIN_VERSION := "25.0" +BITCOIN_VERSION := "27.1" C_LIGHTNING_GIT_REF := $(shell cat .git/modules/lightning/HEAD) C_LIGHTNING_GIT_FILE := $(addprefix .git/modules/lightning/,$(if $(filter ref:%,$(C_LIGHTNING_GIT_REF)),$(lastword $(C_LIGHTNING_GIT_REF)),HEAD)) C_LIGHTNING_REST_SRC := $(shell find ./c-lightning-REST) diff --git a/clboss b/clboss index 2c7ce2f..159ef70 160000 --- a/clboss +++ b/clboss @@ -1 +1 @@ -Subproject commit 2c7ce2f5b905d1eb3a5298404ad669f4463511b2 +Subproject commit 159ef70278100ab6fda4e625259f2a52b791979a diff --git a/docker_entrypoint.sh b/docker_entrypoint.sh index 4236edc..35bcccc 100755 --- a/docker_entrypoint.sh +++ b/docker_entrypoint.sh @@ -25,6 +25,7 @@ export RPC_TOR_ADDRESS=$(yq e '.rpc-tor-address' /root/.lightning/start9/config. export UI_TOR_ADDRESS=$(yq e '.web-ui-tor-address' /root/.lightning/start9/config.yaml) export UI_LAN_ADDRESS=$(echo "$UI_TOR_ADDRESS" | sed 's/\.onion/\.local/') export REST_TOR_ADDRESS=$(yq e '.rest-tor-address' /root/.lightning/start9/config.yaml) +export CLN_REST_TOR_ADDRESS=$(yq e '.clnrest-tor-address' /root/.lightning/start9/config.yaml) export CLAMS_WEBSOCKET_TOR_ADDRESS=$(yq e '.clams-websocket-tor-address' /root/.lightning/start9/config.yaml) export WATCHTOWER_TOR_ADDRESS=$(yq e '.watchtower-tor-address' /root/.lightning/start9/config.yaml) export TOWERS_DATA_DIR=/root/.lightning/.watchtower @@ -82,6 +83,7 @@ mkdir -p /root/.lightning/public echo $PEER_TOR_ADDRESS > /root/.lightning/start9/peerTorAddress echo $RPC_TOR_ADDRESS > /root/.lightning/start9/rpcTorAddress echo $REST_TOR_ADDRESS > /root/.lightning/start9/restTorAddress +echo $CLN_REST_TOR_ADDRESS > /root/.lightning/start9/clnRestTorAddress echo $CLAMS_WEBSOCKET_TOR_ADDRESS > /root/.lightning/start9/clamsRemoteWebsocketTorAddress echo $WATCHTOWER_TOR_ADDRESS > /root/.lightning/start9/watchtowerTorAddress diff --git a/lightning b/lightning index 11586ab..5ec5580 160000 --- a/lightning +++ b/lightning @@ -1 +1 @@ -Subproject commit 11586abf79cad33727c03dfa810ae8bcdd3762bf +Subproject commit 5ec5580a587faf7b19f2d0b9dc445f6a42db2602 diff --git a/manifest.yaml b/manifest.yaml index 26f59b1..6db001d 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -1,5 +1,5 @@ id: c-lightning -version: 24.05.0 +version: 24.08.0 title: Core Lightning license: BSD-MIT wrapper-repo: https://github.com/Start9Labs/cln-startos @@ -7,10 +7,9 @@ upstream-repo: https://github.com/ElementsProject/lightning support-site: https://github.com/ElementsProject/lightning/issues marketing-site: https://blockstream.com/lightning release-notes: |- - * Update to CLN 24.05.0 [Release Notes](https://github.com/ElementsProject/lightning/releases/tag/v24.05) - * Update cln-application UI to v0.0.5 - * Update plugins - * Expose gRPC interface + * Update to CLN 24.08 [Release Notes](https://github.com/ElementsProject/lightning/releases/tag/v24.08) + * Update clboss to v0.13.3 + * Expose CLNRest in Properties build: ["make"] description: short: "An implementation of the Lightning Network protocol by Blockstream." diff --git a/scripts/procedures/migrations.ts b/scripts/procedures/migrations.ts index 6378c82..97ef8a6 100644 --- a/scripts/procedures/migrations.ts +++ b/scripts/procedures/migrations.ts @@ -345,7 +345,7 @@ export const migration: T.ExpectedExports.migration = ) }, }, - "24.05.0", + "24.08.0", ); function generateRandomString(length: number) { diff --git a/scripts/procedures/properties.ts b/scripts/procedures/properties.ts index 7902ce8..ee924e0 100644 --- a/scripts/procedures/properties.ts +++ b/scripts/procedures/properties.ts @@ -102,6 +102,14 @@ export const properties: T.ExpectedExports.properties = async ( ) { return noPropertiesFound; } + if ( + (await util.exists(effects, { + volumeId: "main", + path: "start9/watchtowerTorAddress", + })) === false + ) { + return noPropertiesFound; + } const nodeInfo = nodeInfoMatcher.unsafeCast( await effects.readJsonFile({ @@ -133,6 +141,22 @@ export const properties: T.ExpectedExports.properties = async ( path: "start9/watchtowerTorAddress", }) .then((x) => x.trim()); + const clnRestTorAddress = await effects + .readFile({ + volumeId: "main", + path: "start9/clnRestTorAddress", + }) + .then((x) => x.trim()); + const clnRestRune = await effects + .readFile({ + volumeId: "main", + path: "public/clnrest_rune", + }) + .then((x) => { + const trimmed = x.trim(); + const rune = trimmed.split(/=(.+)/)[1].replace(/"/g, ""); + return rune; + }); const config = setConfigMatcher.unsafeCast( YAML.parse( await effects.readFile({ @@ -257,8 +281,10 @@ export const properties: T.ExpectedExports.properties = async ( }) .then(JSON.parse) .then((dataIn) => { - if (config.watchtowers["wt-client"].enabled == "enabled" ) { - for (const tower of config.watchtowers["wt-client"]["add-watchtowers"]) { + if (config.watchtowers["wt-client"].enabled == "enabled") { + for (const tower of config.watchtowers["wt-client"][ + "add-watchtowers" + ]) { const [pubkey, url] = tower.split("@"); if (!(pubkey in dataIn)) { dataIn[pubkey] = { @@ -354,17 +380,18 @@ export const properties: T.ExpectedExports.properties = async ( masked: true, }, ...(config.advanced["clams-remote-websocket"] - ? {"Clams Remote Websocket URI": { - type: "string", - value: `${nodeInfo.id}@${clamsRemoteWebsocketTorAddress}:7272`, - description: - "The URI needed by Clams Remote to connect to Core Lightning's websocket interface.", - copyable: true, - qr: true, - masked: true, - } - } - : {}), + ? { + "Clams Remote Websocket URI": { + type: "string", + value: `${nodeInfo.id}@${clamsRemoteWebsocketTorAddress}:7272`, + description: + "The URI needed by Clams Remote to connect to Core Lightning's websocket interface.", + copyable: true, + qr: true, + masked: true, + }, + } + : {}), "UI Password": { type: "string", value: config["ui-password"], @@ -373,15 +400,28 @@ export const properties: T.ExpectedExports.properties = async ( qr: true, masked: true, }, + ...(config.advanced.plugins.clnrest + ? { + "CLNRest Quick Connect": { + type: "string", + value: `clnrest://${nodeInfo.id}@${clnRestTorAddress}:3010?rune=${clnRestRune}`, + description: + "URI to connect a wallet to Core Lightning's CLNRest interface remotely via Tor", + copyable: true, + qr: true, + masked: true, + }, + } + : {}), ...(config.advanced.plugins.rest - ? { - "REST Properties": { - type: "object", - value: restProperties, - description: "Properties of the CLN REST interface", - } - } - : {}), + ? { + "REST Properties": { + type: "object", + value: restProperties, + description: "Properties of the CLN REST interface", + }, + } + : {}), ...(config.watchtowers["wt-server"] ? { "Watchtower Server Properties": {