Repository navigation
smite: add channel_ready oracle - #260
Conversation
| if context | ||
| .negotiated_features | ||
| .supports_feature(Features::OPTION_SCID_ALIAS) | ||
| && context.channel_ready.tlvs.short_channel_id.is_none() |
There was a problem hiding this comment.
Is it the alias feature from init that matters, or the one from channel_type? BOLT 2 seems to say both at different places:
There was a problem hiding this comment.
I think it is init rather than channel_type specifically here (see: lightning/bolts#910 (comment)). I think the reason for separating the two is that the one coupled with channel_type enables required privacy, while the one coupled with init says that if the alias is present (which it must be if option_scid_alias is negotiated in init), the peer can resend multiple channel_ready with a different alias as well (see: lightning/bolts#910 (comment), lightning/bolts#910 (comment)).
12ede2f to
e99f4c9
Compare
|
Some additional checks that could be added:
|
Why not
These seem good to me, though I'd rather add them in follow-ups so this PR doesn't continue to grow. I also wonder if it's worth checking for premature/unexpected |
I was thinking that, on mainnet, 2-block reorgs have already been observed (1 are frequent, while 2 are rare), so it's better to have
Yes, I was thinking of adding these and the other mentioned checks in a follow-up |
| } | ||
|
|
||
| #[test] | ||
| fn execute_recv_channel_ready_rejects_alias_reused_by_another_channel() { |
There was a problem hiding this comment.
Today we could also add a test for one channel's real SCID being reused as another channel's alias.
There was a problem hiding this comment.
Yes, I am aware of it, but that is a gap we currently have, and it is not allowed behaviour. So I don't think we should add tests allowing it. I think we should add only a rejection test in a follow-up PR when we reject those cases
There was a problem hiding this comment.
Actually I think we could write the test today, since we record the real SCID in revealed_scids.
The test we couldn't write yet is for the real SCID being used as the alias for the same channel, though an oracle unit test is probably good enough for that one.
Either way works for me, whether we add the test in this PR or a follow up.
There was a problem hiding this comment.
I added the case where the second channel_ready uses an alias that matches the real_scid of the first channel. I think the inverse case, where the first channel uses an alias that matches the real_scid of the second channel, could be added in a follow-up once we add the corresponding check
morehouse
left a comment
There was a problem hiding this comment.
Ready for squash and rebase.
| } | ||
|
|
||
| #[test] | ||
| fn execute_recv_channel_ready_rejects_alias_reused_by_another_channel() { |
There was a problem hiding this comment.
Actually I think we could write the test today, since we record the real SCID in revealed_scids.
The test we couldn't write yet is for the real SCID being used as the alias for the same channel, though an oracle unit test is probably good enough for that one.
Either way works for me, whether we add the test in this PR or a follow up.
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
ebc13c9 to
42e3871
Compare
Depends-on: #212 and #259
Add
ChannelReadyOracleand consolidate all previously scattered checks relevant to thechannel_readynegotiation into it, including unknownchannel_id, cases where the target omits theshort_channel_id aliasrequired byoption_scid_alias, and cases where the target reuses a per-commitment point from an earlier negotiation.Deferred oracle checks
short_channel_idalias collisions: BOLT 2 requires aliases not to collide with any of the target's realshort_channel_ids. Checking this requires fetching theshort_channel_idfor all channels we have with the target over RPC. Bulk fetching adds RPC overhead that reduces fuzzing throughput, while lazy lookups can still miss collisions. Until this can be checked more efficiently, it is not worthwhile for this narrow surface.