Skip to content

Commit

Permalink
fix: revert if salt used on propose and update
Browse files Browse the repository at this point in the history
  • Loading branch information
Orlando committed Aug 11, 2023
1 parent 548113d commit b404007
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion starknet/src/authenticators/stark_sig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mod StarkSigAuthenticator {
salt: felt252,
account_type: felt252
) {
assert(!self._used_salts.read((author, salt)), 'Salt Already Used');

stark_eip712::verify_propose_sig(
self._domain_hash.read(),
signature,
Expand Down Expand Up @@ -102,6 +104,8 @@ mod StarkSigAuthenticator {
metadata_URI: Array<felt252>,
account_type: felt252
) {
// No need to check salts here, as double voting is prevented by the space itself.

stark_eip712::verify_vote_sig(
self._domain_hash.read(),
signature,
Expand All @@ -113,7 +117,6 @@ mod StarkSigAuthenticator {
metadata_URI.span(),
account_type
);
// No need to check salts here, as double voting is prevented by the space itself.

ISpaceDispatcher {
contract_address: target
Expand All @@ -138,6 +141,8 @@ mod StarkSigAuthenticator {
salt: felt252,
account_type: felt252
) {
assert(!self._used_salts.read((author, salt)), 'Salt Already Used');

stark_eip712::verify_update_proposal_sig(
self._domain_hash.read(),
signature,
Expand Down
2 changes: 1 addition & 1 deletion starknet/tests/stark-sig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ describe('Starknet Signature Authenticator', () => {
params: ['0x5', '0x6', '0x7', '0x8'],
},
metadataURI: ['0x1', '0x2', '0x3', '0x4'],
salt: '0x0',
salt: '0x1',
};
const updateProposalData: typedData.TypedData = {
types: updateProposalTypes,
Expand Down

0 comments on commit b404007

Please sign in to comment.