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

Move VSS into mutiny-core #669

Merged
merged 2 commits into from Jul 20, 2023
Merged

Move VSS into mutiny-core #669

merged 2 commits into from Jul 20, 2023

Conversation

benthecarman
Copy link
Collaborator

@benthecarman benthecarman commented Jul 16, 2023

Closes #652

To fix the backwards compatibility I had to change the channel monitor encoding (luckily we wanted to get this to hex). This should make it so worst case that if a user with a password never opens to get the the update, they will get a restore with a force close.

We should heavily test this

@benthecarman
Copy link
Collaborator Author

I should write tests

@TonyGiorgio
Copy link
Contributor

TonyGiorgio commented Jul 18, 2023

Didn't work when I restored from a wallet with a password on it.

mutiny_wasm.js:4386 INFO mutiny-core/src/logging.rs:1182023-07-18 15:18:51.722 INFO  [mutiny_core::node:183] initializing a new node: 3c112de4-c75b-45e7-9d4a-9cb855695ccb
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-18 15:18:51.752 DEBUG [mutiny_core::ldkstorage:122] Failed to read channel monitors, trying old encoding
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-18 15:18:51.788 DEBUG [mutiny_core::ldkstorage:145] Read 9 channel monitors from storage
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-18 15:18:51.995 DEBUG [mutiny_core::ldkstorage:189] Reading channel manager from storage
megaStore.tsx:187 Failed to read data from storage.

@benthecarman benthecarman marked this pull request as ready for review July 18, 2023 22:43
@benthecarman
Copy link
Collaborator Author

Tested and was able to do the full flow. There is only one "bad" case now, if you recover without every opening the wallet since this update to get the migration, then you'll get the monitors but not the manager, in this case you'll have a 0 lightning balance which is a little scary but if the channels are force closed you'll get your money back. Maybe along with this we can add a force close channels button in the settings that'll reuse some of our scb stuff to tell the LSP to close the channel.

@TonyGiorgio
Copy link
Contributor

rebased onto master, testing now.

@TonyGiorgio
Copy link
Contributor

I've tested this multiple times now and keep running into storage problems that causes the whole thing to not load.

  1. Be encrypted, have a channel, backup seed words, delete wallet
  2. Run this fork, restore from seed words
  3. Wait for channel to force close and broadcast sweep
  4. Open a new channel
  5. Make a payment
  6. Refresh

Irrecoverable state:

DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:01.836 DEBUG [mutiny_wasm::indexed_db:204] Reading from local storage
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:02.234 DEBUG [mutiny_wasm::indexed_db:204] Reading from local storage
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:02.235 DEBUG [mutiny_wasm::indexed_db:227] Reading from vss
mutiny_wasm.js:4386 INFO mutiny-core/src/logging.rs:1182023-07-19 18:33:02.996 INFO  [mutiny_core::lnurlauth:80] LNURL auth successful!
mutiny_wasm.js:4386 INFO mutiny-core/src/logging.rs:1182023-07-19 18:33:03.329 INFO  [mutiny_core::auth:165] Retrieved new JWT token
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:03.571 DEBUG [mutiny_wasm::indexed_db:251] Found vss key manager_7447a6a6-9460-4f28-84d5-e9ffeeaf64de with version 35
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:03.574 DEBUG [mutiny_wasm::indexed_db:251] Found vss key monitors/195bd537571ad61b7a3f2276d890c5fc1a266f9061b1fb1ab6bd2352a86cf2b4_0 with version 5
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:03.575 DEBUG [mutiny_wasm::indexed_db:251] Found vss key monitors/b101842394e35c148af4dfd529e40e6c3d3cee58f134fe394a4353f21300edd9_0 with version 4294967295
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:03.577 DEBUG [mutiny_wasm::indexed_db:251] Found vss key monitors/b101842394e35c148af4dfd529e40e6c3d3cee58f134fe394a4353f21300edd9_0_7447a6a6-9460-4f28-84d5-e9ffeeaf64de with version 5
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:03.579 DEBUG [mutiny_wasm::indexed_db:251] Found vss key nodes with version 7
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:04.015 DEBUG [mutiny_core::gossip:64] Got network graph, getting scorer...
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:04.017 DEBUG [mutiny_core::gossip:134] Previous gossip sync timestamp: 1689736800
mutiny_wasm.js:4386 INFO mutiny-core/src/logging.rs:1182023-07-19 18:33:04.018 INFO  [mutiny_core::gossip:153] RGS URL: https://rgs.mutinynet.com/snapshot/1689736800
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:04.347 DEBUG [lightning_rapid_gossip_sync::processing:148] Processing RGS update from 1689736800 with 14 nodes, 15 channel announcements and 30 channel updates.
mutiny_wasm.js:4386 INFO mutiny-core/src/logging.rs:1182023-07-19 18:33:04.356 INFO  [mutiny_core::gossip:203] RGS sync result: 1689736800
mutiny_wasm.js:4386 INFO mutiny-core/src/logging.rs:1182023-07-19 18:33:04.691 INFO  [mutiny_core::node:183] initializing a new node: 7447a6a6-9460-4f28-84d5-e9ffeeaf64de
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:04.726 DEBUG [mutiny_core::ldkstorage:122] Failed to read channel monitors, trying old encoding
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:04.732 DEBUG [mutiny_core::ldkstorage:145] Read 1 channel monitors from storage
mutiny_wasm.js:4389 DEBUG mutiny-core/src/logging.rs:1172023-07-19 18:33:04.820 DEBUG [mutiny_core::ldkstorage:189] Reading channel manager from storage
mutiny_wasm.js:4383 ERROR mutiny-core/src/logging.rs:1202023-07-19 18:33:04.988 ERROR [lightning::ln::channelmanager:8238] Missing ChannelMonitor for channel b4f26ca85223bdb61afbb161906f261afcc590d876223f7a1bd61a5737d55b19 needed by ChannelManager.

@benthecarman
Copy link
Collaborator Author

@TonyGiorgio fixed

Copy link
Contributor

@TonyGiorgio TonyGiorgio left a comment

Choose a reason for hiding this comment

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

Tested a lot of different paths and upgrades, works pretty well, nice job!

@benthecarman benthecarman merged commit 1828632 into master Jul 20, 2023
9 checks passed
@benthecarman benthecarman deleted the mv-vss-core branch July 20, 2023 04:25
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.

Move VSS storage implementation into MutinyStorage
2 participants