Skip to content

Commit

Permalink
add finalize_keccak
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-fleming committed Jan 16, 2023
1 parent d12abf3 commit 6d4cb75
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/openzeppelin/account/library.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ from starkware.starknet.common.syscalls import (
get_contract_address,
get_tx_info
)
from starkware.cairo.common.cairo_secp.signature import verify_eth_signature_uint256
from starkware.cairo.common.cairo_secp.signature import (
finalize_keccak,
verify_eth_signature_uint256
)
from openzeppelin.utils.constants.library import (
IACCOUNT_ID,
IERC165_ID,
Expand Down Expand Up @@ -157,13 +160,16 @@ namespace Account {
let (high, low) = split_felt(hash);
let msg_hash: Uint256 = Uint256(low=low, high=high);

let (local keccak_ptr: felt*) = alloc();
let (keccak_ptr: felt*) = alloc();
local keccak_ptr_start: felt* = keccak_ptr;

with keccak_ptr {
verify_eth_signature_uint256(
msg_hash=msg_hash, r=sig_r, s=sig_s, v=sig_v, eth_address=_public_key
);
}
// Required to ensure sequencers cannot spoof validation check.
finalize_keccak(keccak_ptr_start=keccak_ptr_start, keccak_ptr_end=keccak_ptr);

return (is_valid=TRUE);
}
Expand Down

0 comments on commit 6d4cb75

Please sign in to comment.