Commit Graph

60 Commits

Author SHA1 Message Date
Matt Corallo
1701b02124 Replace std's unmaintained bench with criterion
Rather than using the std benchmark framework (which isn't
maintained and is unlikely to get any further maintenance), we swap
for criterion, which at least gets us a variable number of test
runs so our benchmarks don't take forever.

We also fix the RGS benchmark to pass now that the file in use is
stale compared to today's date.
2023-05-11 06:11:49 +00:00
Matt Corallo
d355ce1b78
Merge pull request #1497 from TheBlueMatt/2022-05-no-default-opt
Disable LTO builds in tests (and bump deps to -O2)
2023-03-04 02:01:49 +00:00
Matt Corallo
64a7567928 Move lightning-transaction-sync out of the main workspace
Because `lightning-transaction-sync` does not have an MSRV (and
because its dev-dependencies are huge), we can't build it by
default when devs run `cargo test`, so it is moved out of the
top-level workspace.
2023-02-27 19:01:29 +00:00
Matt Corallo
8d35d2cee8 Disable LTO builds in tests (and bump deps to -O2)
For some reason rustc, at some point, decided that our optimization
of dependencies implies we want to also build with LTO. This causes
our test builds to take substantially longer to compile, even with
only a trivial change. By hard-disabling this (even keeping the
optimization of the test and in-tree libraries enabled) the time
required to build with only a trivial change to
`functional_tests.rs` goes from 0m25.635s wall clock/1m14.220s CPU
time to 0m17.841s wall clock/0m17.828s CPU time on my i7-13700K on
rustc 1.63.

The changes in test execution time appear to be within noise.

While we're at it, we also bump dependencies to build with -O2
because their build time is now substantially reduced cost.
2023-02-24 22:20:54 +00:00
Jeffrey Czyz
6e0384e39c
Macro for composing custom message handlers
BOLT 1 specifies a custom message type range for use with experimental
or application-specific messages. While a `CustomMessageHandler` can be
defined to support more than one message type, defining such a handler
requires a significant amount of boilerplate and can be error prone.

Add a crate exporting a `composite_custom_message_handler` macro for
easily composing pre-defined custom message handlers. The resulting
handler can be further composed with other custom message handlers using
the same macro.

This requires a separate crate since the macro needs to support "or"
patterns in macro_rules, which is only available in edition 2021.

https://doc.rust-lang.org/edition-guide/rust-2021/or-patterns-macro-rules.html

Otherwise, a crate defining a handler for a set of custom messages could
not easily be reused with another custom message handler. Doing so would
require explicitly duplicating the reused handlers type ids, but those
may change when the crate is updated.
2023-02-14 18:20:40 -06:00
Elias Rohrer
fa77f34327
Add transaction sync crate
This crate provides utilities for syncing LDK via the transaction-based
`Confirm` interface. The initial implementation facilitates
synchronization with an Esplora backend server.
2023-02-09 15:28:34 -06:00
acid-bit
65d3bc27d9 Fix typo in comment in Cargo.toml 2022-09-14 11:49:20 +01:00
Arik Sosman
a58ae4c97b
Introduce graph sync crate for fast-forwarding through gossip data downloaded from a server. 2022-05-25 01:21:33 -07:00
Jeffrey Czyz
f041a64fca
Check for no-std compatibility across dependencies
To ensure no-std is honored across dependencies, add a crate depending
on lightning crates supporting no-std. This should ensure any
regressions are caught. Otherwise, cargo doesn't seem to catch some
incompatibilities (e.g., f64::log10 unavailable in core) and seemingly
across other dependencies as describe here:

https://blog.dbrgn.ch/2019/12/24/testing-for-no-std-compatibility/
2022-03-08 23:23:26 -06:00
Matt Corallo
08ecb53915 Add bench profiles to Cargo.toml to force codegen-units=1
This makes a small difference for NetworkGraph deserialization
as it enables more inlining across different files, hopefully
better matching user performance as well.

As of this commit, on an Intel 2687W v3, the serialization
benchmarks take:

test routing::network_graph::benches::read_network_graph  ... bench: 2,037,875,071 ns/iter (+/- 760,370)
test routing::network_graph::benches::write_network_graph ... bench: 320,561,557 ns/iter (+/- 176,343)
2021-06-01 15:47:01 +00:00
Matt Corallo
452b72078e Rename background-processor to lightning-... to match other crates 2021-04-15 15:23:05 -04:00
Valentine Wallace
56069ba7aa
Clean up lightning-invoice CI, license, and add to workspaces 2021-04-09 10:08:27 -04:00
Valentine Wallace
a368093803
Add BackgroundProcessor for ChannelManager persistence and other
Other includes calling timer_chan_freshness_every_minute() and in the
future, possibly persisting channel graph data.

This struct is suitable for things that need to happen periodically and
can happen in the background.
2021-02-19 15:00:43 -05:00
Jeffrey Czyz
9860646e73
Add lightning-block-sync package and library
Defines an interface and related types for fetching block headers and
data from a block source (e.g., Bitcoin Core). Used to keep lightning in
sync with chain activity.
2021-02-03 17:45:54 -08:00
Valentine Wallace
82f5a1cbda
Add a sample module FilesystemPersister.
Intended to be a cross-platform implementation of the
channelmonitor::Persist trait.

This adds a new lightning-persister crate, that uses the
newly exposed lightning crate's test utilities.

Notably, this crate is pretty small right now. However, due to
future plans to add more data persistence (e.g. persisting the
ChannelManager, etc) and a desire to avoid pulling in filesystem
usage into the core lightning package, it is best for it to be
separated out.

Note: Windows necessitates the use of OpenOptions with the `write`
permission enabled to `sync_all` on a newly opened channel's
data file.
2020-10-16 13:41:36 -04:00
Matt Corallo
e808d50b9d Fix passing -O1 to build from cargo test
In 9e03087d6a we started setting
`opt-level` only on profile.test and not profile.dev. When that
commit was authored I tested only that rustc was being called with
opt-level set in its flags, not that the resulted run ran at the
speed I expected. It seems profile.test isn't applied properly to
dependencies or so, resulting in tests running much slower than
they do at profile.dev.opt-level=1.
2020-10-05 14:24:41 -04:00
Matt Corallo
dbf4f58987 Remove the bindings crate from the root namespace to let it break
Until we get the bindings generation process super stable, let the
bindings get stale with respect to the main repo while still letting
`cargo check` pass.
2020-09-13 20:58:50 -04:00
Matt Corallo
3c12b0d0af Specify panic = abort in profiles for lightning-c-bindings 2020-09-10 22:03:32 -04:00
Matt Corallo
9e03087d6a Apply -O1 only to tests, not all dev (which is used for bindings) 2020-09-10 22:03:32 -04:00
Matt Corallo
af9d1cf776 LTO in release mode by default, which is really critical for C libs 2020-09-10 22:03:32 -04:00
Matt Corallo
76eaa61725 Update the root Cargo.toml to point to the new subcrate 2020-09-10 22:03:32 -04:00
Matt Corallo
a62e96bcd9 Move test profile to crate root, so it has effect again 2019-11-28 01:21:41 -05:00
RJ Rybarczyk
88fef649b1 Use workspaces to separate crates 2019-11-15 02:44:30 +00:00
Elichai Turkel
f4e8974c16
Updated bitcoin, bitcoin_hashes and secp256k1 dependencies 2019-08-24 11:04:29 -04:00
Matt Corallo
bf7eeb1ec7 Make rand a dev-dep by having the user randomize HTLC forward delay
This removes the last calls to rand outside of test and moves the
dep to a dev-dependency, dropping our fuzz rng wrapper in the
process.
2019-07-23 14:29:56 -04:00
Matt Corallo
7118effbf2 Bump version to 0.0.9 to get current master fixes uploaded. 2019-06-01 07:48:33 -04:00
Matt Corallo
882f7307c8 Bump rust-bitcoin dep to 0.18 2019-06-01 07:40:21 -04:00
Tamas Blummer
02b541607b migration to rust-bitcoin 0.17
typedef Sha256dHash with bitcoin_hashes::sha256d::Hash
SecretKey -> PrivateKey.key
assume compressed public keys
2019-03-07 18:50:02 +01:00
Matt Corallo
cfcecdbf11 Bump version to 0.0.8 2019-01-25 12:07:16 -05:00
Matt Corallo
db07d6e30e Bump bitcoin_hashes to 0.3 2019-01-24 22:29:10 -05:00
Matt Corallo
12d25576c1 Upgrade to secp256k1 v12, bitcoin v16, and crates bitcoin_hashes 2019-01-22 13:49:15 -05:00
Matt Corallo
7ea39a13b2 Use bitcoin_hashes' fixed_time_eq, removing the rust-crypto dep 2018-12-19 20:02:36 -05:00
Matt Corallo
f1e400f142 Switch Sha256 to using bitcoin_hashes and our own HKDF 2018-12-19 17:13:25 -05:00
Matt Corallo
bde921ea20 Bump to 0.0.7 for API rev 2018-11-21 16:18:18 -05:00
Steven Roose
7ff7561f2d Update to rust-bitcoin v0.15 2018-11-14 11:43:54 +00:00
Matt Corallo
cfff650261 Bump version to 0.0.6 2018-10-27 09:58:10 -04:00
Matt Corallo
d2a6ca529f Bump version to 0.0.5 to get new docs out 2018-09-20 10:57:18 -04:00
Matt Corallo
9d69bc9a48 Switch to -O1 in dev as we have long-running tests and O1 is cheap 2018-09-20 10:57:01 -04:00
Matt Corallo
11e5975523 Update to rust-secp256k1 v0.11 and rust-bitcoin v0.14 2018-08-23 14:52:43 -04:00
Antoine Riard
0029f04fce Logging interface
Implement error, warn, info, debug and trace macros, internally calling
an instance of Logger, and passing it to every main structures
Build-time or client-side filtering.
Issue #54
2018-08-17 00:01:15 +00:00
Savil Srivastava
07d7b395e6 change hex version to 0.3, and leave out the minor bumps 2018-07-30 17:01:57 -07:00
Matt Corallo
fe9bb1d970
Merge pull request #84 from savil/sort_outputs
[RFC][Tx Sort] Implement sorting of inputs
2018-07-26 11:54:17 -04:00
Savil Srivastava
da09c4d7f3 adding BIP69 test-cases 2018-07-25 18:33:03 -07:00
Matt Corallo
84cb40f859 Bump version for API overhauls, update deps and docs 2018-07-19 23:06:36 -04:00
Matt Corallo
f462d8ac70 fuzztarget sha -> XOR, crates secp256k1 2018-06-04 20:02:07 -04:00
Yuntai Kyong
7822af8bd1 Update dependency on secp256k1 pointing to https://github.com/rust-bitcoin/rust-secp256k1 2018-05-12 14:30:26 +09:00
Matt Corallo
a31d67474c Fix repo link in Cargo 2018-04-26 17:35:09 -04:00
Matt Corallo
c564f9fd59 Bump version for API changes. 2018-04-26 11:40:48 -04:00
Matt Corallo
1ec9c3aa4b Provide fallback for crypto's fixed_time_eq on non-x86/arm targets 2018-04-16 20:35:21 -04:00
Matt Corallo
00c6f42452 Use libbitcoinconsensus to check tx validity in some tests 2018-04-16 20:35:19 -04:00