Skip to content

Commit e39d99a

Browse files
committed
fuzz fix
Generating random bytes while sending peer storage broke the fuzz due to change in parameters. Key Changes: - Change in HTLC amount as there were both remote and local commitments with the same txid.
1 parent 3826fbc commit e39d99a

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

fuzz/src/full_stack.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
11851185
// inbound read from peer id 1 of len 255
11861186
ext_from_hex("0301ff", &mut test);
11871187
// beginning of accept_channel
1188-
ext_from_hex("0021 0000000000000000000000000000000000000000000000000000000000000e05 0000000000000162 00000000004c4b40 00000000000003e8 00000000000003e8 00000002 03f0 0005 030000000000000000000000000000000000000000000000000000000000000100 030000000000000000000000000000000000000000000000000000000000000200 030000000000000000000000000000000000000000000000000000000000000300 030000000000000000000000000000000000000000000000000000000000000400 030000000000000000000000000000000000000000000000000000000000000500 02660000000000000000000000000000", &mut test);
1188+
ext_from_hex("0021 0000000000000000000000000000000000000000000000000000000000000e12 0000000000000162 00000000004c4b40 00000000000003e8 00000000000003e8 00000002 03f0 0005 030000000000000000000000000000000000000000000000000000000000000100 030000000000000000000000000000000000000000000000000000000000000200 030000000000000000000000000000000000000000000000000000000000000300 030000000000000000000000000000000000000000000000000000000000000400 030000000000000000000000000000000000000000000000000000000000000500 02660000000000000000000000000000", &mut test);
11891189
// inbound read from peer id 1 of len 35
11901190
ext_from_hex("030123", &mut test);
11911191
// rest of accept_channel and mac
@@ -1206,11 +1206,11 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12061206
// inbound read from peer id 1 of len 114
12071207
ext_from_hex("030172", &mut test);
12081208
// funding_signed message and mac
1209-
ext_from_hex("0023 3a00000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000007c0001000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1209+
ext_from_hex("0023 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000b90001000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
12101210

12111211
// broadcast funding transaction
12121212
ext_from_hex("0b", &mut test);
1213-
// by now client should have sent a channel_ready (CHECK 4: SendChannelReady to 03020000 for chan 3f000000)
1213+
// by now client should have sent a channel_ready (CHECK 4: SendChannelReady to 03020000 for chan 2f000000)
12141214

12151215
// inbound read from peer id 1 of len 18
12161216
ext_from_hex("030112", &mut test);
@@ -1219,7 +1219,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12191219
// inbound read from peer id 1 of len 83
12201220
ext_from_hex("030153", &mut test);
12211221
// channel_ready and mac
1222-
ext_from_hex("0024 3a00000000000000000000000000000000000000000000000000000000000000 026700000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1222+
ext_from_hex("0024 2900000000000000000000000000000000000000000000000000000000000000 026700000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
12231223

12241224
// inbound read from peer id 0 of len 18
12251225
ext_from_hex("030012", &mut test);
@@ -1272,7 +1272,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12721272
ext_from_hex("07", &mut test);
12731273
// Four feerate requests to check dust exposure while forwarding the HTLC
12741274
ext_from_hex("00fd00fd00fd00fd", &mut test);
1275-
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 3f000000)
1275+
// client now sends id 1 update_add_htlc and commitment_signed (CHECK 7: UpdateHTLCs event for node 03020000 with 1 HTLCs for channel 2f000000)
12761276

12771277
// we respond with commitment_signed then revoke_and_ack (a weird, but valid, order)
12781278
// inbound read from peer id 1 of len 18
@@ -1282,7 +1282,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12821282
// inbound read from peer id 1 of len 116
12831283
ext_from_hex("030174", &mut test);
12841284
// commitment_signed and mac
1285-
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000006a0001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1285+
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000e40001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
12861286
//
12871287
// inbound read from peer id 1 of len 18
12881288
ext_from_hex("030112", &mut test);
@@ -1291,7 +1291,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
12911291
// inbound read from peer id 1 of len 115
12921292
ext_from_hex("030173", &mut test);
12931293
// revoke_and_ack and mac
1294-
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6600000000000000000000000000000000000000000000000000000000000000 026400000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1294+
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6600000000000000000000000000000000000000000000000000000000000000 026400000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
12951295
//
12961296
// inbound read from peer id 1 of len 18
12971297
ext_from_hex("030112", &mut test);
@@ -1300,7 +1300,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13001300
// inbound read from peer id 1 of len 90
13011301
ext_from_hex("03015a", &mut test);
13021302
// update_fulfill_htlc and mac
1303-
ext_from_hex("0082 3a00000000000000000000000000000000000000000000000000000000000000 0000000000000000 ff00888888888888888888888888888888888888888888888888888888888888 01000000000000000000000000000000", &mut test);
1303+
ext_from_hex("0082 2900000000000000000000000000000000000000000000000000000000000000 0000000000000000 ff00888888888888888888888888888888888888888888888888888888888888 01000000000000000000000000000000", &mut test);
13041304
// client should immediately claim the pending HTLC from peer 0 (CHECK 8: SendFulfillHTLCs for node 03000000 with preimage ff00888888 for channel 3d000000)
13051305

13061306
// inbound read from peer id 1 of len 18
@@ -1310,7 +1310,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13101310
// inbound read from peer id 1 of len 116
13111311
ext_from_hex("030174", &mut test);
13121312
// commitment_signed and mac
1313-
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000100001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1313+
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000330001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
13141314

13151315
// inbound read from peer id 1 of len 18
13161316
ext_from_hex("030112", &mut test);
@@ -1319,7 +1319,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13191319
// inbound read from peer id 1 of len 115
13201320
ext_from_hex("030173", &mut test);
13211321
// revoke_and_ack and mac
1322-
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6700000000000000000000000000000000000000000000000000000000000000 026500000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1322+
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6700000000000000000000000000000000000000000000000000000000000000 026500000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
13231323

13241324
// before responding to the commitment_signed generated above, send a new HTLC
13251325
// inbound read from peer id 0 of len 18
@@ -1395,7 +1395,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
13951395
// inbound read from peer id 1 of len 116
13961396
ext_from_hex("030174", &mut test);
13971397
// commitment_signed and mac
1398-
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000390001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1398+
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000009c0001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
13991399

14001400
// inbound read from peer id 1 of len 18
14011401
ext_from_hex("030112", &mut test);
@@ -1404,7 +1404,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14041404
// inbound read from peer id 1 of len 115
14051405
ext_from_hex("030173", &mut test);
14061406
// revoke_and_ack and mac
1407-
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6400000000000000000000000000000000000000000000000000000000000000 027000000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1407+
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6400000000000000000000000000000000000000000000000000000000000000 027000000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
14081408

14091409
// inbound read from peer id 1 of len 18
14101410
ext_from_hex("030112", &mut test);
@@ -1413,7 +1413,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14131413
// inbound read from peer id 1 of len 60
14141414
ext_from_hex("03013c", &mut test);
14151415
// update_fail_htlc and mac
1416-
ext_from_hex("0083 3a00000000000000000000000000000000000000000000000000000000000000 0000000000000001 0000 01000000000000000000000000000000", &mut test);
1416+
ext_from_hex("0083 2900000000000000000000000000000000000000000000000000000000000000 0000000000000001 0000 01000000000000000000000000000000", &mut test);
14171417

14181418
// inbound read from peer id 1 of len 18
14191419
ext_from_hex("030112", &mut test);
@@ -1422,7 +1422,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14221422
// inbound read from peer id 1 of len 116
14231423
ext_from_hex("030174", &mut test);
14241424
// commitment_signed and mac
1425-
ext_from_hex("0084 3a00000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000390001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
1425+
ext_from_hex("0084 2900000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000e20001000000000000000000000000000000000000000000000000000000000000 0000 01000000000000000000000000000000", &mut test);
14261426

14271427
// inbound read from peer id 1 of len 18
14281428
ext_from_hex("030112", &mut test);
@@ -1431,7 +1431,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14311431
// inbound read from peer id 1 of len 115
14321432
ext_from_hex("030173", &mut test);
14331433
// revoke_and_ack and mac
1434-
ext_from_hex("0085 3a00000000000000000000000000000000000000000000000000000000000000 6500000000000000000000000000000000000000000000000000000000000000 027100000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
1434+
ext_from_hex("0085 2900000000000000000000000000000000000000000000000000000000000000 6500000000000000000000000000000000000000000000000000000000000000 027100000000000000000000000000000000000000000000000000000000000000 01000000000000000000000000000000", &mut test);
14351435

14361436
// process the now-pending HTLC forward
14371437
ext_from_hex("07", &mut test);
@@ -1464,7 +1464,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14641464
// inbound read from peer id 0 of len 255
14651465
ext_from_hex("0300ff", &mut test);
14661466
// beginning of update_add_htlc from 0 to 1 via client
1467-
ext_from_hex("0080 3d00000000000000000000000000000000000000000000000000000000000000 0000000000000002 00000000000b0838 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 12 02030927c0 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test);
1467+
ext_from_hex("0080 3d00000000000000000000000000000000000000000000000000000000000000 0000000000000002 00000000000b0838 ff00000000000000000000000000000000000000000000000000000000000000 000003f0 00 030000000000000000000000000000000000000000000000000000000000000555 12 02030927c1 0401a0 060800000e0000010000 0a00000000000000000000000000000000000000000000000000000000000000 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test);
14681468
// inbound read from peer id 0 of len 255
14691469
ext_from_hex("0300ff", &mut test);
14701470
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", &mut test);
@@ -1480,7 +1480,7 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
14801480
// inbound read from peer id 0 of len 193
14811481
ext_from_hex("0300c1", &mut test);
14821482
// end of update_add_htlc from 0 to 1 via client and mac
1483-
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5300000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
1483+
ext_from_hex("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 5200000000000000000000000000000000000000000000000000000000000000 03000000000000000000000000000000", &mut test);
14841484

14851485
// One feerate request to check dust exposure
14861486
ext_from_hex("00fd", &mut test);
@@ -1512,15 +1512,15 @@ fn two_peer_forwarding_seed() -> Vec<u8> {
15121512

15131513
// connect a block with one transaction of len 125
15141514
ext_from_hex("0c007d", &mut test);
1515-
// the commitment transaction for channel 3f00000000000000000000000000000000000000000000000000000000000000
1516-
ext_from_hex("02000000013a000000000000000000000000000000000000000000000000000000000000000000000000000000800258020000000000002200204b0000000000000000000000000000000000000000000000000000000000000014c0000000000000160014280000000000000000000000000000000000000005000020", &mut test);
1515+
// the commitment transaction for channel 2900000000000000000000000000000000000000000000000000000000000000
1516+
ext_from_hex("020000000129000000000000000000000000000000000000000000000000000000000000000000000000000000800258020000000000002200201f0000000000000000000000000000000000000000000000000000000000000013c00000000000001600143b0000000000000000000000000000000000000005000020", &mut test);
15171517
// Two feerate requests during block connection
15181518
ext_from_hex("00fd00fd", &mut test);
15191519
//
15201520
// connect a block with one transaction of len 94
15211521
ext_from_hex("0c005e", &mut test);
15221522
// the HTLC timeout transaction
1523-
ext_from_hex("0200000001730000000000000000000000000000000000000000000000000000000000000000000000000000000001a701000000000000220020b20000000000000000000000000000000000000000000000000000000000000000000000", &mut test);
1523+
ext_from_hex("0200000001200000000000000000000000000000000000000000000000000000000000000000000000000000000001a701000000000000220020e60000000000000000000000000000000000000000000000000000000000000000000000", &mut test);
15241524
// Two feerate requests during block connection
15251525
ext_from_hex("00fd00fd", &mut test);
15261526
// connect a block with no transactions
@@ -1702,19 +1702,19 @@ mod tests {
17021702
// 3
17031703
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
17041704
// 4
1705-
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 for channel 3a00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
1705+
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendChannelReady event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 for channel 2900000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
17061706
// 5
17071707
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling SendRevokeAndACK event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&4));
17081708
// 6
17091709
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 0 fails, 1 commits for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3));
17101710
// 7
1711-
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails, 1 commits for channel 3a00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3));
1711+
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030200000000000000000000000000000000000000000000000000000000000000 with 1 adds, 0 fulfills, 0 fails, 1 commits for channel 2900000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&3));
17121712
// 8
17131713
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 1 fulfills, 0 fails, 1 commits for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&1));
17141714
// 9
17151715
assert_eq!(log_entries.get(&("lightning::ln::peer_handler".to_string(), "Handling UpdateHTLCs event in peer_handler for node 030000000000000000000000000000000000000000000000000000000000000002 with 0 adds, 0 fulfills, 1 fails, 1 commits for channel 3d00000000000000000000000000000000000000000000000000000000000000".to_string())), Some(&2));
17161716
// 10
1717-
assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending counterparty commitment tx (0000000000000000000000000000000000000000000000000000000000000073:0) in 0000000000000000000000000000000000000000000000000000000000000067 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1));
1717+
assert_eq!(log_entries.get(&("lightning::chain::channelmonitor".to_string(), "Input spending counterparty commitment tx (0000000000000000000000000000000000000000000000000000000000000020:0) in 0000000000000000000000000000000000000000000000000000000000000060 resolves outbound HTLC with payment hash ff00000000000000000000000000000000000000000000000000000000000000 with timeout".to_string())), Some(&1));
17181718
}
17191719

17201720
#[test]

0 commit comments

Comments
 (0)