-
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: update custom_rpc, runtime_api and broker api for broker level screening #5341
feat: update custom_rpc, runtime_api and broker api for broker level screening #5341
Conversation
af966d1
to
a3835f1
Compare
To be discussed: error handling in the subscription forwarding in the broker api ( |
3166701
to
e1a6006
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5341 +/- ##
======================================
- Coverage 72% 71% -0%
======================================
Files 495 496 +1
Lines 86276 86491 +215
Branches 86276 86491 +215
======================================
- Hits 61713 61661 -52
- Misses 21784 22001 +217
- Partials 2779 2829 +50 ☔ 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.
Looking good - I have one larger (and very annoying) suggestion and some minor ones...
sp-rpc = { workspace = true } | ||
sc-rpc = { workspace = true, default-features = true } |
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.
Duplicate 👀
FWIW I think sp-core should also have default-features=true
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.
Unfortunately one is sP-
and the other sC-
... The latter was required for the sc_rpc::utils::pipe_from_stream()
utility.
I am not sure about the default-features though, I copied it from the custom_rpc
lib. In fact it compiles if I remove the default-features=true
for sc-rpc
.
Should I enable default-features for all three of them anyways?
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.
Yes we should enable it for all three - it might not be a problem now, but this kind of thing tends to cause problems unexpectedly.
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 final comments then we're good.
state-chain/runtime/src/lib.rs
Outdated
.filter(|channel_details| match channel_details.action { | ||
ChannelAction::Swap {..} => true, | ||
ChannelAction::CcmTransfer {..} => true, | ||
ChannelAction::LiquidityProvision {..} => false, |
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'm not sure there's a need for this filter - why ignore LiquidityProvision ?
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.
Talked with Martin: Currently we only implement the rejection of transactions which originate from swaps. The liquidity provision transactions would have to be monitored by members of the "whitelist" which are authorized to do so. We don't have the whitelist currently, so nobody monitors these transactions.
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.
Yes but this rpc is called cf_get_open_deposit_channels
so it should probably return all of the open deposit channels for the given id.
If a broker submits this request via the broker api it will implicitly filter out an LP channels anyway. And later on when we want to be able to monitor all channels, we won't get any surprises in the behaviour of this rpc.
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.
Agree, sounds 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.
Done, now don't distinguish between channelactions.
6620ee8
to
b7441df
Compare
d5ae794
to
b191d52
Compare
2e5dae0
to
85a2689
Compare
☝️ disagree? Apart from this I think we're good to go. |
commit 3166701 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 15:27:51 2024 +0100 Add `subscribe_tainted_btc_transaction_events` method to Broker API. It which forwards the node subscription of the same name. commit 010772d Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 13:56:07 2024 +0100 Add `open_btc_deposit_channels` method to broker api. commit 9ea7e6f Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 11:19:07 2024 +0100 Add subscription endpoint for tainted transaction events. commit e81028a Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 15:12:47 2024 +0100 Implement `open_btc_deposit_channels`. commit 439ddd1 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 14:51:22 2024 +0100 Add boilerplate for `open_btc_deposit_channels`. commit a3835f1 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 10:25:51 2024 +0100 Add endpoint for marking btc tx as tainted.
We do not filter out `LiquidityProvision` channels anymore.
… from the node. This is now the same as in the LP API binary. The previous version didn't use finalized blocks and thus might not have been stable. Theoretically it would be nice to be able to forward the subscription from the node, see PRO-1768.
50a1b15
to
636ddc8
Compare
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 to me 👍 would await Dan's review
…screening (#5341) * Squashed commit of the following: commit 3166701 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 15:27:51 2024 +0100 Add `subscribe_tainted_btc_transaction_events` method to Broker API. It which forwards the node subscription of the same name. commit 010772d Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 13:56:07 2024 +0100 Add `open_btc_deposit_channels` method to broker api. commit 9ea7e6f Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 11:19:07 2024 +0100 Add subscription endpoint for tainted transaction events. commit e81028a Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 15:12:47 2024 +0100 Implement `open_btc_deposit_channels`. commit 439ddd1 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 14:51:22 2024 +0100 Add boilerplate for `open_btc_deposit_channels`. commit a3835f1 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 10:25:51 2024 +0100 Add endpoint for marking btc tx as tainted. * Apply suggestions from review. * Return all channels for *all* channel actions. We do not filter out `LiquidityProvision` channels anymore. * Create tainted event subscription in broker API instead of forwarding from the node. This is now the same as in the LP API binary. The previous version didn't use finalized blocks and thus might not have been stable. Theoretically it would be nice to be able to forward the subscription from the node, see PRO-1768. * Apply clippy suggestion. * Remove now unused `tainted_transaction_events` subscription. * Apply suggestions from @kylezs's review.
…screening (#5341) * Squashed commit of the following: commit 3166701 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 15:27:51 2024 +0100 Add `subscribe_tainted_btc_transaction_events` method to Broker API. It which forwards the node subscription of the same name. commit 010772d Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 13:56:07 2024 +0100 Add `open_btc_deposit_channels` method to broker api. commit 9ea7e6f Author: Maxim Urschumzew <maxu@chainflip.io> Date: Tue Oct 29 11:19:07 2024 +0100 Add subscription endpoint for tainted transaction events. commit e81028a Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 15:12:47 2024 +0100 Implement `open_btc_deposit_channels`. commit 439ddd1 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 14:51:22 2024 +0100 Add boilerplate for `open_btc_deposit_channels`. commit a3835f1 Author: Maxim Urschumzew <maxu@chainflip.io> Date: Mon Oct 28 10:25:51 2024 +0100 Add endpoint for marking btc tx as tainted. * Apply suggestions from review. * Return all channels for *all* channel actions. We do not filter out `LiquidityProvision` channels anymore. * Create tainted event subscription in broker API instead of forwarding from the node. This is now the same as in the LP API binary. The previous version didn't use finalized blocks and thus might not have been stable. Theoretically it would be nice to be able to forward the subscription from the node, see PRO-1768. * Apply clippy suggestion. * Remove now unused `tainted_transaction_events` subscription. * Apply suggestions from @kylezs's review.
* origin/main: feat: add version and affiliates to UTXO encoding (#5385) chore: bump all versions to 1.8.0 and remove old migrations. (#5327) feat: update custom_rpc, runtime_api and broker api for broker level screening (#5341) tests: Bouncer test for broker level screening (#5377) Feat: Private Broker Channel Witnessing (#5383) # Conflicts: # state-chain/runtime/src/lib.rs
Pull Request
Closes: PRO-1706
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
In this PR all changes to the broker API which are required for broker level screening are going to be merged. Currently based on @Janislav 's PR
(#5310)(#5332) which implements the extrinsic for rejecting transactions.Once that PR is merged, rebase this on main.
This PR includes the following changes:
custom_rpc
:cf_get_tainted_transaction_events
which gets all events (for a given block) related with tainted transactions occuring in the ingress egress pallet.cf_get_open_deposit_channels
which returns all open channel addresses for a given account id.mark_transaction_as_tainted
endpoint which submits the corresponding extrinsic.get_open_deposit_channels
method.subscribe_tainted_btc_transaction_events
method which creates a subscription for calling thecf_get_tainted_transaction_events
custom rpc method.Non-Breaking changes
If this PR includes non-breaking changes, select the
non-breaking
label. On merge, CI will automatically cherry-pick the commit to a PR against the release branch.