smite: validate negotiated features and channel types in accept_channel oracle - #209
Open
NishantBansal2003 wants to merge 5 commits into
Open
smite: validate negotiated features and channel types in accept_channel oracle#209NishantBansal2003 wants to merge 5 commits into
accept_channel oracle#209NishantBansal2003 wants to merge 5 commits into
Conversation
Contributor
Oh, I like how you added |
Contributor
Author
Yeah, I just added that function to keep things simple, but this could be done via an |
The `accept_channel` oracle needs to verify that `channel_type` uses the smallest possible bitmap and represents a defined channel type. Keeping `ChannelTypeVariant` in `bolt::types` gives the oracle a canonical set of channel types to validate against and avoids duplicating the definition across modules. Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
We strip certain feature bits during setup to exercise only the single funded flow, so the features stored here are what both sides have agreed to continue with, the negotiated feature set, not just the target's advertised features. This prepares for oracle validation that will use negotiated features to validate field constraints. If the target didn't disconnect after our init, that confirms it also conforms to our negotiated features, not its original advertised feature set. Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
This is useful when comparing features in message fields against negotiated features. For eg., comparing channel_type in open_channel and accept_channel to ensure they match the features negotiated during setup. Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
NishantBansal2003
force-pushed
the
accept-chan-feature-oracle
branch
from
September 3, 2026 17:05
33dd398 to
05bce1c
Compare
NishantBansal2003
marked this pull request as ready for review
September 3, 2026 17:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends-on: #192
Depends-on: #186 (added some changes to it, which will be removed once that PR is finalized)
Opening this as a draft since it depends on two PRs. Otherwise, the changes are ready for review.
I tried to add all the definitive checks for
open_channelandaccept_channelmentioned in the BOLT 2, including ones that aren't currently possible, such asoption_dual_fund, since we haven't negotiated it. I think having parity with the BOLTs is good, especially for the future when we extend smite to support more protocolsSome more missing oracles that I will add in follow-up PR are:
open_channelchain_hash != regtestchannel_reserve_satoshis >= funding_satoshisdust_limit_satoshis > 10_000satfeerate_per_kw < 253for non 0FC channelsaccept_channeldust_limit_satoshis > 10_000sathtlc_minimum_msat > max_htlc_value_in_flight_msathtlc_minimum_msat > open_channel.funding_satoshisto_self_delay < 144max_accepted_htlcs == 0open_channelandaccept_channelper_commitment_pointshould not be reusedKnown violations found by this that need to be suppressed are:
option_scid_aliason an announced channel ElementsProject/lightning#9444