Skip to content

smite-ir: add CreateChannelConfig IR operation#103

Open
NishantBansal2003 wants to merge 1 commit into
morehouse:masterfrom
NishantBansal2003:create-chan-config-ir
Open

smite-ir: add CreateChannelConfig IR operation#103
NishantBansal2003 wants to merge 1 commit into
morehouse:masterfrom
NishantBansal2003:create-chan-config-ir

Conversation

@NishantBansal2003
Copy link
Copy Markdown
Contributor

ref: #90 (comment)
Depends-on: #100

This commit introduces a new compute operation CreateChannelConfig, which takes the static channel and party inputs and constructs a new variable type ChannelConfig. This will later be used as an input while constructing the BuildFundingCreated message.

Some reasons why I went with CreateChannelConfig operation in funding flow:

  • This helps keep inputs cleaner for subsequent operations. For example, BuildFundingCreated can now directly take ChannelConfig instead of many raw inputs.
  • Another reason for not building funding_created directly from raw inputs is signature verification. Once we receive funding_signed, we need the same ChannelConfig to verify the received signature. Reconstructing it again from raw inputs could lead to false positives if the reconstructed config differs from the original. By reusing the previously created ChannelConfig, verification stays consistent and avoids such issues.

Some points worth mentioning are:

  • With this approach, mutations from mutators effectively shift from BuildFundingCreated to CreateChannelConfig. So I think we will still receive the same mutation coverage as before. After construction, ChannelConfig becomes immutable, which helps preserve the exact configuration for later signature verification. Because of that, I do not think there is any real tradeoff from the mutator side.
  • Its usage for subsequent normal channel operations is still an open discussion point, and I plan to open a separate issue to finalize that design.

This commit introduces a new compute operation, `CreateChannelConfig`,
which constructs a `ChannelConfig` variable from static channel and
party inputs. This `ChannelConfig` is then used by `BuildFundingCreated`.

The main motivation for introducing `CreateChannelConfig` is to keep
subsequent operations cleaner and avoid repeatedly passing many raw
inputs. It also ensures that the exact same configuration used to build
`funding_created` is later reused for verifying `funding_signed`, avoiding
inconsistencies or false positives from reconstructing the config again
during verification.

From the mutator perspective, mutation coverage is effectively preserved,
with mutations shifting from `BuildFundingCreated` to `CreateChannelConfig`.
Since `ChannelConfig` becomes immutable after construction, it also guarantees
stable inputs for later signature verification.

Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant