mirror of
https://github.com/selfxyz/self.git
synced 2026-01-10 23:27:56 -05:00
Update verifiers (#184)
This commit is contained in:
committed by
GitHub
parent
e09a5e8349
commit
c220d58d9d
@@ -135,7 +135,9 @@ export enum RegisterVerifierId {
|
||||
register_sha1_sha256_sha256_rsa_65537_4096 = 15,
|
||||
register_sha224_sha224_sha224_ecdsa_brainpoolP224r1 = 16,
|
||||
register_sha256_sha224_sha224_ecdsa_secp224r1 = 17,
|
||||
register_sha256_sha256_sha256_ecdsa_brainpoolP256r1 = 18
|
||||
register_sha256_sha256_sha256_ecdsa_brainpoolP256r1 = 18,
|
||||
register_sha1_sha1_sha1_ecdsa_brainpoolP224r1 = 19,
|
||||
register_sha384_sha384_sha384_rsapss_65537_48_2048 = 20,
|
||||
};
|
||||
|
||||
export enum DscVerifierId {
|
||||
@@ -156,7 +158,8 @@ export enum DscVerifierId {
|
||||
dsc_sha512_ecdsa_brainpoolP512r1 = 14,
|
||||
dsc_sha512_ecdsa_secp521r1 = 15,
|
||||
dsc_sha512_rsa_65537_4096 = 16,
|
||||
dsc_sha512_rsapss_65537_64_4096 = 17
|
||||
dsc_sha512_rsapss_65537_64_4096 = 17,
|
||||
dsc_sha256_rsapss_3_32_4096 = 18,
|
||||
};
|
||||
|
||||
export enum SignatureAlgorithmIndex {
|
||||
|
||||
@@ -37,68 +37,77 @@ contract Verifier_vc_and_disclose {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 8171490868973035653618389657772146026236512067359299504309976808339221455945;
|
||||
uint256 constant deltax2 = 1807865550635575770017814887379982633906963839491898267425392469104017084552;
|
||||
uint256 constant deltay1 = 8602714637931053909502061851816609649232437288868154346453227155271177632417;
|
||||
uint256 constant deltay2 = 21310521141589807574981105059592063768735060690323471826550806455469133832811;
|
||||
uint256 constant deltax1 = 21065329734864763713809634189736384930216140267680185743468361133305512567820;
|
||||
uint256 constant deltax2 = 19884021869610667485143531869347288785694671472104782876182233086297022907304;
|
||||
uint256 constant deltay1 = 14286208417420085177729398217973335216644892152424865361488103401383069505779;
|
||||
uint256 constant deltay2 = 18560480605280333001041652536764875391099001795499977327437993275506400956521;
|
||||
|
||||
|
||||
uint256 constant IC0x = 10370114202803665532060425648722146044484953054751202671816311689407444400285;
|
||||
uint256 constant IC0y = 20225806570051915084577741156680748839395520260102982526309007754599167362942;
|
||||
uint256 constant IC0x = 1327643666632315025512187418817023630780563184758021455663314119872437463145;
|
||||
uint256 constant IC0y = 2622893971724901828914047259052067392447274440848954417614321746778812751881;
|
||||
|
||||
uint256 constant IC1x = 19793438079481169790503723923576953737891333839146034001623832407219491185982;
|
||||
uint256 constant IC1y = 9611320071378602154373099346396448153453320171612885404185603984733259874502;
|
||||
uint256 constant IC1x = 20927011517723457008102782318397010921983294435880612972153120487747261995333;
|
||||
uint256 constant IC1y = 18649509350577586920402079427241751583571095028055506078542019996865511703564;
|
||||
|
||||
uint256 constant IC2x = 15577274887875065727830529916974247266080273299500986393624177808881844105458;
|
||||
uint256 constant IC2y = 2909584355372775068014405275787614464185864635563495253664515300652049508078;
|
||||
uint256 constant IC2x = 18223545039205454783148203870836982137410477518180720119480480153635557174304;
|
||||
uint256 constant IC2y = 14354250107099459449970545617224325946145147040253960693477698870437037762909;
|
||||
|
||||
uint256 constant IC3x = 1611434623096275982353137765374561994339530955990548567664588679248441915822;
|
||||
uint256 constant IC3y = 7341809136954563038332980172966204368435199947803318266952287781869732056571;
|
||||
uint256 constant IC3x = 2173758372018833803307650315845499838285851237592930252028174525580546546212;
|
||||
uint256 constant IC3y = 11484957593605555554581664590508364277322965026091620635584632890824112335330;
|
||||
|
||||
uint256 constant IC4x = 19104924222643198084431851367233038043364967449152524119061286392024460680099;
|
||||
uint256 constant IC4y = 1014489770504161800713018569889418072854581516993176287754674058045618764306;
|
||||
uint256 constant IC4x = 7157190044841716686091632308502737011979099809606870421939953854408747856731;
|
||||
uint256 constant IC4y = 18315602217937620885107757034463661543707738397425161578650110819142660670372;
|
||||
|
||||
uint256 constant IC5x = 6445424243111902289315608266674568736284504125244535662599509232705692228248;
|
||||
uint256 constant IC5y = 7283351424218467385412970040529873065301308198233350248746400016221436170039;
|
||||
uint256 constant IC5x = 6260667805546381923858902471892397126243269313854577708606218376521908362565;
|
||||
uint256 constant IC5y = 13716486493605237311926465265255870345358784266311689841198776426559442954137;
|
||||
|
||||
uint256 constant IC6x = 13425791861360394315115814064083706979869043572496127159201833044695672386878;
|
||||
uint256 constant IC6y = 15578003913890810487598763681030022715665320438878490008042632481055787820754;
|
||||
uint256 constant IC6x = 18606363599559637061941956230491916987222537133370229590923171484462919701227;
|
||||
uint256 constant IC6y = 2433361506657306508828144447793032310343955443449067717401403184301651823995;
|
||||
|
||||
uint256 constant IC7x = 5172057316071336271595504686961033301542480548667356242556592185190011398706;
|
||||
uint256 constant IC7y = 19154313264513773521059877922269063784064636615101184047595423091086807566031;
|
||||
uint256 constant IC7x = 19280866248824868201853947527606978917049858969164646547147582117900910165818;
|
||||
uint256 constant IC7y = 12004989744914315761708669577255110696291165332282234776831447906508334174065;
|
||||
|
||||
uint256 constant IC8x = 16377284334493500132959454653341162887814767612915218269395286826010112459690;
|
||||
uint256 constant IC8y = 20224926814266060966800031273139855319844637705626961479766586081588206678331;
|
||||
uint256 constant IC8x = 9499667142250207864939084997366463919158967968217947947452929384485105655483;
|
||||
uint256 constant IC8y = 7934640485738501605809283862245180894070081349952179321671898117937450554978;
|
||||
|
||||
uint256 constant IC9x = 7965669957734426434458064802472546750277950575141028645950669458810361870079;
|
||||
uint256 constant IC9y = 11507823166516055882389647087058284246879381991833399399507252753957708045817;
|
||||
uint256 constant IC9x = 20248101600931458686357220379631192702866178668147896841612695942649039306904;
|
||||
uint256 constant IC9y = 17146962363094782772160475831653226068881596057834124050728488367347134754895;
|
||||
|
||||
uint256 constant IC10x = 17804088622564134938337284659865428217531362824108453821012709676778261837785;
|
||||
uint256 constant IC10y = 6097971449256607361027458787703346794661348460701812374200651044304900381864;
|
||||
uint256 constant IC10x = 7698102871102525311081154517506621927872860404243843030208612865041171291679;
|
||||
uint256 constant IC10y = 17451440288940059901172619610591057928798945050984287918189963973980684490936;
|
||||
|
||||
uint256 constant IC11x = 4365733824267549039023853586880515319995169553534966127481399704439209111066;
|
||||
uint256 constant IC11y = 7499405809531594369733965832081720292618845817351996655742211875827702783253;
|
||||
uint256 constant IC11x = 15522722806663355688859428499986250804296589439746832906847538630162245728449;
|
||||
uint256 constant IC11y = 17731443422876322849401673846065881492578186542336670047706150379276239434736;
|
||||
|
||||
uint256 constant IC12x = 18166151688586651790998810625849019731041554544972724678380373880064207146838;
|
||||
uint256 constant IC12y = 6395405251436601030385590882118285291248208995361099899753730914151183577401;
|
||||
uint256 constant IC12x = 12339816027317431982064382456180166106960325372245286406655416854868988899703;
|
||||
uint256 constant IC12y = 1623004256251937705099896843572191766950534593682479744120770181852683481461;
|
||||
|
||||
uint256 constant IC13x = 2637649946046652403005035921404943786642980114479052521311855116540691483613;
|
||||
uint256 constant IC13y = 16554722544462388106834147558649721977049807011636823368312187172507437343924;
|
||||
uint256 constant IC13x = 16216101416188390585624804230286907502888542435957249996363202481890837436823;
|
||||
uint256 constant IC13y = 19792033164136600401729520568052979301967100486751550563922332851674279231879;
|
||||
|
||||
uint256 constant IC14x = 15158741949128055300286589383346786989343917876687455971039660124801987917109;
|
||||
uint256 constant IC14y = 13647951541071800908877872537973730769158352273596112008158439498600386539419;
|
||||
uint256 constant IC14x = 9526823787561424517694409522408689943116198117932113165892430928752383410927;
|
||||
uint256 constant IC14y = 15425544394205620802764497690404474607132882651029664273449118268473325168573;
|
||||
|
||||
uint256 constant IC15x = 3798683298870163292202662452405569093801861513507188273992576196452316072820;
|
||||
uint256 constant IC15y = 6025156645397990587695686222337436310863041572999135939890010310508770619734;
|
||||
uint256 constant IC15x = 21379552168442334118192987128570335250484225781188878794769111112730685255680;
|
||||
uint256 constant IC15y = 11413252397601154464320301772186050681727031323285046472485957139652053961337;
|
||||
|
||||
uint256 constant IC16x = 213849419412509355139745211912514062293842562550822460598245270476834598696;
|
||||
uint256 constant IC16y = 6966444116300101516706654479201725235707430678901257415922050446151654022150;
|
||||
uint256 constant IC16x = 20428162085801543636385155875246864224732967575559765504978908153515749149989;
|
||||
uint256 constant IC16y = 18815283633327124443616880398781266901051625797588830712455957697615424697685;
|
||||
|
||||
uint256 constant IC17x = 4443493404788309304733358127389868369452918828959966155290898941847676347265;
|
||||
uint256 constant IC17y = 12617942006566815577976507570351371012452401071846706141123841006383608274549;
|
||||
uint256 constant IC17x = 14469038019687287252080675455019765736968071520512741147009183358330281848192;
|
||||
uint256 constant IC17y = 2254410426995330112169610023372576019626185925041252653212723256001596932807;
|
||||
|
||||
uint256 constant IC18x = 8818457607679841061717595228441089388639495166474364985982727537718622446541;
|
||||
uint256 constant IC18y = 17722870791801697423500030065251803027417453266264029375779545878068863207286;
|
||||
uint256 constant IC18x = 6646738351527040290587708010640343681780304778150763218965087230163505094741;
|
||||
uint256 constant IC18y = 7224595387826330922504236191632797623787710821043271778727414843835083051307;
|
||||
|
||||
uint256 constant IC19x = 13930005350988118664410913458609814475220380700610122956318720762892362913810;
|
||||
uint256 constant IC19y = 1510210795288547564147036133366552832970234430196908175239728458476685653344;
|
||||
|
||||
uint256 constant IC20x = 19395101085598768787243131602792145650244700025278061861975309911987787383833;
|
||||
uint256 constant IC20y = 19593647464319651444688400549955086154512565325512427576174534610645336455682;
|
||||
|
||||
uint256 constant IC21x = 6877461228082443111890464295830127588035564773913061145705260000890224419695;
|
||||
uint256 constant IC21y = 13729662662934324858332564018609296055385187918293000684588750857191114304504;
|
||||
|
||||
|
||||
// Memory data
|
||||
@@ -107,7 +116,7 @@ contract Verifier_vc_and_disclose {
|
||||
|
||||
uint16 constant pLastMem = 896;
|
||||
|
||||
function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[18] calldata _pubSignals) public view returns (bool) {
|
||||
function verifyProof(uint[2] calldata _pA, uint[2][2] calldata _pB, uint[2] calldata _pC, uint[21] calldata _pubSignals) public view returns (bool) {
|
||||
assembly {
|
||||
function checkField(v) {
|
||||
if iszero(lt(v, r)) {
|
||||
@@ -187,6 +196,12 @@ contract Verifier_vc_and_disclose {
|
||||
|
||||
g1_mulAccC(_pVk, IC18x, IC18y, calldataload(add(pubSignals, 544)))
|
||||
|
||||
g1_mulAccC(_pVk, IC19x, IC19y, calldataload(add(pubSignals, 576)))
|
||||
|
||||
g1_mulAccC(_pVk, IC20x, IC20y, calldataload(add(pubSignals, 608)))
|
||||
|
||||
g1_mulAccC(_pVk, IC21x, IC21y, calldataload(add(pubSignals, 640)))
|
||||
|
||||
|
||||
// -A
|
||||
mstore(_pPairing, calldataload(pA))
|
||||
@@ -276,6 +291,12 @@ contract Verifier_vc_and_disclose {
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 544)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 576)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 608)))
|
||||
|
||||
checkField(calldataload(add(_pubSignals, 640)))
|
||||
|
||||
|
||||
// Validate all evaluations
|
||||
let isValid := checkPairing(_pA, _pB, _pC, _pubSignals, pMem)
|
||||
|
||||
@@ -37,20 +37,20 @@ contract Verifier_dsc_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 3730365903128819909170005683059743089815359518290245482054307004262505023932;
|
||||
uint256 constant deltax2 = 20504763903692425556935085261774404743441181684908313325035700432492855892729;
|
||||
uint256 constant deltay1 = 17425161062779439106438857752524034035675998412233260869605382778722675980380;
|
||||
uint256 constant deltay2 = 12840370851686686363577458103233281123392596235488984732682460115756208320428;
|
||||
uint256 constant deltax1 = 4056326682593252374154721904049720805581201454384468956042726414816096257242;
|
||||
uint256 constant deltax2 = 18897626800494519278218874835985509447469075545811278080664495431607291224298;
|
||||
uint256 constant deltay1 = 12593432310249479664661217454923350092108938447391372055993927206744189522626;
|
||||
uint256 constant deltay2 = 16224579407741072371544023238782069079335133396017330612512216688259670283213;
|
||||
|
||||
|
||||
uint256 constant IC0x = 3694719960071357034806323578595407809252918523060534066342245446821599421002;
|
||||
uint256 constant IC0y = 363247115885678312311573434941088413728958140504798165776265217264739221855;
|
||||
uint256 constant IC0x = 3843745877786140982041386388849603732708021018821237538468885507592953186207;
|
||||
uint256 constant IC0y = 11875762927521974348353869471521586673829373429302077806282117736480797097743;
|
||||
|
||||
uint256 constant IC1x = 21605473622222755768138820077528500225050008111823412540470784462473413884977;
|
||||
uint256 constant IC1y = 11033390057771779147948775215251645060265141855767828482198197507666778135857;
|
||||
uint256 constant IC1x = 10672962551342929017020221218857787529643459661913710330482576817138407204110;
|
||||
uint256 constant IC1y = 8261318605880951144841128226757005636416661603605299778929617121770461692462;
|
||||
|
||||
uint256 constant IC2x = 4543876073078889220251667873133281830810122189055193492532064166275609249845;
|
||||
uint256 constant IC2y = 10062063679277520748066177329365849785097253540896644918395448946531332991045;
|
||||
uint256 constant IC2x = 4362611164886591707188220119188285301652243903312642293021035268695617013511;
|
||||
uint256 constant IC2y = 8114485986806749942640197146924988256207035890951894628476178111089589887282;
|
||||
|
||||
|
||||
// Memory data
|
||||
|
||||
@@ -37,23 +37,23 @@ contract Verifier_register_sha1_sha256_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 10135556044842668208442836738519868110606846702560155451735209428602189792595;
|
||||
uint256 constant deltax2 = 5694672614939189106785058586667953005387333166106901334228156469791625385410;
|
||||
uint256 constant deltay1 = 16213453853027021078192376060499530907175135792610776641172891280549801543007;
|
||||
uint256 constant deltay2 = 9067377200169469425477575835963174972540366562897083682186733695978922209682;
|
||||
uint256 constant deltax1 = 14194177346600612282000306458617249555989356340453958238362759647473413663402;
|
||||
uint256 constant deltax2 = 1478483666657570128727387360851766578625419232124066147565185430493373350169;
|
||||
uint256 constant deltay1 = 3124048861076342272454323895648338421212778377099174046700369971101509374250;
|
||||
uint256 constant deltay2 = 20029612689212899412566996281697278426883100370878811844118312065212269438517;
|
||||
|
||||
|
||||
uint256 constant IC0x = 353788612555690165303296324788244812829188962677561373403815229867298316239;
|
||||
uint256 constant IC0y = 5218186200537452142339672153699895778652956255409985686036395764356148023589;
|
||||
uint256 constant IC0x = 18127556278301290712062366578628386326205920874089468065881580993845270820479;
|
||||
uint256 constant IC0y = 14579023631541524562866979272076545907668873073129521594397106900558135626577;
|
||||
|
||||
uint256 constant IC1x = 11743221105564550762712694094951960096890894419429438509976097809007591750;
|
||||
uint256 constant IC1y = 9391990573324067545845234105829802449184481916535532476015992024001533765593;
|
||||
uint256 constant IC1x = 141913091135519541176735688105742987413473358900451577715430664041187665983;
|
||||
uint256 constant IC1y = 221252097486914010465281867504263111174818281566735241854773392854493825392;
|
||||
|
||||
uint256 constant IC2x = 6479603846188615563663612234899140442790258133642526212705791535997996584937;
|
||||
uint256 constant IC2y = 9806913410378726466649741582960844128999169390653372294848343734226174896732;
|
||||
uint256 constant IC2x = 21013251300219055654397127544620477900342467788352934393798429140806423870892;
|
||||
uint256 constant IC2y = 613389022608381036868782706777454256842371428979610514201071752855985059753;
|
||||
|
||||
uint256 constant IC3x = 8030468949700528713142378184234878041091363234558622087153911866681705597846;
|
||||
uint256 constant IC3y = 11402009156253067685723179288699148959800035281244680885021267740117258839844;
|
||||
uint256 constant IC3x = 13566799124657139049624255296142128407884193885776263191320858917851144145965;
|
||||
uint256 constant IC3y = 10389733748635157302432655621517757404283539374571469043004314970483084146084;
|
||||
|
||||
|
||||
// Memory data
|
||||
|
||||
@@ -37,23 +37,23 @@ contract Verifier_register_sha256_sha256_sha256_ecdsa_brainpoolP256r1 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 14771974677558923321507976293520787639369376521077732296843905022898255996297;
|
||||
uint256 constant deltax2 = 949801994164823485660590516778125672661767910693547018917021513107977971100;
|
||||
uint256 constant deltay1 = 3745463178241088238620460816308293134540772906988649308351863397940284795125;
|
||||
uint256 constant deltay2 = 4607799472708669599297543975361425552169429620460253273097564582945277015524;
|
||||
uint256 constant deltax1 = 2230349647915301498491080045046727722648188024269010886928159286551473068770;
|
||||
uint256 constant deltax2 = 11901360907300165840820874410463705571372837127763472128732434932140258887192;
|
||||
uint256 constant deltay1 = 10843442466117423757268391590727038568494122521205614988149736517817477665449;
|
||||
uint256 constant deltay2 = 1617287152865902952019075272272509905536485080141894984530837314465517765618;
|
||||
|
||||
|
||||
uint256 constant IC0x = 21594363616391238255797703194717792234096646212365505524546666356455059079234;
|
||||
uint256 constant IC0y = 420160319989401814505664379323800656396187368167665408241808540744909301381;
|
||||
uint256 constant IC0x = 9640380545322209822777411481787631874962125577450552332255467362541353499425;
|
||||
uint256 constant IC0y = 13429939575762650326916382747593022615353130384994114680002979334146573129255;
|
||||
|
||||
uint256 constant IC1x = 2321909757784189467920665803761595235933023017273596597974978512681768697467;
|
||||
uint256 constant IC1y = 8391758599379050838249118969202704730941398608359649438006591373969720393581;
|
||||
uint256 constant IC1x = 17632104423942032550028764412935909002932232889107479150963372125307690584704;
|
||||
uint256 constant IC1y = 18168541405494101039494008261123850010493843415024694739938756335740421489186;
|
||||
|
||||
uint256 constant IC2x = 21439088442289927702664421165638295239327596471260273021786752113713797800203;
|
||||
uint256 constant IC2y = 3592916051631435051139309145057642375407692304938038330423104264101109307213;
|
||||
uint256 constant IC2x = 20915155382446619822513623989417659540216227578582710950875831266475696751906;
|
||||
uint256 constant IC2y = 13262412059865150096134296399412634712758947526136715076920376747412004616637;
|
||||
|
||||
uint256 constant IC3x = 3418938450201935394715654027158142418920504553249953060607491272235053740364;
|
||||
uint256 constant IC3y = 12765344368030731519287747774920154244027538220489221335561121717694808707684;
|
||||
uint256 constant IC3x = 9844602234539712601597559360151838389696264242646821983368234020631443261848;
|
||||
uint256 constant IC3y = 7709909137050813894462695208887903870424492321633344161876914269724545458409;
|
||||
|
||||
|
||||
// Memory data
|
||||
|
||||
@@ -37,23 +37,23 @@ contract Verifier_register_sha256_sha256_sha256_rsa_65537_4096 {
|
||||
uint256 constant gammax2 = 10857046999023057135944570762232829481370756359578518086990519993285655852781;
|
||||
uint256 constant gammay1 = 4082367875863433681332203403145435568316851327593401208105741076214120093531;
|
||||
uint256 constant gammay2 = 8495653923123431417604973247489272438418190587263600148770280649306958101930;
|
||||
uint256 constant deltax1 = 1168702689002897822390331569962648408752476702951730329043972594919620764632;
|
||||
uint256 constant deltax2 = 14377277167318660834630237688633257135586651378293765310925702150129024559637;
|
||||
uint256 constant deltay1 = 2422664632231813106449592713366655890586159817872378460682703703239270959236;
|
||||
uint256 constant deltay2 = 12796577082199910470809303183728188507843251053070448666592481081547588307215;
|
||||
uint256 constant deltax1 = 18202144810192183899497085663377024956399572145976550896845918258435242312525;
|
||||
uint256 constant deltax2 = 7393843891278513490650367772928137317297959871887443487545630802672991843570;
|
||||
uint256 constant deltay1 = 13028504899227886497582702223853063767522395650677576950173968670277642054965;
|
||||
uint256 constant deltay2 = 5306717974973316033708044536357301866369605561303064062662396066140626293743;
|
||||
|
||||
|
||||
uint256 constant IC0x = 18437964935408002498691829903437545948738187768112662421600041601950168504001;
|
||||
uint256 constant IC0y = 10995087032755437508156260980910160153033101697056038971726920569936511475334;
|
||||
uint256 constant IC0x = 20761884079094184124051519587826973179220391259763013483913874847728098505245;
|
||||
uint256 constant IC0y = 13443513945590051028033693311587404513190029895461748981126054696659158356450;
|
||||
|
||||
uint256 constant IC1x = 15825624861298419915172479879695136191661298249400389652073515717464842712314;
|
||||
uint256 constant IC1y = 8862335267936077356109962399880715869563544365027394025492336808448851230126;
|
||||
uint256 constant IC1x = 7716977492740431402972311010973836521974336004764501690000506677448806226457;
|
||||
uint256 constant IC1y = 20243083795965757028094184597463253474182390847320058675125257997599372016681;
|
||||
|
||||
uint256 constant IC2x = 14826196445381905439921465971865670478329135574367107319591317937480185480148;
|
||||
uint256 constant IC2y = 11959802146335853438536386910733089944651015948705857592985199703891465893119;
|
||||
uint256 constant IC2x = 6150729961593624015520569421335282087567376207834090560921411585718469568529;
|
||||
uint256 constant IC2y = 8848339651225051021189584733763734294365727241251686536763076186188606501023;
|
||||
|
||||
uint256 constant IC3x = 9082312380733344180479511273350890744739582199116458564294097348754901026877;
|
||||
uint256 constant IC3y = 11355767726384776916614221075608465778000954361590182585731442296125692759864;
|
||||
uint256 constant IC3x = 12563949632765232089879516232312487984802739426534093873096912706905928480256;
|
||||
uint256 constant IC3y = 6075273025540638045086680975662719390175987413563255053357122973281719310227;
|
||||
|
||||
|
||||
// Memory data
|
||||
|
||||
@@ -114,4 +114,4 @@
|
||||
"typechain": "^8.3.2",
|
||||
"typescript": "^5.1.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,66 +6,112 @@ import { RegisterVerifierId, DscVerifierId } from "../../common/src/constants/co
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(path.join(__dirname, "../ignition/deployments/chain-42220/deployed_addresses.json"), "utf-8"));
|
||||
const contractAbiPath = path.join(__dirname, "../ignition/deployments/chain-11155111/artifacts");
|
||||
// Debug logs for paths and files
|
||||
console.log("Current directory:", __dirname);
|
||||
console.log("Deployed addresses path:", path.join(__dirname, "../ignition/deployments/chain-42220/deployed_addresses.json"));
|
||||
console.log("Contract ABI path:", path.join(__dirname, "../ignition/deployments/chain-42220/artifacts/DeployHub#IdentityVerificationHubImplV1.json"));
|
||||
|
||||
function getContractAddressByPartialName(partialName: string): string | unknown {
|
||||
for (const [key, value] of Object.entries(deployedAddresses)) {
|
||||
if (key.includes(partialName)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
// 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);
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const deployedAddresses = JSON.parse(fs.readFileSync(path.join(__dirname, "../ignition/deployments/chain-42220/deployed_addresses.json"), "utf-8"));
|
||||
console.log("Deployed addresses loaded:", deployedAddresses);
|
||||
|
||||
const provider = new ethers.JsonRpcProvider(process.env.CELO_RPC_URL as string);
|
||||
const wallet = new ethers.Wallet(process.env.CELO_KEY as string, provider);
|
||||
const identityVerificationHubAbiFile = fs.readFileSync(path.join(__dirname, "../ignition/deployments/chain-42220/artifacts/DeployHub#IdentityVerificationHubImplV1.json"), "utf-8");
|
||||
console.log("ABI file loaded");
|
||||
|
||||
const identityVerificationHubAbi = JSON.parse(identityVerificationHubAbiFile).abi;
|
||||
const identityVerificationHub = new ethers.Contract(deployedAddresses["DeployHub#IdentityVerificationHub"], identityVerificationHubAbi, wallet);
|
||||
console.log("ABI parsed");
|
||||
|
||||
const registerVerifierKeys = Object.keys(RegisterVerifierId).filter(key => isNaN(Number(key)));
|
||||
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 contractAbiPath = path.join(__dirname, "../ignition/deployments/chain-11155111/artifacts");
|
||||
|
||||
function getContractAddressByPartialName(partialName: string): string | unknown {
|
||||
for (const [key, value] of Object.entries(deployedAddresses)) {
|
||||
if (key.includes(partialName)) {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
console.log(`Updating for ${verifierName}`);
|
||||
const verifierId = RegisterVerifierId[key as keyof typeof RegisterVerifierId];
|
||||
|
||||
const tx = await identityVerificationHub.updateRegisterCircuitVerifier(
|
||||
verifierId,
|
||||
verifierAddress
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`${verifierName} is updated wit this tx: ${receipt.hash}`)
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const dscKeys = Object.keys(DscVerifierId).filter(key => isNaN(Number(key)));
|
||||
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];
|
||||
async function main() {
|
||||
const provider = new ethers.JsonRpcProvider(process.env.CELO_RPC_URL as string);
|
||||
console.log("Provider created");
|
||||
|
||||
const tx = await identityVerificationHub.updateDscVerifier(
|
||||
verifierId,
|
||||
verifierAddress
|
||||
const wallet = new ethers.Wallet(process.env.CELO_KEY as string, provider);
|
||||
console.log("Wallet created");
|
||||
|
||||
const hubAddress = deployedAddresses["DeployHub#IdentityVerificationHub"];
|
||||
console.log("Hub address:", hubAddress);
|
||||
|
||||
if (!hubAddress) {
|
||||
throw new Error("Hub address not found in deployed_addresses.json");
|
||||
}
|
||||
|
||||
const identityVerificationHub = new ethers.Contract(
|
||||
hubAddress,
|
||||
identityVerificationHubAbi,
|
||||
wallet
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`${verifierName} is updated wit this tx: ${receipt.hash}`);
|
||||
console.log("Contract instance created");
|
||||
|
||||
// Debug verifier addresses before updating
|
||||
const registerVerifierKeys = Object.keys(RegisterVerifierId).filter(key => isNaN(Number(key)));
|
||||
for (const key of registerVerifierKeys) {
|
||||
const verifierName = `Verifier_${key}`;
|
||||
const verifierAddress = getContractAddressByPartialName(verifierName);
|
||||
console.log(`${verifierName} address:`, verifierAddress);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
console.log(`Updating for ${verifierName}`);
|
||||
const verifierId = RegisterVerifierId[key as keyof typeof RegisterVerifierId];
|
||||
|
||||
try {
|
||||
const tx = await identityVerificationHub.updateRegisterCircuitVerifier(
|
||||
verifierId,
|
||||
verifierAddress
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`${verifierName} is updated with tx: ${receipt.hash}`);
|
||||
} catch (error) {
|
||||
console.error(`Error updating ${verifierName}:`, error);
|
||||
}
|
||||
}
|
||||
|
||||
const dscKeys = Object.keys(DscVerifierId).filter(key => isNaN(Number(key)));
|
||||
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];
|
||||
|
||||
const tx = await identityVerificationHub.updateDscVerifier(
|
||||
verifierId,
|
||||
verifierAddress
|
||||
);
|
||||
const receipt = await tx.wait();
|
||||
console.log(`${verifierName} is updated wit this tx: ${receipt.hash}`);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
main().catch((error) => {
|
||||
console.error("Execution error:", error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
} catch (error) {
|
||||
console.error("Initial setup error:", error);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user