Skip to content
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 vault swap bouncer test can open a private channel #5410

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

j4m1ef0rd
Copy link
Contributor

Pull Request

Closes: PRO-1752

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have written sufficient tests.
  • I have written and tested required migrations.
  • I have updated documentation where appropriate.

Summary

  • Added RPC's to the broker to open and close private btc channels.
  • The Btc vault swap now opens a private channel
  • Added the btc vault swap bouncer test to the concurrent tests

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 0% with 33 lines in your changes missing coverage. Please review.

Project coverage is 71%. Comparing base (1ee66a6) to head (303f28f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/lib/src/lib.rs 0% 32 Missing ⚠️
state-chain/runtime/src/lib.rs 0% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##            main   #5410    +/-   ##
======================================
- Coverage     72%     71%    -0%     
======================================
  Files        489     489            
  Lines      86644   86531   -113     
  Branches   86644   86531   -113     
======================================
- Hits       61961   61771   -190     
- Misses     21774   21851    +77     
  Partials    2909    2909            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +487 to +495
if let Some(state_chain_runtime::RuntimeEvent::Swapping(
pallet_cf_swapping::Event::PrivateBrokerChannelOpened { channel_id, .. },
)) = events.iter().find(|event| {
matches!(
event,
state_chain_runtime::RuntimeEvent::Swapping(
pallet_cf_swapping::Event::PrivateBrokerChannelOpened { .. }
)
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use this pattern a lot here, seems like it should be a util

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see a good way to make it a util. Same problem we hit in the LP api.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bouncer/tests/btc_vault_swap.ts Show resolved Hide resolved

async fn open_private_btc_channel(&self) -> Result<ChannelId> {
let (_, events, ..) = self
.submit_signed_extrinsic(RuntimeCall::from(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could use a dry run to avoid submitting the extrinsic if it won't succeed.


// TODO: use chainflip SDK to check if the channel is already open
try {
await jsonRpc('broker_open_private_btc_channel', [], 'http://127.0.0.1:10997');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the jsonRpc util not have a constant (or similar) to avoid having to explicitly pass the api url/port??

Copy link
Contributor Author

@j4m1ef0rd j4m1ef0rd Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't seem worth adding a broker constant when the code will be replaced later by the chainflip SDK.
Could add a brokerRPC function, just like the LP does. Would be useful in the future.

@dandanlen dandanlen changed the title Feat: Btc vault swap bouncer test can open a private channel feat: Btc vault swap bouncer test can open a private channel Nov 12, 2024
@j4m1ef0rd j4m1ef0rd force-pushed the feat/vault-swap-bouncer-test-continued branch from 7533846 to 303f28f Compare November 13, 2024 04:13
@j4m1ef0rd j4m1ef0rd added this pull request to the merge queue Nov 13, 2024
Merged via the queue into main with commit c22b70a Nov 13, 2024
49 checks passed
@j4m1ef0rd j4m1ef0rd deleted the feat/vault-swap-bouncer-test-continued branch November 13, 2024 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants