Skip to content

Commit

Permalink
[compiler-v2 framework] add authentication key to prologue and eilpro…
Browse files Browse the repository at this point in the history
…logue
  • Loading branch information
welbon committed Nov 27, 2024
1 parent 5d924e9 commit feb224e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
6 changes: 0 additions & 6 deletions vm/framework/starcoin-framework/sources/account.move
Original file line number Diff line number Diff line change
Expand Up @@ -768,12 +768,6 @@ module starcoin_framework::account {
account.authentication_key == ZERO_AUTH_KEY
}

/// Check is account auth key
public fun is_account_auth_key(account_addr: address, auth_key: vector<u8>): bool acquires Account {
let account = borrow_global<Account>(account_addr);
account.authentication_key == auth_key
}

/// Convert from authentication key to address
public fun auth_key_to_address(authentication_key: vector<u8>): address {
assert!(vector::length(&authentication_key) == 32, error::invalid_argument(EMALFORMED_AUTHENTICATION_KEY));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,11 @@ module starcoin_framework::stc_transaction_validation {
// Check that the hash of the transaction's public key matches the account's auth key
assert!(
//hash::sha3_256(txn_authentication_key_preimage) == *&sender_account.authentication_key,
account::is_account_auth_key(txn_sender, hash::sha3_256(txn_authentication_key_preimage)),
account::get_authentication_key(txn_sender) == hash::sha3_256(txn_authentication_key_preimage),
error::invalid_argument(EPROLOGUE_INVALID_ACCOUNT_AUTH_KEY)
);
};


assert!(
(txn_gas_price as u128) * (txn_max_gas_units as u128) <= MAX_U64,
error::invalid_argument(EPROLOGUE_CANT_PAY_GAS_DEPOSIT),
Expand Down

0 comments on commit feb224e

Please sign in to comment.