Merge #1448: Refac workspace to follow rust guidelines.

6175ca7b58324a19ba7d8309fac4f18e6a07c178 fix doc (edouardparis)
f32b6aa30dc68623361f7884111707edd0bf3b42 fix the reproducible build to include the workspace change (edouardparis)
8973ee0c7c7b8df37378dde3f1a73b2447147200 fix test not building on windows (edouardparis)
f28b40fe8df967364f2201e3bea84c081b18cac6 fix fuzz, build and tests (edouardparis)
2ab6e40c9399942e2ef756f63e07ff76fb1496b9 refac workspace: move files (edouardparis)

Pull request description:

  This PR clarifies the rust workspace with its members:
  - `liana`: The `lianad` and `liana-cli` crate
  - `liana-gui`: The gui crate to build the graphical interface
  - `liana-ui`: A crate to quickly iterate on a design system

  It allows to have coordination across crates easier, consistent build and shared dependency versions.
  As a result the build processes in the guix container and the macos container are way faster as the dependencies are built only once.

  The overall MSRV is changed for rust 1.71.1, which is the `liana-gui` MSRV.
  Only one rust version is used for all the crates.

  This PR is also a change of vision of the project. The liana daemon is not used as it is. It is too much cumbersome. It should be at the service of the future applications and for now at the service of the GUI.
  The security aspects of the project should be aware of what the end user is using and in reality it is the `liana-gui` binary.

ACKs for top commit:
  pythcoiner:
    ACK 6175ca7b58324a19ba7d8309fac4f18e6a07c178
  jp1ac4:
    ACK 6175ca7b58.

Tree-SHA512: 4b193ed92d3108672d785b28ed54ff95168d365f163235b72cd7e24a7023a7293853ddb458930fb4640d7b1c60a8965e1b38cc060a426474d50b29e2eec4a6d2
This commit is contained in:
edouardparis 2024-11-15 13:45:01 +01:00
commit 89a4187a80
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
226 changed files with 6034 additions and 6684 deletions

View File

@ -75,7 +75,7 @@ task:
fingerprint_script:
- rustc --version
- cat tests/tools/taproot_signer/Cargo.lock
lianad_build_script: cargo build --release && cd tests/tools/taproot_signer && cargo build --release
lianad_build_script: cd liana && cargo build --release && cd ../tests/tools/taproot_signer && cargo build --release
deps_script: apt update && apt install -y python3 python3-pip

View File

@ -14,57 +14,14 @@ jobs:
override: true
- name: rustfmt
run: cargo fmt -- --check
- name: clippy
run: cargo clippy --all-features --all-targets -- -D warnings
unit_tests:
needs: linter
strategy:
matrix:
toolchain:
- 1.63
- nightly
os:
- ubuntu-latest
- macOS-latest
- windows-latest
runs-on: ${{ matrix.os }}
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Install Rust ${{ matrix.toolchain }} toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
profile: minimal
- name: Test on Rust ${{ matrix.toolchain }} (only Windows)
if: matrix.os == 'windows-latest'
run: cargo test --verbose --no-default-features
- name: Test on Rust ${{ matrix.toolchain }} (non Windows)
if: matrix.os != 'windows-latest'
run: cargo test --verbose --color always -- --nocapture
linter_gui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.78.0
components: rustfmt, clippy
override: true
- name: rustfmt
run: cd gui && cargo fmt -- --check
- name: clippy
run: |
sudo apt-get update &&
sudo apt-get install --allow-downgrades libudev-dev pkg-config libvulkan-dev &&
cd gui &&
cargo clippy --all-features --all-targets -- -D warnings
unit_tests_gui:
needs: linter_gui
unit_tests:
needs: linter
strategy:
matrix:
toolchain:
@ -86,14 +43,13 @@ jobs:
profile: minimal
- name: Test on Rust ${{ matrix.toolchain }} (only Windows)
if: matrix.os == 'windows-latest'
run: cd gui && cargo test --verbose --no-default-features
run: cargo test --verbose --no-default-features
- name: Test on Rust ${{ matrix.toolchain }} (non Windows)
if: matrix.os == 'macOS-latest'
run: cd gui && cargo test --verbose --color always -- --nocapture
run: cargo test --verbose --color always -- --nocapture
- name: Test on Rust ${{ matrix.toolchain }} (non Windows)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update &&
sudo apt-get install libudev-dev libfontconfig1-dev &&
cd gui &&
cargo test --verbose --color always -- --nocapture

2
.gitignore vendored
View File

@ -9,8 +9,6 @@ pytest.log
TODO
**/target
**/dist
gui/ui/Cargo.lock
gui/ui/examples/design-system/Cargo.lock
Xcode_12.2.xip
.idea/
fuzz/corpus

5886
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,75 +1,14 @@
[package]
name = "liana"
version = "8.0.0"
authors = ["Antoine Poinsot <darosior@protonmail.com>"]
edition = "2018"
repository = "https://github.com/wizardsardine/liana"
license-file = "LICENCE"
keywords = ["bitcoin", "wallet", "miniscript", "inheritance", "recovery"]
description = "Liana wallet daemon"
exclude = [".github/", ".cirrus.yml", "tests/", "test_data/", "contrib/", "pyproject.toml"]
[workspace]
resolver = "2"
members = [
"fuzz",
"liana",
"liana-gui",
"liana-ui",
]
default-members = ["liana", "liana-gui", "liana-ui"]
[[bin]]
name = "lianad"
path = "src/bin/daemon.rs"
required-features = ["daemon"]
[[bin]]
name = "liana-cli"
path = "src/bin/cli.rs"
required-features = ["daemon"]
[features]
default = ["daemon"]
daemon = ["libc"]
nonblocking_shutdown = []
[dependencies]
# For managing transactions (it re-exports the bitcoin crate)
miniscript = { version = "11.0", features = ["serde", "compiler", "base64"] }
# Coin selection algorithms for spend transaction creation.
bdk_coin_select = "0.3"
# For Electrum backend. This is the latest version with the same bitcoin version as
# the miniscript dependency.
bdk_electrum = { version = "0.14" }
# Don't reinvent the wheel
dirs = "5.0"
# We use TOML for the config, and JSON for RPC
serde = { version = "1.0", features = ["derive"] }
toml = "0.5"
serde_json = { version = "1.0", features = ["raw_value"] }
# Logging stuff
log = "0.4"
fern = "0.6"
# In order to have a backtrace on panic, because the
# stdlib does not have a programmatic interface yet
# to work with our custom panic hook.
backtrace = "0.3"
# Pinned to this version because they keep breaking their MSRV in point releases...
# FIXME: this is unfortunate, we don't receive the updates (sometimes critical) from SQLite.
rusqlite = { version = "0.30", features = ["bundled", "unlock_notify"] }
# To talk to bitcoind
jsonrpc = { version = "0.17", features = ["minreq_http"], default-features = false }
# Used for daemonization
libc = { version = "0.2", optional = true }
# Used for generating mnemonics
getrandom = "0.2"
# Used for the hot signer
bip39 = "2.0"
# Additional entropy for generating mnemonics
[target.'cfg(target_arch = "x86")'.dependencies]
rdrand = "0.8"
[target.'cfg(target_arch = "x86_64")'.dependencies]
rdrand = "0.8"
[patch.crates-io]
iced_style = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
iced_winit = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
iced_futures = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}

View File

@ -57,14 +57,14 @@ The daemon contains the core logic of the wallet. It is both a library (a Rust c
command interface and a standalone UNIX daemon that exposes a JSONRPC API through a Unix Domain
Socket.
The code for the daemon can be found in the [`src/`](src/) folder at the root of this repository.
The code for the daemon can be found in the [`liana`](liana) folder.
#### Liana GUI
The GUI contains both an installer that guides a user through setting up a Liana wallet, as well as
a graphical interface to the daemon using the [`iced`](https://github.com/iced-rs/iced/) library.
The code for the GUI can be found in the [`gui/src/`](gui/src) folder.
The code for the GUI can be found in the [`liana-gui`](liana-gui) folder.
## Security

View File

@ -38,13 +38,13 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
(
cd "$BUILD_DIR"
create_dir "$LINUX_DIR_NAME"
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md "$LINUX_DIR_NAME"
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/release/liana-gui" ../README.md "$LINUX_DIR_NAME"
tar -czf "$LINUX_ARCHIVE" "$LINUX_DIR_NAME"
cp "$LINUX_ARCHIVE" "$RELEASE_DIR"
unzip ../contrib/release/debian/package.zip
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./package/DEBIAN/control
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/gui/release/liana-gui" ../README.md ./package/usr/bin/
cp "$BUILD_DIR/release/lianad" "$BUILD_DIR/release/liana-cli" "$BUILD_DIR/release/liana-gui" ../README.md ./package/usr/bin/
DIRNAME="liana_$VERSION-1_amd64"
mv ./package "$DIRNAME"
dpkg-deb -Zxz --build "$DIRNAME"
@ -55,23 +55,23 @@ TARGET_DIR="$BUILD_DIR" ./contrib/reproducible/docker/docker-build.sh
(
cd "$BUILD_DIR"
create_dir "$WINDOWS_DIR_NAME"
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME"
cp "$BUILD_DIR/x86_64-pc-windows-gnu/release/liana-gui.exe" ../README.md "$WINDOWS_DIR_NAME"
zip -r "$WINDOWS_ARCHIVE" "$WINDOWS_DIR_NAME"
cp "$WINDOWS_ARCHIVE" "$RELEASE_DIR"
cp "$BUILD_DIR/gui/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe"
cp "$BUILD_DIR/x86_64-pc-windows-gnu/release/liana-gui.exe" "$RELEASE_DIR/$LIANA_PREFIX.exe"
)
# Create the MacOS archive and a zipped application bundle of liana-gui.
(
cd "$BUILD_DIR"
create_dir "$MAC_DIR_NAME"
cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME"
cp "$BUILD_DIR/x86_64-apple-darwin/release/lianad" "$BUILD_DIR/x86_64-apple-darwin/release/liana-cli" "$BUILD_DIR/x86_64-apple-darwin/release/liana-gui" ../README.md "$MAC_DIR_NAME"
tar -czf "$MAC_ARCHIVE" "$MAC_DIR_NAME"
cp "$MAC_ARCHIVE" "$RELEASE_DIR"
unzip ../contrib/release/macos/Liana.app.zip
sed -i "s/VERSION_PLACEHOLDER/$VERSION/g" ./Liana.app/Contents/Info.plist
cp "$BUILD_DIR/gui/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana
cp "$BUILD_DIR/x86_64-apple-darwin/release/liana-gui" ./Liana.app/Contents/MacOS/Liana
zip -ry Liana-noncodesigned.zip Liana.app
cp ./Liana-noncodesigned.zip "$RELEASE_DIR/"

View File

@ -11,15 +11,18 @@ XCODE_SHASUM="28d352f8c14a43d9b8a082ac6338dc173cb153f964c6e8fb6ba389e5be528bd0"
# Build (only) the Liana GUI on Windows.
docker build . -t liana_cross_win -f contrib/reproducible/docker/windows.Dockerfile
docker run --rm -ti \
-v "$TARGET_DIR/gui":/liana/target \
-v "$TARGET_DIR":/liana/target \
-v "$PWD/contrib/reproducible/docker":/liana/docker \
-v "$PWD/gui/Cargo.toml":/liana/Cargo.toml \
-v "$PWD/gui/Cargo.lock":/liana/Cargo.lock \
-v "$PWD/gui/src":/liana/src \
-v "$PWD/gui/ui/Cargo.toml":/liana/ui/Cargo.toml \
-v "$PWD/gui/ui/Cargo.lock":/liana/ui/Cargo.lock \
-v "$PWD/gui/ui/src":/liana/ui/src \
-v "$PWD/gui/ui/static":/liana/ui/static \
-v "$PWD/Cargo.toml":/liana/Cargo.toml \
-v "$PWD/Cargo.lock":/liana/Cargo.lock \
-v "$PWD/liana/Cargo.toml":/liana/liana/Cargo.toml \
-v "$PWD/liana/src":/liana/liana/src \
-v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \
-v "$PWD/liana-gui/src":/liana/liana-gui/src \
-v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \
-v "$PWD/liana-ui/src":/liana/liana-ui/src \
-v "$PWD/liana-ui/static":/liana/liana-ui/static \
-v "$PWD/fuzz/Cargo.toml":/liana/fuzz/Cargo.toml \
liana_cross_win
@ -33,18 +36,17 @@ fi
docker build . -t liana_cross_mac -f contrib/reproducible/docker/macos.Dockerfile
docker run -ti \
-v "$TARGET_DIR":/liana/target \
-v "$TARGET_DIR/gui":/liana/gui/target \
-v "$PWD/contrib/reproducible/docker":/liana/docker \
-v "$PWD/Cargo.toml":/liana/Cargo.toml \
-v "$PWD/Cargo.lock":/liana/Cargo.lock \
-v "$PWD/src":/liana/src \
-v "$PWD/gui/Cargo.toml":/liana/gui/Cargo.toml \
-v "$PWD/gui/Cargo.lock":/liana/gui/Cargo.lock \
-v "$PWD/gui/src":/liana/gui/src \
-v "$PWD/gui/ui/Cargo.toml":/liana/gui/ui/Cargo.toml \
-v "$PWD/gui/ui/Cargo.lock":/liana/gui/ui/Cargo.lock \
-v "$PWD/gui/ui/src":/liana/gui/ui/src \
-v "$PWD/gui/ui/static":/liana/gui/ui/static \
-v "$PWD/liana/Cargo.toml":/liana/liana/Cargo.toml \
-v "$PWD/liana/src":/liana/liana/src \
-v "$PWD/liana-gui/Cargo.toml":/liana/liana-gui/Cargo.toml \
-v "$PWD/liana-gui/src":/liana/liana-gui/src \
-v "$PWD/liana-ui/Cargo.toml":/liana/liana-ui/Cargo.toml \
-v "$PWD/liana-ui/src":/liana/liana-ui/src \
-v "$PWD/liana-ui/static":/liana/liana-ui/static \
-v "$PWD/fuzz/Cargo.toml":/liana/fuzz/Cargo.toml \
-v "$XCODE_PATH":"/liana/$XCODE_FILENAME" \
-e XCODE_PATH="/liana/$XCODE_FILENAME" \
liana_cross_mac

View File

@ -29,25 +29,18 @@ cd ..
# Finally build the projects using the toolchain just created.
alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo"
PATH="$PATH:$PWD/osxcross/target/bin/" \
CC=o64-clang \
CXX=o64-clang++ \
RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \
cargo rustc \
for package_name in "liana" "liana-gui"; do
PATH="$PATH:$PWD/osxcross/target/bin/" \
CC=o64-clang \
CXX=o64-clang++ \
RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \
cargo rustc \
-p "$package_name" \
--target x86_64-apple-darwin \
--release
cd gui/
PATH="$PATH:$PWD/../osxcross/target/bin/" \
CC=o64-clang \
CXX=o64-clang++ \
RUSTFLAGS="$RUSTFLAGS -Clinker=o64-clang" \
cargo rustc \
--target x86_64-apple-darwin \
--release
cd ..
done
# Avoid having to get root on the host to remove the target dir.
chmod -R a+rw target/ gui/target
chmod -R a+rw target/
set +xe

View File

@ -11,6 +11,7 @@ set -xe
alias cargo="/liana/rust-1.71.1-x86_64-unknown-linux-gnu/cargo/bin/cargo"
RUSTFLAGS="-Clink-arg=-Wl,--no-insert-timestamp" \
cargo rustc \
-p liana-gui \
--release \
--target x86_64-pc-windows-gnu

View File

@ -1,6 +1,6 @@
# ==========================================================================
# The script ran within the GUIX container to build the Liana daemon or GUI.
# ==========================================================================
# ===========================================================================
# The script ran within the GUIX container to build the Liana daemon and GUI.
# ===========================================================================
set -ex
@ -24,24 +24,25 @@ branch = "patch-0.12.3"
replace-with = "vendored_sources"
EOF
ls -la .cargo/config.toml
export CARGO_HOME="/liana/.cargo"
# We need to set RUSTC_BOOTSTRAP=1 as a workaround to be able to use unstable
# features in the GUI dependencies
RUSTC_BOOTSTRAP=1 cargo -vvv \
--color always \
--frozen \
--offline \
rustc \
--jobs "$JOBS" \
--release \
--target-dir "/out"
for package_name in "liana" "liana-gui"; do
RUSTC_BOOTSTRAP=1 cargo -vvv \
--color always \
--frozen \
--offline \
rustc \
-p "$package_name" \
--jobs "$JOBS" \
--release \
--target-dir "/out"
done
if [ "$IS_GUI" = "1" ]; then
BIN_NAMES="liana-gui"
else
BIN_NAMES="lianad liana-cli"
fi
for bin_name in $BIN_NAMES; do
for bin_name in "liana-gui" "lianad" "liana-cli"; do
# Assume 64bits. Even bitcoind doesn't ship 32bits binaries for x86.
# FIXME: is there a cleaner way than using patchelf for this?
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 "/out/release/$bin_name"

View File

@ -48,95 +48,55 @@ fi
# across time.
time_machine() {
guix time-machine --url=https://git.savannah.gnu.org/git/guix.git \
--commit=059d38dc3f8b087f4a42df586daeb05761ee18d7 \
--cores="$JOBS" \
--keep-failed \
--fallback \
-- "$@"
--commit=059d38dc3f8b087f4a42df586daeb05761ee18d7 \
--cores="$JOBS" \
--keep-failed \
--fallback \
-- "$@"
}
# Build both the daemon (at the root of the repository) and the GUI (in gui/)
for project_folder in "" "gui"; do
PROJECT_ROOT="$PWD/$project_folder"
PROJECT_VENDOR_DIR="$VENDOR_DIR/$project_folder"
PROJECT_OUT_DIR="$OUT_DIR/$project_folder"
PROJECT_PATCHES_ROOT="$PWD/contrib/reproducible/guix/liana-patches/$project_folder"
# Build both the daemon (at the root of the repository) and the GUI
PROJECT_ROOT="$PWD"
PROJECT_VENDOR_DIR="$VENDOR_DIR"
PROJECT_OUT_DIR="$OUT_DIR"
project_needs_patches() {
test "$(ls -A1q "$PROJECT_PATCHES_ROOT" |grep patch)"
}
maybe_create_dir "$PROJECT_OUT_DIR"
maybe_create_dir "$PROJECT_OUT_DIR"
# Pull the sources of our dependencies before building them in the container.
if ! [ -d "$PROJECT_VENDOR_DIR" ]; then
# Download the dependencies
($CARGO_BIN vendor "$PROJECT_VENDOR_DIR" )
fi
# Pull the sources of our dependencies before building them in the container.
if ! [ -d "$PROJECT_VENDOR_DIR" ]; then
# Download the dependencies
( cd "$project_folder" && $CARGO_BIN vendor "$PROJECT_VENDOR_DIR" )
cp "$PROJECT_ROOT/Cargo.lock" "$BUILD_ROOT/Cargo.lock"
# Patch some dependencies sources if needed for this project
if project_needs_patches; then
(
cd "$PROJECT_VENDOR_DIR"
for patch_file in $(ls "$PROJECT_PATCHES_ROOT"); do
patch -p1 < "$PROJECT_PATCHES_ROOT/$patch_file"
done
)
# Some of the checksums will be incorrect. Instead of cherry-picking remove them
# altogether, since they aren't useful anyways (see comment below).
for dep in $(ls "$PROJECT_VENDOR_DIR"); do
echo "{\"files\":{}}" > "$PROJECT_VENDOR_DIR/$dep/.cargo-checksum.json"
done
fi
fi
cp "$PROJECT_ROOT/Cargo.lock" "$BUILD_ROOT/Cargo.lock"
if project_needs_patches; then
# Remove the checksums from the Cargo.lock. In the container `cargo rustc` would compare
# them against the .cargo-checksum.json to make sure they weren't tampered with since they
# where vendored. But we just removed the checksums from the .cargo-checksum.json.
# There is little point in checking integrity between the above vendor step and now anyways.
# What matters is checking integrity after downloading the crates from the internet and
# `cargo vendor` does that already.
sed -i '/checksum/d' "$BUILD_ROOT/Cargo.lock"
fi
# FIXME: find a cleaner way to get the binary name, or get rid of patchelf entirely
# Note: we also rely on it in manifest.scm
if [ "$project_folder" = "" ]; then
IS_GUI=0
elif [ "$project_folder" = "gui" ]; then
IS_GUI=1
else
echo "Can't determine binary name"
exit 1
fi
# Bootstrap a reproducible environment as specified by the manifest in an isolated
# container, and build the project.
# NOTE: it looks like "--rebuild-cache" is necessary for the IS_GUI variable to
# be taken into account when building the container (otherwise the GUI container could
# miss some dependencies).
# TODO: only expose the "ui" folder for GUI builds
IS_GUI="$IS_GUI" time_machine shell --no-cwd \
--expose="$PROJECT_ROOT/src=/liana/src" \
--expose="$PROJECT_ROOT/Cargo.toml=/liana/Cargo.toml" \
--expose="$BUILD_ROOT/Cargo.lock=/liana/Cargo.lock" \
--expose="$PWD/gui/ui/src=/liana/ui/src" \
--expose="$PWD/gui/ui/Cargo.toml=/liana/ui/Cargo.toml" \
--expose="$PWD/gui/ui/static=/liana/ui/static" \
--expose="$PWD/contrib/reproducible/guix/build.sh=/liana/build.sh" \
--expose="$PROJECT_VENDOR_DIR=/vendor" \
--share="$PROJECT_OUT_DIR=/out" \
--cores="$JOBS" \
--container \
--pure \
--fallback \
--rebuild-cache \
-m $PWD/contrib/reproducible/guix/manifest.scm \
-- env CC=gcc VENDOR_DIR="$PROJECT_VENDOR_DIR" TARGET_DIR="$PROJECT_OUT_DIR" IS_GUI="$IS_GUI" JOBS="$JOBS" \
/bin/sh -c "cd /liana && ./build.sh"
done
# Bootstrap a reproducible environment as specified by the manifest in an isolated
# container, and build the project.
# NOTE: it looks like "--rebuild-cache" is necessary for the IS_GUI variable to
# be taken into account when building the container (otherwise the GUI container could
# miss some dependencies).
time_machine shell --no-cwd \
--expose="$PWD/Cargo.toml=/liana/Cargo.toml" \
--expose="$BUILD_ROOT/Cargo.lock=/liana/Cargo.lock" \
--expose="$PWD/liana/src=/liana/liana/src" \
--expose="$PWD/liana/Cargo.toml=/liana/liana/Cargo.toml" \
--expose="$PWD/liana-gui/Cargo.toml=/liana/liana-gui/Cargo.toml" \
--expose="$PWD/liana-gui/src=/liana/liana-gui/src" \
--expose="$PWD/liana-ui/src=/liana/liana-ui/src" \
--expose="$PWD/liana-ui/Cargo.toml=/liana/liana-ui/Cargo.toml" \
--expose="$PWD/liana-ui/static=/liana/liana-ui/static" \
--expose="$PWD/fuzz/Cargo.toml=/liana/fuzz/Cargo.toml" \
--expose="$PWD/contrib/reproducible/guix/build.sh=/liana/build.sh" \
--expose="$PROJECT_VENDOR_DIR=/vendor" \
--share="$PROJECT_OUT_DIR=/out" \
--cores="$JOBS" \
--container \
--pure \
--fallback \
--rebuild-cache \
-m $PWD/contrib/reproducible/guix/manifest.scm \
-- env CC=gcc VENDOR_DIR="$PROJECT_VENDOR_DIR" TARGET_DIR="$PROJECT_OUT_DIR" IS_GUI="$IS_GUI" JOBS="$JOBS" \
/bin/sh -c "cd /liana && ./build.sh"
set +ex

View File

@ -170,27 +170,21 @@ FILE-NAME found in ./patches relative to the current file."
;; END of the newer rustc versions copied over from the current Guix master.
(let ((is_gui (getenv "IS_GUI")))
(concatenate-manifests
(list
(specifications->manifest
(append
(list
"rust:cargo"
"coreutils-minimal"
"patchelf"
"gcc-toolchain@10.3.0")
;; Additional dependencies for building the GUI.
(if
(string=? is_gui "1")
(list "pkg-config"
"eudev"
"fontconfig")
'())))
;; The GUI's MSRV is 1.70 and the daemon's 1.63. We just use the same rustc version for
;; both.
;; FIXME: be able to compile against a specified glibc (or musl) instead of having to
;; resort to backporting the newer rustc releases here. Also have proper Guix packages
;; for the two projects.
(packages->manifest
`(,rust-1.71)))))
(concatenate-manifests
(list
(specifications->manifest
(list
"rust:cargo"
"coreutils-minimal"
"patchelf"
"gcc-toolchain@10.3.0"
"pkg-config"
"eudev"
"fontconfig"))
;; The GUI's MSRV is 1.70 and the daemon's 1.63. We just use the same rustc version for
;; both.
;; FIXME: be able to compile against a specified glibc (or musl) instead of having to
;; resort to backporting the newer rustc releases here. Also have proper Guix packages
;; for the two projects.
(packages->manifest
`(,rust-1.71))))

View File

@ -68,30 +68,20 @@ Some package managers distribute a version of `rustup`. Failing that, you can al
## Building the project
Once you've got Cargo, building the project is a simple `cargo` invocation away.
To only build the daemon, run it from the root of the repository:
```
$ cargo build --release
```
The `lianad` and `liana-cli` binaries will be in the `target/` directory at the root of the
repository:
```
$ ls target/release/
build deps examples incremental liana-cli liana-cli.d lianad lianad.d libliana.d libliana.rlib
```
To build the whole wallet including the GUI, you'll need to install its [build and runtime
dependencies](https://github.com/wizardsardine/liana/tree/master/gui#dependencies) first. Then run
the same command as above within the [`gui/`](../gui/) folder present at the root of the repository:
dependencies](https://github.com/wizardsardine/liana/tree/master/liana-gui#dependencies) first.
Then run:
```
$ cd gui/
$ cargo build --release
```
The `liana-gui` binary will be in the `target/` folder:
The `lianad`, `liana-cli` and `liana-gui` binaries will be in the `target/` directory at the root of the
repository, except if using Windows in which case only `liana-gui` will be built
(`lianad` and `liana-cli` relies on Unix socket):
```
$ ls target/release/
build deps examples incremental liana-gui liana-gui.d libliana_gui.d libliana_gui.rlib
build deps examples incremental liana-cli liana-cli.d lianad lianad.d liana-gui liana-gui.d libliana.d libliana_gui.d libliana_gui.rlib libliana.rlib libliana_ui.d libliana_ui.rlib
```
Whether your are building the whole wallet or only the daemon, make sure not to forget the

View File

@ -14,7 +14,7 @@ secp256k1 = { version = "0.28", features = ["global-context-less-secure"] }
[dependencies.liana]
path = ".."
path = "../liana"
[[bin]]
name = "descriptor_parse"

View File

@ -37,7 +37,7 @@ fuzz_target!(|data: &[u8]| {
// parse nested fragments. Until they fix it, rule out the most trivial recursion overflow the
// fuzzer can generate: too deep wrappers.
// FIXME: this shouldn't be necessary when upgrading to the next rust-miniscript version.
if too_deep_wrappers(&desc_str) {
if too_deep_wrappers(desc_str) {
return;
}
@ -57,15 +57,18 @@ fuzz_target!(|data: &[u8]| {
desc.receive_descriptor();
desc.change_descriptor();
desc.first_timelock_value();
desc.max_sat_weight();
desc.max_sat_vbytes();
desc.spender_input_size();
desc.max_sat_weight(true);
desc.max_sat_vbytes(true);
desc.spender_input_size(true);
desc.max_sat_weight(false);
desc.max_sat_vbytes(false);
desc.spender_input_size(false);
// Exercise the various methods of derived descriptors. None should crash.
let der_index = 42.into();
let der_descs = [
desc.receive_descriptor().derive(der_index, &SECP256K1),
desc.change_descriptor().derive(der_index, &SECP256K1),
desc.receive_descriptor().derive(der_index, SECP256K1),
desc.change_descriptor().derive(der_index, SECP256K1),
];
let mut psbt_in = Default::default();
let mut psbt_out = Default::default();

View File

@ -88,7 +88,7 @@ struct DummyPsbt(pub Option<Psbt>);
impl<'a> Arbitrary<'a> for DummyPsbt {
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
let psbt_bytes = <&[u8]>::arbitrary(u)?;
Ok(Self(Psbt::deserialize(&psbt_bytes).ok()))
Ok(Self(Psbt::deserialize(psbt_bytes).ok()))
}
}
@ -150,15 +150,18 @@ fuzz_target!(|config: Config| {
desc.receive_descriptor();
desc.change_descriptor();
desc.first_timelock_value();
desc.max_sat_weight();
desc.max_sat_vbytes();
desc.spender_input_size();
desc.max_sat_weight(true);
desc.max_sat_vbytes(true);
desc.spender_input_size(true);
desc.max_sat_weight(false);
desc.max_sat_vbytes(false);
desc.spender_input_size(false);
// Exercise the various methods of derived descriptors. None should crash.
let der_index = (config.der_index as u32).into();
let der_descs = [
desc.receive_descriptor().derive(der_index, &SECP256K1),
desc.change_descriptor().derive(der_index, &SECP256K1),
desc.receive_descriptor().derive(der_index, SECP256K1),
desc.change_descriptor().derive(der_index, SECP256K1),
];
let mut psbt_in = Default::default();
let mut psbt_out = Default::default();
@ -171,7 +174,7 @@ fuzz_target!(|config: Config| {
// Exercise the methods gathering information from a PSBT. TODO: get more useful PSBTs.
if let Some(mut psbt) = config.dummy_psbt.0 {
desc.change_indexes(&psbt, &SECP256K1);
desc.change_indexes(&psbt, SECP256K1);
// Get the spend info without populating the PSBT at all.
let _ = desc.partial_spend_info(&psbt);

6175
gui/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
[package]
name = "liana_gui"
name = "liana-gui"
version = "8.0.0"
readme = "README.md"
description = "Liana GUI"
@ -17,7 +17,7 @@ path = "src/main.rs"
async-trait = "0.1"
async-hwi = { version = "0.0.24" }
liana = { git = "https://github.com/wizardsardine/liana", branch = "master", default-features = false, features = ["nonblocking_shutdown"] }
liana_ui = { path = "ui" }
liana-ui = { path = "../liana-ui" }
backtrace = "0.3"
hex = "0.4.3"
@ -51,11 +51,6 @@ reqwest = { version = "0.11", default-features=false, features = ["json", "rustl
rust-ini = "0.19.0"
[patch.crates-io]
iced_style = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
iced_winit = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
iced_futures = { git = "https://github.com/edouardparis/iced", branch = "patch-0.12.3"}
[target.'cfg(windows)'.dependencies]
zip = { version = "0.6", default-features=false, features = ["bzip2", "deflate"] }
@ -65,6 +60,3 @@ flate2 = { version = "1.0", default-features=false }
[dev-dependencies]
tokio = {version = "1.9.0", features = ["rt", "macros"]}
[workspace]
members = ["ui"]

Some files were not shown because too many files have changed in this diff Show More