Commit graph

72 commits

Author SHA1 Message Date
Matt Corallo
3fe4ef9640 Drop the _test_vectors feature in favor of a cfg flag
This exists just for tests, so there's no reason for it to be
publicly visible.
2024-08-19 15:09:40 +00:00
Matt Corallo
e212d74298 Somewhat clean up ci-tests.sh and sort by RUSTFLAGS 2024-08-19 15:09:40 +00:00
Matt Corallo
51f5bc881f Drop the no-std feature from lightning-rapid-gossip-sync
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes another step by removing the `no-std` feature entirely
from the `lightning-rapid-gossip-sync` crate and removing all
feature implications on dependencies from the remaining `std`
feature.
2024-08-19 15:09:40 +00:00
Matt Corallo
31a9cd2d3d Drop the no-std feature from lightning-invoice
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes another step by removing the `no-std` feature entirely
from the `lightning-invoice` crate and removing all feature
implications on dependencies from the remaining `std` feature.
2024-08-19 15:09:40 +00:00
Matt Corallo
5e37074246 Drop the no-std feature from BP and drop feature implications
Now that we don't have to have everything in our entire ecosystem
use the same `std`/`no-std` feature combinations we should start by
untangling our own features a bit.

This takes the first step by removing the `no-std` feature entirely
from the `lightning-background-processor` crate and removing most
feature implications on dependencies from the remaining `std`
feature.

It also addresses a CI oversight where we were not testing
`lightning-background-processor` without the `std` feature in CI at
all.
2024-08-19 15:09:40 +00:00
Matt Corallo
9ca38c59f4 Ensure we always pass a path for in-workspace dependencies
In order to ensure our crates depend on the workspace copies of
each other in test builds we need to override the crates.io
dependency with a local `path`.

We can do this in one of two ways - either specify the `path` in
the dependency listing in each crate's `Cargo.toml` or use the
workspace `Cargo.toml` to `patch` all dependencies. The first is
tedious while the second lets us have it all in one place. However,
the second option does break `cargo *` in individual crate
directories (forcing the use of `cargo -p crate *` instead) and
makes it rather difficult to depend on local versions of workspace
crates.

Thus, here we drop the `patch.crates-io` from our top-level
`Cargo.toml` entirely.

Still, we do update the `ci/ci-tests.sh` script here to use
`cargo -p crate` instead of switching to each crate's directory as
it allows `cargo` to use a shared `target` and may speed up tests.
2024-08-19 15:09:38 +00:00
Elias Rohrer
43bc78ce3d
Disallow skipping tx-sync tests in CI
Previously, we'd always skip tx-sync tests if the
`BITCOIND_EXE`/`ELECTRS_EXE` environment variables would be unset. While
this is especially fine for local testing, we still want to enforce
tests failing if somehow the `bitcoind`/`electrs` downloading or caching
in CI stops working. Here, we therefore add a `CI_ENV` variable that
indicates we're indeed running in CI, and only skip if it's unset.
2024-08-16 17:41:16 +02:00
Elias Rohrer
4320f483f2
Enable caching for bitcoind/electrs in CI 2024-08-13 15:02:46 +02:00
Elias Rohrer
e5fea78502
Fix misc shellcheck complaints 2024-08-13 08:50:30 +02:00
Elias Rohrer
3e1c9e7059
Drop electrsd autodownload feature for good
... which requires a bunch of unnecessary dev dependencies, e.g., `zip`.

Instead we lean on the `download_bitcoind_electrs.sh` script also for
local testing.
2024-08-13 08:50:29 +02:00
Elias Rohrer
5f15d6f051
Move CI downloading bitcoind/electrsd to dedicated shell script
... allowing it to be sourced locally before running
`lightning-transaction-sync` tests.
2024-08-13 08:50:29 +02:00
Matt Corallo
4c650b9830 Force locale in rustfmt shell scripts that rely on sort order 2024-08-06 15:13:59 +00:00
Elias Rohrer
3566b98b75
Pin tokio in CI to fix MSRV
The recently released `tokio` 1.39 bumped their MSRV to rustc 1.70.
Here, we pin the `tokio` version to 1.38 for users that require to
maintain our MSRV of rustc 1.63.
2024-08-01 16:20:20 -05:00
Duncan Dean
99aa6e27f6
Use native check-cfg lint in cargo beta
This uses the newly introduced conditional configuration checks that are
now configurable withint Cargo (beta).

This allows us to get rid of our custom python script that checks for
expected features and cfgs.

This does introduce a warning regarding the unknown lint in Cargo
versions prior to the current beta, but since these are not rustc errors,
they won't break any builds with the "-D warnings" RUSTFLAG.

Moving to this lint actually exposed the "strict" feature not being
present in the lightning-invoice crate, as our python script didnt
correctly parse the cfg_attr where it appeared.
2024-07-12 11:48:15 +02:00
Valentine Wallace
5c7af8c6d3
Cfg-gate async payments module and public enum variants. 2024-06-20 14:24:09 -04:00
Elias Rohrer
43b41868bb
Pass our edition to rustfmt
.. as it otherwise doesn't seem to pick up the right one when checkin
integration tests.
2024-06-07 16:55:11 +02:00
Jiri Jakes
a8bd4c097f
Upgrade rust-bitcoin to 0.31 2024-05-30 18:35:29 +08:00
Matt Corallo
6ab91cb43f Drop the rustup-specific calling in ci/rustfmt.sh
The +rustversion call semantics are specific to rustup and do not
work with standard rust toolchains. However, because rustfmt
formatting differs slightly between stable and our 1.63 target, we
need to keep the +1.63.0 for rustup users.

Thus, here, we check for the presence of a `rustup` command and
pass the "+1.63.0" argument if we find one.
2024-04-22 13:05:53 +00:00
optout
8c334cb579
Add splicing feature flag (also triggers dual_funding) 2024-04-18 08:40:34 +02:00
Matt Corallo
9571988d21 Avoid new "out of disk space" issues in CI
Our 1.63 build on Ubuntu has been failing for quite some time
because it runs out of disk space trying to build tests in the last
cfg-flag steps. Thus, we add a few new `cargo clean`s here to fix
it.
2024-03-12 15:20:52 +00:00
Matt Corallo
c4a2f1bb21
Merge pull request #2877 from tnull/2024-02-start-rustfmt-journey
`rustfmt`: Add CI scripts and format `onion_utils.rs`
2024-02-22 19:30:17 +00:00
Duncan Dean
47f7dfe9ee
Test builds with #[cfg(dual_funding)] enabled 2024-02-20 09:15:11 +02:00
Matt Corallo
3096061bef Drop ahash dependency in favor of core's SipHasher
https://github.com/tkaitchuck/aHash/pull/196 bumped the MSRV of
`ahash` in a patch release, which makes it rather difficult for us
to have it as a dependency.

Further, it seems that `ahash` hasn't been particularly robust in
the past, notably
https://github.com/tkaitchuck/aHash/issues/163 and
https://github.com/tkaitchuck/aHash/issues/166.

Luckily, `core` provides `SipHasher` even on no-std (sadly its
SipHash-2-4 unlike the SipHash-1-3 used by the `DefaultHasher` in
`std`). Thus, we drop the `ahash` dependency entirely here and
simply wrap `SipHasher` for our `no-std` HashMaps.
2024-02-16 20:34:41 +00:00
Matt Corallo
65108a022f Add a crate which wraps getrandom but always compiles
In the next commit we'll drop the `ahash` dependency in favor of
directly calling `getrandom` to seed our hash tables. However,
we'd like to depend on `getrandom` only on certain platforms *and*
only when certain features (no-std) are set.

This introduces an indirection crate to do so, allowing us to
depend on it only when `no-std` is set but only depending on
`getrandom` on platforms which it supports.
2024-02-16 20:34:40 +00:00
Elias Rohrer
d5344dc178
Add rustfmt to CI, ignore all files
We add the previously discussed `rustfmt.toml` and enforce it in CI for
any files that are not contained in an exclusion list.

To start, we add all current Rust files to this exclusion list. This
means that formatter rules will be enforced for any newly introduced
files, and we'll then start going through the codebase file-by-file,
removing them from the list as we go.
2024-02-14 09:08:33 +01:00
Matt Corallo
73da722d18
Merge pull request #2861 from tnull/2024-01-introduce-cargo-audit
Introduce CI workflow running `cargo audit`
2024-02-13 21:35:51 +00:00
Elias Rohrer
7299fe62c3
Drop reqwest pin
.. since a version with fixed MSRV was released by now.
2024-02-12 10:42:10 +01:00
Elias Rohrer
9ac42ed394
Move lightning-transaction-sync to main workspace
.. so it's actually included in the audit.
2024-02-12 10:42:09 +01:00
Matt Corallo
dedc8306f6 Bump hashbrown dependency to 0.13
While this isn't expected to materially improve performance, it
does get us ahash 0.8, which allows us to reduce fuzzing
randomness, making our fuzzers much happier.

Sadly, by default `ahash` no longer tries to autodetect a
randomness source, so we cannot simply rely on `hashbrown` to do
randomization for us, but rather have to also explicitly depend on
`ahash`.
2024-02-02 18:05:08 +00:00
Elias Rohrer
3c0420c39e
Merge pull request #2799 from benthecarman/tx-sync-wasm
Don't call system time in no-std
2024-01-08 18:55:07 +01:00
benthecarman
f836794e98
Don't call system time in unless feature enabled 2023-12-19 13:22:17 -06:00
Elias Rohrer
8471644a2d
Deny warnings in CI
Since we recently got rid of our last build/test/doc warnings, we now
deny warnings via `-D warnings` in CI, enforcing no new ones are
introduced.
2023-12-18 08:53:27 +01:00
Matt Corallo
2aecfa45ba Fix dev MSRV build of lightning-transaction-sync
...due to a transitive dependency of the `bitcoind` crate.
2023-12-15 22:39:57 +00:00
Matt Corallo
a866ba7ee3 cfg-gate async signing logic
We are intending to release without having completed our async
signing logic, which sadly means we need to cfg-gate it to ensure
we restore the previous state of panicking on signer errors, rather
than putting us in a stuck state with no way to recover.

Here we add a new `async_signing` cfg flag and use it to gate all
the new logic from #2558 effectively reverting commits
1da29290e7 through
014a336e59.
2023-12-13 22:58:34 +00:00
Wilmer Paulino
a1c92820b0
Merge pull request #2782 from TheBlueMatt/2023-12-check-cfg-tags
Add CI test that `#[cfg]` tags are from a defined set
2023-12-11 11:04:18 -08:00
Matt Corallo
75c0e06ce1 Add CI test that #[cfg] tags are from a defined set
Rust is fairly relaxed in checking the validity of arguments
passed to #[cfg]. While it should probably be more strict when
checking features, it cannot be strict when checking loose cfg
tags, because those can be anything and are simply passed to rustc
via unconstrained arguments.

Thus, we do it for rustc manually, but scanning all our source and
checking that all our cfg tags match a known cfg tag.

Fixes #2184
2023-12-08 23:07:14 +00:00
Elias Rohrer
f368facac0
Manually download bitcoind/electrs for CI tests
Previously, we used the auto-download feature of the
`electrsd`/`bitcoind` crates. While convenient, they unnecessarily
introduced a lot of dependecies (`zip`, `zstd`, `time`, etc.) to our
test environment which needed pinning for the MSRV of 1.63.

Here, we introduce a new `no_download` config flag to the
`lightning-transaction-sync` crate allowing us to disable this
auto-download feature in CI, where we now opt to download the
corresponding binaries manually. We keep the default-auto-download as a
convenience feature for running tests locally though.
2023-12-08 14:40:15 +01:00
Elias Rohrer
ddf2509227
Bump MSRV to rustc 1.63.0 and edition to 2021
.. which is a reasonable common ground, also supported by Debian stable.
2023-12-08 14:03:45 +01:00
Elias Rohrer
28c14cd884
Add Electrum integration test 2023-11-23 09:30:58 +01:00
Matt Corallo
35eb38df14 Fix CI on rustc 1.50 and below
rustc doesn't allow `--features` with `-p`, so we simply skip the
steps that rely on it.
2023-10-23 19:50:12 +00:00
Matt Corallo
bbb8facbe6 Fix (and test) the c_bindings build flag
Rather than only building with the `c_bindings` flag in certain
crates, we go ahead and test all crates with the flag in CI here.
2023-10-21 14:30:21 +00:00
Matt Corallo
d186c683b9 Reduce disk usage in CI
Recently github appears to have reduced the available free disk
space in actions runs, causing CI to fail with out of space errors.
Here we simply run `cargo clean` a few times in CI to reduce our
disk usage somewhat.
2023-10-14 18:41:34 +00:00
Matt Corallo
e1707baf15 Replace cargo build calls in CI with cargo check
We're not actually using the build output, so there's no reason to
do a build vs just running check.
2023-09-17 00:57:00 +00:00
Matt Corallo
b78f93694f Move coverage generation to llvm-cov in the hopes its more stable 2023-09-17 00:56:56 +00:00
Matt Corallo
a13dd715f2 Correct syn pinning on cargo 1.48
Sadly the pinning introduced in 050f5a9029
was brittle in the face of any further syn updates, and has already
broken.

Here we fix it by looking up the actual version of syn to pin.

Note that this dependency is somewhat nonsense as its actually only
a `criterion` dependency, pulled in even though we haven't set the
bench flag (as we aren't yet using `resolver = 2`).
2023-09-16 16:54:17 +00:00
Matt Corallo
ba12a86393 Pin memchr in our release dependency list due to core2 using it
We're working with rust-bitcoin to remove the `core2` dependency
at https://github.com/rust-bitcoin/rust-bitcoin/pull/2066 but until
that lands and we can upgrade rust-bitcoin we're stuck with it. In
the mean time, we should still pass our MSRV tests.
2023-09-15 17:07:17 +00:00
Matt Corallo
050f5a9029 Pin syn back to 2.0.32 fix MSRV in testing 2023-09-14 20:36:42 +00:00
Matt Corallo
afc5a02fc6 Pin the memchr test-only transitive dependency of regex 2023-08-28 21:16:54 +00:00
Matt Corallo
67e5399eff Make CI build -> test flows test -> build.
Doing `cargo test` causes us to build both the crate(s) themselves
and the test binaries, which depend on the main builds. However, it
can start building the test code while the actual program code for
the main crate(s) themselves are being built, making a
build -> test flow slightly slower than test -> build.

Its not really a huge deal, but I'm using `ci/ci-tests.sh` more
locally and it meaningfully changes the time-to-test-run.
2023-08-08 04:19:51 +00:00
Matt Corallo
aa3c78658e Run all tests first before testing more esoteric flags in CI
This should at least marginally more aggressively target things
which are more likely to have changed in CI, making `ci-tests.sh`
more useful as a "default" script for developers to run locally.
2023-07-24 22:04:10 +00:00