Skip to content

fix: correct disjoint union contract execution - #203

Open
bennyhodl wants to merge 1 commit into
masterfrom
fix/disjoint-union-execution
Open

bennyhodl wants to merge 1 commit into
masterfrom
fix/disjoint-union-execution

Conversation

@bennyhodl

Copy link
Copy Markdown
Owner

Summary

Later branches of a disjoint-union contract could use CETs or adaptor signatures from an earlier branch. This change lets each event settle the contract when its own oracle threshold is met.

Changes

  • Use each branch's CET range for signing and verification. Apply the correct CET and adaptor-signature offsets during manager settlement.
  • Preserve the offer's CET locktime on later branches.
  • Check later events when independent enum events share an outcome label. Preserve oracle indexes during maturity checks and sort attestations by announcement index.
  • Continue to later branches when oracle responses do not give a usable outcome.
  • Add a baseball contract with separate 2-of-3 oracle groups for two hits, numerical at-bats, and a team win. Test each branch from both parties through the stateless and manager APIs.

The locktime correction changes CET reconstruction for older multi-event messages. Those messages need legacy handling. Channel settlement and metadata that exposes only the first event remain separate work. The details are in docs/disjoint-union.md.

Testing

Validation completed during implementation:

  • All 33 stateless tests and 56 manager unit tests passed.
  • All 20 baseball regtest cases passed. The six automatic cases also passed with NB_CONFIRMATIONS=6.
  • The existing mixed enum/numerical regtest with oracle disagreement support passed.
  • The manager build without default features passed. Targeted Clippy checks with --no-deps and -D warnings passed.
  • Changed Rust files passed rustfmt. The branch diff passes git diff --check.

Clippy with dependency checks reports an existing explicit_counter_loop warning in kormir/src/storage.rs on Rust 1.98.

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