From feb224e085b2bfeb626a3a7a49f300b057fa53fd Mon Sep 17 00:00:00 2001 From: welbon <2261238+welbon@users.noreply.github.com> Date: Wed, 27 Nov 2024 17:10:02 +0800 Subject: [PATCH] [compiler-v2 framework] add authentication key to prologue and eilprologue --- vm/framework/starcoin-framework/sources/account.move | 6 ------ .../sources/stc/stc_transaction_validation.move | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/vm/framework/starcoin-framework/sources/account.move b/vm/framework/starcoin-framework/sources/account.move index ae583e1242..9bd168013b 100644 --- a/vm/framework/starcoin-framework/sources/account.move +++ b/vm/framework/starcoin-framework/sources/account.move @@ -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): bool acquires Account { - let account = borrow_global(account_addr); - account.authentication_key == auth_key - } - /// Convert from authentication key to address public fun auth_key_to_address(authentication_key: vector): address { assert!(vector::length(&authentication_key) == 32, error::invalid_argument(EMALFORMED_AUTHENTICATION_KEY)); diff --git a/vm/framework/starcoin-framework/sources/stc/stc_transaction_validation.move b/vm/framework/starcoin-framework/sources/stc/stc_transaction_validation.move index 44fa786f02..6aec1d2458 100644 --- a/vm/framework/starcoin-framework/sources/stc/stc_transaction_validation.move +++ b/vm/framework/starcoin-framework/sources/stc/stc_transaction_validation.move @@ -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),