Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Müller <mich@elmueller.net>
  • Loading branch information
agryaznov and cmichi authored May 12, 2022
1 parent 20aa6bb commit a0e429a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions crates/env/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ pub fn ecdsa_recover(
///
/// # Errors
///
/// - if cannot retrieve ECDSA public key from the provided input
/// - If the ECDSA public key cannot be recovered from the provided public key.
pub fn ecdsa_to_eth_address(pubkey: &[u8; 33], output: &mut [u8; 20]) -> Result<()> {
<EnvInstance as OnInstance>::on_instance(|instance| {
instance.ecdsa_to_eth_address(pubkey, output)
Expand Down Expand Up @@ -629,12 +629,12 @@ pub fn set_code_hash(code_hash: &[u8; 32]) -> Result<()> {
<EnvInstance as OnInstance>::on_instance(|instance| instance.set_code_hash(code_hash))
}

/// Returns the default Substrate's `AccountId` (`\[u8;32\]`) from the ECDSA compressed public key.
/// Returns the default Substrate `AccountId` (`[u8; 32]`) from the ECDSA compressed public key.
/// It hashes the compressed public key with the `blake2b_256` algorithm like in substrate.
///
/// # Note
///
/// This function implies a standart `AccountId` type which is `\[u8;32\]`.
/// This function assumes an `AccountId` type of `[u8; 32]` for the Substrate chain.
pub fn ecdsa_to_default_account_id(pubkey: &[u8; 33]) -> AccountId {
<EnvInstance as OnInstance>::on_instance(|instance| {
instance.ecdsa_to_default_account_id(pubkey)
Expand Down
4 changes: 2 additions & 2 deletions crates/env/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub trait EnvBackend {
output: &mut [u8; 33],
) -> Result<()>;

/// Retrieves an Ethereum address from the ECDSA compressed `pubkey`,
/// Retrieves an Ethereum address from the ECDSA compressed `pubkey`
/// and stores the result in `output`.
fn ecdsa_to_eth_address(
&mut self,
Expand Down Expand Up @@ -305,7 +305,7 @@ pub trait EnvBackend {
/// - If the supplied `code_hash` cannot be found on-chain.
fn set_code_hash(&mut self, code_hash: &[u8]) -> Result<()>;

/// Returns the default Substrate's `AccountId` ([u8;32]) from the ECDSA compressed public key.
/// Returns the default Substrate `AccountId` (`[u8; 32]`) from the ECDSA compressed public key.
/// It hashes the compressed public key with the `blake2b_256` algorithm like in substrate.
///
/// # Note
Expand Down
4 changes: 2 additions & 2 deletions crates/lang/src/env_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ where
/// let output = self
/// .env()
/// .ecdsa_to_eth_address(&pub_key)
/// .expect("Should get ETH address from compressed public key");
/// .expect("must return an Ethereum address for the compressed public key");
/// assert_eq!(output, EXPECTED_ETH_ADDRESS);
/// }
/// #
Expand Down Expand Up @@ -1015,7 +1015,7 @@ where
ink_env::own_code_hash::<E>()
}

/// Returns the default Substrate's `AccountId` from the ECDSA compressed public key.
/// Returns the default Substrate `AccountId` from the ECDSA compressed public key.
/// It hashes the compressed public key with the `blake2b_256` algorithm like in substrate.
///
/// # Note
Expand Down

0 comments on commit a0e429a

Please sign in to comment.