Skip to content

Commit

Permalink
redeploy with renamed ByteHasher function
Browse files Browse the repository at this point in the history
  • Loading branch information
lorbke committed Nov 16, 2024
1 parent bbe76ef commit 3e95f19
Show file tree
Hide file tree
Showing 10 changed files with 449 additions and 26 deletions.
61 changes: 61 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/480/run-1731794559.json

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions packages/foundry/broadcast/Deploy.s.sol/480/run-latest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/foundry/contracts/ByteHasher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ library ByteHasher {
/// @param value The bytestring to hash
/// @return The hash of the specified value
/// @dev `>> 8` makes sure that the result is included in our field
function hashToField(bytes memory value) internal pure returns (uint256) {
function hashToFieldSixtyNine(bytes memory value) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(value))) >> 8;
}
}
4 changes: 2 additions & 2 deletions packages/foundry/contracts/HumanOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ contract HumanOracle {
constructor(address _worldIdAddr, uint256 _groupId, string memory _appId, string memory _action) {
worldId = IWorldID(_worldIdAddr);
groupId = _groupId;
externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToField(), _action).hashToField();
externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToFieldSixtyNine(), _action).hashToFieldSixtyNine();
}

// ====================
Expand All @@ -137,7 +137,7 @@ contract HumanOracle {
worldId.verifyProof(
merkleRoot,
groupId,
abi.encodePacked(userAddr).hashToField(),
abi.encodePacked(userAddr).hashToFieldSixtyNine(),
nullifierHash,
externalNullifierHash,
proof
Expand Down
4 changes: 2 additions & 2 deletions packages/foundry/contracts/HumanOracleWithVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ contract HumanOracleWithVault is Permit2Vault {
worldId = IWorldID(_worldIdAddr);
worldToken = IERC20(_worldTokenAddr);
groupId = _groupId;
externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToField(), _action).hashToField();
externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToFieldSixtyNine(), _action).hashToFieldSixtyNine();
}

// ====================
Expand All @@ -147,7 +147,7 @@ contract HumanOracleWithVault is Permit2Vault {
worldId.verifyProof(
merkleRoot,
groupId,
abi.encodePacked(userAddr).hashToField(),
abi.encodePacked(userAddr).hashToFieldSixtyNine(),
nullifierHash,
externalNullifierHash,
proof
Expand Down
Loading

0 comments on commit 3e95f19

Please sign in to comment.