From b631b8269de3efe1909be8d6764072be6b45d256 Mon Sep 17 00:00:00 2001 From: simonjiao Date: Sun, 24 Nov 2024 09:06:21 +0800 Subject: [PATCH] fix verify-signed-message (#4294) --- cmd/starcoin/src/account/verify_sign_cmd.rs | 4 ++-- vm/framework/starcoin-framework/doc/account.md | 5 +++-- vm/framework/starcoin-framework/sources/account.move | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/starcoin/src/account/verify_sign_cmd.rs b/cmd/starcoin/src/account/verify_sign_cmd.rs index 76d020e51b..6319e2441a 100644 --- a/cmd/starcoin/src/account/verify_sign_cmd.rs +++ b/cmd/starcoin/src/account/verify_sign_cmd.rs @@ -32,10 +32,10 @@ impl CommandAction for VerifySignMessageCmd { let opt = ctx.opt(); let state = ctx.state(); let signed_message = opt.signed_message.clone(); - let account_resource = state.get_account_resource(signed_message.account)?; + let account_resource = state.get_account_resource(signed_message.account).ok(); let result = signed_message.check_signature().and_then(|_| { - signed_message.check_account(state.net().chain_id(), Some(&account_resource)) + signed_message.check_account(state.net().chain_id(), account_resource.as_ref()) }); Ok(VerifyResult { ok: result.is_ok(), diff --git a/vm/framework/starcoin-framework/doc/account.md b/vm/framework/starcoin-framework/doc/account.md index 873802c715..336ad6d9c9 100644 --- a/vm/framework/starcoin-framework/doc/account.md +++ b/vm/framework/starcoin-framework/doc/account.md @@ -984,9 +984,10 @@ is returned. This way, the caller of this function can publish additional resour
fun create_account_unchecked(new_address: address): signer {
     let new_account = create_signer(new_address);
-    let authentication_key = bcs::to_bytes(&new_address);
+    // fixme: create authentication key from address.
+    let authentication_key = ZERO_AUTH_KEY;
     assert!(
-        vector::length(&authentication_key) == 16,
+        vector::length(&authentication_key) == 32,
         error::invalid_argument(EMALFORMED_AUTHENTICATION_KEY)
     );
 
diff --git a/vm/framework/starcoin-framework/sources/account.move b/vm/framework/starcoin-framework/sources/account.move
index e8ffa88f5c..47e3d020e9 100644
--- a/vm/framework/starcoin-framework/sources/account.move
+++ b/vm/framework/starcoin-framework/sources/account.move
@@ -221,9 +221,10 @@ module starcoin_framework::account {
 
     fun create_account_unchecked(new_address: address): signer {
         let new_account = create_signer(new_address);
-        let authentication_key = bcs::to_bytes(&new_address);
+        // fixme: create authentication key from address.
+        let authentication_key = ZERO_AUTH_KEY;
         assert!(
-            vector::length(&authentication_key) == 16,
+            vector::length(&authentication_key) == 32,
             error::invalid_argument(EMALFORMED_AUTHENTICATION_KEY)
         );