Skip to content

Commit

Permalink
fix: auth validity verification when impersonating (#39)
Browse files Browse the repository at this point in the history

Co-authored-by: leo Sayous <[email protected]>
  • Loading branch information
yum0e and leosayous21 authored Jul 13, 2023
1 parent 1b35153 commit 057dba2
Show file tree
Hide file tree
Showing 20 changed files with 294 additions and 183 deletions.
4 changes: 2 additions & 2 deletions deployments/arbitrum-goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x797Dd53c383f7819D54D3aDd6b90c7Ba67E89952",
"hydraS3Verifier": "0x9854860CBEa52E19Ca252D1948F04070eBC46b2C",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0x8eAb4616d47F82C890fdb6eE311A4C0aE34ba7fb",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x90a7fe1D98303Af175Cb6BD0564D5a643Ba1a3c5"
"sismoConnectVerifier": "0xb1327210BAF0E8793f3f4D671573ac1A45619edf"
}
4 changes: 2 additions & 2 deletions deployments/arbitrum-one.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0x39Fcdd48c8EEaa7B0cB918587C22143fE803fAA2",
"hydraS3Verifier": "0xAa745f3833faCE895E0e7f99eD0A4989a470E150",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x40e208f4815Ce25b32BeEEC7415C6CA9424a898F",
"rootsOwner": "0x1BB9AD70F529e36B7Ffed0cfA44fA4cf0213Fa09",
"signatureBuilder": "0x1e7a99e06Ca2C1A63330eC2df8D4fC15EfDa4C55",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x94E772DBe3ce4BD32274a2053C444C802Bb836A5"
"sismoConnectVerifier": "0x80a914AaFB60519a58f531D80fd402ae88047896"
}
4 changes: 2 additions & 2 deletions deployments/gnosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"hydraS3Verifier": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0x0F85c4Fe7644E85579e27A027D94d1Fb3A388710",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x1B05f16686396398F16f8916A032D738005126b7",
"rootsOwner": "0xEf809a50de35c762FBaCf1ae1F6B861CE42911D1",
"signatureBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x39Fcdd48c8EEaa7B0cB918587C22143fE803fAA2"
"sismoConnectVerifier": "0xd1fbf35B45748B2F6998fb7B86eb6A3d73fe91ED"
}
6 changes: 3 additions & 3 deletions deployments/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xb4463Dbcd773F7Ca37E63f12dce9852e59dC86C9",
"hydraS3Verifier": "0x24AAf479DCF0bb3c9f06eA4af0E0e620451a47C5",
"hydraS3Verifier": "0x89f40fd037e62eAec7511b0711f781AA57A3e96f",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"rootsOwner": "0x2a265b954B96d4940B94eb69E8Fc8E7346369D05",
"signatureBuilder": "0x0c5a188E778a9A0736fCBf25aF6298E92182D676",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x1ec082560ab5938ec8D768211684D57089F4D73c"
}
"sismoConnectVerifier": "0x0568ecE836a0881cd305ad53046AB51467B0886a"
}
4 changes: 2 additions & 2 deletions deployments/optimism-goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x797Dd53c383f7819D54D3aDd6b90c7Ba67E89952",
"hydraS3Verifier": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0xe807B5153e3eD4767C3F4EB50b65Fab90c57596B",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x90a7fe1D98303Af175Cb6BD0564D5a643Ba1a3c5"
"sismoConnectVerifier": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4"
}
4 changes: 2 additions & 2 deletions deployments/optimism.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0x39Fcdd48c8EEaa7B0cB918587C22143fE803fAA2",
"hydraS3Verifier": "0x1C4Bd61F5b19750ffb7b0b2D97c77dcf68F49152",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x40e208f4815Ce25b32BeEEC7415C6CA9424a898F",
"rootsOwner": "0xf8640cE5532BCbc788489Bf5A786635ae585258B",
"signatureBuilder": "0x1e7a99e06Ca2C1A63330eC2df8D4fC15EfDa4C55",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x94E772DBe3ce4BD32274a2053C444C802Bb836A5"
"sismoConnectVerifier": "0xAE116c797ae424BF232DfFcdF8a3b741D9e6460c"
}
4 changes: 2 additions & 2 deletions deployments/polygon.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xEB2952A4098e15C97E1Ce126FE479f27E2FFB40c",
"hydraS3Verifier": "0x43A6b844f52CB2CC3c9dBcAE9D853B21fF05c4bD",
"hydraS3Verifier": "0x027AcA627F7D13572A54ac2d027A770ca3eF22c8",
"owner": "0x00c92065F759c3d1c94d08C27a2Ab97a1c874Cbc",
"proxyAdmin": "0x2110475dfbB8d331b300178A867372991ff35fA3",
"requestBuilder": "0x1B05f16686396398F16f8916A032D738005126b7",
"rootsOwner": "0xF0a0B692e1c764281c211948D03edEeF5Fb57111",
"signatureBuilder": "0x8D090172DA53A21D27E7B651ab6E7D9334Ea0783",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x39Fcdd48c8EEaa7B0cB918587C22143fE803fAA2"
"sismoConnectVerifier": "0x1C4Bd61F5b19750ffb7b0b2D97c77dcf68F49152"
}
4 changes: 2 additions & 2 deletions deployments/scroll-testnet-goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x797Dd53c383f7819D54D3aDd6b90c7Ba67E89952",
"hydraS3Verifier": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0x8f9c04d7bA132Fd0CbA124eFCE3936328d217458",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x90a7fe1D98303Af175Cb6BD0564D5a643Ba1a3c5"
"sismoConnectVerifier": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4"
}
4 changes: 2 additions & 2 deletions deployments/testnet-goerli.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x797Dd53c383f7819D54D3aDd6b90c7Ba67E89952",
"hydraS3Verifier": "0x1F60E4023C84e7e5897722b04BEc3De7eEa78DEF",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0xa687922C4bf2eB22297FdF89156B49eD3727618b",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x90a7fe1D98303Af175Cb6BD0564D5a643Ba1a3c5"
"sismoConnectVerifier": "0x2bF68E251A94c83dB3da30a5A997c73705DF1B8b"
}
4 changes: 2 additions & 2 deletions deployments/testnet-mumbai.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4",
"hydraS3Verifier": "0x7750e3e6Df6b5ff1C11ba86A704A366C2187Aab2",
"hydraS3Verifier": "0xBA63Ad5f5570B7Adc82319529eB0694B31f2422E",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0xc33d0496571513c676de73b13c7166e245CD4d5E",
"rootsOwner": "0xCA0583A6682607282963d3E2545Cd2e75697C2bb",
"signatureBuilder": "0x16Cb98567cE6f177C1855906230874AE8c5a8B7f",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0xdF95A1b9480a476f8e2ec8E9261fA66cDB96A6b1"
"sismoConnectVerifier": "0xf219113C648dA1D9F0f12EB1898A6a22fEe86dF8"
}
4 changes: 2 additions & 2 deletions deployments/testnet-sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"pubKeyY": 14672613011011178056703002414016466661118036128791343632962870104486584019450
},
"commitmentMapperRegistry": "0x497f369f94F207663A348b0ac085397C71279bf5",
"hydraS3Verifier": "0x797Dd53c383f7819D54D3aDd6b90c7Ba67E89952",
"hydraS3Verifier": "0x51B3ec080D1459232dbea86B751F75b5204a4abC",
"owner": "0xBB8FcA8f2381CFeEDe5D7541d7bF76343EF6c67B",
"proxyAdmin": "0x246E71bC2a257f4BE9C7fAD4664E6D7444844Adc",
"requestBuilder": "0x0bB5c193aa815F7815aB8e854A87E041519CD2ad",
"rootsOwner": "0x1C0c54EA7Bb55f655fb8Ff6D51557368bA8624E6",
"signatureBuilder": "0xc8F165a3B4CfB7CD2Ae92A582F17b0d7EB3BcE11",
"sismoAddressesProviderV2": "0x3Cd5334eB64ebBd4003b72022CC25465f1BFcEe6",
"sismoConnectVerifier": "0x90a7fe1D98303Af175Cb6BD0564D5a643Ba1a3c5"
"sismoConnectVerifier": "0xAe5f6F591d9F8a5eEB3E6853888B0E80eC9B25E4"
}
6 changes: 5 additions & 1 deletion script/bash/setup-fork.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#! /bin/bash

# Usage
# in a first terminal, launch a fork with anvil: `anvil --fork-url https://rpc.ankr.com/polygon_mumbai`
# in a second terminal, setup the fork to your needs: `yarn setup-fork testnet-mumbai`

# Get chain name from command line arguments to get the config file
chain_name=$1
config_file="./deployments/tmp/${chain_name}.json"
Expand Down Expand Up @@ -40,7 +44,7 @@ declare -a contract_values=("authRequestBuilder-v1.1"
"hydraS3Verifier"
"requestBuilder-v1.1"
"signatureBuilder-v1.1"
"sismoConnectVerifier-v1.1")
"sismoConnectVerifier-v1.2")

# Loop over contract names
for index in "${!contract_keys[@]}"
Expand Down
2 changes: 1 addition & 1 deletion script/utils/SetAddressesProvider.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ contract SetAddressesProvider is Script, BaseDeploymentConfig {

vm.startBroadcast();

_setAddress(config.sismoConnectVerifier, string("sismoConnectVerifier-v1.1"));
_setAddress(config.sismoConnectVerifier, string("sismoConnectVerifier-v1.2"));
_setAddress(config.hydraS3Verifier, string("hydraS3Verifier"));
_setAddress(config.availableRootsRegistry, string("sismoConnectAvailableRootsRegistry"));
_setAddress(config.commitmentMapperRegistry, string("sismoConnectCommitmentMapperRegistry"));
Expand Down
10 changes: 5 additions & 5 deletions src/libs/sismo-connect/SismoConnectLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ contract SismoConnect {
IS_IMPERSONATION_MODE = _config.vault.isImpersonationMode;

_sismoConnectVerifier = ISismoConnectVerifier(
ADDRESSES_PROVIDER_V2.get(string("sismoConnectVerifier-v1.1"))
ADDRESSES_PROVIDER_V2.get(string("sismoConnectVerifier-v1.2"))
);
// external libraries
_authRequestBuilder = AuthRequestBuilder(
Expand Down Expand Up @@ -653,26 +653,26 @@ contract SismoConnect {
function buildSignature(
bytes memory message,
bytes memory extraData
) external view returns (SignatureRequest memory) {
) internal view returns (SignatureRequest memory) {
return _signatureBuilder.build(message, extraData);
}

function buildSignature(
bytes memory message,
bool isSelectableByUser,
bytes memory extraData
) external view returns (SignatureRequest memory) {
) internal view returns (SignatureRequest memory) {
return _signatureBuilder.build(message, isSelectableByUser, extraData);
}

function buildSignature(bool isSelectableByUser) external view returns (SignatureRequest memory) {
function buildSignature(bool isSelectableByUser) internal view returns (SignatureRequest memory) {
return _signatureBuilder.build(isSelectableByUser);
}

function buildSignature(
bool isSelectableByUser,
bytes memory extraData
) external view returns (SignatureRequest memory) {
) internal view returns (SignatureRequest memory) {
return _signatureBuilder.build(isSelectableByUser, extraData);
}

Expand Down
92 changes: 92 additions & 0 deletions src/misc/CheatSheet.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "../libs/sismo-connect/SismoConnectLib.sol";
import "forge-std/console.sol";

contract CheatSheet is SismoConnect {
// reference your appId
bytes16 private _appId = 0x32403ced4b65f2079eda77c84e7d2be6;
// allow impersonation
bool private _isImpersonationMode = true;

constructor()
// use buildConfig helper to easily build a Sismo Connect config in Solidity
SismoConnect(buildConfig({appId: _appId, isImpersonationMode: _isImpersonationMode}))
{}

function verifySismoConnectResponse(bytes memory response) public {
// Recreate the request made in the fontend to verify the proof
AuthRequest[] memory auths = new AuthRequest[](6);
auths[0] = _authRequestBuilder.build({authType: AuthType.VAULT});
auths[1] = _authRequestBuilder.build({authType: AuthType.EVM_ACCOUNT});
auths[2] = _authRequestBuilder.build({
authType: AuthType.EVM_ACCOUNT,
userId: uint160(0xA4C94A6091545e40fc9c3E0982AEc8942E282F38)
});
auths[3] = _authRequestBuilder.build({authType: AuthType.GITHUB});
auths[4] = _authRequestBuilder.build({
authType: AuthType.TWITTER,
userId: 295218901,
isOptional: true,
isSelectableByUser: false
});
auths[5] = _authRequestBuilder.build({
authType: AuthType.TELEGRAM,
userId: 875608110,
isOptional: true,
isSelectableByUser: false
});

ClaimRequest[] memory claims = new ClaimRequest[](6);
claims[0] = _claimRequestBuilder.build({groupId: 0xfae674b6cba3ff2f8ce2114defb200b1});
claims[1] = _claimRequestBuilder.build({
groupId: 0x1cde61966decb8600dfd0749bd371f12,
claimType: ClaimType.GTE,
value: 15
});
claims[2] = _claimRequestBuilder.build({
groupId: 0xfae674b6cba3ff2f8ce2114defb200b1,
claimType: ClaimType.EQ,
value: 10
});
claims[3] = _claimRequestBuilder.build({
groupId: 0x1cde61966decb8600dfd0749bd371f12,
claimType: ClaimType.EQ,
value: 15,
isSelectableByUser: true,
isOptional: true
});
claims[4] = _claimRequestBuilder.build({
groupId: 0xfae674b6cba3ff2f8ce2114defb200b1,
claimType: ClaimType.GTE,
isSelectableByUser: true,
isOptional: true
});
claims[5] = _claimRequestBuilder.build({
groupId: 0x1cde61966decb8600dfd0749bd371f12,
claimType: ClaimType.GTE,
value: 25,
isSelectableByUser: true,
isOptional: false
});

SismoConnectVerifiedResult memory result = verify({
responseBytes: response,
auths: auths,
claims: claims,
signature: _signatureBuilder.build({message: abi.encode("I love Sismo!")})
});

uint256 vaultId = SismoConnectHelper.getUserId(result, AuthType.VAULT);
uint256 githubId = SismoConnectHelper.getUserId(result, AuthType.GITHUB);
uint256 telegramId = SismoConnectHelper.getUserId(result, AuthType.TELEGRAM);
uint256[] memory evmAccountIds = SismoConnectHelper.getUserIds(result, AuthType.EVM_ACCOUNT);

console.log("Vault ID: %s", vaultId);
console.log("Github ID: %s", githubId);
console.log("Telegram ID: %s", telegramId);
console.log("First EVM Account ID: %s", evmAccountIds[0]);
console.log("Second EVM Account ID: %s", evmAccountIds[1]);
}
}
21 changes: 14 additions & 7 deletions src/verifiers/HydraS3Verifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ contract HydraS3Verifier is IHydraS3Verifier, IBaseVerifier, HydraS3SnarkVerifie
// Registry storing the Registry Tree Roots of the Attester's available ClaimData
IAvailableRootsRegistry public immutable AVAILABLE_ROOTS_REGISTRY;

// Impersonation Commitment Mapper EdDSA Public key
uint256 public constant impersonationCommitmentMapperPubKeyX =
0x1801b584700a740f9576cc7e83745895452edc518a9ce60b430e1272fc4eb93b;
uint256 public constant impersonationCommitmentMapperPubKeyY =
0x057cf80de4f8dd3e4c56f948f40c28c3acbeca71ef9f825597bf8cc059f1238b;

constructor(address commitmentMapperRegistry, address availableRootsRegistry) {
COMMITMENT_MAPPER_REGISTRY = ICommitmentMapperRegistry(commitmentMapperRegistry);
AVAILABLE_ROOTS_REGISTRY = IAvailableRootsRegistry(availableRootsRegistry);
Expand Down Expand Up @@ -81,7 +87,8 @@ contract HydraS3Verifier is IHydraS3Verifier, IBaseVerifier, HydraS3SnarkVerifie
hydraS3Proof.input,
sismoConnectProof.proofData,
auth,
appId
appId,
isImpersonationMode
);
}
if (sismoConnectProof.claims.length == 1) {
Expand Down Expand Up @@ -133,10 +140,7 @@ contract HydraS3Verifier is IHydraS3Verifier, IBaseVerifier, HydraS3SnarkVerifie
// In impersonation mode, we use the EdDSA public key of the Impersonation Commitment Mapper
// otherwise we use the EdDSA public key of the Commitment Mapper Registry
uint256[2] memory commitmentMapperPubKey = isImpersonationMode
? [
0x1801b584700a740f9576cc7e83745895452edc518a9ce60b430e1272fc4eb93b,
0x057cf80de4f8dd3e4c56f948f40c28c3acbeca71ef9f825597bf8cc059f1238b
]
? [impersonationCommitmentMapperPubKeyX, impersonationCommitmentMapperPubKeyY]
: COMMITMENT_MAPPER_REGISTRY.getEdDSAPubKey();

if (
Expand Down Expand Up @@ -187,7 +191,8 @@ contract HydraS3Verifier is IHydraS3Verifier, IBaseVerifier, HydraS3SnarkVerifie
HydraS3ProofInput memory input,
bytes memory proofData,
Auth memory auth,
bytes16 appId
bytes16 appId,
bool isImpersonationMode
) private view returns (VerifiedAuth memory) {
uint256 userIdFromProof;
if (auth.authType == AuthType.VAULT) {
Expand All @@ -203,7 +208,9 @@ contract HydraS3Verifier is IHydraS3Verifier, IBaseVerifier, HydraS3SnarkVerifie
revert DestinationVerificationNotEnabled();
}
// commitmentMapperPubKey
uint256[2] memory commitmentMapperPubKey = COMMITMENT_MAPPER_REGISTRY.getEdDSAPubKey();
uint256[2] memory commitmentMapperPubKey = isImpersonationMode
? [impersonationCommitmentMapperPubKeyX, impersonationCommitmentMapperPubKeyY]
: COMMITMENT_MAPPER_REGISTRY.getEdDSAPubKey();
if (
input.commitmentMapperPubKey[0] != commitmentMapperPubKey[0] ||
input.commitmentMapperPubKey[1] != commitmentMapperPubKey[1]
Expand Down
Loading

0 comments on commit 057dba2

Please sign in to comment.