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

fix: grpc inconsistent serialization of keys (see issue #4224) #4491

Conversation

jorgeantonio21
Copy link
Contributor

@jorgeantonio21 jorgeantonio21 commented Aug 17, 2022

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.

@jorgeantonio21
Copy link
Contributor Author

jorgeantonio21 commented Aug 17, 2022

fixes: #4224.

@jorgeantonio21 jorgeantonio21 marked this pull request as ready for review August 19, 2022 14:57
@@ -95,7 +95,7 @@ message SoftwareUpdate {
message GetIdentityRequest { }

message GetIdentityResponse {
bytes public_key = 1;
string public_key = 1;
Copy link
Collaborator

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(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
public_key: identity.public_key().to_string(),
public_key: Vec::from(identity.public_key().as_bytes())

Copy link
Contributor Author

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() ?

Copy link
Collaborator

@stringhandler stringhandler left a comment

Choose a reason for hiding this comment

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

Nice!

@stringhandler stringhandler merged commit bdb262c into tari-project:development Aug 22, 2022
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.

Inconsistent serialisation of keys in gRPC
2 participants