Skip to content

Commit

Permalink
signature validation test
Browse files Browse the repository at this point in the history
  • Loading branch information
ermvrs committed Dec 6, 2024
1 parent 22ab2df commit d72a783
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion .snfoundry_cache/.prev_tests_failed
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
rosettacontracts_integrationtest::accounts_test::test_signature_validation
6 changes: 3 additions & 3 deletions tests/accounts_test.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ fn check_initial_variables() {
#[test]
fn test_signature_validation() {
let eth_address: EthAddress = 0xE4306a06B19Fdc04FDf98cF3c00472f29254c0e1.try_into().unwrap();
let tx_hash: u256 = 0x2b02ce3f05e22e1045d2d6872e22487820c9b408dcfb9b4cf4c0b1fdf4effe60;
let signature: Array<felt252> = array![0x64534a24ba972dec423b5562e5529844, 0x94a76749edb78eff04f44205e8268fc2 ,0x4a801ea1ad2eb9d7ba8210bbbd8dd196, 0x6241083946fd385474d1b48ea02e2144, 0x1b]; // r.low, r.high, s.low, s.high, v
let unsigned_tx_hash: u256 = 0x105d7b8d7c9fe830c123f2d99c01e09bfa7d902cb3b5afee409cf3dca533f52b;
let signature: Array<felt252> = array![0x3188ef10bf8469101d372e6b0960ed1b, 0x02bb74ffa5465b3dda0e353bbc3b6be3, 0x436c4cd167829819ce46024300e24d6d , 0x0739cb3999ae6842528ce5d8ec01a7fc , 0x1b]; // r.low, r.high, s.low, s.high, v

let (rosettanet, account) = deploy_account_from_rosettanet(eth_address);

assert_eq!(account.is_valid_signature(tx_hash, signature), 1);
assert_eq!(account.is_valid_signature(unsigned_tx_hash, signature), starknet::VALIDATED);
}

0 comments on commit d72a783

Please sign in to comment.