mycognosist/solar

Deserialization of `replication.toml` fails

Closed this issue · 0 comments

The peers field of ReplicationConfig is defined as HashMap<PublicKey, String>.

Deserialization fails because serde doesn't know how to deserialize bytes into a PublicKey:

thread 'main' panicked at 'could not load configuration: DeserializeToml(Error { inner: ErrorInner { kind: Custom, line: Some(0), col: 0, at: Some(0), message: "invalid type: string \"@QlQwWaj48J1Du5rHQXTPfifUFsPKLrOo6T5EfWfkqXU=.ed25519\", expected PublicKey", key: ["peers"] } })', solar_cli/src/main.rs:253:33

Two options:

  1. Write a custom deserializer (tedious when dealing with a HashMap)
  2. Change the peers field to HashMap<String, String> and then map to HashMap<PublicKey, String> downstream

I'm going for 2.