-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove
pkg/coordinator
package (#3659)
Here we remove the `pkg/coordinator` by moving their contents to `pkg/maintainer/wallet`. This package seems to be no longer needed so this operation makes the package structure and dependency graph simpler. This refactoring was done in several steps: ### Step 1: Make the nomenclature in `pkg/maintainer/wallet` more precise The tBTC v2 system defines two types of sweeps: deposit sweeps and moved funds sweeps. In the first step, we narrowed the existing nomenclature used within the wallet maintainer to remove ambiguity and make it clear that the existing code refers to deposit sweeps. ### Step 2: Move the deposit sweep code from `pkg/coordinator` to `pkg/maintainer/wallet` package In the second step, we moved the deposit sweep code living so far in the `pkg/coordinator`. By the way, some simplifications were made in order to make the public API cleaner and more readable. After this change, the `pkg/maintainer/wallet` package exposes the following public API: - `FindDeposits` that allows to find deposits according to the given criteria - `FindDepositsToSweep` that finds a batch of deposits that are most suitable to become part of a deposit sweep - `ProposeDepositsSweep` which submits a deposit sweep proposal to the `WalletCoordinator` contract - `EstimateDepositsSweepFee` that estimates the deposit sweep transaction fee - `DepositReference` which is a set of data allowing to identify and refer to a deposit - `Deposit` that holds some detailed data about a deposit - `ParseDepositsReferences` that allows creating an array of `DepositReference` based on the provided input string - `ValidateDepositReferenceString` that allows to validate whether the given string can be used to create a valid `DepositReference` instance This step also involved moving unit tests stressing the deposit sweep code described above. ### Step 3: Move the redemption code from `pkg/coordinator` to `pkg/maintainer/wallet` package In this step, we moved the redemption code from `pkg/coordinator` to the `pkg/maintainer/wallet` package. This was similar to the previous step but much simpler. After this step, the public API of the `pkg/maintainer/wallet` package was extended with the following items: - `FindPendingRedemptions` which allows to find pending redemption requests - `ProposeRedemption` which submits a redemption proposal to the `WalletCoordinator` contract - `EstimateRedemptionFee` that estimates the redemption transaction fee This step also involved moving unit tests stressing the redemption code described above. ### Step 4: Move the `coordinator.Chain` interface In the fourth step, we moved the `coordinator.Chain` interface by merging it with the `maintainer/wallet.Chain` interface. This change clarifies the chain expectations defined by the `pkg/maintainer/wallet` package. We also moved the remaining chain types living so far in the `pkg/coordinator` (`coordinator. NewWalletRegisteredEvent` and `coordinator. NewWalletRegisteredEventFilter`) to the `pkg/tbtc` package. This package should be the right place for them according to the recent discussion (see #3650 (comment)), at least until #3652 is done. ### Step 5: Remove `pkg/coordinator` package In the last step, we removed the `pkg/coordinator` package and made sure all references from the `cmd` package were correctly replaced.
- Loading branch information
Showing
36 changed files
with
1,498 additions
and
1,625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.