-
Notifications
You must be signed in to change notification settings - Fork 219
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
fix: grpc inconsistent serialization of keys (see issue #4224) #4491
fix: grpc inconsistent serialization of keys (see issue #4224) #4491
Conversation
fixes: #4224. |
@@ -95,7 +95,7 @@ message SoftwareUpdate { | |||
message GetIdentityRequest { } | |||
|
|||
message GetIdentityResponse { | |||
bytes public_key = 1; | |||
string public_key = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bytes is actually correct here. see the fix below rather
@@ -198,9 +198,9 @@ impl wallet_server::Wallet for WalletGrpcServer { | |||
async fn identify(&self, _: Request<GetIdentityRequest>) -> Result<Response<GetIdentityResponse>, Status> { | |||
let identity = self.wallet.comms.node_identity(); | |||
Ok(Response::new(GetIdentityResponse { | |||
public_key: identity.public_key().to_string().into_bytes(), | |||
public_key: identity.public_key().to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public_key: identity.public_key().to_string(), | |
public_key: Vec::from(identity.public_key().as_bytes()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks ! Why not just identity.public_key().to_vec()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Description
We address inconsistent serialization of keys across base node and wallet grpc servers. The first uses a little endian 32-byte representation of the keys, whereas the second a 64-byte hex representation. We opt to use a hex-representation for the public key on the wallet grpc side.
Motivation and Context
Fixes #4224.
How Has This Been Tested?
Manually.