Skip to content

Commit 633aff4

Browse files
committed
fuzz: add chanmon holder signer fuzz ops
Allow chanmon consistency fuzz inputs to block holder-side signer operations and later retry monitor-driven claim signing. This gives force-close sequences a way to cover local on-chain claim construction while reusing the harness' existing signer-op blocking machinery.
1 parent 467cd0b commit 633aff4

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

fuzz/src/chanmon_consistency.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,16 @@ impl SignerProvider for KeyProvider {
718718
}
719719
}
720720

721-
// Since this fuzzer is only concerned with live-channel operations, we don't need to worry about
722-
// any signer operations that come after a force close.
723-
const SUPPORTED_SIGNER_OPS: [SignerOp; 4] = [
721+
// These signer operations can be blocked by fuzz bytes. The first four cover
722+
// live-channel and splice signing, while the holder-side operations cover local
723+
// on-chain claim signing after LDK has moved a channel to chain handling.
724+
const SUPPORTED_SIGNER_OPS: [SignerOp; 6] = [
724725
SignerOp::SignCounterpartyCommitment,
725726
SignerOp::GetPerCommitmentPoint,
726727
SignerOp::ReleaseCommitmentSecret,
727728
SignerOp::SignSpliceSharedInput,
729+
SignerOp::SignHolderCommitment,
730+
SignerOp::SignHolderHtlcTransaction,
728731
];
729732

730733
impl KeyProvider {
@@ -1024,6 +1027,15 @@ impl<'a> HarnessNode<'a> {
10241027
self.node.timer_tick_occurred();
10251028
}
10261029

1030+
// Re-enables holder claim signing and asks the chain monitor to retry
1031+
// pending claim transactions. Different on-chain claim paths use
1032+
// SignHolderCommitment or SignHolderHtlcTransaction for force-closed channels.
1033+
fn enable_holder_signer_ops(&self) {
1034+
self.keys_manager.enable_op_for_all_signers(SignerOp::SignHolderCommitment);
1035+
self.keys_manager.enable_op_for_all_signers(SignerOp::SignHolderHtlcTransaction);
1036+
self.monitor.signer_unblocked(None);
1037+
}
1038+
10271039
fn current_feerate_sat_per_kw(&self) -> FeeRate {
10281040
self.fee_estimator.feerate_sat_per_kw()
10291041
}
@@ -2959,9 +2971,14 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
29592971
self.nodes[1].keys_manager.enable_op_for_all_signers(op);
29602972
self.nodes[2].keys_manager.enable_op_for_all_signers(op);
29612973
}
2974+
// Live-channel signer work retries through the manager, while
2975+
// on-chain holder claims retry through the chain monitor.
29622976
self.nodes[0].signer_unblocked(None);
29632977
self.nodes[1].signer_unblocked(None);
29642978
self.nodes[2].signer_unblocked(None);
2979+
self.nodes[0].monitor.signer_unblocked(None);
2980+
self.nodes[1].monitor.signer_unblocked(None);
2981+
self.nodes[2].monitor.signer_unblocked(None);
29652982

29662983
self.process_all_events();
29672984

@@ -3383,6 +3400,12 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
33833400
.enable_op_for_all_signers(SignerOp::SignSpliceSharedInput);
33843401
harness.nodes[2].signer_unblocked(None);
33853402
},
3403+
// The harness toggles signer availability at node granularity, not
3404+
// per channel, so each byte re-enables both holder claim ops and
3405+
// asks that node's monitors to retry.
3406+
0xd3 => harness.nodes[0].enable_holder_signer_ops(),
3407+
0xd4 => harness.nodes[1].enable_holder_signer_ops(),
3408+
0xd5 => harness.nodes[2].enable_holder_signer_ops(),
33863409

33873410
0xf0 => harness.ab_link.complete_monitor_updates_for_node(
33883411
0,

0 commit comments

Comments
 (0)