Commit graph

850 commits

Author SHA1 Message Date
Matt Corallo
faf9864d9d Don't HTLC claim with no-possible-preimage in full_stack_target 2018-08-17 12:34:09 -04:00
Matt Corallo
ebd3bbba0f Remove some dead Logger code 2018-08-16 23:11:15 -04:00
Matt Corallo
09583f3116 Fix PaymentReceived/sha256 handling in full_stack_target
Sha256 in fuzztarget was updated some time ago to use XOR instead
of the first byte of a real SHA256 run and somehow received and
sent payments got crossed in full_stack_target.
2018-08-16 22:37:44 -04:00
Matt Corallo
609054eae0 Handle duplicate funding transaction gracefully.
This can otherwise cause strange behavior, including a panic on
force_close_all_channels found by full_stack_target fuzzing.
2018-08-16 22:37:44 -04:00
Matt Corallo
dde0ac4c29 Fix fee_base_msat overflowing entire fee range in RouteHint 2018-08-16 20:51:50 -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
Savil Srivastava
4c44b787f1 use hex::decode instead of extend_vec_from_hex 2018-07-28 10:09:29 -07:00
Matt Corallo
da014797b0 Properly calculate Channel::announce_publicly
For some reason we were only setting "announce_publicly" when
Channel::new_from_req had announce_publicly set to true and the
open_channel message had the relevant flag set. However, this
resulted in us rejecting peers for sending unsolicited
announcement_signatures messages, despite them having indicated,
and us having accepted, their announce-bit-set open_channel.
2018-07-26 15:11:36 -04:00
Matt Corallo
c45d8eb41e Only abort channel_target fuzz test on Err if ErrorAction says to 2018-07-25 16:25:12 -04:00
Matt Corallo
0ce6e397a7 Add router_target to fuzzing which fuzzes router msgs + get_route 2018-07-25 16:25:12 -04:00
Matt Corallo
66023b7886 Update NodeAnnouncement addr deserialization to check addr len.
This more aggressively checks the message contents are correct
before returning WrongLength so existing fuzz setup has an easier
time.
2018-07-25 15:57:36 -04:00
Matt Corallo
d4bb39a1dd Ensure all msg deserialization can provide extra bytes, rename err 2018-07-25 15:56:46 -04:00
Matt Corallo
af5c6e8186 PendingHTLCsForwardable really should just be upstreamed.
This is just a comment/docs/function rename change
2018-07-24 22:33:10 -04:00
Matt Corallo
b8b7cb238d Convert fee API to per_kw instead of per_vb
This (a) cuts down a bit on some conversions, reducing chances for
bugsand (b) provides greater accuracy for clients.
2018-07-24 20:34:56 -04:00
Antoine Riard
20fa9d331d Add DisconnectPeer events
Add test for DisconnectPeer event
Update DisconnectPeer with optional ErrorMessage
Manage error for funding_transaction_generated
Add disconnect_socket to SocketDescriptor trait
2018-07-23 14:31:44 -04:00
Antoine Riard
1c12e83941 Implement ErrorMessage msg and ErrorAction::SendErrorMessage + fuzz test 2018-07-23 14:31:44 -04:00
Matt Corallo
667cd66ede Add arg to get_route to specify our local channels explicitly
(and a new getter in ChannelManager to get the thing to pass in)
2018-07-23 13:33:00 -04:00
Savil Srivastava
0c1f47807a [msgs::ChannelReestablish] implement encoding and decoding
Summary:

Implementing these, taking inspiration from the surrounding code since i'm a rust n00b.

Test Plan:
```
cargo build
cargo test channel_reestablish
```
output:
```
running 3 tests
test ln::msgs::tests::encoding_channel_reestablish_with_secret ... ok
test ln::msgs::tests::decode_channel_reestablish_bad_length ... ok
test ln::msgs::tests::encoding_channel_reestablish_no_secret ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 14 filtered out
```
2018-07-22 23:26:47 -04:00
Matt Corallo
add1d9d9e5
Merge pull request #69 from savil/gen-target-fix
[fuzz] remove \L in sed regex for filenames in gen_target.sh
2018-07-22 23:25:30 -04:00
Matt Corallo
e93c9fbeaf Migrate all Uint256s used for channel_ids to [u8; 32] 2018-07-22 18:55:20 -04:00
Savil Srivastava
dee4ce5171 [fuzz] remove \L in sed regex for filenames in gen_target.sh
Summary:
on `master` branch, if i ran `gen_target.sh` i would get the following output:
https://gist.github.com/savil/2b3114eaf34c3ef8499b65005e374841

Without it, I get the files generated that are already checked-in (as expected).

Looking at the sed docs (https://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html) i don't see an explanation for what `\L` may do in whatever regex sed follows. Does this look correct? cc @yuntai
2018-07-20 23:00:31 -07:00
Matt Corallo
84cb40f859 Bump version for API overhauls, update deps and docs 2018-07-19 23:06:36 -04:00
Matt Corallo
77a96366ba Shorten channelmonitor_deserialize_target's name for AFL 2018-07-18 14:36:48 -04:00
Matt Corallo
0b82f5584f Test channelmonitor serialization roundtrip doesn't mutate state 2018-07-17 14:59:29 -04:00
Jean Pierre Dudey
d0e9137bc5 Add the OutPoint type for the ChannelMonitor's funding_txo field.
This structure replaces the (Sha256dHash, u16) tuple that was being used
for the funding output.

Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
2018-06-29 12:12:17 -04:00
Matt Corallo
4de3cfe665 Fix message targets to not have an internal loop 2018-06-16 23:26:56 -04:00
Matt Corallo
a73dea7722 Add ping/pong fuzz targets 2018-06-16 23:26:56 -04:00
Matt Corallo
f462d8ac70 fuzztarget sha -> XOR, crates secp256k1 2018-06-04 20:02:07 -04:00
Matt Corallo
03d07bf73d Update msg_target_template to note auto-generation 2018-05-13 13:28:47 -04:00
Matt Corallo
98af41ba29 Fix indentation in fuzz_target utils 2018-05-13 13:23:22 -04:00
Matt Corallo
ce382c0979 Make travis check that msg_targets match the template 2018-05-13 13:23:22 -04:00
Yuntai Kyong
913ea887fe add fuzz target for messages
[[bin]] section for each new target in Cargo.toml
glob chanbes in travis-fuzz.sh
2018-05-13 05:22:55 +09:00
Yuntai Kyong
e2ff3393ea add script to generate msg test target 2018-05-13 05:10:23 +09: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
Yuntai Kyong
dda8414161 add .gitignore 2018-05-12 14:30:26 +09:00
Matt Corallo
cff3ae5f26 Make channel_target return as channelmanager removes on shutdown 2018-05-10 10:39:20 -04:00
Matt Corallo
2d8afeccdb Rewrite channelmonitor framework and implement a bunch of it 2018-04-24 20:42:24 -04:00
Matt Corallo
53d1518566 Move ChannelKeys creation into channelmanager 2018-04-17 12:43:12 -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
374ea1f05e Completely rewrite channel HTLC tracking and processing
It obviously was nonsensical prior, though its now way more
complicated...there's refactoring work to be done here, but it
should at least kinda sorta work now.
2018-04-16 20:35:21 -04:00
Matt Corallo
1ae603cc3d Switch back to crates.io rust-bitcoin for 0.13 release 2018-04-16 20:35:03 -04:00
Matt Corallo
9ccfb358b4 Fix travis-fuzz upgrade-handling 2018-04-02 18:42:41 -04:00
Matt Corallo
b21048a1ce Check funding txout format when transaction is confirmed in channel 2018-04-02 18:07:03 -04:00
Matt Corallo
8938cd7d78 Expand full_stack_target from uselessly-large to laughably-large 2018-04-02 18:07:03 -04:00
Matt Corallo
c528ff3650 Handle incoming shutdown messages 2018-04-02 18:07:02 -04:00
Matt Corallo
890e3cb165 Update for new rust-bitcoin API, avoid some duplicate hashing 2018-04-02 18:06:59 -04:00
Matt Corallo
942d760b83 impl more message decoders 2018-03-25 17:02:28 -04:00
Matt Corallo
2188192efa Set travis to run honggfuzz for a while 2018-03-23 13:16:24 -04:00
Matt Corallo
1d2774dd64 Add some fuzz targets.
Sadly none of them are really any good without some hand-holding to
generate good input data, and unless sha256 gets stubbed out I'm
not sure they're gonna get good without a symbolic execution fuzzer
2018-03-23 13:16:24 -04:00