-
Notifications
You must be signed in to change notification settings - Fork 296
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
pcli: add balance migration command #4842
Conversation
f450513
to
18ec03e
Compare
18ec03e
to
385617d
Compare
385617d
to
345d06b
Compare
345d06b
to
ebc9593
Compare
ebc9593
to
8a219f0
Compare
f553930
to
ff6783c
Compare
Conor and I confirmed that this implementation seems to work, but only by doubling the estimated fee. Work on this has revealed some issues:
|
I think we want to avoid having to work around the planner, and should instead have a way to express to the planner the desire to send the maximum amount. |
11148cf
to
a045912
Compare
a045912
to
682490d
Compare
Tested @cronokirby's additions locally, and very satisfied with the results. The source wallet was completely emptied, with no dust notes remaining. The destination wallet received all amounts of all assets, minus the small fee paid to make the transaction. Using the change address was a big missing piece in the first draft of the implementation. Now, the only concerns I have remaining are:
Regarding 1, I realize we commit the sin of asking for FVK as a CLI opt elsewhere, too, but would like to upgrade the experience to minimize account info dangling in insecure contexts. |
Point 1 addressed. |
Absolutely awesome. The stdin reading prompts interactively for the FVK, and supports reading from pipes, so it's still scriptable, but the FVK won't ever show up as a cli arg in terminal history. Tacked on some nice-to-haves like a custom error message for an empty balance (happens if you try to migrate a second time on the same source wallet), and more verbose help docs. Will clean up the submission text and squash-merge to land. |
9f02118
to
492ec64
Compare
Adds a new subcommand to pcli for moving the entirety of a wallet's assets to a new wallet, as defined by an FVK. Stores both FVKs in the memo of the transaction. Leaves zero notes in the source wallet, and the dest wallet gets everything, minus whatever gas price was paid. The full-send functionality is achieved by using the change address of the planner, setting it to the dest FVK's 0 address. This approach avoids the issue of dealing with fees outside the planner. It does this by eschewing trying to figure out how much to output, and instead focusing on what to spend (everything). Then, the change address is set to the desired destination, allowing the planner to automatically move the funds as needed, minus fees. Ensures that the FVK is read from stdin, so that it's never placed on the command line. Co-authored-by: aubrey <[email protected]> Co-authored-by: Lucas Meier <[email protected]> Co-authored-by: Conor Schaefer <[email protected]>
492ec64
to
6ea0c0e
Compare
initial attempt at implementing a balance migration function for pcli - does not currently handle non-zero fees correctly, but that seems to be the only remaining thing to correctly implement
If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: