-
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: broker can encode btc smart contract call #5329
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5329 +/- ##
======================================
- Coverage 71% 71% -0%
======================================
Files 490 492 +2
Lines 85209 85614 +405
Branches 85209 85614 +405
======================================
+ Hits 60659 60917 +258
- Misses 21837 21964 +127
- Partials 2713 2733 +20 ☔ View full report in Codecov by Sentry. |
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.
Some minor comments, looking good.
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.
Looks good (apart from things that Dan already commented on)
Adding the broker fees is a nice idea but we should not just silently ignore them - better to return an error message for now. |
☝️ Will add this and then merge, thanks @j4m1ef0rd |
Actually, I'll also rename the params so that they match |
Any reason you didnt keep this (https://github.com/chainflip-io/chainflip-backend/blob/main/api/bin/chainflip-broker-api/src/main.rs#L61-L65) consistent with the order of https://github.com/chainflip-io/chainflip-backend/blob/main/api/bin/chainflip-broker-api/src/main.rs#L41-L44 ? |
Also, my Rust is rusty, but here you got While here you dont: https://github.com/chainflip-io/chainflip-backend/blob/main/api/bin/chainflip-broker-api/src/main.rs#L164 |
Out of curiosity, how are refunds handled in this way? Since there is no refund address, where do you get it from? |
The refund address is stored in the 3rd output of the bitcoin transaction. Will be explained in the docs.
We would just unwrao_or_default in the next function. Does not really matter at what point it becomes non optional. You're right, we should be consistent.
At first it was because I wanted to put the optional params at the end also some of the params where different, so it could not be exactly the same, but Dan changed it. So now there is no reason they are not consistent 😅. |
Re. consistency: I tried to keep it as consistent as possible. There are some necessary differences between requesting a deposit channel vs. requesting a transaction payload. The specific reason for the change in order in this case is that retry_duration and min_output_amount are non-optional and replace Unifying this would have required changing the original api so I opted not to (for now). My main concern was for naming. In general, however, I would highly recommend using on object rather than an array for passing the parameters, then the order is a non-issue. |
Object it is! thanks |
* origin/main: feat: broker can encode btc smart contract call (#5329) chore: localnet recreate script can use defaults (#5338) feat: witnessing btc smart contract swaps (#5331) feat: Solana CCM fallback (#5316) fix: scale types for pending ceremonies (#5286) chore: Prune historical values in Validator pallet (#5292) feat: expose deposit transaction hash from ingress-egress-tracker (#5320) # Conflicts: # Cargo.lock # engine/src/witness/btc/smart_contract.rs
…waps-close-accounts * origin/main: (44 commits) fix: expire all previous epochs (#5279) feat: add/update contract swaps parameters (#5343) chore: add address to solana logging (#5353) fix: ignore dust underflows in order fills rpc (#5352) chore: consistent naming prewitnessed (#5351) feat: engine-runner verifies gpg signature of old dylib when downloaded (#5339) feat: tainted transaction reporting (#5310) bug: change_utxo not always present (#5340) feat: structured error return types for rpcs (#5346) chore: unify dependencies to root cargo.toml (#5333) feat: Submit a slot number alongside nonce (#5297) chore: use node version from `.nvmrc` 📌 (#5336) chore: add engine account_info logging (#5347) chore: replace manual scale encoding for ts-scale (#5335) chore: more consistent params in Broker API (#5342) feat: broker can encode btc smart contract call (#5329) chore: localnet recreate script can use defaults (#5338) feat: witnessing btc smart contract swaps (#5331) feat: Solana CCM fallback (#5316) fix: scale types for pending ceremonies (#5286) ... # Conflicts: # Cargo.lock # state-chain/chains/src/sol/api.rs # state-chain/pallets/cf-broadcast/src/migrations.rs # state-chain/pallets/cf-environment/Cargo.toml
Pull Request
Closes: PRO-1648
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
broker_encodeBtcSmartContractCall
rpc that will create an encoded btc start contract call with the given params.SwapLimitsProvider
trait to validate the dca and refund params.TODO