diff --git a/crypto/starkware/crypto/signature/signature.js b/crypto/starkware/crypto/signature/signature.js index 4ef6b18..118bfc1 100644 --- a/crypto/starkware/crypto/signature/signature.js +++ b/crypto/starkware/crypto/signature/signature.js @@ -247,7 +247,7 @@ function getTransferMsgHash( let instructionType = oneBn; if (condition !== null) { condition = condition.substring(2); - assertInRange(new BN(condition), zeroBn, prime, 'condition'); + assertInRange(new BN(condition, 16), zeroBn, prime, 'condition'); instructionType = twoBn; } return hashMsg( diff --git a/crypto/starkware/crypto/signature/signature_test.py b/crypto/starkware/crypto/signature/signature_test.py index 7e60098..fd91ce8 100644 --- a/crypto/starkware/crypto/signature/signature_test.py +++ b/crypto/starkware/crypto/signature/signature_test.py @@ -174,7 +174,7 @@ def test_transfer_signing_example(data_file: dict): """ Tests signing transfer. Parameters are from signature_test_data.json. """ - private_key = int(data_file['meta_data']['party_a_order']['private_key'], 16) + private_key = int(data_file['meta_data']['transfer_order']['private_key'], 16) public_key = private_to_stark_key(private_key) key = 'transfer_order' data = read_transfer_data(data_file[key]) diff --git a/crypto/starkware/crypto/signature/signature_test_data.json b/crypto/starkware/crypto/signature/signature_test_data.json index 6359d1c..eaccfe1 100644 --- a/crypto/starkware/crypto/signature/signature_test_data.json +++ b/crypto/starkware/crypto/signature/signature_test_data.json @@ -44,8 +44,8 @@ "sender_vault_id": 34, "token": "0x3003a65651d3b9fb2eff934a4416db301afd112a8492aaf8d7297fc87dcd9f4", "signature": { - "r": "0x735fffa9bf371ca294c5f74c15b434684cfe7e9e0500e6a59589ef05c1fce13", - "s": "0x1ddc49993ad678e2b5b80fb0e22a077b136353514f60edc3c2fc77d59dbd93e" + "r": "0x4c21b3df630eab38d75b5538e8f635167f4f7107a885d7adf542a7525240323", + "s": "0x5eacfaa59ed1b63d75241a1dbd9256d2efbe97f9451f2cf2a2af0bad5b5ab69" }, "public_key": "0x59a543d42bcc9475917247fa7f136298bb385a6388c3df7309955fcb39b8dd4" }, @@ -58,8 +58,8 @@ "sender_vault_id": 34, "token": "0x3003a65651d3b9fb2eff934a4416db301afd112a8492aaf8d7297fc87dcd9f4", "signature": { - "r": "0x735fffa9bf371ca294c5f74c15b434684cfe7e9e0500e6a59589ef05c1fce13", - "s": "0x1ddc49993ad678e2b5b80fb0e22a077b136353514f60edc3c2fc77d59dbd93e" + "r": "0x5003de97b66391d8609493ec3f51d9a8ee73c0f3ac866b647a9a6915c615f34", + "s": "0x2c91324c2d5f3746c8be017eb2c7e082e2128cbcf85aa1254b7510a87664be8" }, "public_key": "0x59a543d42bcc9475917247fa7f136298bb385a6388c3df7309955fcb39b8dd4", "condition": "0x318ff6d26cf3175c77668cd6434ab34d31e59f806a6a7c06d08215bccb7eaf8"