Skip to content

Commit

Permalink
PR fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kubaplas committed Dec 5, 2023
1 parent e49c952 commit de73e5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions core/src/contract_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use casper_types::crypto::PublicKey;
use crate::key_maker;
pub use crate::ContractContext;
use crate::ExecutionError::CouldntDeserializeSignature;
use crate::OdraError::ExecutionError;

pub struct ContractEnv {
index: u32,
Expand Down Expand Up @@ -132,7 +131,7 @@ impl ContractEnv {
public_key: &PublicKey
) -> bool {
let (signature, _) = casper_types::crypto::Signature::from_bytes(signature.as_slice())
.unwrap_or_else(|_| self.revert(ExecutionError(CouldntDeserializeSignature)));
.unwrap_or_else(|_| self.revert(CouldntDeserializeSignature));
casper_types::crypto::verify(message.as_slice(), &signature, public_key).is_ok()
}
}
7 changes: 6 additions & 1 deletion core/src/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ pub fn generate_key_pairs(amount: u8) -> BTreeMap<Address, (SecretKey, PublicKey
// Create an AccountHash from a public key.
let account_addr = AccountHash::from(&public_key);

let address = match account_addr.try_into() {
Ok(address) => address,
Err(_) => continue
};

// Create a GenesisAccount.
accounts.insert(account_addr.try_into().unwrap(), (secret_key, public_key));
accounts.insert(address, (secret_key, public_key));
}
accounts
}

0 comments on commit de73e5d

Please sign in to comment.