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

Feat/taro-update-backend #669

Merged
merged 36 commits into from
Feb 25, 2023

Conversation

amovfx
Copy link
Contributor

@amovfx amovfx commented Feb 11, 2023

Create a draft of this for you to inspect workflow. I'm still working on tests and coverage. Also, compatibility filtering isn't working. I will figure that out.

Description

Modal for changeing the backend of taro nodes.

Steps to Test

  1. Create 2 LND nodes and 1 Taro Node
  2. Click the link between the taro node and lnd node
  3. Click 'Change Backend' on info panel.
  4. Change the lnd node selection.
  5. Click 'Change Backend' button.

if (compatibility) {
const requiredVersion = compatibility[lndBackend.version];
//version compatibility function breaks down
if (!requiredVersion) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had a lot of trouble hitting this if statement, I couldn't figure out how what test you were running where your coverage would clear.

Copy link
Contributor Author

@amovfx amovfx left a comment

Choose a reason for hiding this comment

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

This has been rebased to the latest add-taro.

100% Coverage and linting checked.

What is the process to remove the conflicts with the main branch? Is that something that I do, or would you do?
Also, should I rename any variable named lndName to something like LNDname? I think I remember a note that said something along those lines?

@amovfx amovfx marked this pull request as ready for review February 12, 2023 21:33
@jamaljsr
Copy link
Owner

This needs a rebase on master since #656 and #667 were merged. One tip to make rebases a little easier is to do an interactive rebase then drop all of the commits that are already in the base branch.

git rebase -i feat/add-taro

I did a pass on this to test the UX. I noticed some things to improve:

  1. You should be able to drag from the bottom port of a taro node to the top port of an LND node to open the change backend modal.
  2. You shouldn't be able to change the backend if the taro node has assets. Those assets are embedded in UTXOs in the wallet of the LND node it is currently connected to. If you change the backend, then the taro node will no longer have access to the UTXOs in the LND wallet so those assets are essentially burned. The challenge is going to be how to tell if the taro node has assets if changing the backend when the network is stopped. There may be some data on disk that you can check. I'm not sure. This would require a bunch of testing scenarios and/or asking questions in the LND slack #taro channel about what users should & shouldn't do when changing nodes.

Copy link
Contributor Author

@amovfx amovfx left a comment

Choose a reason for hiding this comment

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

I think this might be the last feature on the addTaro check list.

Coverage, testing and linting 100%.

@amovfx
Copy link
Contributor Author

amovfx commented Feb 15, 2023

I added the drag link feature.

You shouldn't be able to change the backend if the taro node has assets. Those assets are embedded in UTXOs in the wallet of the LND node it is currently connected to. If you change the backend, then the taro node will no longer have access to the UTXOs in the LND wallet so those assets are essentially burned. The challenge is going to be how to tell if the taro node has assets if changing the backend when the network is stopped. There may be some data on disk that you can check. I'm not sure. This would require a bunch of testing scenarios and/or asking questions in the LND slack #taro channel about what users should & shouldn't do when changing nodes.

Thanks for clarifying this behavior. I'll look into a solution. Sounds like a good challenge.

Andrew Oseen added 24 commits February 15, 2023 09:23
Proper casing on the usePrefixedTranslation
Added updateTaroBackendNode and updateTaroBackendLink
Added tarp send asset functionality.
Rebase onto latest add-taro
When dragging from LND network node to a Taro node or vice versa,
the Change Taro Backend Modal will appear.
@amovfx amovfx force-pushed the feat/taro-update-backend branch from 32f8991 to 387e943 Compare February 15, 2023 17:36
Andrew Oseen added 5 commits February 15, 2023 12:11
If a node as assets, disable the change taro backend button.
Taro change backend button is only enabled when the network is started and has no assets.
Changing taro backend is only available before the network starts and while a admin.macaron exists.
If the macaron exists, and error pops up.
Cleaning up cruft
@amovfx
Copy link
Contributor Author

amovfx commented Feb 18, 2023

K this is ready for review.

Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

Did another pass of the UX and found some issues. Can you resolve these before I dive into code review?

  • With carol-taro connected to carol, drag a new link between the two and click Change Backend. It will display an already connected error, which is correct. But now if you click on the link, the sidebar says invalid selection. You will also see a link remains if you drag from alice-taro to bob then hit Cancel in the modal. You have to remove the temporary link that gets added when dragging.
  • I am allowed to change the backend of a started network by dragging a link between the nodes. It should display an error
  • With the network started, the Change Taro backend modal displays a message stating the node will be restarted automatically. This msg should be removed since we won't allow changing after initial startup. Also remove the code that restarts the node
  • I'm getting failing tests in LinkDetails.spec.tsx due to this error
    /Users/jamal/dev/polar/src/utils/config.ts:208
      join)(network.path, 'volumes',
                    ^
    
    TypeError: Cannot read properties of undefined (reading 'path')
    
    Note: to make your life easier, it would be fine to ignore the unit tests for now. When the UX/code are approved and final, then you can write all of the test. I usually implement the full feature first, then write tests at the end, so I don't have to repeated rewrite the tests over and over again while iterating on the code.

@amovfx
Copy link
Contributor Author

amovfx commented Feb 18, 2023

Thanks for the feedback and guidance, I'll get on this. If you are happy with this, Ill move on to cleaning up the tests.

Links are removed when modal is hidden.
Restarting is removed.
Change Taro Backend button errors after the network has been started.
@amovfx
Copy link
Contributor Author

amovfx commented Feb 18, 2023

I hit these notes, thanks for running through this, this has been a challenging task.

Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

Functionality looks good now.

Did a first pass of code review.

@amovfx
Copy link
Contributor Author

amovfx commented Feb 19, 2023

This should be good for review.

Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

Apologies for taking a while to review this. I missed your comment about it being ready. I just happened to check today because I was wondering about the status of this PR. In the future, it would be helpful if you can click on the re-request review icon on the PR. I typically check my review queue on a daily basis and it will stay on my list until I review it.

Thanks for the updates. After another pass on the code, there's just a few minor tweaks I'd suggest. Also there were some comments from my prior review that were not addressed. They are the ones not marked as unresolved.

Comment on lines 43 to 45
const taroNode = network.nodes.taro.find(n => n.name === taroName) as TarodNode;
const result = await exists(taroNode.paths.adminMacaroon);
setHasMacaroon(result);
Copy link
Owner

Choose a reason for hiding this comment

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

You can run this code in the handleChangeClick callback instead of adding a state var.

Tests, lint and coverage 100%
@amovfx amovfx requested a review from jamaljsr February 23, 2023 21:08
@amovfx
Copy link
Contributor Author

amovfx commented Feb 23, 2023

Thanks for pointing me to to the re-request review button. I'll be sure to use that in the future.
A couple messages aren't coming through.
In regard to the ChangeTaroBackendButton.btnText and .error. I am using them in the component.

Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. I just reiterated a couple comments on the en-US.json file. Then this should be good to go.

@amovfx
Copy link
Contributor Author

amovfx commented Feb 24, 2023

Good to go.

@amovfx amovfx requested a review from jamaljsr February 24, 2023 21:50
Copy link
Owner

@jamaljsr jamaljsr left a comment

Choose a reason for hiding this comment

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

Perfect 👌

Thanks for iterating on this. Going to squash merge this because there are a lot of commits and the diff is not that big.

@jamaljsr jamaljsr merged commit e030170 into jamaljsr:feat/add-taro Feb 25, 2023
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.

2 participants