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

Taker protocol refactoring #9

Merged
merged 7 commits into from
Jul 23, 2023
Merged

Conversation

rajarshimaitra
Copy link

@rajarshimaitra rajarshimaitra commented Jul 1, 2023

This is an ongoing work of simplifying the taker-protocol.rs module.

The Objective is to clearly define critical and non-ceritical portions of the Taker states.

Approach:

  • first simplify the existing function definition. Create common containers to hold related data.
  • Use a dedicated Taker strcut (concept in taker.rs). Handle all function calls via mutable and immutable references to this struct.

Work done so far:

  • Use the existing FundingTxInfo to pass around data which fits in this message. This partially simplifies exchange_signatures_and_find_next_maker and other downstream functions.

Next Work:

  • create a dedicated NextPeerInfo to containerise next peer info related data.
  • create a CurrentSwapCoin info to hold all the active swap coins. Use that to pass around required data in protocol functions.
  • use the new Taker struct to perform coinswap protocol.

Create a FundingTXInfo struct inside the protocol run and use that
pass around required data. Partially simplifies `exchange_signatures_and_find_next_maker`
and other downstream functions.
Create a dedicated NextSwapInfo to pass around next swap info related data.

Few reference passing are fixed. Its much simpler to clone around data at
this stage than worry about lifetimes of references.

Comment section for next phase of work.
@rajarshimaitra rajarshimaitra marked this pull request as draft July 5, 2023 16:51
Useful to distinguish between std::error::Error.
Create a dedicated Taker struct, which includes a OngoingSwapState. This
state is used to perform all the swap protocol specific operations. These
states are specific to a single swap and are ephemeral. Before the finalization
of the swap the state is cashed into wallet file.

Various other utility structures are added.

Taker configuration structure added which defaults to the hard code variables.
@rajarshimaitra rajarshimaitra marked this pull request as ready for review July 11, 2023 16:02
@rajarshimaitra
Copy link
Author

This completes the basic refactoring of the Taker protocol. The swap state is separated out and updated sequentially as the swap progresses. Configuration and swap parameters are separated out.

Few more documentation addition ad this will be good to go.

 - Move around few more functions from and to util.rs.
 - More explainer and todo docs.
 - Fixing cargo clippy for taker_protocol.rs.
@rajarshimaitra rajarshimaitra changed the title [draft] Taker protocol refactoring Taker protocol refactoring Jul 12, 2023
@v1shwakarma
Copy link

Thanks @rajarshimaitra !

Will test and review this by eod.

@rajarshimaitra rajarshimaitra self-assigned this Jul 20, 2023
@rajarshimaitra rajarshimaitra merged commit 80ce0f7 into master Jul 23, 2023
@rajarshimaitra rajarshimaitra deleted the taker-protocol-refactoring branch February 22, 2024 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants