Make entropy source configurable, default to mnemonic#197
Conversation
|
👋 Thanks for assigning @benthecarman as a reviewer! |
|
concept ack |
c95f8ab to
e849521
Compare
|
Should be good for review. |
e849521 to
a26361f
Compare
Anyitechs
left a comment
There was a problem hiding this comment.
Thanks!
Just curious, is there a reason the entropy source are only configurable via the toml file and not added to the env var as well?
| let mut f = fs::OpenOptions::new().create_new(true).write(true).mode(0o600).open(path)?; | ||
| writeln!(f, "{}", mnemonic)?; | ||
| f.sync_all()?; | ||
| fs::set_permissions(path, fs::Permissions::from_mode(0o600))?; |
There was a problem hiding this comment.
shouldn't the f.sync_all() be after we set permissions?
a26361f to
bcb430a
Compare
|
Hi @tnull. I think that this change doesn't do the
Part you described. I've did the following to test:
It seems that:
Also, if I may, I'm not sure that the best path is ignoring any key, as it may confuse the user on what key he is actually using. Maybe the best path forward is fail to boot not only if both config options are present, but if the two files are present or something like that |
Well, it used to, but Ben explicitly requested the backwards compatibility logic to be dropped in #197 (comment) as there are currently only ~5 nodes actually deployed for testing purposes and if this is the new default behavior prior to the actual release, we should be able to at some point even drop the legacy keys_seed behavior entirely. |
bcb430a to
367e8d2
Compare
367e8d2 to
ade2e30
Compare
I'm happy to set the legacy keys seed explicitly, and would love to keep this behavior around long-term. |
Mhh, I mean its not much code, but more generally we're not providing compatibility guarantees prior to 0.1 final release, and the 3 of us running on mainnet can be expected to migrate once. Before we cut the release we should also take another good look at the codebase if there is any tech debt already that we want to remove while we're free to break API and backwards compat. (cc @benthecarman). |
I have no problem with required migrations prior to the release. Rather, I do not want to take a dependency on BIP39 to run ldk-server :) |
Okay, would love to learn why that is, but let's take that discussion offline. |
ade2e30 to
36f89b6
Compare
Squashed without further changes. |
|
I think we discussed offline just removing the old file type completely. Do you still want to do that here? |
Previously ldk-server loaded node entropy from a raw 64-byte file at `<storage_dir>/keys_seed`, which is opaque and cannot be imported into standard wallets. Use a BIP39 mnemonic at `<storage_dir>/keys_mnemonic` instead, so operators can back up their node identity as a 24-word phrase and recover on-chain funds with BIP39-compatible tooling. Do not retain raw `keys_seed` loading as a fallback or configurable entropy source. Stale `keys_seed` files are ignored, and removed `[node.entropy]` config and CLI options are rejected, keeping startup behavior unambiguous for new and upgraded nodes. Co-Authored-By: HAL 9000
Update the operator-facing docs to describe `keys_mnemonic` as the node master secret and default entropy file. Remove the legacy `keys_seed` backup guidance so the documentation matches the mnemonic-only startup behavior. This keeps recovery guidance aligned with the entropy source ldk-server actually loads and avoids suggesting that raw seed fallback remains supported. Co-Authored-By: HAL 9000
36f89b6 to
b1ebfe8
Compare
Done, dropped support for |
We switch to, by default, creating and reading a BIP39 mnemonic file rather than raw bytes. We however detect the old behavior and will keep using
keys_seedif it is present.