Skip to content

Commit

Permalink
fix: eip712 data type for nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
fermentfan committed Sep 7, 2023
1 parent da27159 commit ab252c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
32 changes: 16 additions & 16 deletions contracts/RevocationRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_changeStatus(revoked, namespace, revocationList, revocationKey);
}

function _hashChangeStatus(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey, address signer, uint nonce) internal view returns (bytes32) {
function _hashChangeStatus(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("ChangeStatus(bool revoked,address namespace,bytes32 revocationList,bytes32 revocationKey,address signer,uint nonce)"),
keccak256("ChangeStatus(bool revoked,address namespace,bytes32 revocationList,bytes32 revocationKey,address signer,uint256 nonce)"),
revoked,
namespace,
revocationList,
Expand All @@ -110,9 +110,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_changeStatus(revoked, namespace, revocationList, revocationKey);
}

function _hashChangeStatusDelegated(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey, address signer, uint nonce) internal view returns (bytes32) {
function _hashChangeStatusDelegated(bool revoked, address namespace, bytes32 revocationList, bytes32 revocationKey, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("ChangeStatusDelegated(bool revoked,address namespace,bytes32 revocationList,bytes32 revocationKey,address signer,uint nonce)"),
keccak256("ChangeStatusDelegated(bool revoked,address namespace,bytes32 revocationList,bytes32 revocationKey,address signer,uint256 nonce)"),
revoked,
namespace,
revocationList,
Expand Down Expand Up @@ -142,9 +142,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_changeStatusesInList(revoked, namespace, revocationList, revocationKeys);
}

function _hashChangeStatusesInList(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys, address signer, uint nonce) internal view returns (bytes32) {
function _hashChangeStatusesInList(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("ChangeStatusesInList(bool[] revoked,address namespace,bytes32 revocationList,bytes32[] revocationKeys,address signer,uint nonce)"),
keccak256("ChangeStatusesInList(bool[] revoked,address namespace,bytes32 revocationList,bytes32[] revocationKeys,address signer,uint256 nonce)"),
keccak256(abi.encodePacked(revoked)),
namespace,
revocationList,
Expand All @@ -167,9 +167,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_changeStatusesInList(revoked, namespace, revocationList, revocationKeys);
}

function _hashChangeStatusesInListDelegated(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys, address signer, uint nonce) internal view returns (bytes32) {
function _hashChangeStatusesInListDelegated(bool[] memory revoked, address namespace, bytes32 revocationList, bytes32[] memory revocationKeys, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("ChangeStatusesInListDelegated(bool[] revoked,address namespace,bytes32 revocationList,bytes32[] revocationKeys,address signer,uint nonce)"),
keccak256("ChangeStatusesInListDelegated(bool[] revoked,address namespace,bytes32 revocationList,bytes32[] revocationKeys,address signer,uint256 nonce)"),
keccak256(abi.encodePacked(revoked)),
namespace,
revocationList,
Expand Down Expand Up @@ -198,9 +198,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_changeListOwner(namespace, newOwner, revocationList);
}

function _hashChangeListOwner(address namespace, address newOwner, bytes32 revocationList, address signer, uint nonce) internal view returns (bytes32) {
function _hashChangeListOwner(address namespace, address newOwner, bytes32 revocationList, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("ChangeListOwner(address namespace,address newOwner,bytes32 revocationList,address signer,uint nonce)"),
keccak256("ChangeListOwner(address namespace,address newOwner,bytes32 revocationList,address signer,uint256 nonce)"),
namespace,
newOwner,
revocationList,
Expand All @@ -227,9 +227,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_changeListStatus(revoked, namespace, revocationList);
}

function _hashChangeListStatus(bool revoked, address namespace, bytes32 revocationList, address signer, uint nonce) internal view returns (bytes32) {
function _hashChangeListStatus(bool revoked, address namespace, bytes32 revocationList, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("ChangeListStatus(bool revoked,address namespace,bytes32 revocationList,address signer,uint nonce)"),
keccak256("ChangeListStatus(bool revoked,address namespace,bytes32 revocationList,address signer,uint256 nonce)"),
revoked,
namespace,
revocationList,
Expand Down Expand Up @@ -258,9 +258,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_addListDelegate(namespace, delegate, revocationList, validity);
}

function _hashAddListDelegate(address namespace, address delegate, bytes32 revocationList, uint validity, address signer, uint nonce) internal view returns (bytes32) {
function _hashAddListDelegate(address namespace, address delegate, bytes32 revocationList, uint validity, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("AddListDelegate(address namespace,address delegate,bytes32 revocationList,uint validity,address signer,uint nonce)"),
keccak256("AddListDelegate(address namespace,address delegate,bytes32 revocationList,uint validity,address signer,uint256 nonce)"),
namespace,
delegate,
revocationList,
Expand Down Expand Up @@ -289,9 +289,9 @@ contract RevocationRegistry is Initializable, EIP712Upgradeable, PausableUpgrade
_removeListDelegate(namespace, delegate, revocationList);
}

function _hashRemoveListDelegate(address namespace, address delegate, bytes32 revocationList, address signer, uint nonce) internal view returns (bytes32) {
function _hashRemoveListDelegate(address namespace, address delegate, bytes32 revocationList, address signer, uint256 nonce) internal view returns (bytes32) {
return _hashTypedDataV4(keccak256(abi.encode(
keccak256("RemoveListDelegate(address namespace,address delegate,bytes32 revocationList,address signer,uint nonce)"),
keccak256("RemoveListDelegate(address namespace,address delegate,bytes32 revocationList,address signer,uint256 nonce)"),
namespace,
delegate,
revocationList,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spherity/ethr-revocation-registry",
"version": "1.0.13",
"version": "1.1.0",
"description": "The Ethereum Revocation List types for smart contract interaction.",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
18 changes: 9 additions & 9 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const EIP712ChangeStatusType = {
{name: 'revocationList', type: 'bytes32'} as TypedDataField,
{name: 'revocationKey', type: 'bytes32'} as TypedDataField,
{name: 'signer', type: 'address'} as TypedDataField,
{name: 'nonce', type: 'uint'} as TypedDataField,
{name: 'nonce', type: 'uint256'} as TypedDataField,
]
}

Expand All @@ -20,7 +20,7 @@ export const EIP712ChangeStatusDelegatedType = {
{name: 'revocationList', type: 'bytes32'} as TypedDataField,
{name: 'revocationKey', type: 'bytes32'} as TypedDataField,
{name: 'signer', type: 'address'} as TypedDataField,
{name: 'nonce', type: 'uint'} as TypedDataField,
{name: 'nonce', type: 'uint256'} as TypedDataField,
]
}

Expand All @@ -31,7 +31,7 @@ export const EIP712ChangeStatusesInListType = {
{name: 'revocationList', type: 'bytes32'},
{name: 'revocationKeys', type: 'bytes32[]'},
{name: 'signer', type: 'address'},
{name: 'nonce', type: 'uint'},
{name: 'nonce', type: 'uint256'},
]
}

Expand All @@ -42,7 +42,7 @@ export const EIP712ChangeStatusesInListDelegatedType = {
{name: 'revocationList', type: 'bytes32'},
{name: 'revocationKeys', type: 'bytes32[]'},
{name: 'signer', type: 'address'},
{name: 'nonce', type: 'uint'},
{name: 'nonce', type: 'uint256'},
]
}

Expand All @@ -52,7 +52,7 @@ export const EIP712ChangeListOwnerType = {
{name: 'newOwner', type: 'address'},
{name: 'revocationList', type: 'bytes32'},
{name: 'signer', type: 'address'},
{name: 'nonce', type: 'uint'},
{name: 'nonce', type: 'uint256'},
]
}

Expand All @@ -61,9 +61,9 @@ export const EIP712AddListDelegateType = {
{name: 'namespace', type: 'address'},
{name: 'delegate', type: 'address'},
{name: 'revocationList', type: 'bytes32'},
{name: 'validity', type: 'uint'},
{name: 'validity', type: 'uint256'},
{name: 'signer', type: 'address'},
{name: 'nonce', type: 'uint'},
{name: 'nonce', type: 'uint256'},
]
}

Expand All @@ -73,7 +73,7 @@ export const EIP712RemoveListDelegateType = {
{name: 'delegate', type: 'address'},
{name: 'revocationList', type: 'bytes32'},
{name: 'signer', type: 'address'},
{name: 'nonce', type: 'uint'},
{name: 'nonce', type: 'uint256'},
]
}

Expand All @@ -83,6 +83,6 @@ export const EIP712ChangeListStatusType = {
{name: 'namespace', type: 'address'},
{name: 'revocationList', type: 'bytes32'},
{name: 'signer', type: 'address'},
{name: 'nonce', type: 'uint'},
{name: 'nonce', type: 'uint256'},
]
}

0 comments on commit ab252c5

Please sign in to comment.