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

Problem: Solana wallet couln't be used to control the VM #700

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

olethanh
Copy link
Collaborator

@olethanh olethanh commented Sep 18, 2024

Add Solana authentication method for the VM operator endpoint.

First version on how to implement this. It is the same method as with Ethereum using an ephemeral key, but that key is signed with Solana private key instead of Ethereum.

On the SignedPubKeyPayload a chain argument that can be either ETH or SOL so we know which chain signing method to validate against. It default to ETH as to remain backward compatible with current client implementations.

Also added a docstring on the require_jwk_authentication decorator.

Related Jira tickets : ALEPH-50

Self proofreading checklist

  • The new code clear, easy to read and well commented.
  • New code does not duplicate the functions of builtin or popular libraries.
  • An LLM was used to review the new code and look for simplifications.
  • New classes and functions contain docstrings explaining what they provide.
  • All new code is covered by relevant tests.
  • Documentation has been updated regarding these changes.

How to test

Not really much to test as the client part (Python/ web) is not developed yet. So you will have to rely on the tests.

Print screen / video

N/A

Notes

This add the new dependency Solathon to sign and validate the signature via a Solana wallet, it itself use the nacl.sign module (which is a binding on top of libsodium). An alternative would be to use the Solders lib which is running in rust. The API we use is quite small. So it shouldn't be much trouble to port from one to the other.

Copy link
Member

@hoh hoh left a comment

Choose a reason for hiding this comment

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

Looks good overall !

Small comments regarding the use of Enums and best practices for optional imports.

The dependencies pulling qrcode and pillow seem a bit overkill but well 🙄 ...

src/aleph/vm/orchestrator/views/authentication.py Outdated Show resolved Hide resolved
src/aleph/vm/orchestrator/views/authentication.py Outdated Show resolved Hide resolved
@olethanh
Copy link
Collaborator Author

Thanks for the review I will make the correction.

I can try porting using Solder if you want, should have less deps.

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 83.63636% with 9 lines in your changes missing coverage. Please review.

Project coverage is 62.35%. Comparing base (de4a0ff) to head (0fb7f7b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/aleph/vm/orchestrator/views/authentication.py 65.21% 7 Missing and 1 partial ⚠️
src/aleph/vm/utils/__init__.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #700      +/-   ##
==========================================
+ Coverage   62.18%   62.35%   +0.17%     
==========================================
  Files          69       69              
  Lines        6079     6128      +49     
  Branches      643      646       +3     
==========================================
+ Hits         3780     3821      +41     
- Misses       2147     2154       +7     
- Partials      152      153       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nesitor nesitor merged commit 15ecb92 into main Oct 8, 2024
22 checks passed
@nesitor nesitor deleted the ol-solana-support branch October 8, 2024 11:51
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