Skip to content

Commit 963c414

Browse files
authored
Merge pull request #2 from pluto/feat/proofs_duplicate_patch
patch
2 parents 32f8c72 + 3a2a8bd commit 963c414

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/SignatureChecker.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contract SignatureChecker is Ownable {
1010
mapping(address => bool) public isNotary;
1111

1212
/// valid digests for a given address
13-
mapping(address => bytes32) public digests;
13+
mapping(bytes32 => address) public digests;
1414

1515
/// @notice Error for invalid signatures
1616
error InvalidSignature();
@@ -80,11 +80,13 @@ contract SignatureChecker is Ownable {
8080
if (recoveredSigner != signer) {
8181
revert InvalidSignature();
8282
}
83-
if (digests[msg.sender] == digest) {
83+
84+
// TODO(WJ 2025-02-20): Should check for any sender.
85+
if (digests[digest] == msg.sender) {
8486
revert DuplicateProof();
8587
}
8688

87-
digests[msg.sender] = digest;
89+
digests[digest] = msg.sender;
8890
return true;
8991
}
9092
}

test/SignatureChecker.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ contract SignatureCheckerTest is Test {
1111
signatureChecker = new SignatureChecker(0xfdf07A5dCfa7b74f4c28DAb23eaD8B1c43Be801F);
1212
}
1313

14-
function test_isValidSignatureNow() public {
14+
function test_isValidSignature() public {
1515
// TEST vector from web-prover @ githash 2dc768e818d6f9fef575a88a2ceb80c0ed11974f
1616
address signer = 0xfdf07A5dCfa7b74f4c28DAb23eaD8B1c43Be801F;
1717
bytes32 digest = bytes32(0xe45537be7b5cd288c9c46b7e027b4f5a66202146012f792c1b1cabb65828994b);

0 commit comments

Comments
 (0)