From a4bb52dfd744af623fad94e26ca6f5828af60912 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 00:21:31 +0900 Subject: [PATCH 01/13] chore: add tests --- src/verify/starknet.spec.ts | 72 +++++++++---------- test/fixtures/starknet/message-alias-alt.json | 56 +++++++++++++++ 2 files changed, 90 insertions(+), 38 deletions(-) create mode 100644 test/fixtures/starknet/message-alias-alt.json diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index f637e2698..ea5530bf3 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -1,5 +1,6 @@ import { test, expect, describe } from 'vitest'; import starknetMessage from '../../test/fixtures/starknet/message-alias.json'; +import starknetMessageAlt from '../../test/fixtures/starknet/message-alias-alt.json'; import verify, { getHash } from './starknet'; import { validateAndParseAddress } from 'starknet'; @@ -21,47 +22,42 @@ describe('verify/starknet', () => { }); describe('verify()', () => { - test('should return true if the signature is valid', () => { - expect( - verify( - starknetMessage.address, - starknetMessage.sig, - starknetMessage.data, - 'SN_SEPOLIA' - ) - ).resolves.toBe(true); - }); + describe.each([ + ['2', starknetMessage], + ['3', starknetMessageAlt] + ])('with a %s items signature', (title, message) => { + test('should return true if the signature is valid', () => { + expect( + verify(message.address, message.sig, message.data, 'SN_SEPOLIA') + ).resolves.toBe(true); + }); - test('should return true if the signature is valid with a padded address', () => { - expect( - verify( - validateAndParseAddress(starknetMessage.address), - starknetMessage.sig, - starknetMessage.data, - 'SN_SEPOLIA' - ) - ).resolves.toBe(true); - }); + test('should return true if the signature is valid with a padded address', () => { + expect( + verify( + validateAndParseAddress(message.address), + message.sig, + message.data, + 'SN_SEPOLIA' + ) + ).resolves.toBe(true); + }); - test('should return true when verifying on a different network', () => { - expect( - verify( - starknetMessage.address, - starknetMessage.sig, - starknetMessage.data, - 'SN_MAIN' - ) - ).resolves.toBe(true); - }); + test('should return true when verifying on a different network', () => { + expect( + verify(message.address, message.sig, message.data, 'SN_MAIN') + ).resolves.toBe(true); + }); - test('should throw an error if the signature is invalid', () => { - expect( - verify( - '0x7667469b8e93faa642573078b6bf8c790d3a6184b2a1bb39c5c923a732862e1', - starknetMessage.sig, - starknetMessage.data - ) - ).rejects.toThrow(); + test('should throw an error if the signature is invalid', () => { + expect( + verify( + '0x7667469b8e93faa642573078b6bf8c790d3a6184b2a1bb39c5c923a732862e1', + message.sig, + message.data + ) + ).rejects.toThrow(); + }); }); }); }); diff --git a/test/fixtures/starknet/message-alias-alt.json b/test/fixtures/starknet/message-alias-alt.json new file mode 100644 index 000000000..bc1706281 --- /dev/null +++ b/test/fixtures/starknet/message-alias-alt.json @@ -0,0 +1,56 @@ +{ + "address": "0x008cf64fc19a22c94c4d751ebd39ff897dbe2c8646b2900d646558e293b0a2e5", + "sig": [ + "0x1", + "0x7aa8a7abcde2cc41d3dd11f929131a6244e901cad7f11ad620bc7eb3181cb54", + "0x67a33d8fb1a638445f1e42eadcc3eb93d3d2ad394130268c163824521503962" + ], + "data": { + "domain": { + "name": "sx-starknet", + "version": "0.1.0", + "chainId": "0x534e5f4d41494e", + "verifyingContract": "" + }, + "types": { + "StarkNetDomain": [ + { + "name": "name", + "type": "felt252" + }, + { + "name": "version", + "type": "felt252" + }, + { + "name": "chainId", + "type": "felt252" + }, + { + "name": "verifyingContract", + "type": "ContractAddress" + } + ], + "SetAlias": [ + { + "name": "from", + "type": "ContractAddress" + }, + { + "name": "alias", + "type": "string" + }, + { + "name": "timestamp", + "type": "felt" + } + ] + }, + "message": { + "from": "0x008cf64fc19a22c94c4d751ebd39ff897dbe2c8646b2900d646558e293b0a2e5", + "timestamp": 1721834014, + "alias": "0x2d6e1Cb5E7f169B784e1bF5C4363c070AD767e68" + }, + "primaryType": "SetAlias" + } +} From f1deb2c71d8d0fe2baee5ab79b0b3ca9cb2c50e8 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 00:41:00 +0900 Subject: [PATCH 02/13] fix: add support for validating signatures with `v` element --- src/verify/starknet.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index 34d6f397a..54e879387 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -73,10 +73,7 @@ export default async function verify( getProvider(network, options) ); - await contractAccount.isValidSignature(getHash(data, address), [ - sig[0], - sig[1] - ]); + await contractAccount.isValidSignature(getHash(data, address), sig.slice(-2)); return true; } From 580b343ceca36559bc1a381bb87bce827d3861dc Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 01:04:47 +0900 Subject: [PATCH 03/13] chore: update test fixtures --- test/fixtures/starknet/message-alias-alt.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fixtures/starknet/message-alias-alt.json b/test/fixtures/starknet/message-alias-alt.json index bc1706281..c2c65256f 100644 --- a/test/fixtures/starknet/message-alias-alt.json +++ b/test/fixtures/starknet/message-alias-alt.json @@ -2,8 +2,8 @@ "address": "0x008cf64fc19a22c94c4d751ebd39ff897dbe2c8646b2900d646558e293b0a2e5", "sig": [ "0x1", - "0x7aa8a7abcde2cc41d3dd11f929131a6244e901cad7f11ad620bc7eb3181cb54", - "0x67a33d8fb1a638445f1e42eadcc3eb93d3d2ad394130268c163824521503962" + "0xa0f72077d0b928be15ddfc21c481af27a9c79d7b67e049bb97a9919cb9218e", + "0x895bcbd404d7374850219753d98a397c962985ffa3f36d5bd06aab41a01709" ], "data": { "domain": { @@ -48,8 +48,8 @@ }, "message": { "from": "0x008cf64fc19a22c94c4d751ebd39ff897dbe2c8646b2900d646558e293b0a2e5", - "timestamp": 1721834014, - "alias": "0x2d6e1Cb5E7f169B784e1bF5C4363c070AD767e68" + "timestamp": 1721836843, + "alias": "0x6ceddb030f3ef6dBD04B8b3691CaB101ECe226f6" }, "primaryType": "SetAlias" } From 0e714a4eb27f5d1d7c170fa28ca4313841db7452 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:47:57 +0900 Subject: [PATCH 04/13] fix: app support for [rsv] signature --- src/verify/starknet.spec.ts | 10 +++++----- src/verify/starknet.ts | 11 +++++++---- ...{message-alias-alt.json => message-alias-rsv.json} | 0 3 files changed, 12 insertions(+), 9 deletions(-) rename test/fixtures/starknet/{message-alias-alt.json => message-alias-rsv.json} (100%) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index ea5530bf3..2360c2b41 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -1,6 +1,6 @@ import { test, expect, describe } from 'vitest'; import starknetMessage from '../../test/fixtures/starknet/message-alias.json'; -import starknetMessageAlt from '../../test/fixtures/starknet/message-alias-alt.json'; +import starknetMessageRsv from '../../test/fixtures/starknet/message-alias-rsv.json'; import verify, { getHash } from './starknet'; import { validateAndParseAddress } from 'starknet'; @@ -24,11 +24,11 @@ describe('verify/starknet', () => { describe('verify()', () => { describe.each([ ['2', starknetMessage], - ['3', starknetMessageAlt] + ['3', starknetMessageRsv] ])('with a %s items signature', (title, message) => { test('should return true if the signature is valid', () => { expect( - verify(message.address, message.sig, message.data, 'SN_SEPOLIA') + verify(message.address, message.sig, message.data, 'SN_MAIN') ).resolves.toBe(true); }); @@ -38,14 +38,14 @@ describe('verify/starknet', () => { validateAndParseAddress(message.address), message.sig, message.data, - 'SN_SEPOLIA' + 'SN_MAIN' ) ).resolves.toBe(true); }); test('should return true when verifying on a different network', () => { expect( - verify(message.address, message.sig, message.data, 'SN_MAIN') + verify(message.address, message.sig, message.data, 'SN_SEPOLIA') ).resolves.toBe(true); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index 54e879387..fc1660141 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -11,11 +11,11 @@ const RPC_URLS: Record = { const ABI = [ { - name: 'argent::account::interface::IDeprecatedArgentAccount', + name: 'argent::common::account::IAccount', type: 'interface', items: [ { - name: 'isValidSignature', + name: 'is_valid_signature', type: 'function', inputs: [ { @@ -23,7 +23,7 @@ const ABI = [ type: 'core::felt252' }, { - name: 'signatures', + name: 'signature', type: 'core::array::Array::' } ], @@ -73,7 +73,10 @@ export default async function verify( getProvider(network, options) ); - await contractAccount.isValidSignature(getHash(data, address), sig.slice(-2)); + await contractAccount.is_valid_signature( + getHash(data, address), + sig.slice(-2) + ); return true; } diff --git a/test/fixtures/starknet/message-alias-alt.json b/test/fixtures/starknet/message-alias-rsv.json similarity index 100% rename from test/fixtures/starknet/message-alias-alt.json rename to test/fixtures/starknet/message-alias-rsv.json From dcdfaf71b2bf6b9403a56277990ccad9c5abfedc Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 14:57:14 +0900 Subject: [PATCH 05/13] fix: throw meaningful error when starknet contract is not deployed --- src/verify/starknet.spec.ts | 11 +++++++++++ src/verify/starknet.ts | 28 ++++++++++++++++++---------- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index 2360c2b41..ce600f149 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -59,5 +59,16 @@ describe('verify/starknet', () => { ).rejects.toThrow(); }); }); + + test('should throw an error when the contract is not deployed', () => { + expect( + verify( + '0x07f71118e351c02f6EC7099C8CDf93AED66CEd8406E94631cC91637f7D7F203A', + starknetMessage.sig, + starknetMessage.data, + 'SN_MAIN' + ) + ).rejects.toThrowError('Contract not deployed'); + }); }); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index fc1660141..0ec3019b1 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -67,16 +67,24 @@ export default async function verify( network: NetworkType = 'SN_MAIN', options: ProviderOptions = {} ): Promise { - const contractAccount = new Contract( - ABI, - address, - getProvider(network, options) - ); + try { + const contractAccount = new Contract( + ABI, + address, + getProvider(network, options) + ); - await contractAccount.is_valid_signature( - getHash(data, address), - sig.slice(-2) - ); + await contractAccount.is_valid_signature( + getHash(data, address), + sig.slice(-2) + ); - return true; + return true; + } catch (e: any) { + if (e.message.includes('Contract not found')) { + throw new Error('Contract not deployed'); + } + + throw e; + } } From 14d993ad4fbd1e49acb1704125dbe4e160945436 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 15:33:35 +0900 Subject: [PATCH 06/13] fix: validate result before returning --- package.json | 1 + src/verify/starknet.spec.ts | 11 +++++++++++ src/verify/starknet.ts | 5 +++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b791eb79e..9652d88f1 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "@ensdomains/eth-ens-namehash": "^2.0.15", "@ethersproject/abi": "^5.6.4", "@ethersproject/address": "^5.6.1", + "@ethersproject/bignumber": "^5.7.0", "@ethersproject/bytes": "^5.6.1", "@ethersproject/contracts": "^5.6.2", "@ethersproject/hash": "^5.7.0", diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index ce600f149..b3c1cb7ca 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -70,5 +70,16 @@ describe('verify/starknet', () => { ) ).rejects.toThrowError('Contract not deployed'); }); + + test('should return false when the message is not valid', () => { + expect( + verify( + starknetMessage.address, + ['1', '2'], + starknetMessage.data, + 'SN_MAIN' + ) + ).resolves.toBe(false); + }); }); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index 0ec3019b1..cf1723002 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -1,4 +1,5 @@ import { Contract, RpcProvider, typedData } from 'starknet'; +import { BigNumber } from '@ethersproject/bignumber'; import type { SignaturePayload } from '.'; import type { ProviderOptions } from '../utils/provider'; @@ -74,12 +75,12 @@ export default async function verify( getProvider(network, options) ); - await contractAccount.is_valid_signature( + const result = await contractAccount.is_valid_signature( getHash(data, address), sig.slice(-2) ); - return true; + return BigNumber.from(result).eq(BigNumber.from('370462705988')); } catch (e: any) { if (e.message.includes('Contract not found')) { throw new Error('Contract not deployed'); From 8097af9f9841f862e0bf2be5c8c3cee39532fd0d Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:18:22 +0900 Subject: [PATCH 07/13] fix: reject with a meaningful error on invalid signature format --- src/verify/starknet.spec.ts | 8 +++++++- src/verify/starknet.ts | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index b3c1cb7ca..cdea970e9 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -71,7 +71,7 @@ describe('verify/starknet', () => { ).rejects.toThrowError('Contract not deployed'); }); - test('should return false when the message is not valid', () => { + test('should return false when the signature is not valid', () => { expect( verify( starknetMessage.address, @@ -81,5 +81,11 @@ describe('verify/starknet', () => { ) ).resolves.toBe(false); }); + + test('should throw an error on wrong signature length', () => { + expect( + verify(starknetMessage.address, ['1'], starknetMessage.data, 'SN_MAIN') + ).rejects.toThrowError('Invalid signature'); + }); }); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index cf1723002..353e63e7d 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -75,6 +75,10 @@ export default async function verify( getProvider(network, options) ); + if (sig.length < 2) { + throw new Error('Invalid signature'); + } + const result = await contractAccount.is_valid_signature( getHash(data, address), sig.slice(-2) From 0211641e6c6644c7a97d261a1e824ea2938bd5a9 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:06:58 +0900 Subject: [PATCH 08/13] fix: default to return false --- src/verify/starknet.spec.ts | 22 +++++++++++++++++++++- src/verify/starknet.ts | 10 +++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index cdea970e9..6990e5d9a 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -82,10 +82,30 @@ describe('verify/starknet', () => { ).resolves.toBe(false); }); + test('should return false when the payload has been tempered', () => { + const data = structuredClone(starknetMessage.data); + data.message.timestamp = 1234; + + expect( + verify(starknetMessage.address, starknetMessage.sig, data, 'SN_MAIN') + ).resolves.toBe(false); + }); + + test('should return false when the payload format is not valid', () => { + expect( + verify( + starknetMessage.address, + starknetMessage.sig, + { test: 'hello' }, + 'SN_MAIN' + ) + ).resolves.toBe(false); + }); + test('should throw an error on wrong signature length', () => { expect( verify(starknetMessage.address, ['1'], starknetMessage.data, 'SN_MAIN') - ).rejects.toThrowError('Invalid signature'); + ).rejects.toThrowError('Invalid signature format'); }); }); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index 353e63e7d..e98629848 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -68,6 +68,10 @@ export default async function verify( network: NetworkType = 'SN_MAIN', options: ProviderOptions = {} ): Promise { + if (sig.length < 2) { + throw new Error('Invalid signature format'); + } + try { const contractAccount = new Contract( ABI, @@ -75,10 +79,6 @@ export default async function verify( getProvider(network, options) ); - if (sig.length < 2) { - throw new Error('Invalid signature'); - } - const result = await contractAccount.is_valid_signature( getHash(data, address), sig.slice(-2) @@ -90,6 +90,6 @@ export default async function verify( throw new Error('Contract not deployed'); } - throw e; + return false; } } From 57f3fa16f8693ba94fbb79424efda6a3268563fd Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:14:56 +0900 Subject: [PATCH 09/13] Revert "fix: default to return false" This reverts commit 0211641e6c6644c7a97d261a1e824ea2938bd5a9. --- src/verify/starknet.spec.ts | 22 +--------------------- src/verify/starknet.ts | 10 +++++----- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index 6990e5d9a..cdea970e9 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -82,30 +82,10 @@ describe('verify/starknet', () => { ).resolves.toBe(false); }); - test('should return false when the payload has been tempered', () => { - const data = structuredClone(starknetMessage.data); - data.message.timestamp = 1234; - - expect( - verify(starknetMessage.address, starknetMessage.sig, data, 'SN_MAIN') - ).resolves.toBe(false); - }); - - test('should return false when the payload format is not valid', () => { - expect( - verify( - starknetMessage.address, - starknetMessage.sig, - { test: 'hello' }, - 'SN_MAIN' - ) - ).resolves.toBe(false); - }); - test('should throw an error on wrong signature length', () => { expect( verify(starknetMessage.address, ['1'], starknetMessage.data, 'SN_MAIN') - ).rejects.toThrowError('Invalid signature format'); + ).rejects.toThrowError('Invalid signature'); }); }); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index e98629848..353e63e7d 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -68,10 +68,6 @@ export default async function verify( network: NetworkType = 'SN_MAIN', options: ProviderOptions = {} ): Promise { - if (sig.length < 2) { - throw new Error('Invalid signature format'); - } - try { const contractAccount = new Contract( ABI, @@ -79,6 +75,10 @@ export default async function verify( getProvider(network, options) ); + if (sig.length < 2) { + throw new Error('Invalid signature'); + } + const result = await contractAccount.is_valid_signature( getHash(data, address), sig.slice(-2) @@ -90,6 +90,6 @@ export default async function verify( throw new Error('Contract not deployed'); } - return false; + throw e; } } From 127a57b2b5b77f29843832b9433fc43b95c9c9ae Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:16:02 +0900 Subject: [PATCH 10/13] fix: improve error message --- src/verify/starknet.spec.ts | 2 +- src/verify/starknet.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index cdea970e9..8b6c973e5 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -85,7 +85,7 @@ describe('verify/starknet', () => { test('should throw an error on wrong signature length', () => { expect( verify(starknetMessage.address, ['1'], starknetMessage.data, 'SN_MAIN') - ).rejects.toThrowError('Invalid signature'); + ).rejects.toThrowError('Invalid signature format'); }); }); }); diff --git a/src/verify/starknet.ts b/src/verify/starknet.ts index 353e63e7d..dea5d4fc3 100644 --- a/src/verify/starknet.ts +++ b/src/verify/starknet.ts @@ -76,7 +76,7 @@ export default async function verify( ); if (sig.length < 2) { - throw new Error('Invalid signature'); + throw new Error('Invalid signature format'); } const result = await contractAccount.is_valid_signature( From 637f54931efbd544d3f0068668c1e0a7b837c4bb Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:18:44 +0900 Subject: [PATCH 11/13] chore: add more tests --- src/verify/starknet.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index 8b6c973e5..496b2070b 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -82,6 +82,15 @@ describe('verify/starknet', () => { ).resolves.toBe(false); }); + test('should return false when the signature is not valid', () => { + const data = structuredClone(starknetMessage.data); + data.message.timestamp = 1234; + + expect( + verify(starknetMessage.address, starknetMessage.sig, data, 'SN_MAIN') + ).resolves.toBe(false); + }); + test('should throw an error on wrong signature length', () => { expect( verify(starknetMessage.address, ['1'], starknetMessage.data, 'SN_MAIN') From 3f968da32d0412457a0a9002cc534053815875e8 Mon Sep 17 00:00:00 2001 From: Wan Qi Chen <495709+wa0x6e@users.noreply.github.com> Date: Thu, 25 Jul 2024 19:30:24 +0900 Subject: [PATCH 12/13] fix: fix function not available on lower node version --- src/verify/starknet.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/verify/starknet.spec.ts b/src/verify/starknet.spec.ts index 496b2070b..7f79f6142 100644 --- a/src/verify/starknet.spec.ts +++ b/src/verify/starknet.spec.ts @@ -3,6 +3,7 @@ import starknetMessage from '../../test/fixtures/starknet/message-alias.json'; import starknetMessageRsv from '../../test/fixtures/starknet/message-alias-rsv.json'; import verify, { getHash } from './starknet'; import { validateAndParseAddress } from 'starknet'; +import { clone } from '../utils'; describe('verify/starknet', () => { describe('getHash()', () => { @@ -83,7 +84,7 @@ describe('verify/starknet', () => { }); test('should return false when the signature is not valid', () => { - const data = structuredClone(starknetMessage.data); + const data = clone(starknetMessage.data); data.message.timestamp = 1234; expect( From b364c6120c3119463a0570c33a36f114860e8c9b Mon Sep 17 00:00:00 2001 From: Chaitanya Date: Thu, 25 Jul 2024 16:16:32 +0530 Subject: [PATCH 13/13] v0.12.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9652d88f1..d6572e63c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@snapshot-labs/snapshot.js", - "version": "0.12.1", + "version": "0.12.2", "repository": "snapshot-labs/snapshot.js", "license": "MIT", "main": "dist/snapshot.cjs.js",