Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
#364 (comment)

and specifics of the crate being used
  • Loading branch information
blasrodri committed Sep 7, 2022
1 parent ba8a3d3 commit bdf64d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions neps/nep-0364.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ This NEP aims to introduce the following host function:
///
/// `input_cost(num_bytes_signature + num_bytes_message, num_bytes_public_key) +
/// ed25519_verify_base + ed25519_verify_byte * (num_bytes_signature + num_bytes_message)`
///
/// # Errors
///
/// The signature size is fixed and equal to SIGNATURE_LENGTH (64 bytes). In case the length of signature input is not equal to
/// SIGNATURE_LENGTH, then the function returns HostError::Ed25519VerifyInvalidInput with the message "invalid signature length".
///
/// A similar case occurs with the public key. Its size is known and its equal to PUBLIC_KEY_LENGTH (32 bytes). In case the
/// input length provided for the publc key doesn't match PUBLIC_KEY_LENGTH, the function will return the following error:
/// HostError::Ed25519VerifyInvalidInput with the message "invalid public key length".
pub fn ed25519_verify(
&mut self,
sig_len: u64,
Expand All @@ -164,6 +173,8 @@ And a `rust-sdk` possible implementation could look like this:
pub fn ed25519_verify(sig: &ed25519::Signature, msg: &[u8], pub_key: &ed25519::Public) -> bool;

```
The current implementation is imported from the crate `ed25519-dalek`, version 1. It uses no feature flags
except from the default one. This is the exact same setup used in the crate `near-crypto`.

Once this NEP is approved and integrated, these functions will be available in the `near_sdk` crate in the
`env` module.
Expand Down

0 comments on commit bdf64d0

Please sign in to comment.