1+ // FUZZER COMMANDS:
2+ // RUSTFLAGS="--cfg hashes_fuzz --cfg=secp256k1_fuzz" cargo +nightly fuzz run --features "libfuzzer_fuzz" process_onion_failure_target
3+ // RUSTFLAGS="--cfg hashes_fuzz --cfg=secp256k1_fuzz" cargo +nightly fuzz coverage -v --features "libfuzzer_fuzz" process_onion_failure_target
4+ // llvm-cov show target/aarch64-apple-darwin/coverage/aarch64-apple-darwin/release/process_onion_failure_target --instr-profile=/Users/joost/repo/rust-lightning/fuzz/coverage/process_onion_failure_target/coverage.profdata --format=html --output-dir=reports
5+
16use std:: sync:: Arc ;
27
38use bitcoin:: { key:: Secp256k1 , secp256k1:: { PublicKey , SecretKey } } ;
4- use lightning:: { blinded_path:: BlindedHop , ln:: { channelmanager:: { HTLCSource , PaymentId } , msgs:: OnionErrorPacket } , routing:: router:: { BlindedTail , Path , RouteHop , TrampolineHop } , types:: features:: { ChannelFeatures , Features , NodeFeatures } , util:: test_utils:: TestLogger } ;
9+ use lightning:: { blinded_path:: BlindedHop , ln:: { channelmanager:: { HTLCSource , PaymentId } , msgs:: OnionErrorPacket } , routing:: router:: { BlindedTail , Path , RouteHop , TrampolineHop } , types:: features:: { ChannelFeatures , Features , NodeFeatures } , util:: { logger :: Logger , test_utils:: TestLogger } } ;
510
611// Imports that need to be added manually
712use crate :: { utils:: test_logger:: { self } } ;
@@ -21,7 +26,9 @@ fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
2126 }
2227
2328 let secp_ctx = Secp256k1 :: new ( ) ;
24- let logger: Arc < TestLogger > = Arc :: new ( TestLogger :: new ( ) ) ;
29+
30+ let logger: Arc < dyn Logger > =
31+ Arc :: new ( test_logger:: TestLogger :: new ( "" . to_owned ( ) , out) ) ;
2532
2633 let first_hop_htlc_msat_bytes = match get_slice ! ( 8 ) . try_into ( ) {
2734 Ok ( val) => val,
@@ -40,7 +47,7 @@ fn do_test<Out: test_logger::Output>(data: &[u8], out: Out) {
4047
4148 macro_rules! get_pubkey {
4249 ( ) => {
43- match PublicKey :: from_slice( get_slice!( 32 ) ) {
50+ match PublicKey :: from_slice( get_slice!( 33 ) ) {
4451 Ok ( val) => val,
4552 Err ( _) => return ,
4653 }
0 commit comments