-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: BTC contract swap encoding #5311
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5311 +/- ##
======================================
- Coverage 71% 71% -0%
======================================
Files 488 490 +2
Lines 84898 85016 +118
Branches 84898 85016 +118
======================================
+ Hits 60375 60405 +30
- Misses 21822 21897 +75
- Partials 2701 2714 +13 ☔ View full report in Codecov by Sentry. |
Yes exactly, that looks good to me. |
The only thing left to "match" the contract swaps is the CCM parameters ( |
3e1967e
to
7cc4533
Compare
// We only store (spendable) BitcoinScripts that we authored ourselves. | ||
// For these, the max encoded length is MAX_BITCOIN_SCRIPT_LENGTH. | ||
// For anything else, we don't need MaxEncodedLen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that PushBytes allows MAX_PUSHABLE_BYTES, but we were storing it in a bounded vec of size MAX_BITCOIN_SCRIPT_LENGTH.
The only reason we defined this was to derive MaxEncodedLen, so I moved the definition of this here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - I added one small change (see comment). Will let you double-check my commit and then push the button if you're happy.
…lana-ccm * origin/main: ci: upgrade action version to supress deprecation warnings ⚙️ (#5330) feat: handle rotation tx construction failures (#5307) test(bouncer): add test for new utility (#5324) fix: keyholder check should use `HistoricalActiveEpochs` (#5325) feat: BTC contract swap encoding (#5311)
Pull Request
Closes: PRO-1673
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
UtxoEncodedData
which effectively determines how swap parameters are layed out/encoded. For encoding/decoding we use Scale to keep things smiple. It still results in a reasonably compact encoding: thecheck_utxo_encoding
test demonstrates which bytes are used for what (and that we don't exceed the limit of 80 bytes). I chose not to use "insta" in this case to make things a bit more explicit.SharedCfParameters
defines a subset ofUtxoEncodedData
's fields which we expect to use in other smart contracts (this is what you intended @albert-llimos?)