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

RPC server for API Interface #1276

Merged
merged 133 commits into from
May 22, 2024
Merged

RPC server for API Interface #1276

merged 133 commits into from
May 22, 2024

Conversation

yamabiiko
Copy link
Contributor

@yamabiiko yamabiiko commented Jan 11, 2023

Opening this PR so it can start getting reviewed and possibly get some help.
As discussed in #1185, this is quite a substantial rework which adds the possibility of running an RPC server and unifies the RPC methods and CLI commands under an internal API.

To be done before we can get this merged:

  • Tests: fixing and expanding tests in swap/tests/rpc.rs: right now the test runs the RPC server but the functionality cannot be tested as the Bitcoin wallet does not have any balance and the swap database is empty (so right now it's using some placeholder BTC/XMR addresses and swap ids and it will always fail).
  • Tests: write more tests (containers?)
  • Reevaluate the placing of the new files (request.rs, api.rs, rpc.rs) within the project file strucuture
  • Organize commits by squashing some, changing commit messages to be more descriptive to make reviewing this easier
  • Get the entire code reviewed by one other person (@delta1)

If someone could help with writing proper tests (or pointing out at some examples in the code to how swaps and transactions can be simulated/tested) it would be appreciated.

@binarybaron
Copy link
Collaborator

@delta1 @yamabiiko Please give as much feedback and scrutiny as possible. The API is really important and we need to make sure that it's stable enough to be used by a lot of GUIs etc. in the future. I'll also give feedback in the next days and try to be as thorough as possible.

@delta1
Copy link
Collaborator

delta1 commented Jan 13, 2023

Will review when I can in the next few days. @yamabiiko is there a reason for duplicated code instead of importing from other modules?

@yamabiiko
Copy link
Contributor Author

Will review when I can in the next few days. @yamabiiko is there a reason for duplicated code instead of importing from other modules?

Could you point out the specific examples?

@yamabiiko
Copy link
Contributor Author

Seems like the ubuntu-latest runner is full. Maybe this can be helpful

@delta1
Copy link
Collaborator

delta1 commented Feb 12, 2024

Seems like the ubuntu-latest runner is full. Maybe this can be helpful

testing on my fork here: https://github.com/delta1/xmr-btc-swap/actions/runs/7872376768/job/21477456268

@yamabiiko
Copy link
Contributor Author

Seems like all the main concerns have been addressed and tests are passing successfully. Are we waiting for a final review or some other process I can contribute to?

@delta1
Copy link
Collaborator

delta1 commented Feb 21, 2024

Seems like all the main concerns have been addressed and tests are passing successfully. Are we waiting for a final review or some other process I can contribute to?

indeed sorry i am busy with some personal issues but should have a final review/approval next week

@binarybaron do you have a moment to review, and test this?

swap/src/bitcoin/wallet.rs Show resolved Hide resolved
if self.meets_target(target) {
0
} else {
target.into() - self.confirmations()
Copy link
Collaborator

Choose a reason for hiding this comment

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

not to self: this can't be negative because !meets_target implies confirmations < target

swap/src/bitcoin/wallet.rs Outdated Show resolved Hide resolved
swap/src/bitcoin/wallet.rs Outdated Show resolved Hide resolved
monero_receive_address,
swap_id,
} => {
context.swap_lock.acquire_swap_lock(swap_id).await?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

@binarybaron was this addressed?

@binarybaron
Copy link
Collaborator

@binarybaron was this addressed?

Can you expand? Don't know what you mean

@delta1
Copy link
Collaborator

delta1 commented Mar 26, 2024

Copy link
Collaborator

@delta1 delta1 left a comment

Choose a reason for hiding this comment

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

I'm happy for this to go in with @binarybaron's approval.

@yamabiiko
Copy link
Contributor Author

@binarybaron was this addressed?

Yes, the swap lock release logic was addressed by c7f411c and improved in the next few commits

@binarybaron
Copy link
Collaborator

binarybaron commented May 22, 2024

I'll do a few last tests and then this can be merged.

@yamabiiko Can you give me an XMR address to send the Bounty to?

I want to thank you for all your work and I apologize for the long time it took to get this PR merged. This PR really is of immense value. It will dramatically improve the usability of this project. I really mean it.

@delta1
Copy link
Collaborator

delta1 commented May 22, 2024

I'll do a few last tests and then this can be merged.

Sounds good, I just resolved the conflicts.

@delta1
Copy link
Collaborator

delta1 commented May 22, 2024

@binarybaron merging this now, any issues can be fixed in a follow-up.

@yamabiiko congrats! thank you for the contribution 🙏

@delta1 delta1 merged commit 5ff46be into comit-network:master May 22, 2024
26 checks passed
@delta1 delta1 mentioned this pull request May 22, 2024
@binarybaron
Copy link
Collaborator

@binarybaron merging this now, any issues can be fixed in a follow-up.

@yamabiiko congrats! thank you for the contribution 🙏

Thanks for merging :))) we're missing a changelog sadly but its no big deal

@delta1
Copy link
Collaborator

delta1 commented May 23, 2024

yes definitely need a changelog entry.

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.

3 participants