Skip to content

Commit

Permalink
Empty signature allowed for owner as caller
Browse files Browse the repository at this point in the history
  • Loading branch information
geovgy committed Nov 7, 2024
1 parent fe32126 commit 15cef63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/EIPAuthorReward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ contract EIPAuthorReward is
if (_claimed[author][claimable.id]) {
revert AlreadyClaimed(author, claimable.id);
}
bytes32 hash = _hashClaimableStruct(claimable);
if (!_isValidSignature(owner(), hash, signature)) {
revert InvalidSignature();
if (owner() != msg.sender) {
bytes32 hash = _hashClaimableStruct(claimable);
if (!_isValidSignature(owner(), hash, signature)) {
revert InvalidSignature();
}
}
_claimed[author][claimable.id] = true;
_supply++;
Expand Down
9 changes: 9 additions & 0 deletions test/unit/EIPAuthorReward.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ contract EIPAuthorRewardTest is BaseTest {
assertEq(reward.balanceOf(sender, id), 1);
}

function test_claim_asOwner() public {
address recipient = vm.addr(3);

vm.prank(owner);
reward.claim(EIPAuthorReward.Claimable({id: 1, author: "author", to: recipient}), "");

assertEq(reward.balanceOf(recipient, 1), 1);
}

function test_claimed() public {
_signAndExecuteClaim(
reward,
Expand Down

0 comments on commit 15cef63

Please sign in to comment.