-
Notifications
You must be signed in to change notification settings - Fork 0
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
add neuron certificate handling #2
Conversation
b4e04f5
to
e5ad0a0
Compare
e5ad0a0
to
472d178
Compare
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.
Could not compile due to certificate
module non-existing. I could be wrong, but if a file was missing from git, I'll look at it again once you add the file.
I have little to no idea about subtensor internals, so left some style related nitpick comments 😁. But going through it, it looks good to me (assuming certificate::Certificate
is just an alias for Vec<u8>
), apart from the nomenclature thing pawel mentioned.
6a5aedc
to
9b12bcc
Compare
pallets/subtensor/src/certificate.rs
Outdated
use sp_std::vec::Vec; | ||
|
||
// TODO Certificate Encryption Pubkey | ||
pub type Certificate = Vec<u8>; |
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.
As odd pointed out in slack, having [u8; 32]
would be more appropriate than Vec<u8>
as the certificates are supposed to be 256-bit in length. We don't want to allow users to store data of arbitrary size here.
@@ -14,6 +14,7 @@ sp_api::decl_runtime_apis! { | |||
pub trait NeuronInfoRuntimeApi { | |||
fn get_neurons(netuid: u16) -> Vec<u8>; | |||
fn get_neuron(netuid: u16, uid: u16) -> Vec<u8>; | |||
fn get_neuron_certificate(netuid: u16, uid: u16) -> Vec<u8>; |
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.
Here and every other method the returns a certificate should have a return type of Option<...>
( Option<Vec<u8>>
, Option<[u8; 32]>
if we go the array route).
I'd also prefer using Certificate
instead of Vec<u8>
/[u8; 32]
as we are defining a type anyway.
…-flag Added `--no-purge` flag to `scripts/localnet.sh` to be able to save state when restarting a script.
…_conflict Chore/testnet merge conflict
Fix pallet indicies and specify them explicitly
…conflic Fix docker, merge conflicts and publish docker images on tag
6bb6d24
to
b5d7c0e
Compare
…to-publish Add token argument to the publish script
fix benchmarks + CI
…roxy Feat/root weights proxy
as instructed by formalized_tensor
Description
implemented logic for neuron certificate discovery and storage:
neuronInfo_getNeuronCertificate: ( netuid, hotkey ) --> certificate
pallet storage for neuron certificatesfn get_neuron_certificate(netuid, neuron_uid)
rpc to be called via bittensor library to fetch the certificate for a particular neuronfn serve_axon_tls(..., certificate)
as an alternative for existingserve_axon
taking an additional certificate parameter and storing itcompatible with older versions of bittensor as it doesn't modify the behaviour of existing rpc calls.
Checklist
rustfmt
changes