smite-ir: back channel_announcement with a real funding output - #193
smite-ir: back channel_announcement with a real funding output#193devvaansh wants to merge 2 commits into
channel_announcement with a real funding output#193Conversation
6cf5ef5 to
80aa097
Compare
FundedChannelAnnouncementGenerator
NishantBansal2003
left a comment
There was a problem hiding this comment.
I think we should update the existing channel announcement generator to only create, broadcast, and mine the tx, and then use that SCID only. Otherwise, there isn't much difference between the two, and we can always test all the other cases with the current set of mutators. WDYT?
Also, does it make sense to include a full gossip generator that creates a fully funded channel announcement, followed by a node announcement and then a channel update for it?
i think Keeping both generators preserves cheap bogus-SCID testing without block-mining overhead.
Yes, worth doing - |
|
Concept ACK. I have no strong feelings on whether we keep the existing |
morehouse
left a comment
There was a problem hiding this comment.
After thinking about it more, I think we should merge this generator into ChannelAnnouncementGenerator as @NishantBansal2003 suggested, since it's less code overall. And in general we try to have the generators produce validish flows and then let mutators exercise the invalid flows. The valid flows are harder to produce by mutators alone; the invalid flows are generally easy.
80aa097 to
6525deb
Compare
FundedChannelAnnouncementGeneratorchannel_announcement with a real funding output
Makes sense - merged it into |
6525deb to
a4535dd
Compare
`generated_funding_flow_program_structure` defines an ad-hoc closure to locate an instruction by its operation variant. Hoist it into a macro so other structure tests can reuse it, and so call sites match on a pattern rather than constructing the operation they are looking for.
Create, broadcast, and confirm a 2-of-2 P2WSH funding transaction, then announce the short_channel_id it lands at along with the bitcoin keys its witness script commits to, so the message can pass the on-chain UTXO validation that lightning implementations perform. `funding_satoshis` and `feerate_per_kw` are loaded rather than picked, since a full-range random amount exceeds Bitcoin's maximum supply and fails coin selection, which would end the program before the announcement is ever sent. Only the maximums are bounded; both may still be zero, since `sign_and_broadcast_tx` already mines dust outputs and below-min-relay-feerate transactions directly. `ChannelAnnouncementGenerator` now emits more than one Act instruction, so `instr_reorder_returns_false_on_single_or_no_act` uses `NodeAnnouncementGenerator` instead.
a4535dd to
32fae06
Compare
ChannelAnnouncementGeneratornow creates, broadcasts, and confirms a 2-of-2 P2WSH funding transaction, and announces theshort_channel_idit lands at along with the bitcoin keys its witness script commits to. The messages can then pass the on-chain UTXO validation performed by CLN and LND.#155 resolved the
short_channel_idhalf of this, but nothing ever emitted the operation, and the generator picked its bitcoin keys withgenerate_fresh, unrelated to any funding output. Deriving the funding pubkeys from the announced private keys closes the gap. No new operations are needed, sinceDerivePoint,CreateFundingTransaction,BroadcastTransaction,MineBlocks, andLookupShortChannelIdalready compose.funding_satoshisandfeerate_per_kware emitted directly instead of picked, sincegenerate_fresh(Amount)draws from the full u64 range and exceedsMAX_MONEYessentially always, which fails coin selection and aborts the program before the announcement is sent. Only the maximums are bounded: the funding amount is capped at BOLT 2's non-wumbo limit and the feerate is capped so fees don't exhaust the wallet. Both may still go to zero, sincesign_and_broadcast_txalready falls back to mining dust outputs and below-min-relay-feerate transactions directly.OperationParamMutatorcan widen both afterwards.FundingFlowGeneratorpicks those same two values withpick_variableand has the same full-range exposure, which seems worth a follow-up.Tested with unit tests covering the ordering of the funding sequence, that each announced bitcoin key is the one behind the corresponding funding pubkey, and that the generated amounts stay in range. Not yet fuzzed against the targets; I'll follow up with coverage once I've run a campaign.
Ref: #71