Skip to content

Commit

Permalink
redeploy with byte fix after signal
Browse files Browse the repository at this point in the history
  • Loading branch information
lorbke committed Nov 16, 2024
1 parent 3e95f19 commit 8786e84
Show file tree
Hide file tree
Showing 14 changed files with 432 additions and 383 deletions.
61 changes: 61 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/480/run-1731794987.json

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/480/run-1731795767.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"transactions": [
{
"hash": "0x73efc8e278b57040a64e082a88a9e9887d50d2491cc43d0542c01b996849d2b0",
"transactionType": "CREATE",
"contractName": "WorldIDRegister",
"contractAddress": "0xe988f1c08a61842a4fb91bbc79720730caf22723",
"function": null,
"arguments": [
"0x17B354dD2595411ff79041f930e491A4Df39A278",
"1",
"app_22ea9fb73d53333c2997e8f16e60cc6b",
"registration"
],
"transaction": {
"from": "0x4639b9f663c14bad89ddcc16966e85bc81dccd40",
"gas": "0x80b33",
"value": "0x0",
"input": "0x60c0604052600160805234801561001557600080fd5b5060405161084b38038061084b83398101604081905261003491610199565b600080546001600160a01b0319166001600160a01b0386161790556080839052604051610094906100829061006d90859060200161022b565b60408051601f198184030181529190526100a1565b8260405160200161006d929190610247565b60a0525061026d92505050565b60006008826040516020016100b6919061022b565b60408051601f198184030181529190528051602090910120901c92915050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101075781810151838201526020016100ef565b50506000910152565b600082601f83011261012157600080fd5b81516001600160401b0381111561013a5761013a6100d6565b604051601f8201601f19908116603f011681016001600160401b0381118282101715610168576101686100d6565b60405281815283820160200185101561018057600080fd5b6101918260208301602087016100ec565b949350505050565b600080600080608085870312156101af57600080fd5b84516001600160a01b03811681146101c657600080fd5b6020860151604087015191955093506001600160401b038111156101e957600080fd5b6101f587828801610110565b606087015190935090506001600160401b0381111561021357600080fd5b61021f87828801610110565b91505092959194509250565b6000825161023d8184602087016100ec565b9190910192915050565b8281526000825161025f8160208501602087016100ec565b919091016020019392505050565b60805160a0516105b9610292600039600061021e015260006101e001526105b96000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c8063753e9ef014610046578063a87430ba14610076578063d4e51d30146100b2575b600080fd5b600054610059906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009d610084366004610354565b6001602081905260009182526040909120805491015482565b6040805192835260208301919091520161006d565b6100c56100c03660046103cb565b6100c7565b005b33600090815260016020526040902054156101225760405162461bcd60e51b815260206004820152601660248201527507573657220616c7265616479207369676e65642075760541b60448201526064015b60405180910390fd5b60003390506000806000848060200190518101906101409190610465565b600082815260026020526040902054929550909350915060ff1615156001036101ab5760405162461bcd60e51b815260206004820152601e60248201527f6e756c6c69666965724861736820616c7265616479206578697374696e6700006044820152606401610119565b6000546040516bffffffffffffffffffffffff19606087901b1660208201526001600160a01b0390911690633bc778e39085907f00000000000000000000000000000000000000000000000000000000000000009061021b9060340160405160208183030381529060405261031f565b867f0000000000000000000000000000000000000000000000000000000000000000876040518763ffffffff1660e01b815260040161025f969594939291906104fb565b60006040518083038186803b15801561027757600080fd5b505afa15801561028b573d6000803e3d6000fd5b5050506000838152600260209081526040808320805460ff1916600190811790915581518083018352878152438185019081526001600160a01b038b168087528386529584902082518082559151930183905583519081529384019190915293507f47c8e83729a89f8b0c23b722e4c21f48295ddfcd683910c564e11e6b6037d01c910160405180910390a2505050505050565b60006008826040516020016103349190610554565b60408051601f198184030181529190528051602090910120901c92915050565b60006020828403121561036657600080fd5b81356001600160a01b038116811461037d57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156103c3576103c3610384565b604052919050565b6000602082840312156103dd57600080fd5b813567ffffffffffffffff8111156103f457600080fd5b8201601f8101841361040557600080fd5b803567ffffffffffffffff81111561041f5761041f610384565b610432601f8201601f191660200161039a565b81815285602083850101111561044757600080fd5b81602084016020830137600091810160200191909152949350505050565b6000806000610140848603121561047b57600080fd5b835160208501519093509150605f8401851361049657600080fd5b604051610100810167ffffffffffffffff811182821017156104ba576104ba610384565b604052806101408601878111156104d057600080fd5b604087015b818110156104ed5780518352602092830192016104d5565b505050809150509250925092565b60006101a08201905087825286602083015285604083015284606083015283608083015260a082018360005b6008811015610546578151835260209283019290910190600101610527565b505050979650505050505050565b6000825160005b81811015610575576020818601810151858301520161055b565b50600092019182525091905056fea26469706673582212208a9c7e5f1fc89db10c4569d1872c590bc7a5c1ecbff38d9d1125c60f0934605964736f6c634300081c003300000000000000000000000017b354dd2595411ff79041f930e491a4df39a2780000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000246170705f323265613966623733643533333333633239393765386631366536306363366200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c726567697374726174696f6e0000000000000000000000000000000000000000",
"nonce": "0x1d",
"chainId": "0x1e0"
},
"additionalContracts": [],
"isFixedGasLimit": false
}
],
"receipts": [
{
"status": "0x1",
"cumulativeGasUsed": "0xb47be",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"type": "0x0",
"transactionHash": "0x73efc8e278b57040a64e082a88a9e9887d50d2491cc43d0542c01b996849d2b0",
"transactionIndex": "0x2",
"blockHash": "0x4d957378810a18747bdb9ae822950a5651ece6224c542162fcb2a7e6b5879703",
"blockNumber": "0x5f102f",
"gasUsed": "0x63098",
"effectiveGasPrice": "0xf4340",
"blobGasUsed": "0x0",
"from": "0x4639b9f663c14bad89ddcc16966e85bc81dccd40",
"to": null,
"contractAddress": "0xe988f1c08a61842a4fb91bbc79720730caf22723",
"l1BaseFeeScalar": "0x21f9",
"l1BlobBaseFee": "0x4ef9325c",
"l1BlobBaseFeeScalar": "0xc5f4f",
"l1Fee": "0x3533b25ebc6",
"l1GasPrice": "0x24b66e53f",
"l1GasUsed": "0x5d6e"
}
],
"libraries": [],
"pending": [],
"returns": {},
"timestamp": 1731795767,
"chain": 480,
"commit": "3e95f19"
}
61 changes: 61 additions & 0 deletions packages/foundry/broadcast/Deploy.s.sol/480/run-1731796052.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 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 hashToFieldSixtyNine(bytes memory value) internal pure returns (uint256) {
function hashToField(bytes memory value) internal pure returns (uint256) {
return uint256(keccak256(abi.encodePacked(value))) >> 8;
}
}
7 changes: 3 additions & 4 deletions packages/foundry/contracts/HumanOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {ByteHasher} from "./ByteHasher.sol";

contract HumanOracle {

using ByteHasher for bytes;

// ====================
// ====== Structs =====
// ====================
Expand Down Expand Up @@ -119,7 +117,8 @@ contract HumanOracle {
constructor(address _worldIdAddr, uint256 _groupId, string memory _appId, string memory _action) {
worldId = IWorldID(_worldIdAddr);
groupId = _groupId;
externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToFieldSixtyNine(), _action).hashToFieldSixtyNine();
externalNullifierHash = ByteHasher.hashToField(abi.encodePacked(ByteHasher.hashToField(abi.encodePacked(_appId)), _action));
// externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToField(), _action).hashToField();
}

// ====================
Expand All @@ -137,7 +136,7 @@ contract HumanOracle {
worldId.verifyProof(
merkleRoot,
groupId,
abi.encodePacked(userAddr).hashToFieldSixtyNine(),
ByteHasher.hashToField(abi.encodePacked(userAddr)),
nullifierHash,
externalNullifierHash,
proof
Expand Down
6 changes: 2 additions & 4 deletions packages/foundry/contracts/HumanOracleWithVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {IERC20} from "../interfaces/IERC20.sol";

contract HumanOracleWithVault is Permit2Vault {

using ByteHasher for bytes;

// ====================
// ====== Structs =====
// ====================
Expand Down Expand Up @@ -123,7 +121,7 @@ contract HumanOracleWithVault is Permit2Vault {
worldId = IWorldID(_worldIdAddr);
worldToken = IERC20(_worldTokenAddr);
groupId = _groupId;
externalNullifierHash = abi.encodePacked(abi.encodePacked(_appId).hashToFieldSixtyNine(), _action).hashToFieldSixtyNine();
externalNullifierHash = ByteHasher.hashToField(abi.encodePacked(ByteHasher.hashToField(abi.encodePacked(_appId)), _action));
}

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

0 comments on commit 8786e84

Please sign in to comment.