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

Update/v0.15.1 #48

Merged
merged 4 commits into from
Jun 18, 2024
Merged

Update/v0.15.1 #48

merged 4 commits into from
Jun 18, 2024

Conversation

Dominion5254
Copy link
Collaborator

  • Bump LND Dependency max version to <0.19.0
  • Update RTL to v0.15.1

@Dominion5254 Dominion5254 self-assigned this Jun 12, 2024
@remcoros
Copy link

I have been running my own build of this to test RTL 0.15.1 and found one issue in the configurator. It seems the json config file is now case-sensitive.

Due to the serde mapping in the configurator, the "Authentication" and "Settings" property in the json start with a capital letter A and S, which is not expected

I fixed it in the configurator like this (used 'alias' so that the properties are still read, but written out lowercase):

diff --git a/configurator/src/main.rs b/configurator/src/main.rs
index d3fef69..da4638f 100644
--- a/configurator/src/main.rs
+++ b/configurator/src/main.rs
@@ -120,9 +120,9 @@ struct RTLNode {
     index: usize,
     ln_implementation: RTLNodeType,
     ln_node: String,
-    #[serde(rename = "Authentication")]
+    #[serde(alias = "Authentication")]
     authentication: RTLNodeAuthentication,
-    #[serde(rename = "Settings")]
+    #[serde(alias = "Settings")]
     settings: RTLNodeSettings,
 }

@Dominion5254
Copy link
Collaborator Author

Dominion5254 commented Jun 13, 2024

Due to the serde mapping in the configurator, the "Authentication" and "Settings" property in the json start with a capital letter A and S, which is not expected

Can you clarify what you mean by "not expected"? Were you seeing issues with RTL accepting the key-values in RTL-Config.json?

I would expect #[serde(rename_all = "camelCase")] to be overridden by #[serde(rename = "Authentication")] and #[serde(rename = "Settings")], resulting in Keys "Authentication" and "Settings" as you suggested; but that actually doesn't seem to be the case in the RTL-Config.json file built from the 0.15.1 s9pk artifact of this PR:

    {
      "index": 1,
      "lnImplementation": "LND",
      "lnNode": "StartOS LND",
      "authentication": {
        "macaroonPath": "/mnt/lnd"
      },
      "settings": {
        "channelBackupPath": "/root/backup/node-1",
        "fiatConversion": false,
        "lnServerUrl": "https://lnd.embassy:8080",
        "themeColor": "PURPLE",
        "themeMode": "NIGHT",
        "userPersona": "OPERATOR"
      }
    }

I don't quite understand why the settings and authorization attributes are serialized as camelCase, but everything does seem to be working as expected.

@remcoros
Copy link

They should be camelCased, but they are not now. I installed 0.15.0 from the registry, when I upgraded to my custom build with an updated RTL version, it couldn't start because of missing properties "settings" and "authentication", then I found that in my config they were UpperCased.

I think the serde override is not needed, so I changed it to an alias to stay backwards compatible.

If it still works as is, maybe it was a fluke upstream 🤷 😄

@Dominion5254
Copy link
Collaborator Author

I am inclined to leave as-is given that I can't seem to reproduce with this repo.

It looks like your fork isn't public, but if you wanted to open it up and share the repo link I can take a look to see what might be amiss.

Although I suspect the culprit is likely related to build environment.

@remcoros
Copy link

It's exactly the same as this plus those serde mappings. I've been keeping up with the 0.51.1 branch upstream the last few commits.

I'll do a clean test from a 0.15.0 install to this pr on my build env and let you know. might have just been a fluke.

@remcoros
Copy link

tested from a clean install from registry to an upgrade to this pr, seems to work.

What I noticed that on 0.15.0, it saves as "Settings" and "Authentication", but after the upgrade it is "settings", even though that's not how the 'rename' serde attribute works afaik, so I don't know what is/was happing then.

don't fix what ain't broken I suppose, I can't seem to replicate it anymore.

@remcoros
Copy link

remcoros commented Jun 15, 2024

There is still some issue somewhere...

I restarted my server today, I did not update or touch anything else. RTL did not start and has these logs:

2024-06-15T12:57:15+02:00  Error: missing field `Authentication` at line 25 column 5
2024-06-15T12:57:31+02:00  Error: missing field `Authentication` at line 25 column 5
2024-06-15T12:57:47+02:00  Error: missing field `Authentication` at line 25 column 5

Checked the config file, the properties are "camelCased".

I'm not sure what is going on now...

Upstream uses camelCase, see here: https://github.com/Ride-The-Lightning/RTL/blob/master/Sample-RTL-Config.json

But now RTL does not start.


I think the RTL-Config.json file is not actually (over)written:

-rw-r--r-- 1 root root 680 Jun 13 21:49 RTL-Config.json

note that date, that's from a few days ago. Even though I restarted the service today.

@remcoros
Copy link

remcoros commented Jun 15, 2024

I think I figured it out.

The properties need to be "camelCased".

  • At first run (when no config exists), the configurator creates RTL-config.json with UpperCased properties
  • RTL starts up, it can read the UpperCased properties, but overwrites!! the existing config with camelCased properties
  • When the service restarts, the configurator crashes with Error: missing field 'Authentication' at line 25 column 5, because "Settings" and "Authentication" do not exist anymore.

All the properties need to be camelCased, so the serde attributes need to be either removed, or use "alias" to stay backwards-compatible, so the properties can be read as UpperCase, but are always written as camelCase.

@Dominion5254
Copy link
Collaborator Author

I was able to reproduce the error Error: missing field 'Authentication' at line 25 column 5 on service restart as well.

It seems the issue is arising with the deserialization of the RTL-Config.json into the RTLNode struct. Replacing serde rename with alias as you suggested resolves the deserialization error. Thanks for testing and debugging.

@Dominion5254 Dominion5254 merged commit 4faab14 into master Jun 18, 2024
1 check passed
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.

3 participants