Skip to content

Commit 12c541c

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 e575804 commit 12c541c

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
@@ -880,13 +880,16 @@ impl SignerProvider for KeyProvider {
880880
}
881881
}
882882

883-
// Since this fuzzer is only concerned with live-channel operations, we don't need to worry about
884-
// any signer operations that come after a force close.
885-
const SUPPORTED_SIGNER_OPS: [SignerOp; 4] = [
883+
// These signer operations can be blocked by fuzz bytes. The first four cover
884+
// live-channel and splice signing, while the holder-side operations cover local
885+
// on-chain claim signing after LDK has moved a channel to chain handling.
886+
const SUPPORTED_SIGNER_OPS: [SignerOp; 6] = [
886887
SignerOp::SignCounterpartyCommitment,
887888
SignerOp::GetPerCommitmentPoint,
888889
SignerOp::ReleaseCommitmentSecret,
889890
SignerOp::SignSpliceSharedInput,
891+
SignerOp::SignHolderCommitment,
892+
SignerOp::SignHolderHtlcTransaction,
890893
];
891894

892895
impl KeyProvider {
@@ -1242,6 +1245,15 @@ impl<'a> HarnessNode<'a> {
12421245
self.node.timer_tick_occurred();
12431246
}
12441247

1248+
// Re-enables holder claim signing and asks the chain monitor to retry
1249+
// pending claim transactions. Different on-chain claim paths use
1250+
// SignHolderCommitment or SignHolderHtlcTransaction for force-closed channels.
1251+
fn enable_holder_signer_ops(&self) {
1252+
self.keys_manager.enable_op_for_all_signers(SignerOp::SignHolderCommitment);
1253+
self.keys_manager.enable_op_for_all_signers(SignerOp::SignHolderHtlcTransaction);
1254+
self.monitor.signer_unblocked(None);
1255+
}
1256+
12451257
fn current_feerate_sat_per_kw(&self) -> FeeRate {
12461258
self.fee_estimator.feerate_sat_per_kw()
12471259
}
@@ -3273,9 +3285,14 @@ impl<'a, Out: Output + MaybeSend + MaybeSync> Harness<'a, Out> {
32733285
self.nodes[1].keys_manager.enable_op_for_all_signers(op);
32743286
self.nodes[2].keys_manager.enable_op_for_all_signers(op);
32753287
}
3288+
// Live-channel signer work retries through the manager, while
3289+
// on-chain holder claims retry through the chain monitor.
32763290
self.nodes[0].signer_unblocked(None);
32773291
self.nodes[1].signer_unblocked(None);
32783292
self.nodes[2].signer_unblocked(None);
3293+
self.nodes[0].monitor.signer_unblocked(None);
3294+
self.nodes[1].monitor.signer_unblocked(None);
3295+
self.nodes[2].monitor.signer_unblocked(None);
32793296

32803297
self.process_all_events();
32813298

@@ -3799,6 +3816,12 @@ pub fn do_test<Out: Output + MaybeSend + MaybeSync>(data: &[u8], out: Out) {
37993816
.enable_op_for_all_signers(SignerOp::SignSpliceSharedInput);
38003817
harness.nodes[2].signer_unblocked(None);
38013818
},
3819+
// The harness toggles signer availability at node granularity, not
3820+
// per channel, so each byte re-enables both holder claim ops and
3821+
// asks that node's monitors to retry.
3822+
0xd3 => harness.nodes[0].enable_holder_signer_ops(),
3823+
0xd4 => harness.nodes[1].enable_holder_signer_ops(),
3824+
0xd5 => harness.nodes[2].enable_holder_signer_ops(),
38023825
0xd6 => harness.relay_broadcasts_for_node(0),
38033826
0xd7 => harness.relay_broadcasts_for_node(1),
38043827
0xd8 => harness.relay_broadcasts_for_node(2),

0 commit comments

Comments
 (0)