mirror of
https://github.com/selfxyz/self.git
synced 2026-01-09 14:48:06 -05:00
Contracts/deploy staging (#668)
* update scripts * deploy vc and disclose id * fix the deployment scripts on staging * update yarn.lock
This commit is contained in:
committed by
GitHub
parent
f08cfe11c0
commit
dd02d04a09
22
contracts/.gitignore
vendored
22
contracts/.gitignore
vendored
@@ -11,16 +11,20 @@ artifacts
|
||||
ignition/deployed_addresses.json
|
||||
ignition/parameters.json
|
||||
|
||||
# Ignore all deployment folders except important ones
|
||||
ignition/deployments/*
|
||||
!ignition/deployments/prod
|
||||
ignition/deployments/prod/*
|
||||
!ignition/deployments/prod/deployed_addresses.json
|
||||
!ignition/deployments/prod/artifacts
|
||||
ignition/deployments/prod/artifacts/*
|
||||
!ignition/deployments/prod/artifacts/*.json
|
||||
!ignition/deployments/prod/artifacts/**/*.json
|
||||
ignition/deployments/prod/artifacts/**/dbg.json
|
||||
ignition/deployments/prod/artifacts/dbg.json
|
||||
!ignition/deployments/prod/
|
||||
!ignition/deployments/staging/
|
||||
|
||||
# For important environments, keep only essential files
|
||||
ignition/deployments/{prod,staging}/*
|
||||
!ignition/deployments/{prod,staging}/deployed_addresses.json
|
||||
!ignition/deployments/{prod,staging}/artifacts/
|
||||
|
||||
# In artifacts, keep deployment files but exclude debug files
|
||||
ignition/deployments/{prod,staging}/artifacts/*
|
||||
!ignition/deployments/{prod,staging}/artifacts/**/*.json
|
||||
ignition/deployments/{prod,staging}/artifacts/**/*dbg.json
|
||||
|
||||
#Local verifier
|
||||
contracts/verifiers/local/*
|
||||
|
||||
443
contracts/error-selectors.json
Normal file
443
contracts/error-selectors.json
Normal file
@@ -0,0 +1,443 @@
|
||||
[
|
||||
{
|
||||
"name": "REGISTERED_COMMITMENT",
|
||||
"signature": "REGISTERED_COMMITMENT()",
|
||||
"selector": "0x034acfcc",
|
||||
"file": "contracts/registry/IdentityRegistryIdCardImplV1.sol",
|
||||
"line": 141
|
||||
},
|
||||
{
|
||||
"name": "REGISTERED_COMMITMENT",
|
||||
"signature": "REGISTERED_COMMITMENT()",
|
||||
"selector": "0x034acfcc",
|
||||
"file": "contracts/registry/IdentityRegistryImplV1.sol",
|
||||
"line": 149
|
||||
},
|
||||
{
|
||||
"name": "InvalidProof",
|
||||
"signature": "InvalidProof()",
|
||||
"selector": "0x09bde339",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 54
|
||||
},
|
||||
{
|
||||
"name": "NoVerifierSet",
|
||||
"signature": "NoVerifierSet()",
|
||||
"selector": "0x0ee78d58",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 110
|
||||
},
|
||||
{
|
||||
"name": "InvalidAttestationId",
|
||||
"signature": "InvalidAttestationId()",
|
||||
"selector": "0x12ec75fe",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 142
|
||||
},
|
||||
{
|
||||
"name": "InvalidAttestationId",
|
||||
"signature": "InvalidAttestationId()",
|
||||
"selector": "0x12ec75fe",
|
||||
"file": "contracts/libraries/CustomVerifier.sol",
|
||||
"line": 11
|
||||
},
|
||||
{
|
||||
"name": "RegistrationNotOpen",
|
||||
"signature": "RegistrationNotOpen()",
|
||||
"selector": "0x153745d3",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 63
|
||||
},
|
||||
{
|
||||
"name": "InvalidDscProof",
|
||||
"signature": "InvalidDscProof()",
|
||||
"selector": "0x1644e049",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 122
|
||||
},
|
||||
{
|
||||
"name": "InvalidYearRange",
|
||||
"signature": "InvalidYearRange()",
|
||||
"selector": "0x16f40c94",
|
||||
"file": "contracts/libraries/Formatter.sol",
|
||||
"line": 10
|
||||
},
|
||||
{
|
||||
"name": "InvalidDateDigit",
|
||||
"signature": "InvalidDateDigit()",
|
||||
"selector": "0x17af8154",
|
||||
"file": "contracts/libraries/Formatter.sol",
|
||||
"line": 14
|
||||
},
|
||||
{
|
||||
"name": "INVALID_OFAC_ROOT",
|
||||
"signature": "INVALID_OFAC_ROOT()",
|
||||
"selector": "0x1ce3d3ca",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 166
|
||||
},
|
||||
{
|
||||
"name": "RegisteredNullifier",
|
||||
"signature": "RegisteredNullifier()",
|
||||
"selector": "0x22cbc6a2",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 78
|
||||
},
|
||||
{
|
||||
"name": "InvalidMonthRange",
|
||||
"signature": "InvalidMonthRange()",
|
||||
"selector": "0x25e62788",
|
||||
"file": "contracts/libraries/Formatter.sol",
|
||||
"line": 11
|
||||
},
|
||||
{
|
||||
"name": "UserIdentifierAlreadyRegistered",
|
||||
"signature": "UserIdentifierAlreadyRegistered()",
|
||||
"selector": "0x29393238",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 75
|
||||
},
|
||||
{
|
||||
"name": "InvalidFieldElement",
|
||||
"signature": "InvalidFieldElement()",
|
||||
"selector": "0x3ae4ed6b",
|
||||
"file": "contracts/libraries/Formatter.sol",
|
||||
"line": 13
|
||||
},
|
||||
{
|
||||
"name": "InvalidOlderThan",
|
||||
"signature": "InvalidOlderThan()",
|
||||
"selector": "0x49aecbc2",
|
||||
"file": "contracts/libraries/CustomVerifier.sol",
|
||||
"line": 14
|
||||
},
|
||||
{
|
||||
"name": "InvalidDscCommitmentRoot",
|
||||
"signature": "InvalidDscCommitmentRoot()",
|
||||
"selector": "0x4cb305bb",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 134
|
||||
},
|
||||
{
|
||||
"name": "HUB_NOT_SET",
|
||||
"signature": "HUB_NOT_SET()",
|
||||
"selector": "0x4ffa9998",
|
||||
"file": "contracts/registry/IdentityRegistryIdCardImplV1.sol",
|
||||
"line": 137
|
||||
},
|
||||
{
|
||||
"name": "HUB_NOT_SET",
|
||||
"signature": "HUB_NOT_SET()",
|
||||
"selector": "0x4ffa9998",
|
||||
"file": "contracts/registry/IdentityRegistryImplV1.sol",
|
||||
"line": 145
|
||||
},
|
||||
{
|
||||
"name": "INVALID_COMMITMENT_ROOT",
|
||||
"signature": "INVALID_COMMITMENT_ROOT()",
|
||||
"selector": "0x52906601",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 162
|
||||
},
|
||||
{
|
||||
"name": "UnauthorizedCaller",
|
||||
"signature": "UnauthorizedCaller()",
|
||||
"selector": "0x5c427cd9",
|
||||
"file": "contracts/abstract/SelfVerificationRoot.sol",
|
||||
"line": 46
|
||||
},
|
||||
{
|
||||
"name": "UserIdentifierAlreadyMinted",
|
||||
"signature": "UserIdentifierAlreadyMinted()",
|
||||
"selector": "0x5dd09265",
|
||||
"file": "contracts/example/SelfIdentityERC721.sol",
|
||||
"line": 48
|
||||
},
|
||||
{
|
||||
"name": "InvalidOfacCheck",
|
||||
"signature": "InvalidOfacCheck()",
|
||||
"selector": "0x5fb542f4",
|
||||
"file": "contracts/libraries/CustomVerifier.sol",
|
||||
"line": 12
|
||||
},
|
||||
{
|
||||
"name": "CrossChainIsNotSupportedYet",
|
||||
"signature": "CrossChainIsNotSupportedYet()",
|
||||
"selector": "0x61296fbb",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 150
|
||||
},
|
||||
{
|
||||
"name": "AlreadyClaimed",
|
||||
"signature": "AlreadyClaimed()",
|
||||
"selector": "0x646cf558",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 57
|
||||
},
|
||||
{
|
||||
"name": "AlreadyClaimed",
|
||||
"signature": "AlreadyClaimed()",
|
||||
"selector": "0x646cf558",
|
||||
"file": "contracts/example/HappyBirthday.sol",
|
||||
"line": 64
|
||||
},
|
||||
{
|
||||
"name": "InputTooShort",
|
||||
"signature": "InputTooShort()",
|
||||
"selector": "0x65ec0cf1",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 154
|
||||
},
|
||||
{
|
||||
"name": "InvalidRegisterProof",
|
||||
"signature": "InvalidRegisterProof()",
|
||||
"selector": "0x67b61dc7",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 118
|
||||
},
|
||||
{
|
||||
"name": "RegistrationNotClosed",
|
||||
"signature": "RegistrationNotClosed()",
|
||||
"selector": "0x697e379b",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 66
|
||||
},
|
||||
{
|
||||
"name": "INVALID_DSC_PROOF",
|
||||
"signature": "INVALID_DSC_PROOF()",
|
||||
"selector": "0x6a86dd76",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 154
|
||||
},
|
||||
{
|
||||
"name": "ClaimNotOpen",
|
||||
"signature": "ClaimNotOpen()",
|
||||
"selector": "0x6b687806",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 69
|
||||
},
|
||||
{
|
||||
"name": "INVALID_OFAC",
|
||||
"signature": "INVALID_OFAC()",
|
||||
"selector": "0x71b125ed",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 146
|
||||
},
|
||||
{
|
||||
"name": "InvalidForbiddenCountries",
|
||||
"signature": "InvalidForbiddenCountries()",
|
||||
"selector": "0x82cba848",
|
||||
"file": "contracts/libraries/CustomVerifier.sol",
|
||||
"line": 13
|
||||
},
|
||||
{
|
||||
"name": "InsufficientCharcodeLen",
|
||||
"signature": "InsufficientCharcodeLen()",
|
||||
"selector": "0x86d41225",
|
||||
"file": "contracts/libraries/CircuitAttributeHandler.sol",
|
||||
"line": 15
|
||||
},
|
||||
{
|
||||
"name": "InsufficientCharcodeLen",
|
||||
"signature": "InsufficientCharcodeLen()",
|
||||
"selector": "0x86d41225",
|
||||
"file": "contracts/libraries/CircuitAttributeHandlerV2.sol",
|
||||
"line": 17
|
||||
},
|
||||
{
|
||||
"name": "InsufficientCharcodeLen",
|
||||
"signature": "InsufficientCharcodeLen()",
|
||||
"selector": "0x86d41225",
|
||||
"file": "contracts/libraries/IdCardAttributeHandler.sol",
|
||||
"line": 16
|
||||
},
|
||||
{
|
||||
"name": "InvalidDayRange",
|
||||
"signature": "InvalidDayRange()",
|
||||
"selector": "0x8930acef",
|
||||
"file": "contracts/libraries/Formatter.sol",
|
||||
"line": 12
|
||||
},
|
||||
{
|
||||
"name": "LENGTH_MISMATCH",
|
||||
"signature": "LENGTH_MISMATCH()",
|
||||
"selector": "0x899ef10d",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 126
|
||||
},
|
||||
{
|
||||
"name": "NO_VERIFIER_SET",
|
||||
"signature": "NO_VERIFIER_SET()",
|
||||
"selector": "0x8e727f46",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 130
|
||||
},
|
||||
{
|
||||
"name": "InvalidCscaRoot",
|
||||
"signature": "InvalidCscaRoot()",
|
||||
"selector": "0x8f1b44c7",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 138
|
||||
},
|
||||
{
|
||||
"name": "INVALID_REGISTER_PROOF",
|
||||
"signature": "INVALID_REGISTER_PROOF()",
|
||||
"selector": "0x9003ac4d",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 150
|
||||
},
|
||||
{
|
||||
"name": "UserContextDataTooShort",
|
||||
"signature": "UserContextDataTooShort()",
|
||||
"selector": "0x94ec3503",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 158
|
||||
},
|
||||
{
|
||||
"name": "NotWithinBirthdayWindow",
|
||||
"signature": "NotWithinBirthdayWindow()",
|
||||
"selector": "0x9b7983d7",
|
||||
"file": "contracts/example/HappyBirthday.sol",
|
||||
"line": 63
|
||||
},
|
||||
{
|
||||
"name": "INVALID_CSCA_ROOT",
|
||||
"signature": "INVALID_CSCA_ROOT()",
|
||||
"selector": "0xa294ad3c",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 170
|
||||
},
|
||||
{
|
||||
"name": "InvalidDataFormat",
|
||||
"signature": "InvalidDataFormat()",
|
||||
"selector": "0xa512e2ff",
|
||||
"file": "contracts/abstract/SelfVerificationRoot.sol",
|
||||
"line": 42
|
||||
},
|
||||
{
|
||||
"name": "ConfigNotSet",
|
||||
"signature": "ConfigNotSet()",
|
||||
"selector": "0xace124bc",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 166
|
||||
},
|
||||
{
|
||||
"name": "InvalidDateLength",
|
||||
"signature": "InvalidDateLength()",
|
||||
"selector": "0xb3375953",
|
||||
"file": "contracts/libraries/Formatter.sol",
|
||||
"line": 9
|
||||
},
|
||||
{
|
||||
"name": "ONLY_HUB_CAN_ACCESS",
|
||||
"signature": "ONLY_HUB_CAN_ACCESS()",
|
||||
"selector": "0xba0318cb",
|
||||
"file": "contracts/registry/IdentityRegistryIdCardImplV1.sol",
|
||||
"line": 139
|
||||
},
|
||||
{
|
||||
"name": "ONLY_HUB_CAN_ACCESS",
|
||||
"signature": "ONLY_HUB_CAN_ACCESS()",
|
||||
"selector": "0xba0318cb",
|
||||
"file": "contracts/registry/IdentityRegistryImplV1.sol",
|
||||
"line": 147
|
||||
},
|
||||
{
|
||||
"name": "INVALID_FORBIDDEN_COUNTRIES",
|
||||
"signature": "INVALID_FORBIDDEN_COUNTRIES()",
|
||||
"selector": "0xbf21b11c",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 142
|
||||
},
|
||||
{
|
||||
"name": "NotRegistered",
|
||||
"signature": "NotRegistered(address)",
|
||||
"selector": "0xbfc6c337",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 60
|
||||
},
|
||||
{
|
||||
"name": "CurrentDateNotInValidRange",
|
||||
"signature": "CurrentDateNotInValidRange()",
|
||||
"selector": "0xcf46551c",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 114
|
||||
},
|
||||
{
|
||||
"name": "INVALID_VC_AND_DISCLOSE_PROOF",
|
||||
"signature": "INVALID_VC_AND_DISCLOSE_PROOF()",
|
||||
"selector": "0xd4d37a7a",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 158
|
||||
},
|
||||
{
|
||||
"name": "InvalidVcAndDiscloseProof",
|
||||
"signature": "InvalidVcAndDiscloseProof()",
|
||||
"selector": "0xda7bd3a6",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 126
|
||||
},
|
||||
{
|
||||
"name": "INVALID_REVEALED_DATA_TYPE",
|
||||
"signature": "INVALID_REVEALED_DATA_TYPE()",
|
||||
"selector": "0xe0f15544",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 174
|
||||
},
|
||||
{
|
||||
"name": "ScopeMismatch",
|
||||
"signature": "ScopeMismatch()",
|
||||
"selector": "0xe7bee380",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 146
|
||||
},
|
||||
{
|
||||
"name": "InvalidUserIdentifierInProof",
|
||||
"signature": "InvalidUserIdentifierInProof()",
|
||||
"selector": "0xebbcc178",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 162
|
||||
},
|
||||
{
|
||||
"name": "CURRENT_DATE_NOT_IN_VALID_RANGE",
|
||||
"signature": "CURRENT_DATE_NOT_IN_VALID_RANGE()",
|
||||
"selector": "0xed8cf9ff",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 134
|
||||
},
|
||||
{
|
||||
"name": "InvalidUserIdentifier",
|
||||
"signature": "InvalidUserIdentifier()",
|
||||
"selector": "0xf0c426db",
|
||||
"file": "contracts/example/Airdrop.sol",
|
||||
"line": 72
|
||||
},
|
||||
{
|
||||
"name": "InvalidUserIdentifier",
|
||||
"signature": "InvalidUserIdentifier()",
|
||||
"selector": "0xf0c426db",
|
||||
"file": "contracts/example/SelfIdentityERC721.sol",
|
||||
"line": 49
|
||||
},
|
||||
{
|
||||
"name": "INVALID_OLDER_THAN",
|
||||
"signature": "INVALID_OLDER_THAN()",
|
||||
"selector": "0xf0e539b9",
|
||||
"file": "contracts/IdentityVerificationHubImplV1.sol",
|
||||
"line": 138
|
||||
},
|
||||
{
|
||||
"name": "InvalidIdentityCommitmentRoot",
|
||||
"signature": "InvalidIdentityCommitmentRoot()",
|
||||
"selector": "0xf53393a7",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 130
|
||||
},
|
||||
{
|
||||
"name": "LengthMismatch",
|
||||
"signature": "LengthMismatch()",
|
||||
"selector": "0xff633a38",
|
||||
"file": "contracts/IdentityVerificationHubImplV2.sol",
|
||||
"line": 106
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"DeployRegistryModule#PoseidonT3": "0x40Ac8B4Ca156915675Cb6128940a58b884c64194",
|
||||
"DeployRegistryModule#IdentityRegistryImplV1": "0x0729Bfd9F70E65Fdda5eA69560902802cE948882",
|
||||
"DeployRegistryModule#IdentityRegistry": "0xE1A05bbee7D8DF2ee2A81dEE8FB22e07B07D1084",
|
||||
"DeployHubV2#CustomVerifier": "0xC95e53bB0d26295c5814F4cE1d72fB4c2df0Fd4f",
|
||||
"DeployHubV2#IdentityVerificationHubImplV2": "0xC3b7D434C08311eCF437b54A5d4c5Ecd88FB505A",
|
||||
"DeployHubV2#IdentityVerificationHub": "0x68c931C9a534D37aa78094877F46fE46a49F1A51",
|
||||
"DeployIdCardRegistryModule#IdentityRegistryIdCard": "0xF77Be82318F11392Efb5F1062D954911d6086537",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha1_ecdsa_brainpoolP256r1": "0x1c017f6Ec7f28e793fbCFf86fDED3A7Ab702026C",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha1_ecdsa_secp256r1": "0xa484e357B380D25CC8343C3970fFA3244aa85C8f",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha1_rsa_65537_4096": "0x3AA2af39570943826A0F3E947b709C9624F955Ef",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_ecdsa_brainpoolP256r1": "0x63d054d4c8043D687fA81596cFaE63C070449167",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_ecdsa_brainpoolP384r1": "0x516B5A6A48fE3fd192b41E427A484F49782E2438",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_ecdsa_secp256r1": "0x014792E1484E8375B8d41737D5a7c7197635a6D0",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_ecdsa_secp384r1": "0x33d2093C5cf16664C2171ac54BBf1063762546c7",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_ecdsa_secp521r1": "0x775a2Dd7Ba6416e652A14697a5B0581ac23BcaC1",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_rsa_65537_4096": "0x3616B10Cc045C292432594F2ce1Ed908fb066078",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_rsapss_3_32_3072": "0xf0E99b1511144BB5EC84551f919dA86B9929E022",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_rsapss_65537_32_3072": "0xb558f1fb9d60045D29C2Fb4aF6Ac62F72eF29a99",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha256_rsapss_65537_32_4096": "0xe804f329ceEf4b532356E96d4413eE46f314fC97",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha384_ecdsa_brainpoolP384r1": "0xAaBD239E64C4144bd9d337F147685a8e2665814c",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha384_ecdsa_brainpoolP512r1": "0xcb0b0Bc432CB8E691910968E44BbF3C686d4c73A",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha384_ecdsa_secp384r1": "0x333Ec9A6056D87271D494422cAb82022f9ADc983",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha512_ecdsa_brainpoolP512r1": "0x380D9914cE42873c669fb2376992DfD4a4971898",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha512_ecdsa_secp521r1": "0x4e0AF15776EA8952B2fC45809Cf763a6d79feFde",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha512_rsa_65537_4096": "0x184ebA657AEfe09Bcb4A7c76509D8Eed8E363d0c",
|
||||
"DeployAllVerifiers#Verifier_dsc_sha512_rsapss_65537_64_4096": "0x0a4BC686C852F889819095B34Ee11134D3Ab568f",
|
||||
"DeployAllVerifiers#Verifier_register_sha1_sha1_sha1_ecdsa_brainpoolP224r1": "0x4C5D2242C258f62A4d8bAA47682a14D6c1ECa18F",
|
||||
"DeployAllVerifiers#Verifier_register_sha1_sha1_sha1_ecdsa_secp256r1": "0xd0EEF6915281eaea8D2c9c2253763070595b68D8",
|
||||
"DeployAllVerifiers#Verifier_register_sha1_sha1_sha1_rsa_65537_4096": "0x15DE81B47beb3CaF304244c9B8D9346a4B47C8Fa",
|
||||
"DeployAllVerifiers#Verifier_register_sha1_sha256_sha256_rsa_65537_4096": "0x430B70c0D8bc83BFF68556b32D601328e98a4146",
|
||||
"DeployAllVerifiers#Verifier_register_sha224_sha224_sha224_ecdsa_brainpoolP224r1": "0x5ed203dDF1F8bB946b0E7981bE6E92548A2E0763",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha224_sha224_ecdsa_secp224r1": "0x9958797dEA8abc6f7F12f6a19cF42610673f6835",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP256r1": "0xF9c20BD2f95c6b76fae3198570041281aC61388e",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP384r1": "0x3DE61B75dbAE97CEC72E22F1CcdC980c986C9748",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_ecdsa_secp256r1": "0x8438948a7E8679687F6E7D52279Adc9242C554dd",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_ecdsa_secp384r1": "0x9a346c828F1E7e7a832E106147E64f30983cE673",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_rsa_3_4096": "0x3040bAc557b5Be825529A0769D6231B28881967c",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_rsa_65537_4096": "0xCc4dd91aEfEBeF67b5aF86163533cfaf2D362b31",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_rsapss_3_32_2048": "0xF07C9Ff0688F54DE368F3b901223e9409099caaa",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_rsapss_65537_32_2048": "0xF3ebA139E88dE8D188227Be6253b7B3Cc7b85183",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_rsapss_65537_32_3072": "0x79Aa3D9F7Dd1e00D5F16aC9D6cAB601fc46E22aE",
|
||||
"DeployAllVerifiers#Verifier_register_sha256_sha256_sha256_rsapss_65537_64_2048": "0x73a3D7B0DA1B291314Cc1F060b5F3FE69B2d06C3",
|
||||
"DeployAllVerifiers#Verifier_register_sha384_sha384_sha384_ecdsa_brainpoolP384r1": "0xBc101a79Eb6B15ad5D2372a1F0D78691E938E86d",
|
||||
"DeployAllVerifiers#Verifier_register_sha384_sha384_sha384_ecdsa_brainpoolP512r1": "0x177e69b3D309bAd55eC952E0c4d9c5c59d724622",
|
||||
"DeployAllVerifiers#Verifier_register_sha384_sha384_sha384_ecdsa_secp384r1": "0xaA685275e77881B4619c67F5124f1B7337a07183",
|
||||
"DeployAllVerifiers#Verifier_register_sha384_sha384_sha384_rsapss_65537_48_2048": "0xF75D86E8F396cf855aaCe3a497071EeD9928C740",
|
||||
"DeployAllVerifiers#Verifier_register_sha512_sha512_sha256_rsa_65537_4096": "0x9b927797B2d07154C3CA0d6f1A19d9ebd9D36C8A",
|
||||
"DeployAllVerifiers#Verifier_register_sha512_sha512_sha512_ecdsa_brainpoolP512r1": "0xD4d8897Fd5Ce1BCbcbA149d8137fda9949a5ba36",
|
||||
"DeployAllVerifiers#Verifier_register_sha512_sha512_sha512_ecdsa_secp521r1": "0xCab0632d19d387218d68b026e9b1A62f2C0866dA",
|
||||
"DeployAllVerifiers#Verifier_register_sha512_sha512_sha512_rsa_65537_4096": "0xFad583ccE9B8Ff9131eA09308E423C6A16b255b0",
|
||||
"DeployAllVerifiers#Verifier_register_sha512_sha512_sha512_rsapss_65537_64_2048": "0xA3d7F6c891DaF8e036c92c92Df174c9E3a390f86",
|
||||
"DeployAllVerifiers#Verifier_vc_and_disclose": "0x34e0d12F100e8fBaFb3d7c2605c53684a38bA3dD",
|
||||
"DeployAllVerifiers#Verifier_vc_and_disclose_id": "0xC59B0E8525DedF2D64CA8f60c930279c871Aa3cc",
|
||||
"UpdateRegistryHubV2#IdentityRegistryIdCardImplV1": "0xF77Be82318F11392Efb5F1062D954911d6086537",
|
||||
"DeployAllVerifiers#Verifier_register_id_sha256_sha256_sha256_rsa_65537_4096": "0x05D1043F88aeA207f5a450597c5ABA8cCe8Dc874"
|
||||
}
|
||||
@@ -4,21 +4,34 @@ import { ethers } from "ethers";
|
||||
|
||||
export default buildModule("DeployRegistryModule", (m) => {
|
||||
// Deploy PoseidonT3
|
||||
console.log("📚 Deploying PoseidonT3 library...");
|
||||
const poseidonT3 = m.library("PoseidonT3");
|
||||
|
||||
console.log("🏗️ Deploying IdentityRegistryImplV1 implementation...");
|
||||
// Deploy IdentityRegistryImplV1
|
||||
const identityRegistryImpl = m.contract("IdentityRegistryImplV1", [], {
|
||||
libraries: { PoseidonT3: poseidonT3 },
|
||||
});
|
||||
|
||||
// Deploy registry with temporary hub address
|
||||
console.log("⚙️ Preparing registry initialization data...");
|
||||
// Get the interface and encode the initialize function call
|
||||
const registryInterface = getRegistryInitializeData();
|
||||
|
||||
const registryInitData = registryInterface.encodeFunctionData("initialize", [
|
||||
"0x0000000000000000000000000000000000000000",
|
||||
ethers.ZeroAddress,
|
||||
]);
|
||||
console.log(" Init data:", registryInitData);
|
||||
|
||||
console.log("🚀 Deploying IdentityRegistry proxy...");
|
||||
// Deploy the proxy contract with the implementation address and initialization data
|
||||
const registry = m.contract("IdentityRegistry", [identityRegistryImpl, registryInitData]);
|
||||
|
||||
// Return deployed contracts
|
||||
console.log("✅ Registry deployment module setup complete!");
|
||||
console.log(" 📋 Summary:");
|
||||
console.log(" - PoseidonT3: Library");
|
||||
console.log(" - IdentityRegistryImplV1: Implementation contract");
|
||||
console.log(" - IdentityRegistry: Proxy contract");
|
||||
|
||||
return {
|
||||
poseidonT3,
|
||||
identityRegistryImpl,
|
||||
|
||||
50
contracts/ignition/modules/scripts/updateRegistryHubV2.ts
Normal file
50
contracts/ignition/modules/scripts/updateRegistryHubV2.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
||||
import hre from "hardhat";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
module.exports = buildModule("UpdateRegistryHubV2", (m) => {
|
||||
const repo = hre.network.config.chainId === 42220 ? "prod" : "staging";
|
||||
const deployedAddressesPath = path.join(__dirname, `../../deployments/${repo}/deployed_addresses.json`);
|
||||
|
||||
console.log(`Reading deployed addresses from: ${deployedAddressesPath}`);
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf8"));
|
||||
|
||||
const registryAddress = deployedAddresses["DeployRegistryModule#IdentityRegistry"];
|
||||
const registryIdCardAddress = deployedAddresses["DeployIdCardRegistryModule#IdentityRegistryIdCard"];
|
||||
const hubAddress = deployedAddresses["DeployHubV2#IdentityVerificationHub"];
|
||||
|
||||
// Validate addresses
|
||||
if (!registryAddress) {
|
||||
throw new Error("IdentityRegistry address not found in deployed addresses");
|
||||
}
|
||||
if (!registryIdCardAddress) {
|
||||
throw new Error("IdentityRegistryIdCard address not found in deployed addresses");
|
||||
}
|
||||
if (!hubAddress) {
|
||||
throw new Error("IdentityVerificationHub address not found in deployed addresses");
|
||||
}
|
||||
|
||||
console.log(`Registry address: ${registryAddress}`);
|
||||
console.log(`Registry ID Card address: ${registryIdCardAddress}`);
|
||||
console.log(`Hub address: ${hubAddress}`);
|
||||
|
||||
const deployedRegistryInstance = m.contractAt("IdentityRegistryImplV1", registryAddress);
|
||||
const deployedRegistryIdCardInstance = m.contractAt("IdentityRegistryIdCardImplV1", registryIdCardAddress);
|
||||
|
||||
console.log("✓ Created registry contract instances");
|
||||
|
||||
// Execute the updateHub calls
|
||||
console.log("Updating hub address on IdentityRegistry...");
|
||||
m.call(deployedRegistryInstance, "updateHub", [hubAddress]);
|
||||
|
||||
console.log("Updating hub address on IdentityRegistryIdCard...");
|
||||
m.call(deployedRegistryIdCardInstance, "updateHub", [hubAddress]);
|
||||
|
||||
console.log("✓ Hub update calls initiated successfully");
|
||||
|
||||
return {
|
||||
deployedRegistryInstance,
|
||||
deployedRegistryIdCardInstance
|
||||
};
|
||||
});
|
||||
@@ -17,6 +17,7 @@ function contractExists(contractName: string): boolean {
|
||||
const contractsDir = path.join(__dirname, "../../../contracts");
|
||||
const possiblePaths = [
|
||||
path.join(contractsDir, "verifiers/register", `${contractName}.sol`),
|
||||
path.join(contractsDir, "verifiers/register_id", `${contractName}.sol`),
|
||||
path.join(contractsDir, "verifiers/dsc", `${contractName}.sol`),
|
||||
path.join(contractsDir, "verifiers/disclose", `${contractName}.sol`),
|
||||
path.join(contractsDir, "verifiers", `${contractName}.sol`),
|
||||
@@ -32,6 +33,25 @@ export default buildModule("DeployAllVerifiers", (m) => {
|
||||
console.log("Deploying VC and Disclose verifier...");
|
||||
deployedContracts.vcAndDiscloseVerifier = m.contract("Verifier_vc_and_disclose");
|
||||
|
||||
// Deploy VC and Disclose ID verifier
|
||||
console.log("Deploying VC and Disclose ID verifier...");
|
||||
deployedContracts.vcAndDiscloseIdVerifier = m.contract("Verifier_vc_and_disclose_id");
|
||||
|
||||
// Deploy Register ID verifiers (for ID cards)
|
||||
console.log("Deploying Register ID verifiers...");
|
||||
const registerIdCircuits = ["register_id_sha256_sha256_sha256_rsa_65537_4096"];
|
||||
let successfulRegisterIdDeployments = 0;
|
||||
registerIdCircuits.forEach((circuitName) => {
|
||||
const contractName = `Verifier_${circuitName}`;
|
||||
if (contractExists(contractName)) {
|
||||
console.log(` - Deploying ${contractName}`);
|
||||
deployedContracts[circuitName] = m.contract(contractName);
|
||||
successfulRegisterIdDeployments++;
|
||||
} else {
|
||||
console.warn(` - Warning: Contract ${contractName} not found, skipping...`);
|
||||
}
|
||||
});
|
||||
|
||||
// Deploy Register verifiers using RegisterVerifierId enum
|
||||
console.log("Deploying Register verifiers...");
|
||||
const registerCircuits = getEnumKeys(RegisterVerifierId);
|
||||
@@ -64,13 +84,17 @@ export default buildModule("DeployAllVerifiers", (m) => {
|
||||
|
||||
console.log(`Total verifiers deployment summary:`);
|
||||
console.log(` - VC and Disclose: 1`);
|
||||
console.log(` - VC and Disclose ID: 1`);
|
||||
console.log(
|
||||
` - Register ID: ${successfulRegisterIdDeployments}/${registerIdCircuits.length} (${registerIdCircuits.length - successfulRegisterIdDeployments} skipped)`,
|
||||
);
|
||||
console.log(
|
||||
` - Register: ${successfulRegisterDeployments}/${registerCircuits.length} (${registerCircuits.length - successfulRegisterDeployments} skipped)`,
|
||||
);
|
||||
console.log(
|
||||
` - DSC: ${successfulDscDeployments}/${dscCircuits.length} (${dscCircuits.length - successfulDscDeployments} skipped)`,
|
||||
);
|
||||
console.log(` - Total successful deployments: ${1 + successfulRegisterDeployments + successfulDscDeployments}`);
|
||||
console.log(` - Total successful deployments: ${2 + successfulRegisterIdDeployments + successfulRegisterDeployments + successfulDscDeployments}`);
|
||||
|
||||
return deployedContracts;
|
||||
});
|
||||
|
||||
@@ -28,9 +28,13 @@
|
||||
"prettier:check": "prettier --list-different '**/*.{json,md,yml,sol,ts}'",
|
||||
"prettier:write": "prettier --write '**/*.{json,md,yml,sol,ts}'",
|
||||
"publish": "npm publish --access public",
|
||||
"set:hub:v2": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-staging} npx ts-node scripts/setHubV2.ts'",
|
||||
"set:hub:v2": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-alfajores} npx ts-node scripts/setHubV2.ts'",
|
||||
"set:registry": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-staging} npx ts-node scripts/setRegistry.ts'",
|
||||
"set:registry:idcard": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-staging} npx ts-node scripts/setRegistryId.ts'",
|
||||
"set:registry:hub:v2": "npx dotenv-cli -- bash -c 'yarn hardhat ignition deploy ignition/modules/scripts/updateRegistryHubV2.ts --network ${NETWORK:-localhost} ${VERIFY:+--verify}'",
|
||||
"find:error": "npx ts-node scripts/findErrorSelectors.ts",
|
||||
"set:verifiers:v2": "npx dotenv-cli -- bash -c 'NETWORK=${NETWORK:-alfajores} npx ts-node scripts/setVerifiersV2.ts'",
|
||||
"show:registry": "npx ts-node scripts/showRegistryAddresses.ts",
|
||||
"test": "yarn hardhat test",
|
||||
"test:airdrop": "npx dotenv-cli -- bash -c 'TEST_ENV=${TEST_ENV:-local} npx hardhat test test/example/airdrop.test.ts'",
|
||||
"test:attribute": "npx dotenv-cli -- bash -c 'TEST_ENV=${TEST_ENV:-local} npx hardhat test test/unit/CircuitAttributeHandler.test.ts'",
|
||||
@@ -67,7 +71,7 @@
|
||||
"@openpassport/zk-kit-smt": "^0.0.1",
|
||||
"@openzeppelin/contracts": "^5.0.2",
|
||||
"@openzeppelin/contracts-upgradeable": "^5.1.0",
|
||||
"@selfxyz/common": "workspace:",
|
||||
"@selfxyz/common": "workspace:^",
|
||||
"@types/circomlibjs": "^0.1.6",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@zk-kit/imt": "^2.0.0-beta.4",
|
||||
|
||||
182
contracts/scripts/findErrorSelectors.ts
Normal file
182
contracts/scripts/findErrorSelectors.ts
Normal file
@@ -0,0 +1,182 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { keccak256 } from 'ethers';
|
||||
|
||||
interface CustomError {
|
||||
name: string;
|
||||
signature: string;
|
||||
selector: string;
|
||||
file: string;
|
||||
line: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively find all .sol files in a directory
|
||||
*/
|
||||
function findSolidityFiles(dir: string): string[] {
|
||||
const files: string[] = [];
|
||||
|
||||
function traverse(currentDir: string) {
|
||||
const items = fs.readdirSync(currentDir);
|
||||
|
||||
for (const item of items) {
|
||||
const fullPath = path.join(currentDir, item);
|
||||
const stat = fs.statSync(fullPath);
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
// Skip node_modules, .git, and other common directories
|
||||
if (!['node_modules', '.git', 'dist', 'build', 'cache'].includes(item)) {
|
||||
traverse(fullPath);
|
||||
}
|
||||
} else if (item.endsWith('.sol')) {
|
||||
files.push(fullPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
traverse(dir);
|
||||
return files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract custom errors from Solidity file content
|
||||
*/
|
||||
function extractCustomErrors(filePath: string): CustomError[] {
|
||||
const content = fs.readFileSync(filePath, 'utf8');
|
||||
const lines = content.split('\n');
|
||||
const errors: CustomError[] = [];
|
||||
|
||||
// Regex to match custom error declarations
|
||||
// Matches: error ErrorName(type1 param1, type2 param2, ...);
|
||||
const errorRegex = /^\s*error\s+([A-Za-z_][A-Za-z0-9_]*)\s*\(([^)]*)\)\s*;/;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
const line = lines[i];
|
||||
const match = line.match(errorRegex);
|
||||
|
||||
if (match) {
|
||||
const errorName = match[1];
|
||||
const params = match[2].trim();
|
||||
|
||||
// Clean up parameters - remove parameter names, keep only types
|
||||
const paramTypes = params
|
||||
.split(',')
|
||||
.map(param => param.trim())
|
||||
.filter(param => param.length > 0)
|
||||
.map(param => {
|
||||
// Extract type from "type name" or "type"
|
||||
const parts = param.split(/\s+/);
|
||||
return parts[0]; // First part is the type
|
||||
})
|
||||
.join(',');
|
||||
|
||||
const signature = `${errorName}(${paramTypes})`;
|
||||
const hash = keccak256(Buffer.from(signature, 'utf8'));
|
||||
const selector = hash.slice(0, 10); // First 4 bytes (8 hex chars + 0x)
|
||||
|
||||
errors.push({
|
||||
name: errorName,
|
||||
signature,
|
||||
selector,
|
||||
file: path.relative(process.cwd(), filePath),
|
||||
line: i + 1
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function to scan all contracts and find error selectors
|
||||
*/
|
||||
async function findAllErrorSelectors(targetSelector?: string) {
|
||||
console.log('🔍 Scanning Solidity files for custom errors...\n');
|
||||
|
||||
const contractsDir = path.join(process.cwd(), 'contracts');
|
||||
const solidityFiles = findSolidityFiles(contractsDir);
|
||||
|
||||
console.log(`Found ${solidityFiles.length} Solidity files\n`);
|
||||
|
||||
const allErrors: CustomError[] = [];
|
||||
let foundTarget = false;
|
||||
|
||||
for (const file of solidityFiles) {
|
||||
const errors = extractCustomErrors(file);
|
||||
allErrors.push(...errors);
|
||||
|
||||
// Check if we found the target selector
|
||||
if (targetSelector) {
|
||||
const match = errors.find(error => error.selector.toLowerCase() === targetSelector.toLowerCase());
|
||||
if (match) {
|
||||
console.log(`🎯 FOUND TARGET ERROR: ${targetSelector}`);
|
||||
console.log(` Error: ${match.name}`);
|
||||
console.log(` Signature: ${match.signature}`);
|
||||
console.log(` File: ${match.file}:${match.line}`);
|
||||
console.log(` Selector: ${match.selector}\n`);
|
||||
foundTarget = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sort errors by selector for easy lookup
|
||||
allErrors.sort((a, b) => a.selector.localeCompare(b.selector));
|
||||
|
||||
console.log(`📊 Found ${allErrors.length} custom errors total\n`);
|
||||
|
||||
if (targetSelector && !foundTarget) {
|
||||
console.log(`❌ Target selector ${targetSelector} not found in custom errors`);
|
||||
console.log(`💡 This might be a built-in error or from an imported contract\n`);
|
||||
}
|
||||
|
||||
// Group errors by file for better organization
|
||||
const errorsByFile = allErrors.reduce((acc, error) => {
|
||||
if (!acc[error.file]) {
|
||||
acc[error.file] = [];
|
||||
}
|
||||
acc[error.file].push(error);
|
||||
return acc;
|
||||
}, {} as Record<string, CustomError[]>);
|
||||
|
||||
console.log('📋 All Custom Errors by File:');
|
||||
console.log('================================\n');
|
||||
|
||||
for (const [file, errors] of Object.entries(errorsByFile)) {
|
||||
console.log(`📄 ${file}:`);
|
||||
for (const error of errors) {
|
||||
console.log(` ${error.selector} → ${error.signature} (line ${error.line})`);
|
||||
}
|
||||
console.log('');
|
||||
}
|
||||
|
||||
// Generate a quick lookup table
|
||||
console.log('🔗 Quick Selector Lookup:');
|
||||
console.log('=========================\n');
|
||||
|
||||
for (const error of allErrors) {
|
||||
console.log(`${error.selector} → ${error.name} (${error.file}:${error.line})`);
|
||||
}
|
||||
|
||||
// Save results to JSON file for future reference
|
||||
const outputFile = 'error-selectors.json';
|
||||
fs.writeFileSync(outputFile, JSON.stringify(allErrors, null, 2));
|
||||
console.log(`\n💾 Results saved to ${outputFile}`);
|
||||
|
||||
return allErrors;
|
||||
}
|
||||
|
||||
// CLI interface
|
||||
const targetSelector = process.argv[2];
|
||||
|
||||
if (targetSelector) {
|
||||
console.log(`🎯 Looking for specific error selector: ${targetSelector}\n`);
|
||||
}
|
||||
|
||||
findAllErrorSelectors(targetSelector)
|
||||
.then(() => {
|
||||
console.log('\n✅ Scan complete!');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('❌ Error during scan:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -2,25 +2,31 @@ import { ethers } from "ethers";
|
||||
import * as dotenv from "dotenv";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { RegisterVerifierId, DscVerifierId } from "../../common/src/constants/constants";
|
||||
import { RegisterVerifierId, DscVerifierId } from "@selfxyz/common";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
// Environment configuration
|
||||
const NETWORK = process.env.NETWORK || "localhost"; // Default to staging
|
||||
const RPC_URL_KEY = NETWORK === "celo" ? "CELO_RPC_URL" : "CELO_ALFAJORES_RPC_URL";
|
||||
const PRIVATE_KEY = process.env.CELO_KEY;
|
||||
const PRIVATE_KEY = process.env.PRIVATE_KEY;
|
||||
|
||||
// Network to Chain ID mapping
|
||||
const NETWORK_TO_CHAIN_ID: Record<string, string> = {
|
||||
localhost: "31337",
|
||||
hardhat: "31337",
|
||||
alfajores: "44787",
|
||||
celoAlfajores: "44787",
|
||||
celo: "42220",
|
||||
mainnet: "42220",
|
||||
staging: "44787", // Default staging to alfajores
|
||||
};
|
||||
|
||||
// Get chain ID from network name
|
||||
const getChainId = (network: string): string => {
|
||||
return NETWORK_TO_CHAIN_ID[network] || NETWORK_TO_CHAIN_ID["staging"];
|
||||
const chainId = NETWORK_TO_CHAIN_ID[network] || NETWORK_TO_CHAIN_ID["alfajores"];
|
||||
console.log(`Network "${network}" mapped to Chain ID: ${chainId}`);
|
||||
return chainId;
|
||||
};
|
||||
|
||||
const CHAIN_ID = getChainId(NETWORK);
|
||||
@@ -32,11 +38,13 @@ const AttestationId = {
|
||||
EU_ID_CARD: "0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
};
|
||||
|
||||
const repo = CHAIN_ID === "42220" ? "prod" : "staging";
|
||||
|
||||
// Dynamic paths based on chain ID
|
||||
const deployedAddressesPath = path.join(__dirname, `../ignition/deployments/chain-${CHAIN_ID}/deployed_addresses.json`);
|
||||
const deployedAddressesPath = path.join(__dirname, `../ignition/deployments/${repo}/deployed_addresses.json`);
|
||||
const contractAbiPath = path.join(
|
||||
__dirname,
|
||||
`../ignition/deployments/chain-${CHAIN_ID}/artifacts/DeployHubV2#IdentityVerificationHubImplV2.json`,
|
||||
`../ignition/deployments/${repo}/artifacts/DeployV2#IdentityVerificationHubImplV2.json`,
|
||||
);
|
||||
|
||||
// Debug logs for paths and files
|
||||
@@ -48,7 +56,7 @@ console.log("Contract ABI path:", contractAbiPath);
|
||||
|
||||
// Debug logs for environment variables (redacted for security)
|
||||
console.log(`${RPC_URL_KEY} configured:`, !!process.env[RPC_URL_KEY]);
|
||||
console.log("CELO_KEY configured:", !!PRIVATE_KEY);
|
||||
console.log("PRIVATE_KEY configured:", !!PRIVATE_KEY);
|
||||
|
||||
try {
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf-8"));
|
||||
@@ -87,12 +95,17 @@ try {
|
||||
const wallet = new ethers.Wallet(PRIVATE_KEY as string, provider);
|
||||
console.log("Wallet created");
|
||||
|
||||
// const hubAddress = deployedAddresses["DeployHub#IdentityVerificationHub"];
|
||||
const hubAddress = "0xbaB9B3c376e84FEB4aFD9423e3aB278B47d34a0a"; // Update with your actual hub address
|
||||
// Get hub address from deployment files (PROXY, not implementation)
|
||||
const hubAddress = (getContractAddressByExactName("DeployV2#IdentityVerificationHub") || // ← PROXY
|
||||
getContractAddressByExactName("DeployHubV2#IdentityVerificationHub") ||
|
||||
getContractAddressByExactName("DeployHub#IdentityVerificationHub") ||
|
||||
getContractAddressByPartialName("IdentityVerificationHub")) as string;
|
||||
|
||||
console.log("Hub address:", hubAddress);
|
||||
|
||||
if (!hubAddress) {
|
||||
throw new Error("Hub address not found in deployed_addresses.json");
|
||||
console.error("Available contracts:", Object.keys(deployedAddresses));
|
||||
throw new Error("Hub address not found in deployed_addresses.json. Available contracts listed above.");
|
||||
}
|
||||
|
||||
const identityVerificationHub = new ethers.Contract(hubAddress, identityVerificationHubAbi, wallet);
|
||||
@@ -133,7 +146,7 @@ try {
|
||||
if (attestationType == "E_PASSPORT") {
|
||||
verifierName = "DeployAllVerifiers#Verifier_vc_and_disclose";
|
||||
} else if (attestationType == "EU_ID_CARD") {
|
||||
verifierName = "";
|
||||
verifierName = "DeployAllVerifiers#Verifier_vc_and_disclose_id";
|
||||
}
|
||||
const verifierAddress = getContractAddressByExactName(verifierName);
|
||||
|
||||
@@ -158,69 +171,81 @@ try {
|
||||
|
||||
// Batch update register circuit verifiers
|
||||
const registerVerifierKeys = Object.keys(RegisterVerifierId).filter((key) => isNaN(Number(key)));
|
||||
const registerCircuitVerifierIds: number[] = [];
|
||||
const registerCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
for (const key of registerVerifierKeys) {
|
||||
const verifierName = `Verifier_${key}`;
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
for (const attestationType of attestationTypes) {
|
||||
const attestationId = getAttestationIdBytes32(attestationType);
|
||||
const registerCircuitVerifierIds: number[] = [];
|
||||
const registerCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(`Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
for (const key of registerVerifierKeys) {
|
||||
const verifierName = `Verifier_${key}`;
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(`Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const verifierId = RegisterVerifierId[key as keyof typeof RegisterVerifierId];
|
||||
registerCircuitVerifierIds.push(verifierId);
|
||||
registerCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
|
||||
const verifierId = RegisterVerifierId[key as keyof typeof RegisterVerifierId];
|
||||
registerCircuitVerifierIds.push(verifierId);
|
||||
registerCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
if (registerCircuitVerifierIds.length > 0) {
|
||||
console.log(`Batch updating register circuit verifiers for ${attestationType}`);
|
||||
|
||||
if (registerCircuitVerifierIds.length > 0) {
|
||||
console.log("Batch updating register circuit verifiers");
|
||||
|
||||
try {
|
||||
const tx = await identityVerificationHub.batchUpdateRegisterCircuitVerifiers(
|
||||
registerCircuitVerifierIds,
|
||||
registerCircuitVerifierAddresses,
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`Register circuit verifiers updated with tx: ${receipt.hash}`);
|
||||
} catch (error) {
|
||||
console.error("Error batch updating register circuit verifiers:", error);
|
||||
try {
|
||||
const attestationIds = Array(registerCircuitVerifierIds.length).fill(attestationId);
|
||||
const tx = await identityVerificationHub.batchUpdateRegisterCircuitVerifiers(
|
||||
attestationIds,
|
||||
registerCircuitVerifierIds,
|
||||
registerCircuitVerifierAddresses,
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`Register circuit verifiers for ${attestationType} updated with tx: ${receipt.hash}`);
|
||||
} catch (error) {
|
||||
console.error(`Error batch updating register circuit verifiers for ${attestationType}:`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Batch update DSC circuit verifiers
|
||||
const dscKeys = Object.keys(DscVerifierId).filter((key) => isNaN(Number(key)));
|
||||
const dscCircuitVerifierIds: number[] = [];
|
||||
const dscCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
for (const key of dscKeys) {
|
||||
const verifierName = `Verifier_${key}`;
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
for (const attestationType of attestationTypes) {
|
||||
const attestationId = getAttestationIdBytes32(attestationType);
|
||||
const dscCircuitVerifierIds: number[] = [];
|
||||
const dscCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(`Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
for (const key of dscKeys) {
|
||||
const verifierName = `Verifier_${key}`;
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(`Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const verifierId = DscVerifierId[key as keyof typeof DscVerifierId];
|
||||
dscCircuitVerifierIds.push(verifierId);
|
||||
dscCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
|
||||
const verifierId = DscVerifierId[key as keyof typeof DscVerifierId];
|
||||
dscCircuitVerifierIds.push(verifierId);
|
||||
dscCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
if (dscCircuitVerifierIds.length > 0) {
|
||||
console.log(`Batch updating DSC circuit verifiers for ${attestationType}`);
|
||||
|
||||
if (dscCircuitVerifierIds.length > 0) {
|
||||
console.log("Batch updating DSC circuit verifiers");
|
||||
|
||||
try {
|
||||
const tx = await identityVerificationHub.batchUpdateDscCircuitVerifiers(
|
||||
dscCircuitVerifierIds,
|
||||
dscCircuitVerifierAddresses,
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`DSC circuit verifiers updated with tx: ${receipt.hash}`);
|
||||
} catch (error) {
|
||||
console.error("Error batch updating DSC circuit verifiers:", error);
|
||||
try {
|
||||
const attestationIds = Array(dscCircuitVerifierIds.length).fill(attestationId);
|
||||
const tx = await identityVerificationHub.batchUpdateDscCircuitVerifiers(
|
||||
attestationIds,
|
||||
dscCircuitVerifierIds,
|
||||
dscCircuitVerifierAddresses,
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`DSC circuit verifiers for ${attestationType} updated with tx: ${receipt.hash}`);
|
||||
} catch (error) {
|
||||
console.error(`Error batch updating DSC circuit verifiers for ${attestationType}:`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ dotenv.config();
|
||||
// Environment configuration
|
||||
const NETWORK = process.env.NETWORK || "localhost"; // Default to localhost
|
||||
const RPC_URL_KEY = NETWORK === "celo" ? "CELO_RPC_URL" : "CELO_ALFAJORES_RPC_URL";
|
||||
const PRIVATE_KEY = process.env.CELO_KEY;
|
||||
const PRIVATE_KEY = process.env.PRIVATE_KEY;
|
||||
const SKIP_CSCA_UPDATE = process.env.SKIP_CSCA_UPDATE === "true";
|
||||
const CSCA_ROOT = process.env.CSCA_ROOT; // Allow manual CSCA root setting
|
||||
|
||||
@@ -44,7 +44,7 @@ console.log("Contract ABI path:", contractAbiPath);
|
||||
|
||||
// Debug logs for environment variables (redacted for security)
|
||||
console.log(`${RPC_URL_KEY} configured:`, !!process.env[RPC_URL_KEY]);
|
||||
console.log("CELO_KEY configured:", !!PRIVATE_KEY);
|
||||
console.log("PRIVATE_KEY configured:", !!PRIVATE_KEY);
|
||||
|
||||
try {
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf-8"));
|
||||
|
||||
@@ -10,7 +10,7 @@ dotenv.config();
|
||||
// Environment configuration
|
||||
const NETWORK = process.env.NETWORK || "localhost"; // Default to localhost
|
||||
const RPC_URL_KEY = NETWORK === "celo" ? "CELO_RPC_URL" : "CELO_ALFAJORES_RPC_URL";
|
||||
const PRIVATE_KEY = process.env.CELO_KEY;
|
||||
const PRIVATE_KEY = process.env.PRIVATE_KEY;
|
||||
const SKIP_CSCA_UPDATE = process.env.SKIP_CSCA_UPDATE === "true";
|
||||
const CSCA_ROOT = process.env.CSCA_ROOT; // Allow manual CSCA root setting
|
||||
|
||||
@@ -44,7 +44,7 @@ console.log("Contract ABI path:", contractAbiPath);
|
||||
|
||||
// Debug logs for environment variables (redacted for security)
|
||||
console.log(`${RPC_URL_KEY} configured:`, !!process.env[RPC_URL_KEY]);
|
||||
console.log("CELO_KEY configured:", !!PRIVATE_KEY);
|
||||
console.log("PRIVATE_KEY configured:", !!PRIVATE_KEY);
|
||||
|
||||
try {
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf-8"));
|
||||
|
||||
@@ -19,7 +19,7 @@ console.log(
|
||||
|
||||
// Debug logs for environment variables (redacted for security)
|
||||
console.log("CELO_RPC_URL configured:", !!process.env.CELO_RPC_URL);
|
||||
console.log("CELO_KEY configured:", !!process.env.CELO_KEY);
|
||||
console.log("PRIVATE_KEY configured:", !!process.env.PRIVATE_KEY);
|
||||
|
||||
try {
|
||||
const deployedAddresses = JSON.parse(
|
||||
@@ -51,7 +51,7 @@ try {
|
||||
const provider = new ethers.JsonRpcProvider(process.env.CELO_RPC_URL as string);
|
||||
console.log("Provider created");
|
||||
|
||||
const wallet = new ethers.Wallet(process.env.CELO_KEY as string, provider);
|
||||
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY as string, provider);
|
||||
console.log("Wallet created");
|
||||
|
||||
// const hubAddress = deployedAddresses["DeployHub#IdentityVerificationHub"];
|
||||
|
||||
@@ -13,77 +13,106 @@ const AttestationId = {
|
||||
EU_ID_CARD: "0x0000000000000000000000000000000000000000000000000000000000000002",
|
||||
};
|
||||
|
||||
console.log("🚀 Starting setVerifiersV2 script...");
|
||||
console.log("================================");
|
||||
|
||||
// Debug logs for paths and files
|
||||
console.log("Current directory:", __dirname);
|
||||
console.log("📁 File paths:");
|
||||
console.log(" Current directory:", __dirname);
|
||||
console.log(
|
||||
"Deployed addresses path:",
|
||||
" Deployed addresses path:",
|
||||
path.join(__dirname, "../ignition/deployments/staging/deployed_addresses.json"),
|
||||
);
|
||||
console.log(
|
||||
"Contract ABI path:",
|
||||
" Contract ABI path:",
|
||||
path.join(__dirname, "../ignition/deployments/staging/artifacts/DeployV2#IdentityVerificationHubImplV2.json"),
|
||||
);
|
||||
|
||||
// Debug logs for environment variables (redacted for security)
|
||||
console.log("CELO_RPC_URL configured:", !!process.env.CELO_ALFAJORES_RPC_URL);
|
||||
console.log("CELO_KEY configured:", !!process.env.PRIVATE_KEY);
|
||||
console.log("🔐 Environment variables:");
|
||||
console.log(" CELO_RPC_URL configured:", !!process.env.CELO_ALFAJORES_RPC_URL);
|
||||
console.log(" PRIVATE_KEY configured:", !!process.env.PRIVATE_KEY);
|
||||
console.log(" Network:", process.env.NETWORK || "not set");
|
||||
|
||||
try {
|
||||
console.log("\n📋 Loading deployment data...");
|
||||
const deployedAddresses = JSON.parse(
|
||||
fs.readFileSync(path.join(__dirname, "../ignition/deployments/staging/deployed_addresses.json"), "utf-8"),
|
||||
);
|
||||
console.log("Deployed addresses loaded:", deployedAddresses);
|
||||
console.log("✅ Deployed addresses loaded successfully");
|
||||
console.log(` Found ${Object.keys(deployedAddresses).length} deployed contracts`);
|
||||
|
||||
// Log all available contracts for debugging
|
||||
console.log("\n📦 Available deployed contracts:");
|
||||
Object.keys(deployedAddresses).forEach((key, index) => {
|
||||
console.log(` ${index + 1}. ${key} -> ${deployedAddresses[key]}`);
|
||||
});
|
||||
|
||||
const identityVerificationHubAbiFile = fs.readFileSync(
|
||||
path.join(__dirname, "../ignition/deployments/staging/artifacts/DeployV2#IdentityVerificationHubImplV2.json"),
|
||||
"utf-8",
|
||||
);
|
||||
console.log("ABI file loaded");
|
||||
console.log("✅ ABI file loaded successfully");
|
||||
|
||||
const identityVerificationHubAbi = JSON.parse(identityVerificationHubAbiFile).abi;
|
||||
console.log("ABI parsed");
|
||||
console.log("✅ ABI parsed successfully");
|
||||
|
||||
function getContractAddressByPartialName(partialName: string): string | unknown {
|
||||
console.log(`🔍 Searching for contract with partial name: "${partialName}"`);
|
||||
for (const [key, value] of Object.entries(deployedAddresses)) {
|
||||
if (key.includes(partialName)) {
|
||||
console.log(` ✅ Found match: ${key} -> ${value}`);
|
||||
return value;
|
||||
}
|
||||
}
|
||||
console.log(` ❌ No match found for: "${partialName}"`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getContractAddressByExactName(exactName: string): string | unknown {
|
||||
console.log(`🎯 Looking for exact contract name: "${exactName}"`);
|
||||
if (exactName in deployedAddresses) {
|
||||
console.log(` ✅ Found: ${exactName} -> ${deployedAddresses[exactName]}`);
|
||||
return deployedAddresses[exactName];
|
||||
}
|
||||
console.log(` ❌ Not found: "${exactName}"`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function getAttestationIdBytes32(attestationIdName: string): string {
|
||||
return AttestationId[attestationIdName as keyof typeof AttestationId];
|
||||
const id = AttestationId[attestationIdName as keyof typeof AttestationId];
|
||||
console.log(`🆔 Attestation ID for ${attestationIdName}: ${id}`);
|
||||
return id;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log("\n🌐 Setting up blockchain connection...");
|
||||
const provider = new ethers.JsonRpcProvider(process.env.CELO_ALFAJORES_RPC_URL as string);
|
||||
console.log("Provider created");
|
||||
console.log("✅ Provider created");
|
||||
|
||||
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY as string, provider);
|
||||
console.log("Wallet created");
|
||||
console.log("✅ Wallet created");
|
||||
console.log(` Wallet address: ${wallet.address}`);
|
||||
|
||||
// const hubAddress = deployedAddresses["DeployHub#IdentityVerificationHub"];
|
||||
const hubAddress = "0xbaB9B3c376e84FEB4aFD9423e3aB278B47d34a0a"; // Update with your actual hub address
|
||||
console.log("Hub address:", hubAddress);
|
||||
console.log("\n🏢 Setting up hub contract...");
|
||||
const hubAddress = deployedAddresses["DeployHubV2#IdentityVerificationHub"];
|
||||
console.log("🔍 Hub address lookup result:", hubAddress);
|
||||
|
||||
if (!hubAddress) {
|
||||
throw new Error("Hub address not found in deployed_addresses.json");
|
||||
throw new Error("❌ Hub address not found in deployed_addresses.json");
|
||||
}
|
||||
|
||||
const identityVerificationHub = new ethers.Contract(hubAddress, identityVerificationHubAbi, wallet);
|
||||
console.log("Contract instance created");
|
||||
console.log("✅ Contract instance created");
|
||||
console.log(` Hub contract address: ${hubAddress}`);
|
||||
|
||||
// Update registry addresses for different attestation types
|
||||
console.log("\n📝 STEP 1: Updating registry addresses...");
|
||||
console.log("==========================================");
|
||||
const attestationTypes = ["E_PASSPORT", "EU_ID_CARD"];
|
||||
for (const attestationType of attestationTypes) {
|
||||
console.log(`\n🔄 Processing registry for ${attestationType}:`);
|
||||
|
||||
let registryName: any;
|
||||
if (attestationType == "E_PASSPORT") {
|
||||
registryName = "DeployRegistryModule#IdentityRegistry";
|
||||
@@ -91,129 +120,345 @@ try {
|
||||
registryName = "DeployIdCardRegistryModule#IdentityRegistryIdCard";
|
||||
}
|
||||
|
||||
console.log(` Registry name to search: ${registryName}`);
|
||||
|
||||
const registryAddress = getContractAddressByExactName(registryName);
|
||||
console.log("Registry address:", registryAddress);
|
||||
|
||||
if (!registryAddress) {
|
||||
console.log(`Skipping registry update for ${attestationType} because no deployed address was found.`);
|
||||
console.log(` ⚠️ Skipping registry update for ${attestationType} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`Updating registry for ${attestationType}`);
|
||||
console.log(` 📍 Registry address found: ${registryAddress}`);
|
||||
const attestationId = getAttestationIdBytes32(attestationType);
|
||||
|
||||
try {
|
||||
console.log(` 📤 Sending updateRegistry transaction...`);
|
||||
const tx = await identityVerificationHub.updateRegistry(attestationId, registryAddress);
|
||||
console.log(` ⏳ Transaction sent: ${tx.hash}`);
|
||||
console.log(` ⏳ Waiting for confirmation...`);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`Registry for ${attestationType} updated with tx: ${receipt.hash}`);
|
||||
console.log(` ✅ Registry for ${attestationType} updated successfully!`);
|
||||
console.log(` Transaction hash: ${receipt.hash}`);
|
||||
console.log(` Gas used: ${receipt.gasUsed}`);
|
||||
} catch (error) {
|
||||
console.error(`Error updating registry for ${attestationType}:`, error);
|
||||
console.error(` ❌ Error updating registry for ${attestationType}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
// Update VC and Disclose circuit verifiers for different attestation types
|
||||
console.log("\n📝 STEP 2: Updating VC and Disclose circuit verifiers...");
|
||||
console.log("=======================================================");
|
||||
for (const attestationType of attestationTypes) {
|
||||
console.log(`\n🔄 Processing VC verifier for ${attestationType}:`);
|
||||
|
||||
let verifierName: any;
|
||||
if (attestationType == "E_PASSPORT") {
|
||||
verifierName = "DeployAllVerifiers#Verifier_vc_and_disclose";
|
||||
} else if (attestationType == "EU_ID_CARD") {
|
||||
verifierName = "";
|
||||
verifierName = "DeployAllVerifiers#Verifier_vc_and_disclose_id";
|
||||
}
|
||||
|
||||
console.log(` Verifier name to search: ${verifierName}`);
|
||||
const verifierAddress = getContractAddressByExactName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(
|
||||
`Skipping VC and Disclose circuit update for ${attestationType} because no deployed address was found.`,
|
||||
);
|
||||
console.log(` ⚠️ Skipping VC and Disclose circuit update for ${attestationType} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(`Updating VC and Disclose circuit for ${attestationType}`);
|
||||
console.log(` 📍 Verifier address found: ${verifierAddress}`);
|
||||
const attestationId = getAttestationIdBytes32(attestationType);
|
||||
|
||||
try {
|
||||
console.log(` 📤 Sending updateVcAndDiscloseCircuit transaction...`);
|
||||
const tx = await identityVerificationHub.updateVcAndDiscloseCircuit(attestationId, verifierAddress);
|
||||
console.log(` ⏳ Transaction sent: ${tx.hash}`);
|
||||
console.log(` ⏳ Waiting for confirmation...`);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`VC and Disclose circuit for ${attestationType} updated with tx: ${receipt.hash}`);
|
||||
console.log(` ✅ VC and Disclose circuit for ${attestationType} updated successfully!`);
|
||||
console.log(` Transaction hash: ${receipt.hash}`);
|
||||
console.log(` Gas used: ${receipt.gasUsed}`);
|
||||
} catch (error) {
|
||||
console.error(`Error updating VC and Disclose circuit for ${attestationType}:`, error);
|
||||
console.error(` ❌ Error updating VC and Disclose circuit for ${attestationType}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
// Batch update register circuit verifiers
|
||||
// Batch update register circuit verifiers for E_PASSPORT
|
||||
console.log("\n📝 STEP 3: Batch updating register circuit verifiers for E_PASSPORT...");
|
||||
console.log("=====================================================================");
|
||||
|
||||
console.log("🔍 Discovering register verifiers...");
|
||||
const registerVerifierKeys = Object.keys(RegisterVerifierId).filter((key) => isNaN(Number(key)));
|
||||
console.log(` Found ${registerVerifierKeys.length} register verifier keys in enum:`, registerVerifierKeys);
|
||||
|
||||
// Filter out register_id keys for E_PASSPORT (they should only be used for EU_ID_CARD)
|
||||
const regularRegisterKeys = registerVerifierKeys.filter(key => !key.startsWith('register_id_'));
|
||||
console.log(` Filtered to ${regularRegisterKeys.length} regular register keys (excluding register_id_*):`, regularRegisterKeys);
|
||||
|
||||
const registerAttestationIds: string[] = [];
|
||||
const registerCircuitVerifierIds: number[] = [];
|
||||
const registerCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
for (const key of registerVerifierKeys) {
|
||||
for (const key of regularRegisterKeys) {
|
||||
console.log(`\n 🔄 Processing register verifier: ${key}`);
|
||||
const verifierName = `Verifier_${key}`;
|
||||
console.log(` Searching for: ${verifierName}`);
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(`Skipping ${verifierName} because no deployed address was found.`);
|
||||
console.log(` ❌ Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const verifierId = RegisterVerifierId[key as keyof typeof RegisterVerifierId];
|
||||
console.log(` ✅ Found verifier: ${verifierName} -> ${verifierAddress}`);
|
||||
console.log(` 📋 Verifier ID: ${verifierId} (key: ${key})`);
|
||||
|
||||
registerAttestationIds.push(AttestationId.E_PASSPORT);
|
||||
registerCircuitVerifierIds.push(verifierId);
|
||||
registerCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
|
||||
if (registerCircuitVerifierIds.length > 0) {
|
||||
console.log("Batch updating register circuit verifiers");
|
||||
console.log(`\n📊 Register verifiers summary for E_PASSPORT:`);
|
||||
console.log(` Total found: ${registerCircuitVerifierIds.length}`);
|
||||
console.log(` Verifier IDs: [${registerCircuitVerifierIds.join(', ')}]`);
|
||||
console.log(` Addresses: [${registerCircuitVerifierAddresses.map(addr => addr.slice(0, 10) + '...').join(', ')}]`);
|
||||
|
||||
if (registerCircuitVerifierIds.length > 0) {
|
||||
try {
|
||||
console.log(`📤 Sending batchUpdateRegisterCircuitVerifiers transaction for E_PASSPORT...`);
|
||||
const tx = await identityVerificationHub.batchUpdateRegisterCircuitVerifiers(
|
||||
registerAttestationIds,
|
||||
registerCircuitVerifierIds,
|
||||
registerCircuitVerifierAddresses,
|
||||
);
|
||||
console.log(`⏳ Transaction sent: ${tx.hash}`);
|
||||
console.log(`⏳ Waiting for confirmation...`);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`Register circuit verifiers updated with tx: ${receipt.hash}`);
|
||||
console.log(`✅ Register circuit verifiers for E_PASSPORT updated successfully!`);
|
||||
console.log(` Transaction hash: ${receipt.hash}`);
|
||||
console.log(` Gas used: ${receipt.gasUsed}`);
|
||||
} catch (error) {
|
||||
console.error("Error batch updating register circuit verifiers:", error);
|
||||
console.error("❌ Error batch updating register circuit verifiers for E_PASSPORT:", error);
|
||||
}
|
||||
} else {
|
||||
console.log("⚠️ No register circuit verifiers found for E_PASSPORT");
|
||||
}
|
||||
|
||||
// Batch update register circuit verifiers for EU_ID_CARD (using register_id verifiers)
|
||||
console.log("\n📝 STEP 4: Batch updating register circuit verifiers for EU_ID_CARD...");
|
||||
console.log("====================================================================");
|
||||
|
||||
// Function to map register_id circuit names to their corresponding RegisterVerifierId
|
||||
function getRegisterIdMapping(registerIdCircuitName: string): number | null {
|
||||
console.log(` 🔄 Mapping register_id circuit: ${registerIdCircuitName}`);
|
||||
|
||||
// The register_id circuits should have their own entries in the RegisterVerifierId enum
|
||||
// Look for exact match first
|
||||
if (registerIdCircuitName in RegisterVerifierId) {
|
||||
const verifierId = RegisterVerifierId[registerIdCircuitName as keyof typeof RegisterVerifierId];
|
||||
console.log(` ✅ Found direct mapping: ${registerIdCircuitName} (ID: ${verifierId})`);
|
||||
return verifierId as number;
|
||||
}
|
||||
|
||||
console.warn(` ❌ No RegisterVerifierId mapping found for: ${registerIdCircuitName}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get all register_id verifiers from deployed addresses
|
||||
console.log("🔍 Discovering register_id verifiers...");
|
||||
const registerIdVerifiers: string[] = [];
|
||||
for (const key of Object.keys(deployedAddresses)) {
|
||||
if (key.includes("Verifier_register_id_")) {
|
||||
const circuitName = key.replace("DeployAllVerifiers#Verifier_", "");
|
||||
registerIdVerifiers.push(circuitName);
|
||||
console.log(` Found register_id verifier: ${circuitName}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Batch update DSC circuit verifiers
|
||||
console.log(`📊 Found ${registerIdVerifiers.length} register_id verifier(s): [${registerIdVerifiers.join(', ')}]`);
|
||||
|
||||
const registerIdAttestationIds: string[] = [];
|
||||
const registerIdCircuitVerifierIds: number[] = [];
|
||||
const registerIdCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
for (const registerIdCircuitName of registerIdVerifiers) {
|
||||
console.log(`\n 🔄 Processing register_id verifier: ${registerIdCircuitName}`);
|
||||
const verifierName = `DeployAllVerifiers#Verifier_${registerIdCircuitName}`;
|
||||
console.log(` Full verifier name: ${verifierName}`);
|
||||
const verifierAddress = getContractAddressByExactName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(` ❌ Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const verifierId = getRegisterIdMapping(registerIdCircuitName);
|
||||
if (verifierId === null) {
|
||||
console.log(` ❌ Skipping ${registerIdCircuitName} because no RegisterVerifierId mapping was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log(` ✅ Using register_id verifier: ${registerIdCircuitName} (ID: ${verifierId}) for EU_ID_CARD`);
|
||||
console.log(` 📍 Address: ${verifierAddress}`);
|
||||
|
||||
registerIdAttestationIds.push(AttestationId.EU_ID_CARD);
|
||||
registerIdCircuitVerifierIds.push(verifierId);
|
||||
registerIdCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
|
||||
console.log(`\n📊 Register_id verifiers summary for EU_ID_CARD:`);
|
||||
console.log(` Total found: ${registerIdCircuitVerifierIds.length}`);
|
||||
console.log(` Verifier IDs: [${registerIdCircuitVerifierIds.join(', ')}]`);
|
||||
console.log(` Addresses: [${registerIdCircuitVerifierAddresses.map(addr => addr.slice(0, 10) + '...').join(', ')}]`);
|
||||
|
||||
if (registerIdCircuitVerifierIds.length > 0) {
|
||||
try {
|
||||
console.log(`📤 Sending batchUpdateRegisterCircuitVerifiers transaction for EU_ID_CARD...`);
|
||||
const tx = await identityVerificationHub.batchUpdateRegisterCircuitVerifiers(
|
||||
registerIdAttestationIds,
|
||||
registerIdCircuitVerifierIds,
|
||||
registerIdCircuitVerifierAddresses,
|
||||
);
|
||||
console.log(`⏳ Transaction sent: ${tx.hash}`);
|
||||
console.log(`⏳ Waiting for confirmation...`);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`✅ Register circuit verifiers for EU_ID_CARD updated successfully!`);
|
||||
console.log(` Transaction hash: ${receipt.hash}`);
|
||||
console.log(` Gas used: ${receipt.gasUsed}`);
|
||||
console.log(` Updated ${registerIdCircuitVerifierIds.length} verifier(s) with IDs: [${registerIdCircuitVerifierIds.join(', ')}]`);
|
||||
} catch (error) {
|
||||
console.error("❌ Error batch updating register circuit verifiers for EU_ID_CARD:", error);
|
||||
}
|
||||
} else {
|
||||
console.log("⚠️ No register_id circuit verifiers found to update for EU_ID_CARD");
|
||||
}
|
||||
|
||||
// Batch update DSC circuit verifiers for E_PASSPORT
|
||||
console.log("\n📝 STEP 5: Batch updating DSC circuit verifiers for E_PASSPORT...");
|
||||
console.log("===============================================================");
|
||||
|
||||
console.log("🔍 Discovering DSC verifiers...");
|
||||
const dscKeys = Object.keys(DscVerifierId).filter((key) => isNaN(Number(key)));
|
||||
console.log(` Found ${dscKeys.length} DSC verifier keys in enum:`, dscKeys);
|
||||
|
||||
const dscAttestationIds: string[] = [];
|
||||
const dscCircuitVerifierIds: number[] = [];
|
||||
const dscCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
for (const key of dscKeys) {
|
||||
console.log(`\n 🔄 Processing DSC verifier: ${key}`);
|
||||
const verifierName = `Verifier_${key}`;
|
||||
console.log(` Searching for: ${verifierName}`);
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(`Skipping ${verifierName} because no deployed address was found.`);
|
||||
console.log(` ❌ Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const verifierId = DscVerifierId[key as keyof typeof DscVerifierId];
|
||||
console.log(` ✅ Found verifier: ${verifierName} -> ${verifierAddress}`);
|
||||
console.log(` 📋 Verifier ID: ${verifierId}`);
|
||||
|
||||
dscAttestationIds.push(AttestationId.E_PASSPORT);
|
||||
dscCircuitVerifierIds.push(verifierId);
|
||||
dscCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
|
||||
if (dscCircuitVerifierIds.length > 0) {
|
||||
console.log("Batch updating DSC circuit verifiers");
|
||||
console.log(`\n📊 DSC verifiers summary for E_PASSPORT:`);
|
||||
console.log(` Total found: ${dscCircuitVerifierIds.length}`);
|
||||
console.log(` Verifier IDs: [${dscCircuitVerifierIds.join(', ')}]`);
|
||||
console.log(` Addresses: [${dscCircuitVerifierAddresses.map(addr => addr.slice(0, 10) + '...').join(', ')}]`);
|
||||
|
||||
if (dscCircuitVerifierIds.length > 0) {
|
||||
try {
|
||||
console.log(`📤 Sending batchUpdateDscCircuitVerifiers transaction for E_PASSPORT...`);
|
||||
const tx = await identityVerificationHub.batchUpdateDscCircuitVerifiers(
|
||||
dscAttestationIds,
|
||||
dscCircuitVerifierIds,
|
||||
dscCircuitVerifierAddresses,
|
||||
);
|
||||
console.log(`⏳ Transaction sent: ${tx.hash}`);
|
||||
console.log(`⏳ Waiting for confirmation...`);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`DSC circuit verifiers updated with tx: ${receipt.hash}`);
|
||||
console.log(`✅ DSC circuit verifiers for E_PASSPORT updated successfully!`);
|
||||
console.log(` Transaction hash: ${receipt.hash}`);
|
||||
console.log(` Gas used: ${receipt.gasUsed}`);
|
||||
} catch (error) {
|
||||
console.error("Error batch updating DSC circuit verifiers:", error);
|
||||
console.error("❌ Error batch updating DSC circuit verifiers for E_PASSPORT:", error);
|
||||
}
|
||||
} else {
|
||||
console.log("⚠️ No DSC circuit verifiers found for E_PASSPORT");
|
||||
}
|
||||
|
||||
// Batch update DSC circuit verifiers for EU_ID_CARD
|
||||
console.log("\n📝 STEP 6: Batch updating DSC circuit verifiers for EU_ID_CARD...");
|
||||
console.log("===============================================================");
|
||||
|
||||
const dscIdAttestationIds: string[] = [];
|
||||
const dscIdCircuitVerifierIds: number[] = [];
|
||||
const dscIdCircuitVerifierAddresses: string[] = [];
|
||||
|
||||
for (const key of dscKeys) {
|
||||
console.log(`\n 🔄 Processing DSC verifier for EU_ID_CARD: ${key}`);
|
||||
const verifierName = `Verifier_${key}`;
|
||||
console.log(` Searching for: ${verifierName}`);
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
|
||||
if (!verifierAddress) {
|
||||
console.log(` ❌ Skipping ${verifierName} because no deployed address was found.`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const verifierId = DscVerifierId[key as keyof typeof DscVerifierId];
|
||||
console.log(` ✅ Found verifier: ${verifierName} -> ${verifierAddress}`);
|
||||
console.log(` 📋 Verifier ID: ${verifierId}`);
|
||||
|
||||
dscIdAttestationIds.push(AttestationId.EU_ID_CARD);
|
||||
dscIdCircuitVerifierIds.push(verifierId);
|
||||
dscIdCircuitVerifierAddresses.push(verifierAddress as string);
|
||||
}
|
||||
|
||||
console.log(`\n📊 DSC verifiers summary for EU_ID_CARD:`);
|
||||
console.log(` Total found: ${dscIdCircuitVerifierIds.length}`);
|
||||
console.log(` Verifier IDs: [${dscIdCircuitVerifierIds.join(', ')}]`);
|
||||
console.log(` Addresses: [${dscIdCircuitVerifierAddresses.map(addr => addr.slice(0, 10) + '...').join(', ')}]`);
|
||||
|
||||
if (dscIdCircuitVerifierIds.length > 0) {
|
||||
try {
|
||||
console.log(`📤 Sending batchUpdateDscCircuitVerifiers transaction for EU_ID_CARD...`);
|
||||
const tx = await identityVerificationHub.batchUpdateDscCircuitVerifiers(
|
||||
dscIdAttestationIds,
|
||||
dscIdCircuitVerifierIds,
|
||||
dscIdCircuitVerifierAddresses,
|
||||
);
|
||||
console.log(`⏳ Transaction sent: ${tx.hash}`);
|
||||
console.log(`⏳ Waiting for confirmation...`);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`✅ DSC circuit verifiers for EU_ID_CARD updated successfully!`);
|
||||
console.log(` Transaction hash: ${receipt.hash}`);
|
||||
console.log(` Gas used: ${receipt.gasUsed}`);
|
||||
} catch (error) {
|
||||
console.error("❌ Error batch updating DSC circuit verifiers for EU_ID_CARD:", error);
|
||||
}
|
||||
} else {
|
||||
console.log("⚠️ No DSC circuit verifiers found for EU_ID_CARD");
|
||||
}
|
||||
|
||||
console.log("\n🎉 Script execution completed!");
|
||||
console.log("===============================");
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error("Execution error:", error);
|
||||
console.error("💥 Execution error:", error);
|
||||
if (error.reason) console.error(" Reason:", error.reason);
|
||||
if (error.code) console.error(" Code:", error.code);
|
||||
if (error.transaction) console.error(" Transaction:", error.transaction);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Initial setup error:", error);
|
||||
console.error("💥 Initial setup error:", error);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
|
||||
54
contracts/scripts/showRegistryAddresses.ts
Normal file
54
contracts/scripts/showRegistryAddresses.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
|
||||
async function showRegistryAddresses() {
|
||||
console.log("🔍 Registry Deployment Addresses:");
|
||||
console.log("================================");
|
||||
|
||||
try {
|
||||
// Read the deployed addresses from the deployment artifacts
|
||||
const deployedAddressesPath = path.join(
|
||||
__dirname,
|
||||
"../ignition/deployments/chain-44787/deployed_addresses.json"
|
||||
);
|
||||
|
||||
if (!fs.existsSync(deployedAddressesPath)) {
|
||||
console.log("❌ No deployment found for chain 44787 (Alfajores)");
|
||||
console.log(" Please run: yarn deploy:registry");
|
||||
return;
|
||||
}
|
||||
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(deployedAddressesPath, "utf8"));
|
||||
|
||||
// Show registry-related addresses
|
||||
const registryKeys = Object.keys(deployedAddresses).filter(key =>
|
||||
key.startsWith("DeployRegistryModule#")
|
||||
);
|
||||
|
||||
if (registryKeys.length === 0) {
|
||||
console.log("❌ No registry contracts found in deployed addresses");
|
||||
console.log(" Available deployments:", Object.keys(deployedAddresses));
|
||||
return;
|
||||
}
|
||||
|
||||
registryKeys.forEach(key => {
|
||||
const contractName = key.replace("DeployRegistryModule#", "");
|
||||
const address = deployedAddresses[key];
|
||||
let emoji = "📝";
|
||||
|
||||
if (contractName === "PoseidonT3") emoji = "📚";
|
||||
else if (contractName === "IdentityRegistryImplV1") emoji = "🏗️";
|
||||
else if (contractName === "IdentityRegistry") emoji = "🚀";
|
||||
|
||||
console.log(`${emoji} ${contractName}:`);
|
||||
console.log(` ${address}`);
|
||||
});
|
||||
|
||||
console.log("\n✅ Registry deployment complete!");
|
||||
|
||||
} catch (error) {
|
||||
console.error("❌ Error reading deployment addresses:", error);
|
||||
}
|
||||
}
|
||||
|
||||
showRegistryAddresses().catch(console.error);
|
||||
12
contracts/scripts/staging.sh
Executable file
12
contracts/scripts/staging.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Create directories if they don't exist
|
||||
mkdir -p ignition/deployments/staging/artifacts
|
||||
|
||||
# Copy deployed_addresses.json
|
||||
cp ignition/deployments/chain-44787/deployed_addresses.json ignition/deployments/staging/deployed_addresses.json
|
||||
|
||||
# Copy all artifacts from chain-44787 to staging
|
||||
cp -r ignition/deployments/chain-44787/artifacts/* ignition/deployments/staging/artifacts/
|
||||
|
||||
echo "Successfully exported chain-44787 deployment files to staging directory"
|
||||
Reference in New Issue
Block a user