Skip to content

Commit

Permalink
Merge pull request #489 from oasisprotocol/matevz/fix/contracts-siwe-…
Browse files Browse the repository at this point in the history
…auth-errors-prefix

contracts: Add error prefixes to SiweParser and A13e
  • Loading branch information
matevz authored Feb 3, 2025
2 parents 7b688e7 + 22b77d7 commit 9b74727
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions contracts/contracts/SiweParser.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ struct ParsedSiweMessage {
*/
library SiweParser {
/// Invalid length of the hex-encoded address
error InvalidAddressLength();
error SiweParser_InvalidAddressLength();
/// Invalid length of the nonce
error InvalidNonce();
error SiweParser_InvalidNonce();

/**
* @notice Convert string containing hex address without 0x prefix to solidity address object.
Expand All @@ -39,7 +39,7 @@ library SiweParser {
returns (address)
{
if (s.length != 40) {
revert InvalidAddressLength();
revert SiweParser_InvalidAddressLength();
}

bytes memory r = new bytes(s.length / 2);
Expand Down Expand Up @@ -219,7 +219,7 @@ library SiweParser {
p.chainId = _parseUint(chainId);
(p.nonce, i) = _parseField(siweMsg, "Nonce", i);
if (p.nonce.length < 8) {
revert InvalidNonce();
revert SiweParser_InvalidNonce();
}
(p.issuedAt, i) = _parseField(siweMsg, "Issued At", i);
(p.expirationTime, i) = _parseField(siweMsg, "Expiration Time", i);
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/auth/A13e.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ abstract contract A13e {
mapping(bytes32 => bool) internal _revokedAuthTokens;

/// The authentication token was revoked
error RevokedAuthToken();
error A13e_RevokedAuthToken();

/**
* @notice Reverts if the given token was revoked
*/
modifier checkRevokedAuthToken(bytes memory token) {
if (_revokedAuthTokens[keccak256(token)]) {
revert RevokedAuthToken();
revert A13e_RevokedAuthToken();
}
_;
}
Expand Down

0 comments on commit 9b74727

Please sign in to comment.