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

feat(rpc) Implement WalletSignMessage #4514

Merged
merged 6 commits into from
Jul 15, 2024
Merged

Conversation

lemmih
Copy link
Contributor

@lemmih lemmih commented Jul 11, 2024

Summary of changes

Changes introduced in this pull request:

  • Implement WalletSignMessage - this signs the CID of a message and returns a SignedMessage.

Reference issue to close (if applicable)

Closes #4510

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@lemmih lemmih marked this pull request as ready for review July 11, 2024 13:22
@lemmih lemmih requested a review from a team as a code owner July 11, 2024 13:22
@lemmih lemmih requested review from elmattic and sudo-shashank and removed request for a team July 11, 2024 13:22
let sig = crate::key_management::sign(
*key.key_info.key_type(),
key.key_info.private_key(),
message.cid().unwrap().to_bytes().as_slice(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised that you're ok with panicking in this handler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copy-pasted the signing code, and I didn't have the mental fortitude to fix the root cause. Hashing a message should be infallible but untangling that spaghetti will be rough.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer an expect("<here's why this is impossible>") or a ticket link instead :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

src/rpc/methods/wallet.rs Outdated Show resolved Hide resolved
Copy link
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

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

Do we lack any infrastructure code to add identity tests? I mean, we already have tests for signing blocks, so everything should be in place, no?

@lemmih
Copy link
Contributor Author

lemmih commented Jul 15, 2024

Do we lack any infrastructure code to add identity tests? I mean, we already have tests for signing blocks, so everything should be in place, no?

Nice! Our testing framework is even better than I thought. :)

@lemmih lemmih added this pull request to the merge queue Jul 15, 2024
Merged via the queue into main with commit 7ae9d87 Jul 15, 2024
28 checks passed
@lemmih lemmih deleted the lemmih/wallet-sign-message branch July 15, 2024 10:09
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.

WalletSignMessage
5 participants