Matt Corallo
fd1d5fd62c
Randomize initial onion packet data.
...
This avoids at least the trivial hop count discovery attack, though
other obvious ones remain and are slightly harder to avoid.
See https://github.com/lightningnetwork/lightning-rfc/pull/697
2019-12-01 19:22:44 -05:00
Matt Corallo
c1349e82cd
Add dyn tags in fuzz_targets
...
We only support newish rust in fuzz_targets, so this is fine.
2019-11-28 01:21:41 -05:00
Matt Corallo
9501ecce49
Move fuzz to top level.
2019-11-25 15:42:07 -05:00
RJ Rybarczyk
88fef649b1
Use workspaces to separate crates
2019-11-15 02:44:30 +00:00
Elichai Turkel
20302064a8
Update the fuzz and net-tokio crates
2019-08-24 11:05:38 -04:00
RJ Rybarczyk
d32015377e
Make SocketDescriptor::send_data take slice instead of vec and offset
2019-07-31 11:22:59 -04:00
Matt Corallo
e5c8f05891
Make temporary channel ids unique in full_stack_target
...
This avoids a crash where a channel with a duplicate id is created
immediately after another is closed, where the other still has a
pending funding generation event. Resulting in funding generation
being passed to the wrong channel (which isn't in an appropriate
state).
2019-07-29 12:51:33 -04:00
Matt Corallo
a9aa3c37fe
Make chanmon_fail_consistency slightly less aggressive
...
This resolves some crashes that both afl and honggfuzz found.
2019-07-25 11:30:53 -04:00
Matt Corallo
20efabdaa6
Add deserialize+load steps to chanmon_fail_consistency ( fixes #327 )
2019-07-24 15:31:29 -04:00
Matt Corallo
c2f72b9de3
Drop msgs bound for a disconnecting peer at disconnect time
...
This simplifies chanmon_fail_consistency greatly and makes it a
tiny bit more realistic. It also sets us up for more
disconnect-relatex events without the complexity blowing up.
2019-07-23 15:53:47 -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
084ef28708
Stop using rng in peer_channel_encryptor to generate ephemeral keys
...
This removes the bulk of our reliance on the rand crate in non-test
envs, paving a way towards a syscall-less rust-lightning and WASM.
Since this is a breaking change for full_stack_target (and several
fuzz targets), go ahead and make other changes to make things more
distinct.
2019-07-23 14:29:56 -04:00
Matt Corallo
1650992ec2
Update commitment tx to match actual tx (dunno when it broke)
2019-07-23 14:29:56 -04:00
Matt Corallo
d9043b51bb
Remove dangling link in fuzz/
2019-07-23 14:29:56 -04:00
Antoine Riard
0052b2c5c3
Provide peer local_features to handle_open_channel/accept_channel
...
Peer may send us a shutdown_scriptpubkey in open_channel or
accept_channel messages. Before to enforce this policy on channel
closing, we want to be sure that our peer has opt-in to it.
Extend LocalFeatures new method visibilty from crate to public
for fuzz tests
2019-07-22 13:13:01 -04:00
Matt Corallo
8470e60415
Merge pull request #336 from ariard/2019-04-in-flight-txn-tracking-clean
...
2019 04 in flight txn tracking clean
2019-07-19 18:02:25 -04:00
Matt Corallo
3d55d71fda
Add balance and is_live fields to ChannelDetails
2019-07-18 18:02:31 -04:00
Antoine Riard
a2b6a76e59
Delay failure of non-dust HTLC-outputs until solving timeout tx matures
...
Fix tests broken by introduced change
2019-07-17 15:26:33 -04:00
Antoine Riard
587af43eca
Implement block_disconnect for pruning of waiting-conf HTLC updates
...
Modify ChainListener API by adding height field to block_disconnect
2019-07-17 15:26:33 -04:00
Matt Corallo
882f7307c8
Bump rust-bitcoin dep to 0.18
2019-06-01 07:40:21 -04:00
Matt Corallo
06eddc3465
Merge pull request #320 from TheBlueMatt/2019-03-chan-send-rewrite
...
Rewrite Channel resend tracking to make it much more reliable
2019-04-22 17:32:24 -04:00
Matt Corallo
2811b07ede
Merge pull request #334 from ariard/2019-04-fee-estimation-monitor
...
Add Fee Estimation in ChannelMonitor
2019-04-21 19:44:58 -04:00
Antoine Riard
50b6acb696
Add FeeEstimator in ChannelMonitor
2019-04-16 18:50:09 -04:00
Sebastian Geisler
80aa4f20a9
Make channel open confs configurable (and change from 12 to 6)
...
This fixes compatibility with c-lightning etc as they won't accept
a minimum_depth of 12.
2019-04-10 12:03:10 -04:00
Matt Corallo
c2a3fc74dc
Fix crash in chanmon_fail_consistency due to fuzz hash collisions
2019-03-25 17:03:53 -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
Antoine Riard
6031017351
Clarify a bit full_stack_target test_no_existing_test_breakage
2019-02-27 20:54:52 -05:00
Matt Corallo
74588b2519
Send back the actual received amount, not expected on HTLC fails
...
This resolves an incorrect implementation of the spec and fixes a
major privacy leak.
Fixes GH #289 .
2019-01-24 16:55:01 -05:00
Matt Corallo
49d63302c3
Add a fuzz target to test monitor update failure handling
...
Sadly this requires reducing the honggfuzz iterations to fit within
Travis' runtime limits.
2019-01-24 13:17:00 -05:00
Matt Corallo
aa9a848f79
Take the logger from test_utils into fuzz::test_utils
2019-01-24 13:16:59 -05:00
Yuko Roodt
4d77e9d752
Added tests to check the bolt 2 specs for Sending Node Channel
2019-01-23 14:54: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
7fd294db3d
Merge pull request #285 from TheBlueMatt/2019-01-fuzz-cleanups
...
Trivial cleanups in full_stack_target/fuzztarget
2019-01-16 10:11:32 -05:00
Matt Corallo
90ce97198c
Simplify and expand logging in is_resolving_htlc_output
...
This clarifies all the conditions we can hit and also ensures they
are all logged in a clear and consistent manner.
2019-01-08 23:03:07 -05:00
Matt Corallo
5801d19a69
Switch to bitcoin_hashes Hash160 in full_stack_target
2019-01-08 14:04:06 -05:00
Matt Corallo
d8dcb1a9d3
Add doc to full_stack_target
2019-01-08 14:04:06 -05:00
Matt Corallo
cdf9b4f8ba
Add option to use libfuzzer sys in full_stack_target
...
Note that there doesn't appear to be a way to conditionally set
#[no_main] so that has to happen manually at compile-time.
2019-01-08 14:04:06 -05:00
Matt Corallo
044edd6e86
Fail HTLCs backwards asynchronously
2018-12-21 15:17:42 -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
8e07259326
Use bitcoin_hashes' Ripemd160/Hash160 from rust-crypto+rust-bitcoin
...
Note that this requires rewriting full_stack_target tests, which
sucks, but it does let the fuzzer hit more stuff since the real
ripemd160 isn't ever actually called anymore.
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
caeff85368
Update incorrect_payment_amount generation/handling for BOLT uptd
...
ie dont generate them as they're a really obvious privacy leak.
Luckily we were already handling them the same aside from log
printing so don't have to touch anything there. I was lazy in
updating tests but it only effects log printing, so whatever.
2018-12-17 22:57:47 -05:00
Matt Corallo
f5ccd4b4ef
Add additional log traces in channelmonitor/manager
2018-12-14 17:01:12 -05:00
Antoine Riard
7a483e597c
Typify payment_hash and payment_preimage
...
Fix variable name as payment_hash instead of txid for index
of remote_hash_commitment_number in ChannelMonitor reader
2018-12-14 17:00:50 -05:00
Matt Corallo
221bfa6bd4
Move monitor-generated HTLC event handling to manager event-getters
...
This is somewhat awkward, but prevents a slew of duplicate events.
Really this should probably be more explicit, but would be easy to
move that along with a slew of block_connected-event-processing
refactors, see-also GH #80 .
This affects full_stack_target only on accident cause the demo test
didn't continue onwards with another block connection.
2018-12-14 17:00:22 -05:00
Matt Corallo
4f9b0fbd3f
Avoid writing to stdout during fuzz tests
2018-12-03 13:58:50 -05:00
Matt Corallo
7e94d3a617
Remove unused import in full_stack_target
2018-12-03 13:30:38 -05:00
Yuntai Kyong
7e59e1e392
Add a method to get session secret for onion packet to KeysInterface
2018-11-27 10:44:51 +09:00
Matt Corallo
3a066ccbf2
Ensure fuzz release builds use codegen-units=1 and LTO
2018-11-18 16:17:06 -05:00
Steven Roose
7ff7561f2d
Update to rust-bitcoin v0.15
2018-11-14 11:43:54 +00:00