Skip to content

Commit

Permalink
error CryptoInvalidV();
Browse files Browse the repository at this point in the history
  • Loading branch information
SurfingNerd committed Aug 6, 2024
1 parent 794cf23 commit e9b2c28
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions contracts/ClaimContract.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

//
pragma solidity >=0.8.1 <0.9.0;

contract ClaimContract {
Expand Down Expand Up @@ -102,6 +102,9 @@ contract ClaimContract {
/// @dev Claim Error: Signature does not match
error ClaimErrorSignatureMissmatch();

/// @dev Provided v value is invalid for Ethereum signatures.
error CryptoInvalidV();

event Claim(
bytes20 indexed _from,
address _to,
Expand Down Expand Up @@ -295,8 +298,9 @@ contract ClaimContract {
bytes32 _r,
bytes32 _s
) public view returns (bool) {
require(_v >= 27 && _v <= 30, "v invalid");

if (_v < 27 || _v > 30) revert CryptoInvalidV();

/*
ecrecover() returns an Eth address rather than a public key, so
we must do the same to compare.
Expand Down

0 comments on commit e9b2c28

Please sign in to comment.