tdex-network / tdex-daemon

Go implementation of the TDEX Beta Daemon
https://tdex.network
MIT License
11 stars 13 forks source link

Use vault accounts for fragmenter #502

Closed altafan closed 2 years ago

altafan commented 3 years ago

This updates the fragmentation logic in order to deprecate the usage of ephemeral wallets in favour of reserved accounts of Vault domain.

Daemon

For this, the fragmenter portable interface (ports.Fragmenter) and all other relative types/interfaces have been dropped. Basically, the only thing re-used is the fragmentation logic of the original FragmentAmount() method of both fee and market fragmnenter implementations. These methods have been moved to a fragmenter_utils.go file and became internal methods of the app layer.

As already introduced, this makes use of 2 Vault reserved accounts that have been named FeeFragmenter and MarketFragmenter accounts. This has the benefit of not taking the risk of loosing funds during a fragmentation as explained in the related ticket.

Several RPCs have been added for these 2 new accounts to look similar to those defined for the Fee and Market ones:

The same is done for the MarketFragmenter account.

CLI

On the CLI side, the interactive process originally done with tdex fee|market deposit --fragment is deprecated. Instead, 2 new main commands are added:

Both commands have the following subcommands:

Therefore, the process is no-longer interactive. The operator needs to call at least deposit and split to perform the fragmentation of the funds.

BONUS:

Closes #495.

Please @tiero review this.

tiero commented 3 years ago

Just asking, Why we couldn't keep the tdex fee|market deposit --fragment UX instead of adding specific commands? @altafan

altafan commented 2 years ago

Since FeeFragmenter and MarketFragmenter became accounts similar to the Fee and Market ones, I thought they needed similar RPCs for consistency. Like for instance to check the balance or to list of all derivated deposit addresses.

At this point, the CLI would have been enriched with new commands anyways, so I decided to deprecate the interactive process of the fee/market account commands.