Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 155 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ rand = { version = "0.10", default-features = false }
simple_logger = { version = "5", default-features = false }
postcard = { version = "1.1", default-features = false, features = ["alloc"] }
bitcoin = "0.32"
musig2 = { version = "0.4", default-features = false, features = ["secp256k1"] }
serde = { version = "1", features = ["derive"] }
thiserror = "2"
serde_json = "1"
2 changes: 2 additions & 0 deletions smite-ir/src/generators/funding_created.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl Generator for FundingCreatedGenerator {
let funding_satoshis = builder.pick_variable(VariableType::Amount, rng);
let feerate_per_kw = builder.pick_variable(VariableType::FeeratePerKw, rng);
let temporary_channel_id = builder.pick_variable(VariableType::ChannelId, rng);
let channel_type = builder.pick_variable(VariableType::Features, rng);

// Create the BOLT 3 funding transaction.
let funding_transaction = builder.append(
Expand All @@ -35,6 +36,7 @@ impl Generator for FundingCreatedGenerator {
acceptor_funding_pubkey,
funding_satoshis,
feerate_per_kw,
channel_type,
],
);

Expand Down
14 changes: 13 additions & 1 deletion smite-ir/src/generators/funding_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ impl Generator for FundingFlowGenerator {
let feerate_per_kw = builder.pick_variable(VariableType::FeeratePerKw, rng);
let to_self_delay = builder.pick_variable(VariableType::U16, rng);
let max_accepted_htlcs = builder.pick_variable(VariableType::U16, rng);
let channel_flags = builder.pick_variable(VariableType::U8, rng);
let shutdown_script_variant = ShutdownScriptVariant::random(rng);
let upfront_shutdown_script =
builder.append(Operation::LoadShutdownScript(shutdown_script_variant), &[]);
Expand All @@ -51,6 +50,16 @@ impl Generator for FundingFlowGenerator {
.expect("ChannelTypeVariant::ALL is non-empty");
let channel_type = builder.append(Operation::LoadChannelType(variant), &[]);

// Taproot channels cannot be announced, so a random `channel_flags`
// would leave the happy path unreachable for a third of the channel
// types. Mutators can still flip the bit afterwards to exercise how
// targets reject a public taproot channel.
let channel_flags = if variant.requires_unannounced_channel() {
builder.append(Operation::LoadU8(0), &[])
} else {
builder.pick_variable(VariableType::U8, rng)
};

// Build and send open_channel.
let open_channel_msg = builder.append(
Operation::BuildOpenChannel,
Expand Down Expand Up @@ -94,6 +103,9 @@ impl Generator for FundingFlowGenerator {
acceptor_funding_pubkey,
funding_satoshis,
feerate_per_kw,
// Must match the type sent in open_channel, or the funding
// output will not be the one the target negotiated.
channel_type,
],
);

Expand Down
Loading