Skip to content

Commit

Permalink
Update/v24.08 (#132)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Dominion5254 authored Sep 6, 2024
1 parent 29f0fe7 commit b113f58
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 52 deletions.
64 changes: 42 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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 \
Expand All @@ -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" \
Expand All @@ -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 \
Expand All @@ -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 \
Expand Down Expand Up @@ -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 \
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion clboss
Submodule clboss updated 42 files
+14 −0 .dir-locals.el
+1 −0 .gitignore
+9 −1 Boss/Main.cpp
+20 −26 Boss/Mod/ActiveProber.cpp
+1 −1 Boss/Mod/ChannelFinderByPopularity.cpp
+26 −33 Boss/Mod/ConnectFinderByHardcode.cpp
+57 −0 Boss/Mod/ConstructedListpeers.cpp
+36 −0 Boss/Mod/ConstructedListpeers.hpp
+13 −11 Boss/Mod/EarningsRebalancer.cpp
+27 −4 Boss/Mod/EarningsTracker.cpp
+17 −22 Boss/Mod/FeeModderByBalance.cpp
+1 −1 Boss/Mod/ForwardFeeMonitor.cpp
+15 −17 Boss/Mod/InitialRebalancer.cpp
+22 −2 Boss/Mod/Initiator.cpp
+21 −22 Boss/Mod/JitRebalancer.cpp
+4 −22 Boss/Mod/ListpeersAnalyzer.cpp
+32 −17 Boss/Mod/ListpeersAnnouncer.cpp
+5 −0 Boss/Mod/ListpeersAnnouncer.hpp
+10 −9 Boss/Mod/NodeBalanceSwapper.cpp
+89 −318 Boss/Mod/OnchainFeeMonitor.cpp
+7 −0 Boss/Mod/OnchainFeeMonitor.hpp
+3 −11 Boss/Mod/PeerFromScidMapper.cpp
+4 −6 Boss/Mod/PeerJudge/DataGatherer.cpp
+10 −4 Boss/Msg/ListpeersResult.hpp
+1 −0 Boss/Msg/Network.hpp
+39 −0 ChangeLog
+7 −4 Jsmn/ParserExposedBuffer.cpp
+14 −1 Makefile.am
+27 −0 Util/stream_elements.hpp
+1 −1 configure.ac
+48 −0 docs/channel_balancing.md
+102 −0 docs/channel_creation.md
+21 −0 docs/earnings_tracker.md
+64 −0 docs/offchain_to_onchain_swap.md
+17 −1 flake.nix
+4 −0 generate_commit_hash.sh
+3 −2 tests/boss/test_earningsrebalancer.cpp
+1 −2 tests/boss/test_forwardfeemonitor.cpp
+2 −1 tests/boss/test_initialrebalancer.cpp
+59 −1 tests/boss/test_jitrebalancer.cpp
+4 −3 tests/boss/test_onchainfeemonitor_samples_init.cpp
+8 −1 tests/boss/test_peerjudge_datagatherer.cpp
2 changes: 2 additions & 0 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lightning
Submodule lightning updated 572 files
9 changes: 4 additions & 5 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
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
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."
Expand Down
2 changes: 1 addition & 1 deletion scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export const migration: T.ExpectedExports.migration =
)
},
},
"24.05.0",
"24.08.0",
);

function generateRandomString(length: number) {
Expand Down
82 changes: 61 additions & 21 deletions scripts/procedures/properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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] = {
Expand Down Expand Up @@ -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"],
Expand All @@ -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": {
Expand Down

0 comments on commit b113f58

Please sign in to comment.