Repository navigation
smite: extend accept_channel oracle with key reuse checks - #259
Conversation
cc96bd6 to
2a6f201
Compare
2a6f201 to
57b44fa
Compare
4b5f3b9 to
6ae5679
Compare
|
It turns out LDK actually reuses
They do this to assist in recovery of funds after data loss. AFAICT, this is a safe legitimate thing to do since the private key for So we probably need to rethink our approach here. I think we should refine the oracle to flag only these two cases:
We could do this with a single map that distinguishes between the above types of pubkeys. Something like: enum KeyOrigin {
Ours { instruction: usize },
TargetBasepoint { channel: ChannelId, field: &'static str },
TargetPcp { channel: ChannelId, field: &'static str, commitment_number: u64 },
}
revealed_pubkeys: HashMap<PublicKey, KeyOrigin>The checks we would implement:
|
7c48851 to
359bf31
Compare
| // We will carry forward two funding flows with different temporary channel | ||
| // IDs and funding amounts and hence different funded channel IDs. | ||
| let first_negotiation = sample_funding_negotiation(); | ||
| let target_pcp = sample_pubkey(1); |
There was a problem hiding this comment.
sample_pubkey(1) is also used in the sample open_channel, which makes this test look like it's going to fail once the channel_ready oracle is added.
| let target_pcp = sample_pubkey(1); | |
| let target_pcp = sample_pubkey(9); |
There was a problem hiding this comment.
I assume this is just to clear up the confusion? since we don't execute any negotiate_channel instructions that would add open_channel keys to revealed
There was a problem hiding this comment.
Yeah the suggested change is just the minimal change that helps slightly with the confusion. An even better change would rewrite the test so that we're not relying on this hidden behavior (i.e. we injected the negotiation without processing the corresponding open_channel).
There was a problem hiding this comment.
BTW I still have some refactorings planned for the executor tests that should make it easier to use the full flow rather than injecting the negotiation as a shortcut. My eventual goal is to avoid injecting any test state into the executor unless absolutely necessary.
There was a problem hiding this comment.
An even better change would rewrite the test so that we're not relying on this hidden behavior (i.e. we injected the negotiation without processing the corresponding
open_channel).
Yeah, I also want to avoid injecting negotiations, but currently sample_funding_negotiation().accept_channel reuses pubkeys whose params are used for the further funding flow recv operations. So we won't be able to reach that state without injecting, otherwise we get an oracle violation. But I think this could be simplified once we have instructions for the full flow
This prepares for an oracle that detects pubkey reuse by the target. Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
79a8e71 to
57f2195
Compare
ref: #209 (comment)
Some more oracles added in this PR:
open_channelchain_hash != regtestchannel_reserve_satoshis >= funding_satoshisdust_limit_satoshis > 10_000satto_self_delay > 2016feerate_per_kw == 0for non 0FC channelsaccept_channeldust_limit_satoshis > 10_000sathtlc_minimum_msat > max_htlc_value_in_flight_msathtlc_minimum_msat > open_channel.funding_satoshisto_self_delay == 0max_accepted_htlcs == 0open_channelandaccept_channelper_commitment_pointshould not be reusedNotes
to_self_delayto 6 inaccept_channelon regtest and 144 on mainnet, so I think we should only check thatto_self_delay != 0feerate_per_kwfloor to 1 on regtest and 253 on mainnet when accepting theopen_channelmessage, so I think we should only check thatfeerate_per_kw != 0