Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Aug 3, 2022
1 parent 23b7dd7 commit f979b8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion actors/account/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ impl Actor {
}

/// Authenticates whether the provided signature is valid for the provided message.
/// Should be called with the raw bytes of a signature, NOT a serialized Signature object that includes a SignatureType.
/// Errors if the authentication is invalid.
pub fn authenticate_message<BS, RT>(
rt: &mut RT,
Expand All @@ -92,7 +93,7 @@ impl Actor {
}
};
let sig = Signature { sig_type, bytes: params.signature };
rt.verify_signature(&sig, &st.address, &params.message).map_err(|e| {
rt.verify_signature(&sig, &address, &params.message).map_err(|e| {
e.downcast_default(
ExitCode::USR_ILLEGAL_ARGUMENT,
"failed to authenticate message, signature invalid",
Expand Down
8 changes: 3 additions & 5 deletions test_vm/tests/account_authenticate_message_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use fvm_shared::bigint::Zero;
use fvm_shared::econ::TokenAmount;
use fvm_shared::error::ExitCode;
use test_vm::util::{apply_code, apply_ok, create_accounts, generate_deal_proposal};
use test_vm::{TEST_VM_INVALID, VM};
use test_vm::VM;

// Using a deal proposal as a serialized message, we confirm that:
// - calls to authenticate_message with valid signatures succeed
Expand Down Expand Up @@ -37,10 +37,8 @@ fn account_authenticate_message() {
);

// Bad, bad sig! message fails
let authenticate_message_params = AuthenticateMessageParams {
signature: TEST_VM_INVALID.as_bytes().to_vec(),
message: proposal_ser,
};
let authenticate_message_params =
AuthenticateMessageParams { signature: vec![], message: proposal_ser };
apply_code(
&v,
addr,
Expand Down

0 comments on commit f979b8a

Please sign in to comment.